doc: update Vala documentation
[automake.git] / t / subobj9.sh
bloba566f2ed7417ba20009c522db3c42fab7de75e26
1 #! /bin/sh
2 # Copyright (C) 2002-2024 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 <https://www.gnu.org/licenses/>.
17 # Test for PR 312.
19 # == Report ==
20 # When using non-recursive make to build a libtoolize-library from
21 # sources in a subdirectory, 'make distcheck' fails because of incomplete
22 # cleanup. "make clean" tries to remove '*.o' and '.../<file>.lo' but
23 # forgets '.../<file>.o'.
25 required='c++ libtoolize'
26 . test-init.sh
28 cat > configure.ac << END
29 AC_INIT([$me], [1.0])
30 AM_INIT_AUTOMAKE([subdir-objects])
31 AC_PROG_CXX
32 AM_PROG_AR
33 AM_PROG_LIBTOOL
34 AC_CONFIG_FILES([Makefile])
35 AC_OUTPUT
36 END
38 cat > Makefile.am << 'END'
39 noinst_LTLIBRARIES = libfoo.la
40 libfoo_la_SOURCES = src/foo.cc .//src/bar.cc # The './/' is meant.
41 .PHONY: print
42 print:
43 @echo BEG1: "$(LTCXXCOMPILE)" :1END
44 @echo BEG2: "$(CXXLINK)" :2END
45 END
47 mkdir src
48 cat > src/foo.cc << 'END'
49 int doit2 (void);
50 int doit (void)
52 return doit2();
54 END
56 cat > src/bar.cc << 'END'
57 int doit2 (void)
59 return 23;
61 END
64 libtoolize --force
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE -a
69 ./configure
71 # Ensure './libtool --help' will use the right tool versions.
72 export AUTOCONF AUTOMAKE
74 # Opportunistically check that --tag=CXX is used when supported.
75 if ./libtool --help | grep tag=TAG; then
76 run_make -O print
77 grep 'BEG1: .*--tag=CXX.*--mode=compile.* :1END' stdout
78 grep 'BEG2: .*--tag=CXX.*--mode=link.* :2END' stdout
81 $MAKE
82 run_make -M distcheck
83 # GNU Make used to complain that the Makefile contained two rules
84 # for 'src/.dirstamp' and './/src/.dirstamp'.
85 grep 'overriding commands' output && exit 1