From 8a121803f5226d2c49c8a3562216aff73670e88d Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 19 Dec 2024 20:56:47 -0500 Subject: [PATCH] Add configure CFG_CXX_VERSION --- configure.ac | 6 ++++-- include/verilated.mk.in | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1f0897f7f..83b5ea21b 100644 --- a/configure.ac +++ b/configure.ac @@ -176,8 +176,10 @@ AC_PROG_CXX AC_PROG_INSTALL AC_LANG_PUSH(C++) -cxx_version=$($CXX --version | head -1) -AC_MSG_RESULT([compiler is $CXX --version = $cxx_version]) +CFG_CXX_VERSION=`$CXX --version | head -1` +AC_MSG_RESULT([compiler $CXX --version = $CFG_CXX_VERSION]) +AC_SUBST(CFG_CXX_VERSION) + AC_MSG_CHECKING([that C++ compiler can compile simple program]) AC_RUN_IFELSE( [AC_LANG_SOURCE([int main() { return 0; }])], diff --git a/include/verilated.mk.in b/include/verilated.mk.in index a38afe987..a99873f15 100644 --- a/include/verilated.mk.in +++ b/include/verilated.mk.in @@ -23,6 +23,12 @@ PYTHON3 = @PYTHON3@ CFG_WITH_CCWARN = @CFG_WITH_CCWARN@ CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@ +# Compiler version found during configure. This make variable is not used +# here, but note that if this differs from what `$(CXX) --version` prints, +# then there may be strange results such as unexpected warnings, as +# configure determines compiler characteristics. +CFG_CXX_VERSION = "@CFG_CXX_VERSION@" + # Compiler flags to enable profiling CFG_CXXFLAGS_PROFILE = @CFG_CXXFLAGS_PROFILE@ # Select language required to compile (often empty)