Implement conditional AC_CONFIG_FILES: AM_COND_IF.
[automake/ericb.git] / tests / cond18.test
blob981eaa520b7c4a6e7c1ce35aa88f655aca22dd67
1 #! /bin/sh
2 # Copyright (C) 2001, 2002 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 3, 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 <http://www.gnu.org/licenses/>.
17 # Regression test for substitution references to conditional variables.
18 # Report from Richard Boulton
20 required='GNUmake gcc'
21 . ./defs || exit 1
23 cat > configure.in << 'END'
24 AC_INIT(Makefile.am)
25 AM_INIT_AUTOMAKE(hello,0.23)
26 AC_PROG_CC
27 AM_CONDITIONAL(COND1, true)
28 AM_CONDITIONAL(COND2, true)
29 AC_OUTPUT(Makefile)
30 END
32 cat > Makefile.am << 'END'
34 var1 = dlmain
36 if COND1
37 var2 = $(var1:=.c) foo.cc
38 else
39 var2 = $(var1:=.c)
40 endif
42 if COND2
43 var3 = $(var2:.cc=.c)
44 else
45 var3 = $(var2:.cc=.c)
46 endif
48 helldl_SOURCES = $(var3)
50 echorule:
51 @echo $(helldl_SOURCES) $(helldl_OBJECTS)
53 bin_PROGRAMS = helldl
54 END
56 # Ignore user CFLAGS.
57 CFLAGS=
58 export CFLAGS
60 set -e
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE -a
66 ./configure
68 val=`$MAKE --no-print-directory echorule`;
69 echo $val
70 test "x$val" = "xdlmain.c foo.c dlmain.o foo.o"