Commit d19e1b08 authored by Eddie Kohler's avatar Eddie Kohler

Configury: Check availability of constexpr.

Define it to "const" if not available.
Signed-off-by: default avatarEddie Kohler <ekohler@gmail.com>
parent ab511fe8
......@@ -61,6 +61,9 @@
/* Define if right shift of signed integers acts by sign extension. */
#undef HAVE_ARITHMETIC_RIGHT_SHIFT
/* Define if the C++ compiler understands constexpr. */
#undef HAVE_CXX_CONSTEXPR
/* Define if the machine is indifferent to alignment. */
#undef HAVE_INDIFFERENT_ALIGNMENT
......@@ -121,17 +124,15 @@
#undef __MTCLICK__
#undef NUM_CLICK_CPUS
#ifndef __cplusplus
/* Define inline, if necessary. C only. */
#ifndef __cplusplus
#undef inline
#endif
#ifdef __cplusplus
/* Explicit template instances? */
#if __GNUC__ == 2 && __GNUC_MINOR__ < 90
#define EXPLICIT_TEMPLATE_INSTANCES 1
/* Define constexpr to const under C or old C++. */
#if !defined(__cplusplus) || !HAVE_CXX_CONSTEXPR
# define constexpr const
#endif
#endif /* __cplusplus */
/* Define CLICK_DEBUG_SCHEDULING to 0 if disabled. */
#ifndef CLICK_DEBUG_SCHEDULING
......
......@@ -5189,6 +5189,39 @@ $as_echo "#define HAVE_NEW_H 1" >>confdefs.h
test -n "$GXX" && test "$GXX_MAJOR" -lt 3 && VTABLE_THUNKS=-fvtable-thunks
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler understands constexpr" >&5
$as_echo_n "checking whether the C++ compiler understands constexpr... " >&6; }
if test "${ac_cv_cxx_constexpr+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
constexpr int f(int x) { return x + 1; }
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_cxx_constexpr=yes
else
ac_cv_cxx_constexpr=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_constexpr" >&5
$as_echo "$ac_cv_cxx_constexpr" >&6; }
if test "$ac_cv_cxx_constexpr" = yes; then
$as_echo "#define HAVE_CXX_CONSTEXPR 1" >>confdefs.h
fi
CXX_WARNINGS=
test -z "$ac_user_cxx" -a -n "$GXX" -a -n "$ac_compile_with_warnings" && \
CXX_WARNINGS='-W -Wall'
......@@ -7013,7 +7046,7 @@ else
ac_cv_endian=0
cat > conftest.$ac_ext <<EOF
#line 7016 "configure"
#line 7049 "configure"
#include "confdefs.h"
#include <$endian_hdr>
#ifdef __BYTE_ORDER
......
......@@ -126,6 +126,15 @@ 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
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; }]], [[]])],
[ac_cv_cxx_constexpr=yes], [ac_cv_cxx_constexpr=no])])
if test "$ac_cv_cxx_constexpr" = yes; then
AC_DEFINE([HAVE_CXX_CONSTEXPR], [1], [Define if the C++ compiler understands constexpr.])
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