Module: check_mk
Branch: master
Commit: 4ff3597f77d36c7ca77e02c89cd486950926e9f1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ff3597f77d36c…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Dec 29 13:59:51 2017 +0100
Require a C++17 compiler.
Change-Id: Ib9358a983f3d6e370d43064a9bf3738e0b3c3931
---
Makefile | 11 +----------
configure.ac | 24 +++++++++---------------
livestatus/src/.clang_complete | 2 +-
m4/ax_cxx_compile_stdcxx.m4 | 2 +-
standalone.make | 10 ++++++----
5 files changed, 18 insertions(+), 31 deletions(-)
diff --git a/Makefile b/Makefile
index 1c70f50..27b6b63 100644
--- a/Makefile
+++ b/Makefile
@@ -58,15 +58,6 @@ TAROPTS := --owner=root --group=root --exclude=.svn
--exclude=*~ \
--exclude=.gitignore --exclude=*.swp --exclude=.f12
# We could add clang's -Wshorten-64-to-32 and g++'c/clang's -Wsign-conversion
here.
CXX_FLAGS := -g -O3 -Wall -Wextra
-
-# HACK: Starting with GCC 6.1, g++ defaults to C++14, but even clang++-4.0 still
-# defaults to C++11. So when configure finds such a g++ first, the resulting
-# compilation database does not contain a -std=c++14 flag, because it's simply
-# not needed. But when we want to use our clang-based tools, it *is* needed. :-/
-# To work around that issue, we hackily add that flag below. This is ugly and
-# should be removed when the compiler defaults are in sync again.
-CXX_FLAGS += -std=c++14
-
CLANG_VERSION := 5.0
CLANG_FORMAT := clang-format-$(CLANG_VERSION)
CLANG_TIDY := clang-tidy-$(CLANG_VERSION)
@@ -499,7 +490,7 @@ endif
# Not really perfect rules, but better than nothing
analyze: config.h
$(MAKE) -C livestatus clean
- cd livestatus && $(SCAN_BUILD) -o ../clang-analyzer $(MAKE)
CXXFLAGS="-std=c++14"
+ cd livestatus && $(SCAN_BUILD) -o ../clang-analyzer $(MAKE)
CXXFLAGS="-std=c++17"
# TODO: Repeating the include paths in the cppcheck targets below is ugly and
# fragile.
diff --git a/configure.ac b/configure.ac
index 0776b60..b7c9aba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,13 +49,13 @@ AS_IF([test "x$enable_rrd_is_thread_safe" !=
"xno"], [RRDLIB_TO_CHECK=rrd],
[RRDLIB_TO_CHECK=rrd_th])
# Checks for programs.
-AC_PROG_CC([gcc-7 clang-5.0 gcc-6 clang-4.0 gcc-5 clang-3.9 clang-3.8 clang-3.7 clang-3.6
clang-3.5 gcc-4.9 gcc clang])
+AC_PROG_CC([gcc-7 clang-5.0 gcc clang])
AC_PROG_CC_C99([], [])
if test "x$ac_cv_prog_cc_c99" = xno; then
AC_MSG_ERROR([Need a C99-compliant C compiler])
fi
-AC_PROG_CXX([g++-7 clang++-5.0 g++-6 clang++-4.0 g++-5 clang++-3.9 clang++-3.8
clang++-3.7 clang++-3.6 clang++-3.5 g++-4.9 g++ clang++])
-AX_CXX_COMPILE_STDCXX([14], [noext], [mandatory])
+AC_PROG_CXX([g++-7 clang++-5.0 g++ clang++])
+AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
AC_PROG_RANLIB
# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it. :-P
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
@@ -93,28 +93,22 @@ fi
AC_LANG_PUSH([C++])
-AC_MSG_CHECKING([whether C++14 headers are supported by default])
+AC_MSG_CHECKING([whether C++17 headers are supported by default])
AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([#include <shared_mutex>], [])],
+ [AC_LANG_PROGRAM([#include <optional>
+#include <shared_mutex>], [std::shared_mutex sm])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
CXX="$CXX -stdlib=libc++"
CXXCPP="$CXXCPP -stdlib=libc++"
- AC_MSG_CHECKING([whether C++14 headers are supported with -stdlib=libc++])
+ AC_MSG_CHECKING([whether C++17 headers are supported with -stdlib=libc++])
AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([#include <shared_mutex>], [])],
+ [AC_LANG_PROGRAM([#include <optional>
+#include <shared_mutex>], [std::shared_mutex sm])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([C++ headers are too old. Please install a newer
g++/clang/libc++-dev package.])])])
-AC_MSG_CHECKING([whether <shared_mutex> defines std::shared_timed_mutex])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([#include <shared_mutex>], [std::shared_timed_mutex stm])],
- [AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STD_SHARED_TIMED_MUTEX, 1,
- [Define to 1 if <shared_mutex> defines std::shared_timed_mutex])],
- [AC_MSG_RESULT([no])])
-
AC_LANG_POP([C++])
# Checks for typedefs, structures, and compiler characteristics.
diff --git a/livestatus/src/.clang_complete b/livestatus/src/.clang_complete
index 22f5fdd..ec64bce 100644
--- a/livestatus/src/.clang_complete
+++ b/livestatus/src/.clang_complete
@@ -2,6 +2,6 @@
-I../..
-I..
-DHAVE_CONFIG_H
--std=c++14
+-std=c++17
-Wall
-Wextra
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
index 5032bba..eac609f 100644
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -139,7 +139,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1)
- m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change
in incompatible ways anytime])])
+# m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may
change in incompatible ways anytime])])
])
diff --git a/standalone.make b/standalone.make
index a90bd61..e547a9a 100644
--- a/standalone.make
+++ b/standalone.make
@@ -24,11 +24,13 @@
# TODO(sp) We should really use autotools here...
ifneq ($(shell which g++-7 2>/dev/null),)
- CXX := g++-7 -std=c++14
-else ifneq ($(shell which g++-6 2>/dev/null),)
- CXX := g++-6 -std=c++14
+ CXX := g++-7 -std=c++17
+else ifneq ($(shell which clang++-5.0 2>/dev/null),)
+ CXX := clang++-5.0 -std=c++17
+else ifneq ($(shell which g++ 2>/dev/null),)
+ CXX := g++ -std=c++17
else
- CXX := g++-5 -std=c++14
+ CXX := clang++ -std=c++17
endif
CXXFLAGS := -g -O3 -Wall -Wextra