From 247d0795312fdb8b1bfc68bf9e0d33459dbfeb63 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 6 Sep 2018 10:03:36 +0200 Subject: Make AC_LINK_IFELSE (to check HAVE_CPP_INLINE_VARIABLES) work on Windows Change-Id: I6c71e079f21093d5f8dc4dbca20624e9fc927882 Reviewed-on: https://gerrit.libreoffice.org/60072 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- configure.ac | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ebf8b01ac657..9861188660e2 100644 --- a/configure.ac +++ b/configure.ac @@ -6433,25 +6433,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ CXXFLAGS=$save_CXXFLAGS AC_LANG_POP([C++]) -AC_MSG_CHECKING([whether $CXX supports inline variables]) -AC_LANG_PUSH([C++]) -save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #if !defined __cpp_inline_variables - // This tests for one specific aspect of inline variables that is actually used by - // ORegistry::ROOT (registry/source/regimpl.cxx): - struct S { constexpr S() {} }; - struct T { static constexpr S s{}; }; - S const * f() { return &T::s; } - #endif - ]])], [ - AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1]) - AC_MSG_RESULT([yes]) - ], [AC_MSG_RESULT([no])]) -CXXFLAGS=$save_CXXFLAGS -AC_LANG_POP([C++]) - AC_MSG_CHECKING([whether $CXX has a fix for CWG1579]) AC_LANG_PUSH([C++]) save_CXXFLAGS=$CXXFLAGS @@ -12435,6 +12416,32 @@ if test "$build_os" = "cygwin"; then AC_SUBST(ILIB) fi +AC_MSG_CHECKING([whether $CXX supports inline variables]) +AC_LANG_PUSH([C++]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +if test "$build_os" = cygwin; then + save_LIB=$LIB + export LIB=$ILIB +fi +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #if !defined __cpp_inline_variables + // This tests for one specific aspect of inline variables that is actually used by + // ORegistry::ROOT (registry/source/regimpl.cxx): + struct S { constexpr S() {} }; + struct T { static constexpr S s{}; }; + S const * f() { return &T::s; } + #endif + ]])], [ + AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1]) + AC_MSG_RESULT([yes]) + ], [AC_MSG_RESULT([no])]) +CXXFLAGS=$save_CXXFLAGS +if test "$build_os" = cygwin; then + LIB=$save_LIB +fi +AC_LANG_POP([C++]) + dnl We should be able to drop the below check when bumping the GCC baseline to dnl 4.9, as dnl "deque::erase() still takes iterator instead of const_iterator" should be -- cgit