doc: update Vala documentation
[automake.git] / t / ltcond2.sh
blob1087247ebfcd9fae66a8494aec8b475f6c58dde8
1 #! /bin/sh
2 # Copyright (C) 2003-2024 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 # Test for bug in conditionals.
19 required='cc native libtoolize'
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AM_PROG_AR
25 AC_PROG_LIBTOOL
26 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
27 AM_CONDITIONAL([LINUX], [true])
28 AC_OUTPUT
29 END
31 cat > Makefile.am << 'END'
32 lib_LTLIBRARIES = libhello.la
33 libhello_la_SOURCES = hello-common.c
34 EXTRA_libhello_la_SOURCES = hello-linux.c hello-generic.c
35 libhello_la_LIBADD = $(HELLO_SYSTEM)
36 libhello_la_DEPENDENCIES = $(HELLO_SYSTEM)
38 lib_LTLIBRARIES += libhello2.la
39 libhello2_la_SOURCES = hello-common.c
40 if LINUX
41 libhello2_la_SOURCES += hello-linux.c
42 else
43 libhello2_la_SOURCES += hello-generic.c
44 endif
46 bin_PROGRAMS = hello hello2
47 hello_SOURCES = main.c
48 hello_LDADD = libhello.la
49 hello2_SOURCES = main.c
50 hello2_LDADD = libhello2.la
52 check-local:
53 ./hello$(EXEEXT) | grep hello-generic
54 ./hello2$(EXEEXT) | grep hello-linux
55 : > check-ok
56 END
58 cat > hello-linux.c <<'END'
59 const char* str = "hello-linux";
60 END
62 cat > hello-generic.c <<'END'
63 const char* str = "hello-generic";
64 END
66 cat > hello-common.c <<'END'
67 #include <stdio.h>
68 extern const char* str;
69 void print (void)
71 puts (str);
73 END
75 cat > main.c <<'END'
76 extern void print(void);
78 int main (void)
80 print();
81 return 0;
83 END
85 libtoolize
86 $ACLOCAL
87 $AUTOCONF
88 $AUTOMAKE --add-missing
89 ./configure
90 $MAKE check
91 test -f check-ok