gnulib: update
[bison.git] / tests / atlocal.in
blobd5f31cbb3b56c537e903318fee639d5b63f78705
1 # @configure_input@                                     -*- shell-script -*-
2 # Configurable variable values for Bison test suite.
4 # Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 # We need 'testsuite.h' (srcdir/test).
20 CPPFLAGS="-I$abs_top_srcdir/tests @CPPFLAGS@"
22 # Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
23 # as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
24 # the environment variable.
25 if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
26   POSIXLY_CORRECT_IS_EXPORTED=true
27 else
28   POSIXLY_CORRECT_IS_EXPORTED=false
31 ## ------------------- ##
32 ## C/C++ Compilation.  ##
33 ## ------------------- ##
35 : ${CC='@CC@'}
36 : ${CXX='@CXX@'}
38 # Is the compiler GCC?
39 : ${GCC='@GCC@'}
41 # Sometimes a test group needs to ignore gcc warnings, so it locally
42 # sets CFLAGS to this.
43 : ${NO_WERROR_CFLAGS='@CFLAGS@  @WARN_CFLAGS@  @WARN_CFLAGS_TEST@'}
44 : ${NO_WERROR_CXXFLAGS='@CXXFLAGS@ @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@'}
45 : ${WNO_DEPRECATED_CXXFLAGS='@WNO_DEPRECATED_CXXFLAGS@'}
47 # But most of the time, we want -Werror.
48 : ${CFLAGS="$NO_WERROR_CFLAGS  @WERROR_CFLAGS@"}
49 : ${CXXFLAGS="$NO_WERROR_CXXFLAGS @WERROR_CXXFLAGS@"}
51 # If 'exit 77'; skip all C++ tests; otherwise ':'.
52 : ${BISON_CXX_WORKS='@BISON_CXX_WORKS@'}
54 # Compiler flags to disable exception support.
55 : ${NO_EXCEPTIONS_CXXFLAGS='@NO_EXCEPTIONS_CXXFLAGS@'}
57 # Requiring a specific C++ standard.
58 : ${CXX98_CXXFLAGS='@CXX98_CXXFLAGS@'}
59 : ${CXX03_CXXFLAGS='@CXX03_CXXFLAGS@'}
60 : ${CXX11_CXXFLAGS='@CXX11_CXXFLAGS@'}
61 : ${CXX14_CXXFLAGS='@CXX14_CXXFLAGS@'}
62 : ${CXX17_CXXFLAGS='@CXX17_CXXFLAGS@'}
63 : ${CXX2A_CXXFLAGS='@CXX2A_CXXFLAGS@'}
65 # Be sure that the C++ compiler is not broken because of gnulib.  This
66 # cannot be checked in configure (gnulib is not parameterized yet),
67 # and checking this in every C++ test in AC_COMPILE_CXX is too costly.
69 # https://lists.gnu.org/r/bug-bison/2013-06/msg00001.html
71 # FIXME: Check (say 2014) whether this is still needed.
72 if $BISON_CXX_WORKS; then
73   # See AT_DATA_SOURCE_PROLOGUE.
74   cat >conftest.cc <<EOF
75 #include <testsuite.h>
76 #include <iostream>
78 int main ()
80   std::cout << "Works\n";
82 EOF
83   $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
84   case $? in
85    0);;
86    *) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
87   esac
88   rm -fr conftest*
91 # Whether the compiler supports POSIXLY_CORRECT defined.
92 : ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
93 : ${CXX_COMPILER_POSIXLY_CORRECT='@CXX_COMPILER_POSIXLY_CORRECT@'}
95 if $POSIXLY_CORRECT_IS_EXPORTED; then
96   $C_COMPILER_POSIXLY_CORRECT || BISON_C_WORKS=false
97   $CXX_COMPILER_POSIXLY_CORRECT || BISON_CXX_WORKS=false
100 # Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.
101 if "$at_arg_compile_c_with_cxx"; then
102   CC_IS_CXX=1
103   CC=$CXX
104   NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
105   CFLAGS="$CXXFLAGS $WNO_DEPRECATED_CXXFLAGS"
106   BISON_C_WORKS=$BISON_CXX_WORKS
107 else
108   CC_IS_CXX=0
112 ## ------- ##
113 ## Other.  ##
114 ## ------- ##
116 # Empty if no D compiler was found.
117 : ${DC='@DC@'}
118 : ${DCFLAGS='@DCFLAGS@'}
119 if test x"$DC" = x; then
120   BISON_DC_WORKS=false
121 else
122   BISON_DC_WORKS=true
125 # Empty if no javac was found
126 : ${CONF_JAVAC='@CONF_JAVAC@'}
128 # Empty if no Java VM was found
129 : ${CONF_JAVA='@CONF_JAVA@'}
131 # We need egrep and perl.
132 : ${EGREP='@EGREP@'}
133 : ${PERL='@PERL@'}
135 # Use simple quotes (lib/quote.c).
136 # We have an LC_ALL=C pushed onto us via maint.mk.
137 LC_CTYPE=C
138 export LC_CTYPE
140 # Are special link options needed?
141 : ${LDFLAGS='@LDFLAGS@'}
143 # Are special libraries needed?
144 : ${LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"}
146 # Empty if no xsltproc was found
147 : ${XSLTPROC='@XSLTPROC@'}
150 # Some tests expect a precise diff format.  See AT_DIFF_U_CHECK.
151 # See https://lists.gnu.org/r/bug-bison/2020-05/msg00049.html.
152 cat >conftest.1 <<EOF
161 cat >conftest.2 <<EOF
170 cat >conftest.expected <<EOF
171 @@ -1,6 +1,6 @@
182 diff -u conftest.1 conftest.2 2>/dev/null | sed -n '/^@@/,$p' | sed 's/^ $//' >conftest.diff
183 if diff conftest.expected conftest.diff >/dev/null; then
184     DIFF_U_WORKS=true
185 else
186     DIFF_U_WORKS=false
188 rm conftest.*