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)