news: update w.r.t. recent depcomp changes
[automake.git] / t / subdir-add2-pr46.sh
blobbfe7e9c51583a34c6c7b7fe21f2a25df2e3468a6
1 #! /bin/sh
2 # Copyright (C) 2003-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test to make sure that adding a new directory works, even from
18 # subdirectories. The sister test 'subdir-add-pr46.sh' makes sure
19 # it works when make is run from the top-level directory.
20 # PR automake/46
22 . test-init.sh
24 cat >> configure.ac << 'END'
25 AC_CONFIG_MACRO_DIR([m4])
26 m4_include([confiles.m4])
27 MORE_DEFS
28 AC_OUTPUT
29 END
31 echo 'AC_CONFIG_FILES([sub/Makefile])' > confiles.m4
33 cat > Makefile.am << 'END'
34 SUBDIRS = sub
35 END
37 mkdir sub
39 : > sub/Makefile.am
41 mkdir m4
42 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
44 $ACLOCAL
45 $AUTOCONF
46 $AUTOMAKE
47 ./configure
48 $MAKE
50 # Now add new directories.
52 # The first step users typically do when adding a new subdir is editing
53 # configure.ac. That is already tested by 'subdir-add-pr46.sh' though,
54 # so here we try to just edit a file that is included by configure.ac,
55 # without touching configure.ac itself.
57 mkdir sub/maude
58 cat > sub/maude/Makefile.am << 'END'
59 include_HEADERS = foo.h
60 END
62 : > sub/maude/foo.h
64 echo 'SUBDIRS = maude' >> sub/Makefile.am
66 mkdir maude
67 : > maude/Makefile.am
69 # Update confiles.m4 *after* updating sub/Makefile.am; the sister test
70 # 'subdir-add-pr46.sh' does it the in other way: it updates configure.ac
71 # before Makefile.am. We sleep here because modified configure
72 # dependencies must be newer than config.status.
73 $sleep
74 echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
76 # We want a simple rebuild from sub/ to create sub/maude/Makefile
77 # and maude/Makefile automatically.
78 cd sub
79 $MAKE
80 cd ..
81 grep '^SUBDIRS = *maude *$' sub/Makefile.in
82 grep '^SUBDIRS = *maude *$' sub/Makefile
83 test -f maude/Makefile
84 test -f sub/maude/Makefile
86 # Make sure the dependencies of aclocal.m4 or honored at least from
87 # the top-level directory.
88 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
89 $MAKE
91 for ext in '.in' ''; do
92 for d in . maude sub sub/maude; do
93 grep '^GREPME =' $d/Makefile$ext
94 done
95 done