Kaydet (Commit) e7b9306d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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

Change-Id: I7a3a9593cabec68c0d60c17a991207b5d3dab69c
üst e83393a9
...@@ -12586,33 +12586,37 @@ if test "$build_os" = "cygwin"; then ...@@ -12586,33 +12586,37 @@ if test "$build_os" = "cygwin"; then
fi fi
AC_MSG_CHECKING([whether $CXX has broken static initializer_list support]) AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
save_CXXFLAGS=$CXXFLAGS if test "$CROSS_COMPILING" = "TRUE"; then
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" broken='assuming not (cross-compiling)'
save_LIBS=$LIBS else
if test -n "$ILIB1"; then save_CXXFLAGS=$CXXFLAGS
LIBS="$LIBS $ILIB1" 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 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]) AC_MSG_RESULT([$broken])
if test "$broken" = yes; then if test "$broken" = yes; then
AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST]) AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
......
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