]> git.saurik.com Git - bison.git/blame - tests/atlocal.in
symbol: provide an easy means to compare them in source order
[bison.git] / tests / atlocal.in
CommitLineData
e9690142 1# @configure_input@ -*- shell-script -*-
342b8b6e 2# Configurable variable values for Bison test suite.
3b2942e6 3
7d6bad19 4# Copyright (C) 2000-2013 Free Software Foundation, Inc.
3272a725
AD
5#
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.
10#
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.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
342b8b6e 18
4c9b8f13 19# We need 'config.h'.
e85056ef
AD
20CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
21
d4728d92
AD
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.
25if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
26 POSIXLY_CORRECT_IS_EXPORTED=true
27else
28 POSIXLY_CORRECT_IS_EXPORTED=false
29fi
30
e85056ef
AD
31## ------------------- ##
32## C/C++ Compilation. ##
33## ------------------- ##
34
74553c98 35: ${CC='@CC@'}
e85056ef
AD
36: ${CXX='@CXX@'}
37
38# Is the compiler GCC?
39GCC='@GCC@'
f377f69f 40
52cea04a
JD
41# Sometimes a test group needs to ignore gcc warnings, so it locally
42# sets CFLAGS to this.
321d3e35
AD
43 NO_WERROR_CFLAGS='@CFLAGS@ @WARN_CFLAGS@ @WARN_CFLAGS_TEST@'
44NO_WERROR_CXXFLAGS='@CXXFLAGS@ @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@'
642cb8f8 45
e85056ef
AD
46# But most of the time, we want -Werror.
47 CFLAGS="$NO_WERROR_CFLAGS @WERROR_CFLAGS@"
48CXXFLAGS="$NO_WERROR_CXXFLAGS @WERROR_CXXFLAGS@"
9d56d294 49
209ea708
PE
50# If 'exit 77'; skip all C++ tests; otherwise ':'.
51BISON_CXX_WORKS='@BISON_CXX_WORKS@'
52
b7171c45
AD
53# Be sure that the C++ compiler is not broken because of gnulib. This
54# cannot be checked in configure (gnulib is not parameterized yet),
55# and checking this in every C++ test in AC_COMPILE_CXX is too costly.
56#
57# http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html
58#
59# FIXME: Check (say 2014) whether this is still needed.
60if $BISON_CXX_WORKS; then
61 # See AT_DATA_SOURCE_PROLOGUE.
62 cat >conftest.cc <<EOF
63#include <config.h>
64/* We don't need perfect functions for these tests. */
65#undef malloc
66#undef memcmp
67#undef realloc
68#include <iostream>
69
70int main ()
71{
72 std::cout << "Works" << std::endl;
73}
74EOF
b7171c45
AD
75 $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
76 case $? in
77 0);;
78 *) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
79 esac
3dc50b3b 80 rm -fr conftest*
b7171c45
AD
81fi
82
d4728d92
AD
83# Whether the compiler supports POSIXLY_CORRECT defined.
84: ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
85: ${CXX_COMPILER_POSIXLY_CORRECT='@CXX_COMPILER_POSIXLY_CORRECT@'}
86
87if $POSIXLY_CORRECT_IS_EXPORTED; then
88 $C_COMPILER_POSIXLY_CORRECT ||
89 BISON_C_WORKS="as_fn_error 77 POSIXLY_CORRECT"
90 $CXX_COMPILER_POSIXLY_CORRECT ||
91 BISON_CXX_WORKS="as_fn_error 77 POSIXLY_CORRECT"
92fi
93
e85056ef
AD
94# Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.
95if "$at_arg_compile_c_with_cxx"; then
0e98a81e 96 CC_IS_CXX=1
e85056ef 97 CC=$CXX
e85056ef
AD
98 NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
99 CFLAGS=$CXXFLAGS
d4728d92 100 BISON_C_WORKS=$BISON_CXX_WORKS
0e98a81e
AD
101else
102 CC_IS_CXX=0
e85056ef
AD
103fi
104
105
106## ------- ##
107## Other. ##
108## ------- ##
713535c2 109
8405b70c
PB
110# Empty if no javac was found
111CONF_JAVAC='@CONF_JAVAC@'
112
113# Empty if no Java VM was found
114CONF_JAVA='@CONF_JAVA@'
da730230 115
ccdc1577 116# We need egrep and perl.
74553c98 117: ${EGREP='@EGREP@'}
ccdc1577 118: ${PERL='@PERL@'}
39ac1214
AD
119
120# Use simple quotes (lib/quote.c).
121LC_CTYPE=C
122export LC_CTYPE
ac3f2e33 123
ff020c30
AD
124# Are special link options needed?
125LDFLAGS='@LDFLAGS@'
126
127# Are special libraries needed?
128LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
129
130# Empty if no xsltproc was found
131: ${XSLTPROC='@XSLTPROC@'}
132
0a36880a
AD
133# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
134# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
135# the environment variable.
136: ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
137if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
138 POSIXLY_CORRECT_IS_EXPORTED=true
139else
140 POSIXLY_CORRECT_IS_EXPORTED=false
141fi