ar-lib: new 'AM_PROG_AR' macro, triggering the 'ar-lib' script
[automake.git] / tests / ltcond2.test
blob898c97138d9b939a1c6a410c7903aec6eb7d704e
1 #! /bin/sh
2 # Copyright (C) 2003, 2004 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 <http://www.gnu.org/licenses/>.
17 # Test for bug in conditionals.
19 required='libtoolize gcc'
20 . ./defs || Exit 1
22 set -e
24 cat >> configure.in << 'END'
25 AC_PROG_CC
26 AM_PROG_AR
27 AC_PROG_LIBTOOL
28 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
29 AM_CONDITIONAL([LINUX], true)
30 AC_OUTPUT
31 END
33 cat > Makefile.am << 'END'
34 lib_LTLIBRARIES = libhello.la
35 libhello_la_SOURCES = hello-common.c
36 EXTRA_libhello_la_SOURCES = hello-linux.c hello-generic.c
37 libhello_la_LIBADD = $(HELLO_SYSTEM)
38 libhello_la_DEPENDENCIES = $(HELLO_SYSTEM)
40 lib_LTLIBRARIES += libhello2.la
41 libhello2_la_SOURCES = hello-common.c
42 if LINUX
43 libhello2_la_SOURCES += hello-linux.c
44 else
45 libhello2_la_SOURCES += hello-generic.c
46 endif
48 bin_PROGRAMS = hello hello2
49 hello_SOURCES = main.c
50 hello_LDADD = libhello.la
51 hello2_SOURCES = main.c
52 hello2_LDADD = libhello2.la
54 check-local:
55 ./hello$(EXEEXT) | grep hello-generic
56 ./hello2$(EXEEXT) | grep hello-linux
57 : > check-ok
58 END
60 echo 'char* str() { return "hello-linux"; }' >hello-linux.c
61 echo 'char* str() { return "hello-generic"; }' >hello-generic.c
62 cat >hello-common.c <<'END'
63 #include <stdio.h>
64 char* str();
65 void print()
67 puts (str ());
69 END
70 echo 'int main() { print(); return 0; }' >main.c
72 libtoolize
73 $ACLOCAL
74 $AUTOCONF
75 $AUTOMAKE --add-missing
76 ./configure
77 $MAKE check
78 test -f check-ok