tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / subobj11a.sh
blob317bc1295c6fca0f20642a1fb08b9e489f4d0236
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Test that automake works around a bug of Solaris Make. The bug is the
18 # following. If we have a Makefile containg a file inclusion like this:
19 # include .//foo.mk
20 # Solaris make fails with a message like:
21 # make: ... can't find '/foo.mk': No such file or directory
22 # make: fatal error ... read of include file '/foo.mk' failed
23 # (even if the file 'foo.mk' exists). The error disappear by collapsing
24 # the repeated slash '/' characters into a single one.
26 # See also sister "grepping" test 'subobj11b.sh', and related test
27 # 'subobj11c.sh'.
29 required=cc
30 . test-init.sh
32 cat >> configure.ac << 'END'
33 AC_PROG_CC
34 AC_OUTPUT
35 END
37 cat > Makefile.am << 'END'
38 AUTOMAKE_OPTIONS = subdir-objects
39 bin_PROGRAMS = foo
40 ## The './/' below is meant.
41 foo_SOURCES = .//src/foo.c
42 END
44 mkdir src
46 cat > src/foo.c << 'END'
47 int main(void)
49 return 0;
51 END
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
57 ./configure --enable-dependency-tracking
59 depdir=$(sed -n 's/^ *DEPDIR *= *//p' Makefile)
60 if test x"$depdir" != x; then
61 depdir=src/$depdir
62 else
63 echo "$me: cannot extract value of DEPDIR from Makefile" >&2
64 exit 1
67 ls -l "$depdir"
68 test -f "$depdir"/foo.Po
70 echo 'quux:; echo "z@rd@z" >$@' >> "$depdir"/foo.Po
72 $MAKE quux
73 $FGREP "z@rd@z" quux
75 $MAKE
77 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
78 DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking' $MAKE distcheck