#! /bin/sh # Copyright (C) 2003, 2004, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Test to make sure that adding a new directory works, even from # subdirectories. (subdir5.test makes sure it works when make # is run from the top-level directory.) # PR automake/46 # This test assumes that the `make' utility is able to start # over and reload Makefiles which have been remade (a non-POSIX feature). # See also the related test subdir5.test. required='GNUmake gcc' . ./defs || Exit 1 set -e cat >> configure.in << 'END' AC_PROG_CC AM_PROG_CC_C_O m4_include([confiles.m4]) MORE_DEFS AC_OUTPUT END echo 'AC_CONFIG_FILES([sub/Makefile])' > confiles.m4 cat > Makefile.am << 'END' SUBDIRS = sub ACLOCAL_AMFLAGS = -I m4 END mkdir sub cat > sub/Makefile.am << 'END' bin_PROGRAMS = wish wish_SOURCES = a.c END cat > sub/a.c << 'END' #include int main () { printf ("hi liver!\n"); return 0; } END mkdir m4 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4 $ACLOCAL -I m4 $AUTOCONF $AUTOMAKE --copy --add-missing ./configure $MAKE # Now add new directories. # # We shouldn't need to $sleep here: configure ensures that files # generated by it are newer than configure. Thus, even if # Makefile.in is newer than configure but the updated Makefile.am # below has the same timestamp as Makefile.in, the latter should # be rebuilt due to its dependency on configure.in. # The first step users typically do when adding a new subdir is # editing configure.in. That is already tested by subdir5.test, # though, so here we try to just edit a file that is included by # configure.in, without touching configure.in itself. mkdir sub/maude cat > sub/maude/Makefile.am << 'END' include_HEADERS = foo.h END : > sub/maude/foo.h echo 'SUBDIRS = maude' >> sub/Makefile.am mkdir maude : > maude/Makefile.am # Update confiles.m4 *after* updating sub/Makefile.am; subdir5.test do # it in the other way: it updates configure.in before Makefile.am. echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4 # We want a simple rebuild from sub/ to create sub/maude/Makefile # and maude/Makefile automatically. cd sub $MAKE cd .. test -f maude/Makefile test -f sub/maude/Makefile # Make sure the dependencies of aclocal.m4 or honored at least from # the top-level directory. echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4 $MAKE grep '^GREPME =' Makefile grep '^GREPME =' maude/Makefile grep '^GREPME =' sub/Makefile grep '^GREPME =' sub/maude/Makefile :