2 # Sanity-test a C++ compiler.
4 # Copyright (C) 2004, 2006, 2009-2015, 2018-2021 Free Software
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Written by Paul Eggert.
22 AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COMPILER],
24 AC_CACHE_CHECK([whether $CXX builds executables that work],
34 using namespace std;],
37 typedef std::pair<unsigned, int> uipair;
38 std::map<unsigned, int> m;
39 std::map<unsigned, int>::iterator i;
40 m.insert (uipair (4, -4));
41 for (i = m.begin (); i != m.end (); ++i)
44 [AS_IF([AC_TRY_COMMAND([$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD])],
45 [AS_IF([test "$cross_compiling" = yes],
46 [bison_cv_cxx_works=cross],
47 [AS_IF([AC_TRY_COMMAND(./conftest$ac_exeext)],
48 [bison_cv_cxx_works=yes])])])
49 rm -f conftest$ac_exeext])
52 case $bison_cv_cxx_works in
53 yes) BISON_CXX_WORKS=':';;
54 no | cross) BISON_CXX_WORKS='false';;
57 AC_SUBST([BISON_CXX_WORKS])
58 AM_CONDITIONAL([ENABLE_CXX], [test $bison_cv_cxx_works = yes])
61 # BISON_CXX_COMPILER_POSIXLY_CORRECT
62 # ----------------------------------
63 # Whether the C++ compiler supports -g in POSIXLY_CORRECT mode.
64 AC_DEFUN([BISON_CXX_COMPILER_POSIXLY_CORRECT],
66 BISON_LANG_COMPILER_POSIXLY_CORRECT