tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / auxdir-autodetect.sh
blobbc8c189b4236e27140a8390c3a8eeeddd8eb1561
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 # Make sure that, if AC_CONFIG_AUX_DIR is not specified, Automake tries
18 # to use '.', '..' and '../..', in precisely that order.
20 . test-init.sh
22 nil=__no_such_program
24 unset NONESUCH
26 cat >>configure.ac << END
27 AM_MISSING_PROG([NONESUCH],[$nil])
28 AC_OUTPUT
29 END
31 mkdir d3
32 mkdir d3/d2
33 mkdir d3/d2/d1
34 mkdir d3/d2/d1/d0
36 echo 'echo %%d3%% $*' > d3/missing
37 chmod +x d3/missing
38 echo 'echo %%d2%% $*' > d3/d2/missing
39 chmod +x d3/d2/missing
40 echo 'echo %%d1%% $*' > d3/d2/d1/missing
41 chmod +x d3/d2/d1/missing
42 echo 'echo %%d0%% $*' > d3/d2/d1/d0/missing
43 chmod +x d3/d2/d1/d0/missing
45 mv configure.ac d3/d2/d1/d0/
47 cd d3/d2/d1/d0
49 cat > Makefile.am << 'EOF'
50 .PHONY: test
51 test:
52 $(NONESUCH) >$(out)
53 EOF
55 $ACLOCAL
56 $AUTOCONF
58 # ------------------------------------------- #
59 : We must end up with AC_CONFIG_AUX_DIR = . #
60 # ------------------------------------------- #
62 : > install-sh
63 $AUTOMAKE
64 ./configure
65 out=out0 $MAKE test
66 cat out0
67 grep "%%d0%%.*$nil" out0
68 grep '%%d[123]' out0 && exit 1
70 rm -f missing install-sh
72 # -------------------------------------------- #
73 : We must end up with AC_CONFIG_AUX_DIR = .. #
74 # -------------------------------------------- #
76 # Automake finds 'install-sh' in '.', so it assumes that auxdir is '.';
77 # but it won't find 'missing' in '.', so it will fail.
78 : > install-sh
79 AUTOMAKE_fails
80 grep 'required file.*[^.]\./missing.*not found' stderr
81 rm -f install-sh
83 # Now things should work.
84 : > ../install-sh
85 $AUTOMAKE
86 ./configure
87 out=out1 $MAKE test
88 cat out1
89 grep "%%d1%%.*$nil" out1
90 grep '%%d[023]' out1 && exit 1
92 rm -f ../missing ../install-sh
94 # ----------------------------------------------- #
95 : We must end up with AC_CONFIG_AUX_DIR = ../.. #
96 # ----------------------------------------------- #
98 # Automake finds 'install-sh' in '.', so it assumes that auxdir is '.';
99 # but it won't find 'missing' in '.', so it will fail.
100 : > install-sh
101 AUTOMAKE_fails
102 grep 'required file.*[^.]\./missing.*not found' stderr
103 rm -f install-sh
105 # Automake finds 'install-sh' in '..', so it assumes that auxdir is '..';
106 # but it won't find 'missing' in '.', so it will fail.
107 : > ../install-sh
108 AUTOMAKE_fails
109 grep 'required file.*[^.]\.\./missing.*not found' stderr
110 rm -f ../install-sh
112 # Now things should work.
113 : > ../../install-sh
114 $AUTOMAKE
115 ./configure
116 out=out2 $MAKE test
117 cat out2
118 grep "%%d2%%.*$nil" out2
119 grep '%%d[013]' out2 && exit 1
121 rm -f ../../missing ../../install-sh
123 # --------------------------------------------------------- #
124 : AC_CONFIG_AUX_DIR will not be found: Automake must fail #
125 # --------------------------------------------------------- #
127 AUTOMAKE_fails
128 grep 'required file.*missing.*not found' stderr