summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-10-25 19:52:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-11-26 18:15:55 +0100
commitae16870b2c84c116cde8279a47db106a4fa9d529 (patch)
treee5c1e79c38f967fd5cd69c0e3943bc29fa2f3791 /configure.ac
parent5c2f6d9e2efe1015cfbf9d89a88ed940127c0a4f (diff)
Build as C++17 when GCC/Clang supports it
...and the gperf being used no longer emits "register" in C++ code. Unlike Clang with -Wdynamic-exception-spec ignored, at least GCC 7.2 -std=gnu++17 always makes dynamic exception specs hard errors, which would cause errors both when building StaticLibrary_libcmis and when including libcmis/libcmis.hxx in ucb/source/ucp/cmis/. So patch away all dynamic exception specifications from all external/libcmis include files indirectly included via libcmis/libcmis.hxx, and (to silence the remaining dynamic exception specifications in the innards of external/libcmis, which I did not feel like also patching away) build StaticLibrary_libcmis as C++03 if necessary, and wait for upstream libcmis to eventually be ported to C++17. And external/firebird needs to be built with CXXFLAGS_CXX11 (which amounts to C++17 with this patch) since 9206a08ada00e8762c4a634f242bd566028964bb "Upgrade to ICU 60.1", so the relevant dynamic exception specifications had to be patched away from its innards. Change-Id: I3a0c9ec83c7c1d413559459631970f69ab977f31 Reviewed-on: https://gerrit.libreoffice.org/43851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac54
1 files changed, 34 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 42239059cdcd..3d0e09733ec5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5962,6 +5962,24 @@ AC_MSG_RESULT([$cpp_library_name])
AC_LANG_POP([C++])
dnl ===================================================================
+dnl Check for gperf
+dnl ===================================================================
+AC_PATH_PROG(GPERF, gperf)
+if test -z "$GPERF"; then
+ AC_MSG_ERROR([gperf not found but needed. Install it.])
+fi
+if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
+ GPERF=`cygpath -m $GPERF`
+fi
+AC_MSG_CHECKING([gperf version])
+if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
+ AC_MSG_RESULT([OK])
+else
+ AC_MSG_ERROR([too old, you need at least 3.0.0])
+fi
+AC_SUBST(GPERF)
+
+dnl ===================================================================
dnl C++11
dnl ===================================================================
@@ -5972,8 +5990,11 @@ if test "$COM" = MSC; then
# MSVC supports (a subset of) CXX11 without any switch
elif test "$GCC" = "yes"; then
HAVE_CXX11=
- AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
- for flag in -std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
+ AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
+ dnl But only use C++17 if the gperf that is being used knows not to emit
+ dnl "register" in C++ output:
+ printf 'foo\n' | $GPERF -L C++ > conftest.inc
+ for flag in -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z -std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $flag -Werror"
AC_LANG_PUSH([C++])
@@ -5981,6 +6002,16 @@ elif test "$GCC" = "yes"; then
#include <algorithm>
#include <functional>
#include <vector>
+
+ #include <string.h>
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpragmas"
+ // make GCC not warn about next pragma
+ #pragma GCC diagnostic ignored "-Wdeprecated-register"
+ // make Clang with -std < C++17 not even warn about register
+ #include "conftest.inc"
+ #pragma GCC diagnostic pop
+
void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
std::sort(v.begin(), v.end(), fn);
}
@@ -5992,6 +6023,7 @@ elif test "$GCC" = "yes"; then
break
fi
done
+ rm conftest.inc
if test "$HAVE_CXX11" = TRUE; then
AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
else
@@ -7262,24 +7294,6 @@ fi
AC_SUBST(ENABLE_LWP)
dnl ===================================================================
-dnl Check for gperf
-dnl ===================================================================
-AC_PATH_PROG(GPERF, gperf)
-if test -z "$GPERF"; then
- AC_MSG_ERROR([gperf not found but needed. Install it.])
-fi
-if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
- GPERF=`cygpath -m $GPERF`
-fi
-AC_MSG_CHECKING([gperf version])
-if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
- AC_MSG_RESULT([OK])
-else
- AC_MSG_ERROR([too old, you need at least 3.0.0])
-fi
-AC_SUBST(GPERF)
-
-dnl ===================================================================
dnl Check for building ODK
dnl ===================================================================
if test "$enable_odk" = no; then