tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / ccnoco-deps.sh
blobb134ed9ab535409c99e3d17ebbd46a154f2f3f25
1 #! /bin/sh
2 # Copyright (C) 2013-2018 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 # Check that dependency tracking can also work with compilers that
18 # doesn't understand '-c -o', even if the AM_PROG_CC_C_O macro is not
19 # explicitly called.
21 required=gcc # For 'cc-no-c-o'.
22 . test-init.sh
24 echo '#define myStr "Hello"' > foobar.h
26 cat > foo.c << 'END'
27 #include <stdio.h>
28 #include "foobar.h"
29 int main (void)
31 printf ("%s\n", myStr);
32 return 0;
34 END
36 cat > Makefile.am <<'END'
37 bin_PROGRAMS = foo
38 foo_SOURCES = foo.c foobar.h
39 check-deps: all
40 test -n '$(DEPDIR)' && test -d '$(DEPDIR)'
41 ls -l $(DEPDIR)
42 grep 'stdio\.h' $(DEPDIR)/foo.Po
43 grep 'foobar\.h' $(DEPDIR)/foo.Po
44 check-updated: all
45 is_newest foo$(EXEEXT) foobar.h
46 END
48 # We deliberately don't invoke AM_PROG_CC_C_O here.
49 cat >> configure.ac << 'END'
50 AC_PROG_CC
51 AC_OUTPUT
52 END
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE --add-missing
58 # Make sure the compiler doesn't understand '-c -o'.
59 CC=$am_testaux_builddir/cc-no-c-o; export CC
61 ./configure >stdout || { cat stdout; exit 1; }
62 cat stdout
63 $EGREP 'understands? -c and -o together.* no$' stdout
64 grep '^checking dependency style .*\.\.\. gcc' stdout
66 $MAKE check-deps
68 if ! cross_compiling; then
69 ./foo
70 test "$(./foo)" = Hello
73 $sleep
74 echo '#define myStr "Howdy"' > foobar.h
75 $MAKE check-updated
77 if ! cross_compiling; then
78 ./foo
79 test "$(./foo)" = Howdy