test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / pr300-lib.sh
blob7cab8cf9d592ab5920d6294527ed6e39bb9139cf
1 #! /bin/sh
2 # Copyright (C) 2002-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 that installing subdirectory libraries works.
18 # PR/300
20 required=cc
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_RANLIB
25 AC_PROG_CC
26 AM_PROG_AR
27 AC_OUTPUT
28 END
30 cat > Makefile.am << 'END'
31 lib_LIBRARIES = subdir/liba.a
32 subdir_liba_a_SOURCES = a.c
34 nobase_lib_LIBRARIES = subdir/libb.a
35 subdir_libb_a_SOURCES = a.c
36 END
38 cat > a.c << 'END'
39 int i = 3;
40 END
42 ## A rule in the Makefile should create subdir
43 # mkdir subdir
45 $ACLOCAL
46 $AUTOCONF
47 $AUTOMAKE --copy --add-missing
49 # We pass '--libdir' explicitly, to avoid spurious failures due to users
50 # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
51 # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
52 # as is the case with openSUSE 12.1). See automake bug#10426.
53 cwd=$(pwd) || fatal_ "getting current working directory"
54 ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
56 $MAKE
58 test -f subdir/liba.a
59 test -f subdir/libb.a
61 $MAKE install
63 test -f inst/lib/liba.a
64 test -f inst/lib/subdir/libb.a
66 $MAKE uninstall
68 test -f inst/lib/liba.a && exit 1
69 test -f inst/lib/subdir/libb.a && exit 1
71 $MAKE install-strip
73 test -f inst/lib/liba.a
74 test -f inst/lib/subdir/libb.a