Commit 0add752b authored by Eddie Kohler's avatar Eddie Kohler

Configury: Check whether the C++ compiler defines static_assert.

Like "g++ -std=gnu++0x" might.
Signed-off-by: default avatarEddie Kohler <ekohler@gmail.com>
parent d19e1b08
......@@ -64,6 +64,9 @@
/* Define if the C++ compiler understands constexpr. */
#undef HAVE_CXX_CONSTEXPR
/* Define if the C++ compiler understands static_assert. */
#undef HAVE_CXX_STATIC_ASSERT
/* Define if the machine is indifferent to alignment. */
#undef HAVE_INDIFFERENT_ALIGNMENT
......
......@@ -5221,6 +5221,38 @@ $as_echo "#define HAVE_CXX_CONSTEXPR 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler understands static_assert" >&5
$as_echo_n "checking whether the C++ compiler understands static_assert... " >&6; }
if test "${ac_cv_cxx_static_assert+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
const int f = 2;
int
main ()
{
static_assert(f == 2, "f should be 2");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_cxx_static_assert=yes
else
ac_cv_cxx_static_assert=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_static_assert" >&5
$as_echo "$ac_cv_cxx_static_assert" >&6; }
if test "$ac_cv_cxx_static_assert" = yes; then
$as_echo "#define HAVE_CXX_STATIC_ASSERT 1" >>confdefs.h
fi
CXX_WARNINGS=
test -z "$ac_user_cxx" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
......@@ -7046,7 +7078,7 @@ else
ac_cv_endian=0
cat > conftest.$ac_ext <<EOF
#line 7049 "configure"
#line 7081 "configure"
#include "confdefs.h"
#include <$endian_hdr>
#ifdef __BYTE_ORDER
......
......@@ -126,7 +126,7 @@ by setting the 'CXX' environment variable and rerunning me.
VTABLE_THUNKS=
test -n "$GXX" && test "$GXX_MAJOR" -lt 3 && VTABLE_THUNKS=-fvtable-thunks
dnl check for C++0x constexpr
dnl check for C++0x constexpr and static_assert
AC_CACHE_CHECK([whether the C++ compiler understands constexpr], [ac_cv_cxx_constexpr], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[constexpr int f(int x) { return x + 1; }]], [[]])],
......@@ -135,6 +135,13 @@ by setting the 'CXX' environment variable and rerunning me.
AC_DEFINE([HAVE_CXX_CONSTEXPR], [1], [Define if the C++ compiler understands constexpr.])
fi
AC_CACHE_CHECK([whether the C++ compiler understands static_assert], [ac_cv_cxx_static_assert], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const int f = 2;]], [[static_assert(f == 2, "f should be 2");]])],
[ac_cv_cxx_static_assert=yes], [ac_cv_cxx_static_assert=no])])
if test "$ac_cv_cxx_static_assert" = yes; then
AC_DEFINE([HAVE_CXX_STATIC_ASSERT], [1], [Define if the C++ compiler understands static_assert.])
fi
dnl define correct warning options
CXX_WARNINGS=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment