From: W. Felix Handte Date: Mon, 27 Mar 2023 22:37:19 +0000 (-0400) Subject: Switch Strategies: Only Set `-std=c++11` When Default is Older X-Git-Tag: v1.5.5~2^2~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbe0f0e435e713091fa4741635dab97476e62983;p=thirdparty%2Fzstd.git Switch Strategies: Only Set `-std=c++11` When Default is Older --- diff --git a/contrib/pzstd/Makefile b/contrib/pzstd/Makefile index 423be59d2..e62f8e873 100644 --- a/contrib/pzstd/Makefile +++ b/contrib/pzstd/Makefile @@ -37,24 +37,11 @@ CFLAGS += -Wno-deprecated-declarations PZSTD_INC = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I. GTEST_INC = -isystem googletest/googletest/include -# Select newest C++ standard available, minimum C++11 -ifeq ($(shell echo | $(CXX) -x c++ -Werror -std=c++23 -c - -o /dev/null 2>/dev/null && echo 1 || echo 0),1) -PZSTD_CXX_STD := -std=c++23 -else -ifeq ($(shell echo | $(CXX) -x c++ -Werror -std=c++20 -c - -o /dev/null 2>/dev/null && echo 1 || echo 0),1) -PZSTD_CXX_STD := -std=c++20 -else -ifeq ($(shell echo | $(CXX) -x c++ -Werror -std=c++17 -c - -o /dev/null 2>/dev/null && echo 1 || echo 0),1) -PZSTD_CXX_STD := -std=c++17 -else -ifeq ($(shell echo | $(CXX) -x c++ -Werror -std=c++14 -c - -o /dev/null 2>/dev/null && echo 1 || echo 0),1) -PZSTD_CXX_STD := -std=c++14 -else +# If default C++ version is older than C++11, explicitly set C++11, which is the +# minimum required by the code. +ifeq ($(shell echo "\043if __cplusplus < 201103L\n\043error\n\043endif" | $(CXX) -x c++ -Werror -c - -o /dev/null 2>/dev/null && echo 1 || echo 0),0) PZSTD_CXX_STD := -std=c++11 endif -endif -endif -endif PZSTD_CPPFLAGS = $(PZSTD_INC) PZSTD_CCXXFLAGS =