2 # Copyright (C) 2013 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)
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 pre-processing substitutions '%reldir%' and '%canon_reldir%'
18 # with C compilation and subdir objects.
23 cat >> configure.ac << 'END'
26 AC_CONFIG_FILES([zot/Makefile])
35 cat > Makefile.am << 'END'
36 AUTOMAKE_OPTIONS = subdir-objects
40 include $(top_srcdir)/foo/local.mk
41 include $(srcdir)/foo/foobar/local.mk
45 is $(bin_PROGRAMS) == \
46 foo/mumble2$(EXEEXT) \
47 foo/bar/mumble$(EXEEXT) \
48 foo/foobar/mumble$(EXEEXT) \
50 test '$(mumble_SOURCES)' = one.c
51 test '$(foo_mumble2_SOURCES)' = foo/one.c
52 test '$(foo_bar_mumble_SOURCES)' = foo/bar/one.c
53 test '$(foo_foobar_mumble_SOURCES)' = foo/foobar/one.c
54 test -f mumble$(EXEEXT)
55 test -f foo/mumble2$(EXEEXT)
56 test -f foo/bar/mumble$(EXEEXT)
57 test -f foo/foobar/mumble$(EXEEXT)
58 test -f zot/mumble$(EXEEXT)
59 : Test some of the object files too.
61 test -f foo/foobar/one.$(OBJEXT)
62 test -f zot/one.$(OBJEXT)
65 cat > zot/Makefile.am << 'END'
66 AUTOMAKE_OPTIONS = subdir-objects
68 include $(top_srcdir)/zot/local.mk
71 test '$(bin_PROGRAMS)' = mumble$(EXEEXT)
72 test '$(mumble_SOURCES)' = one.c
76 cat > local.mk << 'END'
77 bin_PROGRAMS += %reldir%/mumble
78 %canon_reldir%_mumble_SOURCES = %reldir%/one.c
81 echo 'int main (void) { return 0; }' > one.c
83 sed 's/mumble/mumble2/' local.mk > foo/local.mk
85 cp local.mk foo/foobar
87 echo "include %reldir%/bar/local.mk" >> foo/local.mk
101 if ! cross_compiling; then
109 (cd zot && $MAKE test)
111 # GNU install refuses to override a just-installed file; since we
112 # have plenty of 'mumble' dummy programs to install in the same
113 # location, such "overridden installations" are not a problem for
114 # us; so just force the use the 'install-sh' script.
115 ac_cv_path_install=$(pwd)/install-sh; export ac_cv_path_install