...and work around AC_RUN_IFELSE not working when cross-compiling

Change-Id: I7a3a9593cabec68c0d60c17a991207b5d3dab69c
This commit is contained in:
Stephan Bergmann
2015-02-10 16:56:16 +01:00
parent e83393a98e
commit e7b9306d8b

View File

@@ -12586,33 +12586,37 @@ if test "$build_os" = "cygwin"; then
fi
AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
save_LIBS=$LIBS
if test -n "$ILIB1"; then
LIBS="$LIBS $ILIB1"
if test "$CROSS_COMPILING" = "TRUE"; then
broken='assuming not (cross-compiling)'
else
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
save_LIBS=$LIBS
if test -n "$ILIB1"; then
LIBS="$LIBS $ILIB1"
fi
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
// Exit with failure if the static initializer_list is stored on the
// stack (as done by Clang < 3.4):
#include <initializer_list>
struct S {};
bool g(void const * p1, void const * p2) {
int n;
return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
}
bool f(void const * p1) {
static std::initializer_list<S> s { S() };
return g(p1, s.begin());
}
]],[[
int n;
return f(&n) ? 0 : 1;
]])], [broken=no], [broken=yes])
AC_LANG_POP([C++])
LIBS=$save_LIBS
CXXFLAGS=$save_CXXFLAGS
fi
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
// Exit with failure if the static initializer_list is stored on the stack
// (as done by Clang < 3.4):
#include <initializer_list>
struct S {};
bool g(void const * p1, void const * p2) {
int n;
return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
}
bool f(void const * p1) {
static std::initializer_list<S> s { S() };
return g(p1, s.begin());
}
]],[[
int n;
return f(&n) ? 0 : 1;
]])], [broken=no], [broken=yes])
AC_LANG_POP([C++])
LIBS=$save_LIBS
CXXFLAGS=$save_CXXFLAGS
AC_MSG_RESULT([$broken])
if test "$broken" = yes; then
AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])