Commit 9f65e559 authored by Eddie Kohler's avatar Eddie Kohler

Configury: Check for C++11 rvalue references and template alias.

parent 4efd5ad6
......@@ -73,9 +73,15 @@
/* Define if the C++ compiler understands #pragma interface. */
#undef HAVE_CXX_PRAGMA_INTERFACE
/* Define if the C++ compiler understands rvalue references. */
#undef HAVE_CXX_RVALUE_REFERENCES
/* Define if the C++ compiler understands static_assert. */
#undef HAVE_CXX_STATIC_ASSERT
/* Define if the C++ compiler understands template alias. */
#undef HAVE_CXX_TEMPLATE_ALIAS
/* Define if the machine is indifferent to alignment. */
#undef HAVE_INDIFFERENT_ALIGNMENT
......
......@@ -5317,6 +5317,38 @@ $as_echo "#define HAVE_CXX_CONSTEXPR 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler understands rvalue references" >&5
$as_echo_n "checking whether the C++ compiler understands rvalue references... " >&6; }
if ${ac_cv_cxx_rvalue_references+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int f(int &) { return 1; } int f(int &&) { return 0; }
int
main ()
{
return f(int());
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_cxx_rvalue_references=yes
else
ac_cv_cxx_rvalue_references=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_rvalue_references" >&5
$as_echo "$ac_cv_cxx_rvalue_references" >&6; }
if test "$ac_cv_cxx_rvalue_references" = yes; then
$as_echo "#define HAVE_CXX_RVALUE_REFERENCES 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 ${ac_cv_cxx_static_assert+:} false; then :
......@@ -5349,6 +5381,38 @@ $as_echo "#define HAVE_CXX_STATIC_ASSERT 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler understands template alias" >&5
$as_echo_n "checking whether the C++ compiler understands template alias... " >&6; }
if ${ac_cv_cxx_template_alias+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
template <typename T> struct X { typedef T type; }; template <typename T> using Y = X<T>; int f(int x) { return x; }
int
main ()
{
return f(Y<int>::type());
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_cxx_template_alias=yes
else
ac_cv_cxx_template_alias=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_template_alias" >&5
$as_echo "$ac_cv_cxx_template_alias" >&6; }
if test "$ac_cv_cxx_template_alias" = yes; then
$as_echo "#define HAVE_CXX_TEMPLATE_ALIAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler understands #pragma interface" >&5
$as_echo_n "checking whether the C++ compiler understands #pragma interface... " >&6; }
if ${ac_cv_cxx_pragma_interface+:} false; then :
......@@ -7394,7 +7458,7 @@ else
ac_cv_endian=0
cat > conftest.$ac_ext <<EOF
#line 7397 "configure"
#line 7461 "configure"
#include "confdefs.h"
#include <$endian_hdr>
#ifdef __BYTE_ORDER
......
......@@ -113,7 +113,7 @@ and Linux header files are GCC-specific.)
fi
fi
dnl check for C++0x constexpr and static_assert
dnl check for C++11 features
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; }]], [[]])],
......@@ -122,6 +122,13 @@ and Linux header files are GCC-specific.)
AC_DEFINE([HAVE_CXX_CONSTEXPR], [1], [Define if the C++ compiler understands constexpr.])
fi
AC_CACHE_CHECK([whether the C++ compiler understands rvalue references], [ac_cv_cxx_rvalue_references], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int f(int &) { return 1; } int f(int &&) { return 0; }]], [[return f(int());]])],
[ac_cv_cxx_rvalue_references=yes], [ac_cv_cxx_rvalue_references=no])])
if test "$ac_cv_cxx_rvalue_references" = yes; then
AC_DEFINE([HAVE_CXX_RVALUE_REFERENCES], [1], [Define if the C++ compiler understands rvalue references.])
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])])
......@@ -129,6 +136,13 @@ and Linux header files are GCC-specific.)
AC_DEFINE([HAVE_CXX_STATIC_ASSERT], [1], [Define if the C++ compiler understands static_assert.])
fi
AC_CACHE_CHECK([whether the C++ compiler understands template alias], [ac_cv_cxx_template_alias], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[template <typename T> struct X { typedef T type; }; template <typename T> using Y = X<T>; int f(int x) { return x; }]], [[return f(Y<int>::type());]])],
[ac_cv_cxx_template_alias=yes], [ac_cv_cxx_template_alias=no])])
if test "$ac_cv_cxx_template_alias" = yes; then
AC_DEFINE([HAVE_CXX_TEMPLATE_ALIAS], [1], [Define if the C++ compiler understands template alias.])
fi
AC_CACHE_CHECK([[whether the C++ compiler understands #pragma interface]], [ac_cv_cxx_pragma_interface], [
save_cxxflags="$CXXFLAGS"; CXXFLAGS="$CXXFLAGS -Werror -Wall -W"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#pragma interface "foo.c"
......
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