From 25592a00b6a1f9af1e97be3856f8d4c9cf3abf3c Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 17 Mar 2024 11:42:44 -0400 Subject: [PATCH] use C++17 for newer versions of clang for BSD --- Makefile.bsd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile.bsd b/Makefile.bsd index 00543193..89229e97 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -6,7 +6,13 @@ CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-misl ## (e.g. -fstack-protector-strong -Wformat -Werror=format-security), we do not want to remove ## -std=c++11. If you want to remove this variable please do so in a way that allows setting ## custom FLAGS to work at build-time. -NEEDED_CXXFLAGS = -std=c++11 +CXXVER := $(shell $(CXX) -dumpversion) +ifneq ($(shell expr match $(CXX) 'clang'),5) + NEEDED_CXXFLAGS = -std=c++11 +else ifeq (${CXXVER}, "4.2.1") # older clang always returned 4.2.1 + NEEDED_CXXFLAGS = -std=c++11 +else # newer versions support C++17 + NEEDED_CXXFLAGS = -std=c++17 DEFINES = -D_GLIBCXX_USE_NANOSLEEP=1 INCFLAGS = -I/usr/include/ -I/usr/local/include/ LDFLAGS = ${LD_DEBUG} -Wl,-rpath,/usr/local/lib -L/usr/local/lib