tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / cond34.sh
blob01c129d6d09929ed99ff3500246a73bf15e21f42
1 #!/bin/sh
2 # Copyright (C) 2004-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 for _DEPENDENCIES definition with conditional _LDADD.
18 # Report from Elena A. Vengerova.
20 . test-init.sh
22 cat >>configure.ac <<'EOF'
23 AM_CONDITIONAL([TWO], [test -n "$two"])
24 AC_OUTPUT
25 EOF
27 cat > Makefile.am <<'EOF'
28 OBJEXT=z
29 CC=false
30 AUTOMAKE_OPTIONS=no-dependencies
32 bin_PROGRAMS = test1 test2
34 if TWO
35 test1_LDADD = two.$(OBJEXT)
36 test2_LDADD = two.$(OBJEXT)
37 test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
38 else !TWO
39 test1_LDADD = one.$(OBJEXT)
40 test2_LDADD = three.$(OBJEXT)
41 endif !TWO
43 test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
45 .PHONY: dep-test1 dep-test2
46 dep-test1:
47 echo BEG: $(test1_DEPENDENCIES) :END
48 dep-test2:
49 echo BEG: $(test2_DEPENDENCIES) :END
50 EOF
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE
55 ./configure
57 run_make -O dep-test1
58 $FGREP 'BEG: one.z somethingelse.a :END' stdout
60 run_make -O dep-test2
61 $FGREP 'BEG: three.z :END' stdout
63 ./configure two=2
65 run_make -O dep-test1
66 $FGREP 'BEG: two.z somethingelse.a :END' stdout
68 run_make -O dep-test2
69 $FGREP 'BEG: two.z somethingelse.a :END' stdout