diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-02-10 16:56:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-02-10 16:56:16 +0100 |
commit | e7b9306d8b48dda16c33be84cc926fa0fd9aeac0 (patch) | |
tree | 7fff8e727dd930c0d67cebd865c736c66e5060fd /configure.ac | |
parent | e83393a98ebc512fb261d52c903fb17827648d56 (diff) |
...and work around AC_RUN_IFELSE not working when cross-compiling
Change-Id: I7a3a9593cabec68c0d60c17a991207b5d3dab69c
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac index 6ea2dc54567b..d4594e86ea81 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) |