From cbe0f0e435e713091fa4741635dab97476e62983 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Mon, 27 Mar 2023 18:37:19 -0400 Subject: [PATCH] Switch Strategies: Only Set `-std=c++11` When Default is Older --- contrib/pzstd/Makefile | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) 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 =