test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / libobj16a.sh
blob0864b06b52a9e25207ecd53de480cc62e60cd21b
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Make sure AC_LIBOBJ and friends work.
18 # Please keep this in sync with sister test 'libobj16b.sh'.
20 required=cc
21 . test-init.sh
23 mv configure.ac configure.proto
24 cat >> configure.proto << 'END'
25 AC_PROG_CC
26 AM_PROG_AR
27 AC_PROG_RANLIB
28 %LIBOBJ-STUFF% # Will be activated later.
29 AC_OUTPUT
30 END
32 cat > Makefile.am << 'END'
33 noinst_LIBRARIES = libtu.a
34 libtu_a_SOURCES =
35 libtu_a_LIBADD = $(LIBOBJS)
37 include extra-checks.am
38 .PHONY: $(extra_checks) pre-test
40 pre-test: distdir
41 ls -l $(srcdir) $(builddir) $(distdir)
42 $(AR) tv libtu.a
43 $(extra_checks): pre-test
44 check-local: $(extra_checks)
46 maude-src:
47 grep dummy_maude $(srcdir)/maude.c
48 maude-dist:
49 grep dummy_maude $(distdir)/maude.c
50 liver-src:
51 grep dummy_liver $(srcdir)/liver.c
52 liver-dist:
53 grep dummy_liver $(distdir)/liver.c
54 liver-not-dist: distdir
55 test ! -r $(distdir)/liver.c
56 maude-not-dist: distdir
57 test ! -r $(distdir)/maude.c
58 maude-lib:
59 $(AR) t libtu.a | grep maude
60 maude-not-lib:
61 $(AR) t libtu.a | grep maude && exit 1; exit 0
62 liver-lib:
63 $(AR) t libtu.a | grep liver
64 liver-not-lib:
65 $(AR) t libtu.a | grep liver && exit 1; exit 0
66 END
68 cat > maude.c << 'END'
69 extern int dummy_maude;
70 END
72 cat > liver.c << 'END'
73 extern int dummy_liver;
74 END
76 sed '/%LIBOBJ-STUFF%/{
77 s/.*//
79 AC_LIBOBJ([maude])
80 }' configure.proto > configure.ac
81 cat configure.ac # For debugging.
83 cat > extra-checks.am << 'END'
84 extra_checks = maude-src maude-dist maude-lib liver-not-dist
85 END
87 $ACLOCAL
88 $AUTOCONF
89 $AUTOMAKE --add-missing
91 ./configure
93 $MAKE
94 $MAKE check
95 $MAKE distcheck
96 $MAKE distclean
98 # Avoid timestamp-related differences.
99 rm -rf autom4te*.cache
101 cat > extra-checks.am << 'END'
102 extra_checks = maude-src maude-dist liver-src liver-dist
103 if MAUDE_COND
104 extra_checks += maude-lib liver-not-lib
105 else
106 extra_checks += maude-not-lib liver-lib
107 endif
110 sed '/%LIBOBJ-STUFF%/{
111 s/.*//
113 AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
114 if test x"$MAUDE" = x"yes"; then\
115 AC_LIBOBJ([maude])\
116 else\
117 AC_LIBOBJ([liver])\
119 AC_LIBSOURCES([maude.c, liver.c])
120 }' configure.proto > configure.ac
121 cat configure.ac # For debugging.
123 $ACLOCAL
124 $AUTOCONF
125 $AUTOMAKE
127 ./configure MAUDE=yes
128 $MAKE
129 $MAKE check
130 $MAKE distcheck
131 $MAKE distclean
133 ./configure MAUDE=no
134 $MAKE
135 $MAKE check
136 $MAKE distcheck
137 $MAKE distclean