tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / subdir-add-pr46.sh
1 #! /bin/sh
2 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test to make sure that adding a new directory works.
18 # This test runs 'make' from the top-level directory, the sister
19 # test 'subdir-add2-pr46.sh' do it from a subdirectory.
20 # PR automake/46
21
22 . test-init.sh
23
24 cat >> configure.ac << 'END'
25 AC_OUTPUT
26 END
27
28 : > Makefile.am
29
30 $ACLOCAL
31 $AUTOCONF
32 $AUTOMAKE
33 ./configure
34 $MAKE
35
36 # Now add new directories.
37
38 # First we add a new directory by modifying configure.ac directly.
39 # We update configure.ac *before* updating sub/Makefile.am; the sister
40 # test 'subdir-add2-pr46.sh' does it in the other way: it updates
41 # confiles.m4 (which is m4_included by configure.ac there) after
42 # Makefile.am.
43
44 # Modified configure dependencies must be newer than config.status.
45 $sleep
46 sed <configure.ac >configure.tmp -e '/^AC_OUTPUT$/i\
47 AC_CONFIG_FILES([maude/Makefile])\
48 m4_include([confile.m4])\
49 ' # Last newline required by older OpenBSD sed.
50 mv -f configure.tmp configure.ac
51
52 cat configure.ac # For debugging.
53
54 : > confile.m4
55
56 mkdir maude
57
58 cat > maude/Makefile.am << 'END'
59 include_HEADERS = foo.h
60 END
61
62 : > maude/foo.h
63
64 echo 'SUBDIRS = maude' >> Makefile.am
65
66 # We want a simple rebuild to create maude/Makefile automatically.
67 $MAKE
68 grep '^SUBDIRS = *maude *$' Makefile.in
69 grep '^SUBDIRS = *maude *$' Makefile
70 test -f maude/Makefile
71
72 # Then we add a new directory by modifying a file included (through
73 # 'm4_include') by configure.ac.
74 mkdir maude2
75 # Modified configure dependencies must be newer than config.status.
76 $sleep
77 cat >> confile.m4 << 'END'
78 AC_CONFIG_FILES([maude2/Makefile])
79 AC_SUBST([GREPME])
80 END
81 : > maude2/Makefile.am
82 echo 'SUBDIRS += maude2' >> Makefile.am
83
84 # We want a simple rebuild to create maude2/Makefile and update
85 # all other Makefiles automatically.
86 $MAKE
87 grep '^SUBDIRS =.* maude2' Makefile.in
88 grep '^SUBDIRS =.* maude2' Makefile
89
90 for ext in '.in' ''; do
91   for d in . maude maude2; do
92     grep '^GREPME =' $d/Makefile$ext
93   done
94 done
95
96 :