mirror of
https://github.com/verilator/verilator.git
synced 2025-01-05 22:27:35 +00:00
configure: Try compiler flags to get to C++11 (#2502)
This commit is contained in:
parent
ea9b65fe6d
commit
698e0fbbd1
@ -89,7 +89,6 @@ datarootdir = @datarootdir@
|
|||||||
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
||||||
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
||||||
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
||||||
CFG_WITH_THREADED = @CFG_WITH_THREADED@
|
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
@ -546,9 +545,6 @@ dist-file-list:
|
|||||||
@echo $(wildcard $(DISTFILES))
|
@echo $(wildcard $(DISTFILES))
|
||||||
@echo "end-dist-file-list:"; # Scripts look for this
|
@echo "end-dist-file-list:"; # Scripts look for this
|
||||||
|
|
||||||
print-cfg-with-threaded:
|
|
||||||
@echo $(CFG_WITH_THREADED)
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Distributions
|
# Distributions
|
||||||
|
|
||||||
|
34
configure.ac
34
configure.ac
@ -394,12 +394,17 @@ _MY_LDLIBS_CHECK_IFELSE(
|
|||||||
fi])
|
fi])
|
||||||
AC_SUBST(CFG_LIBS)
|
AC_SUBST(CFG_LIBS)
|
||||||
|
|
||||||
# Set CFG_WITH_THREADED if can support threading
|
# Need C++11 at least
|
||||||
AC_MSG_CHECKING(whether $CXX supports Verilated threads)
|
#Alternative: AX_CXX_COMPILE_STDCXX([11])
|
||||||
ACO_SAVE_CXXFLAGS="$CXXFLAGS"
|
AC_DEFUN([_MY_CXX_CHECK_CXX_VER],
|
||||||
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD_NEWEST $CFG_CXXFLAGS_NO_UNUSED"
|
[# _MY_CXX_CHECK_CXX_VER(flag) -- Check if compiler runs C++11
|
||||||
AC_LINK_IFELSE(
|
# Set $_my_result
|
||||||
[AC_LANG_PROGRAM([#include <thread>], [[ ]])],
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([#include <thread>
|
||||||
|
#if (__cplusplus < 201103L)
|
||||||
|
# error "Too old"
|
||||||
|
#endif
|
||||||
|
], [[ ]])],
|
||||||
[_my_result=yes
|
[_my_result=yes
|
||||||
if test -s conftest.err; then
|
if test -s conftest.err; then
|
||||||
if grep -e "$1" conftest.err >/dev/null; then
|
if grep -e "$1" conftest.err >/dev/null; then
|
||||||
@ -407,13 +412,18 @@ AC_LINK_IFELSE(
|
|||||||
fi
|
fi
|
||||||
fi],
|
fi],
|
||||||
[_my_result=no])
|
[_my_result=no])
|
||||||
CFG_WITH_THREADED=$_my_result
|
])
|
||||||
AC_SUBST(CFG_WITH_THREADED)
|
|
||||||
AC_MSG_RESULT($CFG_WITH_THREADED)
|
|
||||||
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
|
|
||||||
|
|
||||||
# Check compiler flag
|
AC_MSG_CHECKING(whether $CXX supports C++11)
|
||||||
if test "$CFG_WITH_THREADED" = "no" ; then
|
_MY_CXX_CHECK_CXX_VER()
|
||||||
|
AC_MSG_RESULT($_my_result)
|
||||||
|
if test "$_my_result" = "no" ; then
|
||||||
|
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD_NEWEST"
|
||||||
|
AC_MSG_CHECKING(whether $CXX supports C++11 with $CFG_CXXFLAGS_STD_NEWEST)
|
||||||
|
_MY_CXX_CHECK_CXX_VER()
|
||||||
|
AC_MSG_RESULT($_my_result)
|
||||||
|
fi
|
||||||
|
if test "$_my_result" = "no" ; then
|
||||||
AC_MSG_NOTICE([[]])
|
AC_MSG_NOTICE([[]])
|
||||||
AC_MSG_ERROR([[the $CXX compiler appears to not support C++11.
|
AC_MSG_ERROR([[the $CXX compiler appears to not support C++11.
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
# if defined(_MSC_VER) && _MSC_VER >= 1900
|
# if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||||
# define VL_THREAD_LOCAL thread_local
|
# define VL_THREAD_LOCAL thread_local
|
||||||
# elif defined(__GNUC__)
|
# elif defined(__GNUC__)
|
||||||
# if (__cplusplus < 201103L) && !defined(VL_THREADED_NO_C11_WARNING)
|
# if (__cplusplus < 201103L)
|
||||||
# error "VL_THREADED/--threads support requires C++-11 or newer only; use newer compiler"
|
# error "VL_THREADED/--threads support requires C++-11 or newer only; use newer compiler"
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
|
@ -2250,10 +2250,8 @@ sub cxx_version {
|
|||||||
return $_Cxx_Version;
|
return $_Cxx_Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
our $_Cfg_With_Threaded;
|
|
||||||
sub cfg_with_threaded {
|
sub cfg_with_threaded {
|
||||||
$_Cfg_With_Threaded ||= `$ENV{MAKE} -C $ENV{VERILATOR_ROOT} -f Makefile print-cfg-with-threaded`;
|
return 1; # C++11 now always required
|
||||||
return ($_Cfg_With_Threaded =~ /yes/i) ? 1:0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub tries {
|
sub tries {
|
||||||
|
Loading…
Reference in New Issue
Block a user