test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / conflnk3.sh
blob3b8b0529879846713194276b2ab04002c74bd640
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 to make sure that AC_CONFIG_LINKS using a variable source
18 # is not broken.
20 . test-init.sh
22 cat > Makefile.am << 'END'
23 SUBDIRS = sdir
24 .PHONY: test
25 test: distdir
26 test ! -r $(distdir)/sdir/dest3
27 test ! -r $(distdir)/sdir/dest2
28 test ! -r $(distdir)/dest3
29 test ! -r $(distdir)/dest2
30 test -f $(distdir)/src2
31 ## src3 cannot be distributed, Automake knows nothing about it.
32 test ! -r $(distdir)/sdir/src3
33 test ! -r $(distdir)/src3
34 END
36 : > src
37 : > src2
38 mkdir sdir
39 : > sdir/Makefile.am
40 : > sdir/src3
42 cat >>configure.ac << 'EOF'
43 AC_CONFIG_FILES([sdir/Makefile])
44 my_src_dir=sdir
45 my_dest=dest
46 AC_CONFIG_LINKS([sdir/dest2:src2 sdir/dest3:$my_src_dir/src3])
47 AC_CONFIG_LINKS([$my_dest:src])
48 # The following is a link whose source is itself a link.
49 AC_CONFIG_LINKS([dest4:sdir/dest2])
50 # Some package prefer to compute links.
51 cmplink='dest5:src';
52 AC_CONFIG_LINKS([$cmplink])
53 AC_OUTPUT
54 EOF
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE
60 # $my_src_dir and $my_dest are variables local to configure, they should
61 # not appear in Makefile.
62 grep my_src_dir Makefile.in && exit 1
63 grep my_dest Makefile.in && exit 1
65 ./configure
66 test -r sdir/dest2
67 test -r sdir/dest3
68 test -r dest
69 test -r dest4
70 test -r dest5
71 $MAKE test
73 $MAKE distclean
74 test ! -e sdir/dest2
75 test ! -e sdir/dest3
76 test -r dest # Should still exist, Automake knows nothing about it.
77 test -r dest5 # Ditto.
78 rm -f dest dest5
79 test ! -e dest4
81 mkdir build
82 cd build
83 ../configure
84 $MAKE test