From 606b35853b29ed67be6d8e48f1ac65b72acff8fd Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Mon, 30 May 2022 16:44:00 +0100 Subject: [PATCH] Configure and compile with C++17 on Ubuntu 22.04 The packaged libsystemc on Ubuntu 22.04 uses C++17, so default to that on that platform. Keep C++14 elsewhere. --- configure.ac | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f0abbb265..cea30eb50 100644 --- a/configure.ac +++ b/configure.ac @@ -348,14 +348,18 @@ AC_SUBST(CFG_CXXFLAGS_PROFILE) # Flag to select newest language standard supported # Macros work such that first option that passes is the one we take -# Currently enabled c++14 due to packaged SystemC dependency +# Currently enable c++17/c++14 due to packaged SystemC dependency # c++14 is the newest that Verilator is regressed to support # c++11 is the oldest that Verilator supports # gnu is requried for Cygwin to compile verilated.h successfully #_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++20) #_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++20) -#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++17) -#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++17) +case "$(which lsb_release 2>&1 > /dev/null && lsb_release -d)" in +*Ubuntu*22.04*) +_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++17) +_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++17) +;; +esac _MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++14) _MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++14) _MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++11)