2011-10-04 14:07:46 +00:00
|
|
|
# DESCRIPTION: Process this file with autoconf to produce a configure script.
|
|
|
|
#
|
2024-01-01 08:19:59 +00:00
|
|
|
# Copyright 2003-2024 by Wilson Snyder. Verilator is free software; you
|
2020-03-21 15:24:24 +00:00
|
|
|
# can redistribute it and/or modify it under the terms of either the GNU Lesser
|
2011-10-04 14:07:46 +00:00
|
|
|
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
2020-03-21 15:24:24 +00:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2023-06-13 00:52:29 +00:00
|
|
|
# When releasing, also update header of Changes file, and CmakeLists.txt,
|
2022-06-19 19:13:29 +00:00
|
|
|
# and commit using "devel release" or "Version bump" message
|
|
|
|
# Then 'make maintainer-dist'
|
2012-09-04 00:32:32 +00:00
|
|
|
#AC_INIT([Verilator],[#.### YYYY-MM-DD])
|
|
|
|
#AC_INIT([Verilator],[#.### devel])
|
2024-04-05 10:23:30 +00:00
|
|
|
AC_INIT([Verilator],[5.025 devel],
|
2019-11-08 03:33:59 +00:00
|
|
|
[https://verilator.org],
|
|
|
|
[verilator],[https://verilator.org])
|
2015-08-13 01:40:55 +00:00
|
|
|
|
2023-07-27 09:42:35 +00:00
|
|
|
AC_CONFIG_HEADERS(src/config_package.h)
|
2021-04-05 02:05:44 +00:00
|
|
|
AC_CONFIG_FILES(Makefile src/Makefile src/Makefile_obj include/verilated.mk include/verilated_config.h verilator.pc verilator-config.cmake verilator-config-version.cmake)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-05-05 12:46:24 +00:00
|
|
|
# Version
|
2011-10-05 13:50:14 +00:00
|
|
|
AC_MSG_RESULT([configuring for $PACKAGE_STRING])
|
2020-05-05 12:46:24 +00:00
|
|
|
PACKAGE_VERSION_NUMBER=`AS_ECHO("$PACKAGE_VERSION") | sed 's/ .*//g'`
|
|
|
|
AC_SUBST(PACKAGE_VERSION_NUMBER)
|
2021-04-18 14:16:18 +00:00
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_NUMBER_STRING],["$PACKAGE_VERSION_NUMBER"],[Package version as a number])
|
2022-03-12 16:17:39 +00:00
|
|
|
VERILATOR_VERSION_INTEGER=`AS_ECHO("$PACKAGE_VERSION") | [sed 's/\([0-9]\)\.\([0-9][0-9][0-9]\) .*/\1\2000/g']`
|
|
|
|
AC_SUBST(VERILATOR_VERSION_INTEGER)
|
2023-10-31 12:10:41 +00:00
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_STRING_CHAR],
|
|
|
|
[static const char* const PACKAGE_STRING_UNUSED = "$PACKAGE_STRING";],
|
|
|
|
[Package version as a number])
|
|
|
|
AC_SUBST(PACKAGE_VERSION_STRING_CHAR)
|
2011-10-05 13:50:14 +00:00
|
|
|
|
2018-07-04 01:34:50 +00:00
|
|
|
# Ignore automake flags passed by Ubuntu builds
|
|
|
|
AC_ARG_ENABLE([dependency-tracking],
|
|
|
|
[AS_HELP_STRING([--disable-dependency-tracking], [ignored])])
|
|
|
|
AC_ARG_ENABLE([maintainer-mode],
|
|
|
|
[AS_HELP_STRING([--enable-maintainer-mode], [ignored])])
|
|
|
|
AC_ARG_ENABLE([silent-rules],
|
|
|
|
[AS_HELP_STRING([--disable-silent-rules], [ignored])])
|
|
|
|
|
2020-02-01 00:13:55 +00:00
|
|
|
# Flag to enable linking specific libraries statically
|
|
|
|
AC_MSG_CHECKING(whether to perform partial static linking of Verilator binary)
|
|
|
|
AC_ARG_ENABLE([partial-static],
|
|
|
|
[AS_HELP_STRING([--disable-partial-static],
|
2021-06-29 03:18:14 +00:00
|
|
|
[By default, for Verilation performance, Verilator
|
2020-02-01 00:13:55 +00:00
|
|
|
is linked against some of its dependencies
|
|
|
|
statically. Use this to link the Verilator binary
|
|
|
|
fully dynamically.])],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_ENABLE_PARTIAL_STATIC=yes ;;
|
|
|
|
no) CFG_ENABLE_PARTIAL_STATIC=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value '${enableval}' for --disable-partial-static]) ;;
|
|
|
|
esac],
|
|
|
|
CFG_ENABLE_PARTIAL_STATIC=yes)
|
|
|
|
AC_MSG_RESULT($CFG_ENABLE_PARTIAL_STATIC)
|
|
|
|
|
2020-01-23 22:32:19 +00:00
|
|
|
# Flag to enable linking Verilator with tcmalloc if available
|
2020-02-01 00:13:55 +00:00
|
|
|
AC_MSG_CHECKING(whether to use tcmalloc)
|
2020-01-23 22:32:19 +00:00
|
|
|
AC_ARG_ENABLE([tcmalloc],
|
|
|
|
[AS_HELP_STRING([--enable-tcmalloc],
|
2020-02-01 00:13:55 +00:00
|
|
|
[Use libtcmalloc_minimal for faster dynamic memory
|
2021-06-13 19:13:27 +00:00
|
|
|
management in Verilator binary @<:@default=check@:>@])],
|
2020-01-23 22:32:19 +00:00
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_WITH_TCMALLOC=yes ;;
|
|
|
|
no) CFG_WITH_TCMALLOC=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-tcmalloc]) ;;
|
|
|
|
esac],
|
|
|
|
[CFG_WITH_TCMALLOC=check;])
|
2020-02-01 00:13:55 +00:00
|
|
|
AC_MSG_RESULT($CFG_WITH_TCMALLOC)
|
2020-01-23 22:32:19 +00:00
|
|
|
|
2021-06-14 17:03:05 +00:00
|
|
|
# Flag to enable coverage build
|
|
|
|
AC_MSG_CHECKING(whether to build for coverage collection)
|
|
|
|
AC_ARG_ENABLE([coverage],
|
|
|
|
[AS_HELP_STRING([--enable-coverage],
|
|
|
|
[Build Verilator for code coverage collection.
|
|
|
|
For developers only.])],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_ENABLE_COVERAGE=yes ;;
|
|
|
|
no) CFG_ENABLE_COVERAGE=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-coverage]) ;;
|
|
|
|
esac],
|
|
|
|
CFG_ENABLE_COVERAGE=no)
|
|
|
|
AC_MSG_RESULT($CFG_ENABLE_COVERAGE)
|
|
|
|
|
2011-10-07 10:48:40 +00:00
|
|
|
# Special Substitutions - CFG_WITH_DEFENV
|
2016-11-19 01:31:41 +00:00
|
|
|
AC_MSG_CHECKING(whether to use hardcoded paths)
|
2011-10-04 14:07:46 +00:00
|
|
|
AC_ARG_ENABLE([defenv],
|
|
|
|
[AS_HELP_STRING([--disable-defenv],
|
2020-01-31 00:52:58 +00:00
|
|
|
[disable using some hardcoded data paths extracted
|
|
|
|
from some default environment variables (the default
|
|
|
|
is to use hardcoded paths) in Verilator binary])],
|
2011-10-04 14:07:46 +00:00
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_WITH_DEFENV=yes ;;
|
|
|
|
no) CFG_WITH_DEFENV=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --disable-defenv]) ;;
|
|
|
|
esac],
|
|
|
|
CFG_WITH_DEFENV=yes)
|
2008-03-18 20:26:37 +00:00
|
|
|
AC_SUBST(CFG_WITH_DEFENV)
|
2011-10-07 10:48:40 +00:00
|
|
|
AC_MSG_RESULT($CFG_WITH_DEFENV)
|
|
|
|
|
|
|
|
# Special Substitutions - CFG_WITH_CCWARN
|
|
|
|
AC_MSG_CHECKING(whether to show and stop on compilation warnings)
|
|
|
|
AC_ARG_ENABLE([ccwarn],
|
|
|
|
[AS_HELP_STRING([--enable-ccwarn],
|
2020-01-31 00:52:58 +00:00
|
|
|
[enable showing and stopping on compilation warnings
|
2023-01-08 23:17:24 +00:00
|
|
|
in Verilator binary and Verilated makefiles])],
|
2011-10-07 10:48:40 +00:00
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_WITH_CCWARN=yes ;;
|
|
|
|
no) CFG_WITH_CCWARN=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ccwarn]) ;;
|
|
|
|
esac],
|
|
|
|
[case "x${VERILATOR_AUTHOR_SITE}" in
|
|
|
|
x) CFG_WITH_CCWARN=no ;;
|
|
|
|
*) CFG_WITH_CCWARN=yes ;;
|
|
|
|
esac]
|
2017-10-07 19:25:23 +00:00
|
|
|
)
|
2011-10-07 10:48:40 +00:00
|
|
|
AC_SUBST(CFG_WITH_CCWARN)
|
|
|
|
AC_MSG_RESULT($CFG_WITH_CCWARN)
|
|
|
|
|
|
|
|
# Special Substitutions - CFG_WITH_LONGTESTS
|
|
|
|
AC_MSG_CHECKING(whether to run long tests)
|
|
|
|
AC_ARG_ENABLE([longtests],
|
|
|
|
[AS_HELP_STRING([--enable-longtests],
|
|
|
|
[enable running long developer tests])],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) CFG_WITH_LONGTESTS=yes ;;
|
|
|
|
no) CFG_WITH_LONGTESTS=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-longtests]) ;;
|
|
|
|
esac],
|
|
|
|
[case "x${VERILATOR_AUTHOR_SITE}" in
|
|
|
|
x) CFG_WITH_LONGTESTS=no ;;
|
|
|
|
*) CFG_WITH_LONGTESTS=yes ;;
|
|
|
|
esac]
|
2017-10-07 19:25:23 +00:00
|
|
|
)
|
2011-10-07 10:48:40 +00:00
|
|
|
AC_SUBST(CFG_WITH_LONGTESTS)
|
|
|
|
AC_MSG_RESULT($CFG_WITH_LONGTESTS)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-06-25 13:12:09 +00:00
|
|
|
# Compiler flags (ensure they are not empty to avoid configure defaults)
|
2021-12-11 23:58:26 +00:00
|
|
|
CFLAGS="$CFLAGS "
|
|
|
|
CPPFLAGS="$CPPFLAGS "
|
|
|
|
CXXFLAGS="$CXXFLAGS "
|
|
|
|
LDFLAGS="$LDFLAGS "
|
2020-06-24 10:43:12 +00:00
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for programs.
|
2006-08-26 11:35:28 +00:00
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
|
|
|
AC_PROG_INSTALL
|
2008-06-12 01:00:42 +00:00
|
|
|
|
|
|
|
AC_LANG_PUSH(C++)
|
2018-02-07 23:58:21 +00:00
|
|
|
cxx_version=$($CXX --version | head -1)
|
|
|
|
AC_MSG_RESULT([compiler is $CXX --version = $cxx_version])
|
2008-06-12 01:00:42 +00:00
|
|
|
AC_MSG_CHECKING([that C++ compiler can compile simple program])
|
2011-10-04 12:48:37 +00:00
|
|
|
AC_RUN_IFELSE(
|
2017-10-07 19:25:23 +00:00
|
|
|
[AC_LANG_SOURCE([int main() { return 0; }])],
|
|
|
|
AC_MSG_RESULT(yes),
|
|
|
|
AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]),
|
|
|
|
AC_MSG_RESULT(yes))
|
2008-06-12 01:00:42 +00:00
|
|
|
|
2021-06-19 14:00:31 +00:00
|
|
|
AC_CHECK_PROG(AR,ar,ar)
|
|
|
|
if test "x$AR" = "x" ; then
|
|
|
|
AC_MSG_ERROR([Cannot find "ar" in your PATH, please install it])
|
|
|
|
fi
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
AC_PATH_PROG(PERL,perl)
|
2007-04-24 17:03:52 +00:00
|
|
|
if test "x$PERL" = "x" ; then
|
|
|
|
AC_MSG_ERROR([Cannot find "perl" in your PATH, please install it])
|
|
|
|
fi
|
2020-07-10 22:37:31 +00:00
|
|
|
|
2020-12-23 20:41:14 +00:00
|
|
|
AC_PATH_PROG(PYTHON3,python3)
|
|
|
|
if test "x$PYTHON3" = "x" ; then
|
|
|
|
AC_MSG_ERROR([Cannot find "python3" in your PATH, please install it])
|
|
|
|
fi
|
|
|
|
|
2006-09-25 15:58:17 +00:00
|
|
|
AC_PATH_PROG(LEX,flex)
|
2007-04-24 17:03:52 +00:00
|
|
|
if test "x$LEX" = "x" ; then
|
|
|
|
AC_MSG_ERROR([Cannot find "flex" in your PATH, please install it])
|
|
|
|
fi
|
2020-07-10 22:37:31 +00:00
|
|
|
flex_version=$($LEX --version | head -1)
|
|
|
|
AC_MSG_RESULT([$LEX --version = $flex_version])
|
|
|
|
|
2007-04-24 17:03:52 +00:00
|
|
|
AC_PATH_PROG(YACC,bison)
|
|
|
|
if test "x$YACC" = "x" ; then
|
|
|
|
AC_MSG_ERROR([Cannot find "bison" in your PATH, please install it])
|
|
|
|
fi
|
2020-07-10 22:37:31 +00:00
|
|
|
bison_version=$($YACC --version | head -1)
|
|
|
|
AC_MSG_RESULT([$YACC --version = $bison_version])
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-04-05 20:10:33 +00:00
|
|
|
AC_CHECK_PROG(OBJCACHE,ccache,ccache)
|
|
|
|
if test "x$OBJCACHE" != "x" ; then
|
|
|
|
objcache_version=$($OBJCACHE --version | head -1)
|
|
|
|
AC_MSG_RESULT([objcache is $OBJCACHE --version = $objcache_version])
|
|
|
|
fi
|
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for libraries.
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for typedefs, structures
|
2006-08-26 11:35:28 +00:00
|
|
|
AC_CHECK_TYPE(size_t,unsigned int)
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for compiler characteristics.
|
2006-08-26 11:35:28 +00:00
|
|
|
AC_C_INLINE
|
|
|
|
|
2017-10-14 17:20:58 +00:00
|
|
|
AC_LINK_IFELSE(
|
2017-10-15 14:36:50 +00:00
|
|
|
[AC_LANG_PROGRAM([#include <new>], [[int* a=new int; delete a; ]])],
|
2017-10-14 17:20:58 +00:00
|
|
|
[], [AC_MSG_ERROR([$CXX does not seem to successfully compile a simple C++ program])])
|
|
|
|
|
2017-10-07 19:25:23 +00:00
|
|
|
AC_DEFUN([_MY_CXX_CHECK_FLAG],
|
|
|
|
[# _MY_CXX_CHECK_FLAG(flag) -- Check if compiler supports specific options
|
|
|
|
# Set $_my_result appropriately
|
2011-10-12 23:04:57 +00:00
|
|
|
ACO_SAVE_CXXFLAGS="$CXXFLAGS"
|
|
|
|
# -Werror needed otherwise unknown -Wno-div-by-zero won't report problems
|
2017-10-14 16:56:16 +00:00
|
|
|
# new/delete is needed to find -faligned-new link problem on Darwin
|
2017-10-07 19:25:23 +00:00
|
|
|
CXXFLAGS="$CXXFLAGS $1 -Werror"
|
|
|
|
AC_MSG_CHECKING([whether $CXX accepts $1])
|
2017-10-14 16:56:16 +00:00
|
|
|
AC_LINK_IFELSE(
|
2017-10-15 14:36:50 +00:00
|
|
|
[AC_LANG_PROGRAM([#include <new>], [[int* a=new int; delete a; ]])],
|
2017-10-07 19:25:23 +00:00
|
|
|
[_my_result=yes
|
|
|
|
if test -s conftest.err; then
|
|
|
|
if grep -e "$1" conftest.err >/dev/null; then
|
|
|
|
_my_result=no
|
|
|
|
fi
|
|
|
|
fi],
|
|
|
|
[_my_result=no])
|
2016-11-19 00:27:29 +00:00
|
|
|
# GCC is annoying, trying to be helpful, it postpones unknown -Wno-
|
|
|
|
# options if there's no error We want to see them regardless, so try
|
|
|
|
# forcing an error and see if we get a gcc warning
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[an_error "intentional-error-for-test.h"
|
2017-10-07 19:25:23 +00:00
|
|
|
]],[])],
|
2016-11-19 00:27:29 +00:00
|
|
|
[], # Ignore ok exit
|
|
|
|
[if test -s conftest.err; then
|
2017-10-07 19:25:23 +00:00
|
|
|
if grep -e "$1" conftest.err >/dev/null; then
|
2016-11-19 00:27:29 +00:00
|
|
|
_my_result=no
|
|
|
|
fi
|
|
|
|
fi])
|
2011-10-12 23:04:57 +00:00
|
|
|
AC_MSG_RESULT($_my_result)
|
2017-10-07 19:25:23 +00:00
|
|
|
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
|
|
|
|
])
|
|
|
|
|
2021-06-13 19:13:27 +00:00
|
|
|
AC_DEFUN([_MY_CXX_CHECK_IFELSE],
|
|
|
|
[# _MY_CXX_CHECK_IFELSE(option,action-if-supported,action-if-not-supported)
|
|
|
|
# Check if compiler supports specific option. If it does,
|
|
|
|
# do action-if-supported, otherwise do action-if-not-supported
|
|
|
|
_MY_CXX_CHECK_FLAG($1)
|
|
|
|
if test "$_my_result" = "yes" ; then
|
|
|
|
true
|
|
|
|
$2
|
|
|
|
else
|
|
|
|
true
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2017-10-07 19:25:23 +00:00
|
|
|
AC_DEFUN([_MY_CXX_CHECK_SET],
|
2021-06-13 19:13:27 +00:00
|
|
|
[# _MY_CXX_CHECK_SET(variable,option)
|
|
|
|
# Check if compiler supports specific option. If it does,
|
|
|
|
# set variable to option, only if not previously set.
|
2017-10-08 01:29:57 +00:00
|
|
|
if test "$$1" = ""; then
|
2021-06-13 19:13:27 +00:00
|
|
|
_MY_CXX_CHECK_IFELSE($2, $1="$2")
|
2011-10-12 23:04:57 +00:00
|
|
|
fi
|
2017-10-07 19:25:23 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([_MY_CXX_CHECK_OPT],
|
2021-06-13 19:13:27 +00:00
|
|
|
[# _MY_CXX_CHECK_OPT(variable,option)
|
|
|
|
# Check if compiler supports specific option. If it does,
|
|
|
|
# append option to variable
|
|
|
|
_MY_CXX_CHECK_IFELSE($2, $1="$$1 $2")
|
2017-10-07 19:25:23 +00:00
|
|
|
])
|
2011-10-12 23:04:57 +00:00
|
|
|
|
2018-05-13 23:47:35 +00:00
|
|
|
AC_DEFUN([_MY_LDLIBS_CHECK_FLAG],
|
|
|
|
[# _MY_LDLIBS_CHECK_FLAG(flag) -- Check if linker supports specific options
|
|
|
|
# Set $_my_result appropriately
|
|
|
|
ACO_SAVE_LIBS="$LIBS"
|
|
|
|
LIBS="$LIBS $1"
|
|
|
|
AC_MSG_CHECKING([whether $CXX linker accepts $1])
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[]])],
|
|
|
|
[_my_result=yes
|
|
|
|
if test -s conftest.err; then
|
|
|
|
if grep -e "$1" conftest.err >/dev/null; then
|
|
|
|
_my_result=no
|
|
|
|
fi
|
|
|
|
fi],
|
|
|
|
[_my_result=no])
|
|
|
|
AC_MSG_RESULT($_my_result)
|
|
|
|
LIBS="$ACO_SAVE_LIBS"
|
|
|
|
])
|
|
|
|
|
2020-01-23 22:32:19 +00:00
|
|
|
AC_DEFUN([_MY_LDLIBS_CHECK_IFELSE],
|
|
|
|
[# _MY_LDLIBS_CHECK_IFELSE(flag,action-if-supported,action-if-not-supported)
|
|
|
|
# Check if linker supports specific flag, if it does do action-if-supported
|
|
|
|
# otherwise do action-if-not-supported
|
|
|
|
_MY_LDLIBS_CHECK_FLAG($1)
|
2018-05-13 23:47:35 +00:00
|
|
|
if test "$_my_result" = "yes" ; then
|
2020-01-23 22:32:19 +00:00
|
|
|
true
|
|
|
|
$2
|
|
|
|
else
|
|
|
|
true
|
|
|
|
$3
|
2018-05-13 23:47:35 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2020-01-23 22:32:19 +00:00
|
|
|
AC_DEFUN([_MY_LDLIBS_CHECK_OPT],
|
|
|
|
[# _MY_LDLIBS_CHECK_OPT(variable, flag) -- Check if linker supports specific
|
|
|
|
# options. If it does, append flag to variable.
|
|
|
|
_MY_LDLIBS_CHECK_IFELSE($2, $1="$$1 $2")
|
|
|
|
])
|
|
|
|
|
2024-01-01 15:16:48 +00:00
|
|
|
# Add the coverage flags early as they influence later checks.
|
2021-06-14 17:03:05 +00:00
|
|
|
if test "$CFG_ENABLE_COVERAGE" = "yes"; then
|
|
|
|
_MY_CXX_CHECK_OPT(CXX,--coverage)
|
|
|
|
# Otherwise inline may not show as uncovered
|
|
|
|
# If we use this then e.g. verilated.h functions properly show up
|
|
|
|
# if unused.
|
|
|
|
# However, VerilatedSerialize::write then changes from covered
|
|
|
|
# to uncovered (in G++ 9.3.0) even with all inlining turned off.
|
|
|
|
# Having false negative coverage is more effort then missing negatives.
|
|
|
|
# Also this seems to explode the runtime (since a lot more data).
|
|
|
|
# _MY_CXX_CHECK_OPT(CXX,-fkeep-inline-functions)
|
|
|
|
# Otherwise static may not show as uncovered
|
|
|
|
_MY_CXX_CHECK_OPT(CXX,-fkeep-static-functions)
|
|
|
|
# Exceptions can pollute the branch coverage data
|
|
|
|
_MY_CXX_CHECK_OPT(CXX,-fno-exceptions)
|
|
|
|
# Define-out some impossible stuff
|
|
|
|
_MY_CXX_CHECK_OPT(CXX,-DVL_GCOV)
|
|
|
|
fi
|
|
|
|
|
2021-07-07 23:12:52 +00:00
|
|
|
# Compiler flags to enable profiling
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PROFILE,-pg)
|
|
|
|
AC_SUBST(CFG_CXXFLAGS_PROFILE)
|
|
|
|
|
2017-10-08 01:29:57 +00:00
|
|
|
# Flag to select newest language standard supported
|
|
|
|
# Macros work such that first option that passes is the one we take
|
2022-05-30 15:44:00 +00:00
|
|
|
# Currently enable c++17/c++14 due to packaged SystemC dependency
|
2022-05-30 15:51:40 +00:00
|
|
|
# c++17 is the newest that Verilator is regularly tested to support
|
2023-12-29 15:39:00 +00:00
|
|
|
# c++14 is the oldest that Verilator supports
|
2023-01-08 23:17:24 +00:00
|
|
|
# gnu is required for Cygwin to compile verilated.h successfully
|
2021-09-26 20:19:46 +00:00
|
|
|
#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++20)
|
2021-05-13 18:26:53 +00:00
|
|
|
#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++20)
|
2022-05-30 15:44:00 +00:00
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++17)
|
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++17)
|
2021-09-26 20:19:46 +00:00
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++14)
|
2017-10-08 01:29:57 +00:00
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++14)
|
|
|
|
AC_SUBST(CFG_CXXFLAGS_STD_NEWEST)
|
|
|
|
|
2017-09-15 03:28:02 +00:00
|
|
|
# Flags for compiling Verilator internals including parser, and Verilated files
|
|
|
|
# These turn on extra warnings and are only used with 'configure --enable-ccwarn'
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wextra)
|
2017-10-11 23:01:37 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wfloat-conversion)
|
2017-09-15 03:28:02 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wlogical-op)
|
2017-10-21 20:41:43 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wthread-safety)
|
2017-09-15 03:28:02 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_WEXTRA)
|
|
|
|
|
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.
Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).
The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.
There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
for suspending a stack of coroutines (normally, C++ coroutines are
stackless).
There is a new visitor in `V3Timing.cpp` which:
* scales delays according to the timescale,
* simplifies intra-assignment timing controls and net delays into
regular timing controls and assignments,
* simplifies wait statements into loops with event controls,
* marks processes and tasks with timing controls in them as
suspendable,
* creates delay, trigger scheduler, and fork sync variables,
* transforms timing controls and fork joins into C++ awaits
There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.
There is also a function that transforms forked processes into separate
functions.
See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 12:26:32 +00:00
|
|
|
# Flags for coroutine support for dynamic scheduling
|
2023-10-20 19:47:09 +00:00
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts)
|
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines)
|
|
|
|
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts -Wno-deprecated-experimental-coroutine)
|
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.
Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).
The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.
There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
for suspending a stack of coroutines (normally, C++ coroutines are
stackless).
There is a new visitor in `V3Timing.cpp` which:
* scales delays according to the timescale,
* simplifies intra-assignment timing controls and net delays into
regular timing controls and assignments,
* simplifies wait statements into loops with event controls,
* marks processes and tasks with timing controls in them as
suspendable,
* creates delay, trigger scheduler, and fork sync variables,
* transforms timing controls and fork joins into C++ awaits
There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.
There is also a function that transforms forked processes into separate
functions.
See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 12:26:32 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_COROUTINES)
|
|
|
|
|
|
|
|
# HAVE_COROUTINES
|
|
|
|
# Check if coroutines are supported at all
|
|
|
|
AC_MSG_CHECKING([whether coroutines are supported by $CXX])
|
|
|
|
ACO_SAVE_CXXFLAGS="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_COROUTINES"
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([
|
|
|
|
#ifdef __clang__
|
|
|
|
#define __cpp_impl_coroutine 1
|
|
|
|
#endif
|
|
|
|
#include <coroutine>
|
|
|
|
],[[]])],
|
|
|
|
[_my_result=yes
|
|
|
|
AC_DEFINE([HAVE_COROUTINES],[1],[Defined if coroutines are supported by $CXX])],
|
|
|
|
[AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([#include <experimental/coroutine>],[[]])],
|
|
|
|
[_my_result=yes
|
|
|
|
AC_DEFINE([HAVE_COROUTINES],[1],[Defined if coroutines are supported by $CXX])],
|
|
|
|
[_my_result=no])])
|
|
|
|
AC_MSG_RESULT($_my_result)
|
|
|
|
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
|
|
|
|
AC_SUBST(HAVE_COROUTINES)
|
|
|
|
|
2017-09-15 03:28:02 +00:00
|
|
|
# Flags for compiling Verilator internals including parser always
|
2015-02-11 03:38:05 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments)
|
2017-08-14 23:59:21 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new)
|
2017-08-15 00:15:24 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
|
2017-09-15 03:28:02 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
|
2020-02-01 00:13:55 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_SRC)
|
2015-02-11 03:38:05 +00:00
|
|
|
|
2017-09-15 03:28:02 +00:00
|
|
|
# Flags for compiling Verilator parser always (in addition to above CFG_CXXFLAGS_SRC)
|
2017-08-15 00:15:24 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-char-subscripts)
|
2015-02-11 03:38:05 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-null-conversion)
|
2017-08-15 00:15:24 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-parentheses-equality)
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-unused)
|
2015-02-11 03:38:05 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_PARSER)
|
|
|
|
|
2021-06-12 19:46:08 +00:00
|
|
|
# Flags for compiling the debug version of Verilator (in addition to above CFG_CXXFLAGS_SRC)
|
2021-06-14 17:03:05 +00:00
|
|
|
if test "$CFG_ENABLE_COVERAGE" = "no"; then # Do not optimize for the coverage build
|
2021-06-12 19:46:08 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-Og)
|
2021-06-14 17:03:05 +00:00
|
|
|
fi
|
2021-06-12 19:46:08 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-ggdb)
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-gz)
|
|
|
|
AC_SUBST(CFG_CXXFLAGS_DEBUG)
|
|
|
|
|
|
|
|
# Flags for linking the debug version of Verilator (in addition to above CFG_LDFLAGS_SRC)
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_DEBUG,-gz)
|
|
|
|
AC_SUBST(CFG_LDFLAGS_DEBUG)
|
|
|
|
|
2015-02-11 03:38:05 +00:00
|
|
|
# Flags for Verilated makefile
|
2011-10-12 23:04:57 +00:00
|
|
|
# For example, -Wno-div-by-zero isn't in 4.1.2
|
|
|
|
# Random code often does / 0. Unfortunately VL_DIV_I(0,0) will warn
|
|
|
|
# without this flag, even though there's a conditional to prevent the divide.
|
2011-10-21 01:13:42 +00:00
|
|
|
# We still don't add no-div-by-zero as it throws message to stdout, though doesn't die.
|
|
|
|
#_MY_CXX_CHECK_OPT(-Wno-div-by-zero)
|
2019-07-18 09:31:02 +00:00
|
|
|
# For some reason -faligned-new does not work under Travis w/ clang but the
|
|
|
|
# configure test doesn't catch this either
|
|
|
|
AS_IF([test "x$TRAVIS_COMPILER" != xclang], [_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,-faligned-new)])
|
2019-10-17 23:44:10 +00:00
|
|
|
CFG_CXX_FLAGS_CMAKE="-faligned-new"
|
|
|
|
m4_foreach([cflag],[
|
|
|
|
[-fbracket-depth=4096],
|
2019-10-18 00:43:45 +00:00
|
|
|
[-fcf-protection=none],
|
|
|
|
[-mno-cet],
|
2019-10-17 23:44:10 +00:00
|
|
|
[-Qunused-arguments],
|
|
|
|
[-Wno-bool-operation],
|
2023-10-20 19:47:09 +00:00
|
|
|
[-Wno-c++11-narrowing],
|
2023-09-18 13:21:30 +00:00
|
|
|
[-Wno-constant-logical-operand],
|
2023-10-20 19:47:09 +00:00
|
|
|
[-Wno-non-pod-varargs],
|
2019-10-17 23:44:10 +00:00
|
|
|
[-Wno-parentheses-equality],
|
2023-10-18 12:09:42 +00:00
|
|
|
[-Wno-shadow],
|
2019-10-17 23:44:10 +00:00
|
|
|
[-Wno-sign-compare],
|
2023-10-18 12:09:42 +00:00
|
|
|
[-Wno-tautological-bitwise-compare],
|
2024-02-08 03:16:08 +00:00
|
|
|
[-Wno-tautological-compare],
|
2019-10-17 23:44:10 +00:00
|
|
|
[-Wno-uninitialized],
|
2023-10-18 12:09:42 +00:00
|
|
|
[-Wno-unused-but-set-parameter],
|
2019-10-17 23:44:10 +00:00
|
|
|
[-Wno-unused-but-set-variable],
|
|
|
|
[-Wno-unused-parameter],
|
2023-10-18 12:09:42 +00:00
|
|
|
[-Wno-unused-variable]],[
|
2019-10-17 23:44:10 +00:00
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_NO_UNUSED,cflag)
|
|
|
|
# CMake will test what flags work itself, so pass all flags through to it
|
|
|
|
CFG_CXX_FLAGS_CMAKE="$CFG_CXX_FLAGS_CMAKE cflag"
|
|
|
|
])
|
2011-10-12 23:04:57 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_NO_UNUSED)
|
2019-10-17 23:44:10 +00:00
|
|
|
AC_SUBST(CFG_CXX_FLAGS_CMAKE)
|
2011-10-12 23:04:57 +00:00
|
|
|
|
2018-05-13 23:47:35 +00:00
|
|
|
# Find multithread linker flags
|
2019-10-17 23:44:10 +00:00
|
|
|
m4_foreach([ldflag], [
|
|
|
|
[-mt],
|
|
|
|
[-pthread],
|
|
|
|
[-lpthread],
|
|
|
|
[-latomic]],[
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDLIBS_THREADS,ldflag)
|
|
|
|
# CMake will test what flags work itself, so pass all flags through to it
|
|
|
|
CFG_LDFLAGS_THREADS_CMAKE="$CFG_LDFLAGS_THREADS_CMAKE ldflag"
|
|
|
|
])
|
2018-05-13 23:47:35 +00:00
|
|
|
AC_SUBST(CFG_LDLIBS_THREADS)
|
2019-10-17 23:44:10 +00:00
|
|
|
AC_SUBST(CFG_LDFLAGS_THREADS_CMAKE)
|
2018-05-13 23:47:35 +00:00
|
|
|
|
2023-05-24 01:26:29 +00:00
|
|
|
# If 'mold' is installed, use it to link for faster buildtimes
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -fuse-ld=mold)
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_VERILATED, -fuse-ld=mold)
|
|
|
|
|
2020-02-01 00:13:55 +00:00
|
|
|
# When linking partially statically
|
|
|
|
if test "$CFG_ENABLE_PARTIAL_STATIC" = "yes"; then
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -static-libgcc)
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -static-libstdc++)
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -Xlinker -gc-sections)
|
|
|
|
LTCMALLOC=-l:libtcmalloc_minimal.a
|
|
|
|
else
|
|
|
|
LTCMALLOC=-ltcmalloc_minimal
|
|
|
|
fi
|
|
|
|
AC_SUBST(CFG_LDFLAGS_SRC)
|
2023-05-24 01:26:29 +00:00
|
|
|
AC_SUBST(CFG_LDFLAGS_VERILATED)
|
2020-02-01 00:13:55 +00:00
|
|
|
|
|
|
|
# The pthread library is required by tcmalloc, so add it if it exists. If it
|
|
|
|
# does not, the tcmalloc check below will fail anyway, and linking against
|
|
|
|
# pthreads is harmless otherwise.
|
2020-03-29 16:29:40 +00:00
|
|
|
CFG_LIBS="$LIBS $CFG_LIBS"
|
2020-02-01 00:13:55 +00:00
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lpthread)
|
2024-01-24 03:07:35 +00:00
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -latomic)
|
2020-02-01 00:13:55 +00:00
|
|
|
|
2020-03-29 16:29:40 +00:00
|
|
|
# Check libraries for MingW
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lbcrypt)
|
|
|
|
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lpsapi)
|
|
|
|
|
2020-01-23 22:32:19 +00:00
|
|
|
# Check if tcmalloc is available based on --enable-tcmalloc
|
|
|
|
_MY_LDLIBS_CHECK_IFELSE(
|
2020-02-01 00:13:55 +00:00
|
|
|
$LTCMALLOC,
|
2020-01-23 22:32:19 +00:00
|
|
|
[if test "$CFG_WITH_TCMALLOC" != "no"; then
|
2020-02-01 00:13:55 +00:00
|
|
|
CFG_LIBS="$LTCMALLOC $CFG_LIBS";
|
2020-01-23 22:32:19 +00:00
|
|
|
# If using tcmalloc, add some extra options to make the compiler not assume
|
|
|
|
# it is using it's own versions of the standard library functions
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-malloc)
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-calloc)
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-realloc)
|
|
|
|
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-free)
|
|
|
|
fi],
|
|
|
|
[if test "$CFG_WITH_TCMALLOC" = "yes"; then
|
2020-02-01 00:13:55 +00:00
|
|
|
AC_MSG_ERROR([--enable-tcmalloc was given but test for ${LTCMALLOC} failed])
|
2020-01-23 22:32:19 +00:00
|
|
|
fi])
|
|
|
|
AC_SUBST(CFG_LIBS)
|
|
|
|
|
2023-12-29 15:39:00 +00:00
|
|
|
# Need C++14 at least
|
|
|
|
#Alternative: AX_CXX_COMPILE_STDCXX([14])
|
2020-08-17 11:40:07 +00:00
|
|
|
AC_DEFUN([_MY_CXX_CHECK_CXX_VER],
|
2023-12-29 15:39:00 +00:00
|
|
|
[# _MY_CXX_CHECK_CXX_VER(flag) -- Check if compiler runs C++14
|
2020-08-17 11:40:07 +00:00
|
|
|
# Set $_my_result
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([#include <thread>
|
2023-12-29 15:39:00 +00:00
|
|
|
#if (__cplusplus < 201402L)
|
2020-08-17 11:40:07 +00:00
|
|
|
# error "Too old"
|
|
|
|
#endif
|
|
|
|
], [[ ]])],
|
2017-10-27 01:48:45 +00:00
|
|
|
[_my_result=yes
|
|
|
|
if test -s conftest.err; then
|
|
|
|
if grep -e "$1" conftest.err >/dev/null; then
|
|
|
|
_my_result=no
|
|
|
|
fi
|
|
|
|
fi],
|
|
|
|
[_my_result=no])
|
2020-08-17 11:40:07 +00:00
|
|
|
])
|
2017-10-27 01:48:45 +00:00
|
|
|
|
2023-01-22 14:44:50 +00:00
|
|
|
# Add $CFG_CXXFLAGS_STD only if can't compile correctly otherwise,
|
2023-01-10 12:12:23 +00:00
|
|
|
# as adding std= when not needed can cause errors with the C++ std library.
|
2023-01-22 14:44:50 +00:00
|
|
|
CFG_CXXFLAGS_STD=$CFG_CXXFLAGS_STD_NEWEST
|
2023-12-29 15:39:00 +00:00
|
|
|
AC_MSG_CHECKING(whether $CXX supports C++14)
|
2020-08-17 11:40:07 +00:00
|
|
|
_MY_CXX_CHECK_CXX_VER()
|
|
|
|
AC_MSG_RESULT($_my_result)
|
|
|
|
if test "$_my_result" = "no" ; then
|
2023-01-22 14:44:50 +00:00
|
|
|
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD"
|
|
|
|
CFG_CXX_FLAGS_CMAKE="$CFG_CXX_FLAGS_CMAKE $CFG_CXXFLAGS_STD"
|
2023-12-29 15:39:00 +00:00
|
|
|
AC_MSG_CHECKING(whether $CXX supports C++14 with $CFG_CXXFLAGS_STD)
|
2020-08-17 11:40:07 +00:00
|
|
|
_MY_CXX_CHECK_CXX_VER()
|
|
|
|
AC_MSG_RESULT($_my_result)
|
2023-01-17 12:11:12 +00:00
|
|
|
else
|
2023-01-22 14:44:50 +00:00
|
|
|
# CFG_CXXFLAGS_STD is also propagated to include/verilated.mk.in
|
|
|
|
# make sure we use the same std flag while compiling verilator and verilated design
|
|
|
|
CFG_CXXFLAGS_STD=""
|
2020-08-17 11:40:07 +00:00
|
|
|
fi
|
|
|
|
if test "$_my_result" = "no" ; then
|
2020-08-15 13:28:51 +00:00
|
|
|
AC_MSG_NOTICE([[]])
|
2023-12-29 15:39:00 +00:00
|
|
|
AC_MSG_ERROR([[the $CXX compiler appears to not support C++14.
|
2018-06-26 11:33:55 +00:00
|
|
|
|
2023-12-29 15:39:00 +00:00
|
|
|
Verilator requires a C++14 or newer compiler.]])
|
2018-06-26 11:33:55 +00:00
|
|
|
|
|
|
|
fi
|
2023-01-22 14:44:50 +00:00
|
|
|
AC_SUBST(CFG_CXXFLAGS_STD)
|
2018-06-26 11:33:55 +00:00
|
|
|
|
2023-10-18 02:49:28 +00:00
|
|
|
# Compiler precompiled header options (assumes either gcc or clang++)
|
|
|
|
AC_MSG_CHECKING([for $CXX precompile header include option])
|
|
|
|
if $CXX --help | grep include-pch >/dev/null 2>/dev/null ; then
|
|
|
|
# clang
|
|
|
|
CFG_CXXFLAGS_PCH_I=-include-pch
|
|
|
|
CFG_GCH_IF_CLANG=.gch
|
|
|
|
else
|
|
|
|
# GCC
|
|
|
|
CFG_CXXFLAGS_PCH_I=-include
|
|
|
|
CFG_GCH_IF_CLANG=
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT($CFG_CXXFLAGS_PCH_I)
|
|
|
|
AC_SUBST(CFG_CXXFLAGS_PCH_I)
|
|
|
|
AC_SUBST(CFG_GCH_IF_CLANG)
|
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for library functions.
|
2017-10-14 13:00:39 +00:00
|
|
|
AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec],
|
2017-10-14 16:56:16 +00:00
|
|
|
[AC_DEFINE([HAVE_STAT_NSEC],[1],[Defined if struct stat has st_mtim.tv_nsec])],
|
2017-10-14 13:00:39 +00:00
|
|
|
[], [#include <sys/stat.h>])
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-05-28 22:51:46 +00:00
|
|
|
# HAVE_SYSTEMC
|
|
|
|
# - If found the default search path has it, so support is always enabled.
|
|
|
|
# - If not found or not system-wide, user can set SYSTEMC_INCLUDE.
|
|
|
|
# AC_CHECK_HEADERS seems to not locate on Travis-CI but include does work.
|
|
|
|
AC_MSG_CHECKING([whether SystemC is found (in system path)])
|
2020-06-28 16:17:54 +00:00
|
|
|
ACO_SAVE_LIBS="$LIBS"
|
|
|
|
LIBS="$LIBS -lsystemc"
|
|
|
|
AC_LINK_IFELSE(
|
2020-05-28 22:51:46 +00:00
|
|
|
[AC_LANG_PROGRAM([[#include <systemc.h>
|
2023-09-17 12:01:54 +00:00
|
|
|
extern "C" int sc_main(int argc, char* argv[]) { return 0; }
|
2020-06-28 16:17:54 +00:00
|
|
|
]],[[sc_version()]])],
|
2020-05-28 22:51:46 +00:00
|
|
|
[_my_result=yes
|
2020-06-28 16:17:54 +00:00
|
|
|
AC_DEFINE([HAVE_SYSTEMC],[1],[Defined if have SystemC library])],
|
2020-05-28 22:51:46 +00:00
|
|
|
[_my_result=no])
|
|
|
|
AC_MSG_RESULT($_my_result)
|
2020-06-28 16:17:54 +00:00
|
|
|
LIBS="$ACO_SAVE_LIBS"
|
|
|
|
AC_SUBST(HAVE_SYSTEMC)
|
2020-05-28 22:51:46 +00:00
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Checks for system services
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2011-10-04 14:07:46 +00:00
|
|
|
# Other install directories
|
2006-08-26 11:35:28 +00:00
|
|
|
pkgdatadir=${datadir}/verilator
|
|
|
|
AC_SUBST(pkgdatadir)
|
2015-05-14 01:21:29 +00:00
|
|
|
pkgconfigdir=${datadir}/pkgconfig
|
|
|
|
AC_SUBST(pkgconfigdir)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2011-10-04 12:48:37 +00:00
|
|
|
AC_OUTPUT
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
AC_MSG_RESULT([])
|
2011-10-04 14:07:46 +00:00
|
|
|
AC_MSG_RESULT([Now type 'make' (or sometimes 'gmake') to build Verilator.])
|
2006-08-26 11:35:28 +00:00
|
|
|
AC_MSG_RESULT([])
|