compile: implement library search to support MSVC static linking
[automake.git] / tests / ltcond2.test
blob1687513cde32140d4da9b392c94860fc591bd110
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 AC_PROG_LIBTOOL
27 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
28 AM_CONDITIONAL([LINUX], true)
29 AC_OUTPUT
30 END
32 cat > Makefile.am << 'END'
33 lib_LTLIBRARIES = libhello.la
34 libhello_la_SOURCES = hello-common.c
35 EXTRA_libhello_la_SOURCES = hello-linux.c hello-generic.c
36 libhello_la_LIBADD = $(HELLO_SYSTEM)
37 libhello_la_DEPENDENCIES = $(HELLO_SYSTEM)
39 lib_LTLIBRARIES += libhello2.la
40 libhello2_la_SOURCES = hello-common.c
41 if LINUX
42 libhello2_la_SOURCES += hello-linux.c
43 else
44 libhello2_la_SOURCES += hello-generic.c
45 endif
47 bin_PROGRAMS = hello hello2
48 hello_SOURCES = main.c
49 hello_LDADD = libhello.la
50 hello2_SOURCES = main.c
51 hello2_LDADD = libhello2.la
53 check-local:
54 ./hello$(EXEEXT) | grep hello-generic
55 ./hello2$(EXEEXT) | grep hello-linux
56 : > check-ok
57 END
59 echo 'char* str() { return "hello-linux"; }' >hello-linux.c
60 echo 'char* str() { return "hello-generic"; }' >hello-generic.c
61 cat >hello-common.c <<'END'
62 #include <stdio.h>
63 char* str();
64 void print()
66 puts (str ());
68 END
69 echo 'int main() { print(); return 0; }' >main.c
71 libtoolize
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE --add-missing
75 ./configure
76 $MAKE check
77 test -f check-ok