summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2018-09-16 18:20:56 +0200
committerAkim Demaille <akim.demaille@gmail.com>2018-09-18 13:21:38 +0200
commit3367d8dd5c9fdc53dc7c4c7961a6aee2187f34a4 (patch)
tree3500638e8f8bc121afec6b8ab83f1a450909b2be /configure.ac
parent8da0cef821c10d27ec1966b162cebbcba45ef6de (diff)
downloadbison-3367d8dd5c9fdc53dc7c4c7961a6aee2187f34a4.tar.gz
build: strengthen the C++ standard flag test
On the CI, we have this spurious failure with clang 3.9 with -std=c++17: In file included from list.y:23: In file included from /usr/include/c++/4.8/iostream:39: In file included from /usr/include/c++/4.8/ostream:38: In file included from /usr/include/c++/4.8/ios:42: In file included from /usr/include/c++/4.8/bits/ios_base.h:41: In file included from /usr/include/c++/4.8/bits/locale_classes.h:40: In file included from /usr/include/c++/4.8/string:52: In file included from /usr/include/c++/4.8/bits/basic_string.h:2815: In file included from /usr/include/c++/4.8/ext/string_conversions.h:43: /usr/include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace using ::gets; ~~^ This shows that our test, based on gl_WARN_ADD, is a joke. We have to really check for at least a bit of C++. * m4/ax_check_compile_flag.m4, m4/bison-cxx-std.m4: New. * configure.ac: Use them to make sure the compiler actually works.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac26
1 files changed, 13 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index f8faa2b7..2a4269cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,8 @@
# better to avoid a typo in the 'configure --help' entry for the YACC
# environment variable.
AC_PREREQ([2.68])
-m4_pattern_forbid([^gl_[A-Z]])
+m4_pattern_forbid([^_?(gl_[A-Z]|BISON_)])
+m4_pattern_allow([^BISON_USE_NLS$])
AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
@@ -52,18 +53,6 @@ AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
# Checks for the compiler.
AC_PROG_CC_STDC
AC_PROG_CXX
-AC_LANG_PUSH([C++])
-gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
-gl_WARN_ADD([-std=c++98], [CXX98_CXXFLAGS])
-gl_WARN_ADD([-std=c++03], [CXX03_CXXFLAGS])
-gl_WARN_ADD([-std=c++11], [CXX11_CXXFLAGS])
-gl_WARN_ADD([-std=c++14], [CXX14_CXXFLAGS])
-gl_WARN_ADD([-std=c++17], [CXX17_CXXFLAGS])
-gl_WARN_ADD([-std=c++2a], [CXX2A_CXXFLAGS])
-AC_SUBST([STDCXX_FLAGS],
-["$CXX98_CXXFLAGS $CXX03_CXXFLAGS $CXX11_CXXFLAGS $CXX14_CXXFLAGS $CXX17_CXXFLAGS $CXX2A_CXXFLAGS "])
-AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
-AC_LANG_POP([C++])
# Gnulib (early checks).
gl_EARLY
@@ -82,6 +71,17 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
[lv_cv_gcc_pragma_push_works=no])
CFLAGS=$save_CFLAGS])
+AC_LANG_PUSH([C++])
+gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
+gl_WARN_ADD([-std=c++98], [CXX98_CXXFLAGS])
+gl_WARN_ADD([-std=c++03], [CXX03_CXXFLAGS])
+BISON_CXX_COMPILE_STDCXX_11
+BISON_CXX_COMPILE_STDCXX_14
+BISON_CXX_COMPILE_STDCXX_17
+BISON_CXX_COMPILE_STDCXX_2A
+AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
+AC_LANG_POP([C++])
+
AC_ARG_ENABLE([gcc-warnings],
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
Also, issue synclines from the examples/ to