configure: Test for compiler flags, and remove old config checks

This commit is contained in:
Wilson Snyder 2011-10-12 19:04:57 -04:00
parent 40076287ea
commit 86e3c78776
4 changed files with 32 additions and 44 deletions

View File

@ -94,21 +94,41 @@ fi
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h unistd.h inttypes.h sys/file.h sys/time.h sys/un.h math.h stdint.h mingw/stdint.h)
# Checks for typedefs, structures
AC_CHECK_TYPE(size_t,unsigned int)
AC_CHECK_TYPE(uint_t,unsigned int)
AC_CHECK_TYPE(ulong_t,unsigned long)
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for compiler characteristics.
AC_C_INLINE
AC_DEFUN([_MY_CXX_CHECK_OPT],
[# _MY_CXX_CHECK_OPT(flag) -- Check if compiler supports specific options
ACO_SAVE_CXXFLAGS="$CXXFLAGS"
# -Werror needed otherwise unknown -Wno-div-by-zero won't report problems
CXXFLAGS="$CXXFLAGS $1 -Werror"
AC_MSG_CHECKING([whether $CXX accepts $1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[_my_result=yes],
[_my_result=no])
AC_MSG_RESULT($_my_result)
if test "$_my_result" = "yes" ; then
CFG_CXXFLAGS_NO_UNUSED="$CFG_CXXFLAGS_NO_UNUSED $1"
fi
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
])# _MY_CXX_CHECK_OPT
# For example, -Wno-div-by-zero isn't in 4.1.2
_MY_CXX_CHECK_OPT(-Wno-char-subscripts)
# 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.
_MY_CXX_CHECK_OPT(-Wno-div-by-zero)
_MY_CXX_CHECK_OPT(-Wno-sign-compare)
_MY_CXX_CHECK_OPT(-Wno-uninitialized)
_MY_CXX_CHECK_OPT(-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(-Wno-unused-variable)
AC_SUBST(CFG_CXXFLAGS_NO_UNUSED)
# Checks for library functions.
# Checks for system services

View File

@ -16,6 +16,9 @@ RANLIB = ranlib
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
# Compiler flags to use to turn off unused and generated code warnings, such as -Wno-div-by-zero
CFG_CXXFLAGS_NO_UNUSED = @CFG_CXXFLAGS_NO_UNUSED@
######################################################################
# Programs
@ -43,11 +46,7 @@ VK_CPPFLAGS_ALWAYS += \
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
VK_CPPFLAGS_WALL += -Wall \
-Wno-char-subscripts \
-Wno-sign-compare \
-Wno-unused-parameter \
-Wno-unused-variable \
-Wno-uninitialized \
$(CFG_CXXFLAGS_NO_UNUSED) \
-Werror
endif

View File

@ -33,36 +33,9 @@
//**********************************************************************
//**** Functions
// Set define if we have function: strdup (string)
#define HAVE_STRDUP 0
//**********************************************************************
//**** Headers
// Set define if we have header: <fcntl.h>
#define HAVE_FCNTL_H 0
// Set define if we have header: <math.h>
#define HAVE_MATH_H 1
// Set define if we have header: <unistd.h>
#define HAVE_UNISTD_H 0
// Set define if we have header: <sys/time.h>
#define HAVE_SYS_TIME_H 0
// Set define if we have header: <sys/un.h>
#define HAVE_SYS_UN_H 0
// Set define if we have header: <stdint.h>
#define HAVE_STDINT_H 0
// Set define if we have header: <mingw/stdint.h>
#define HAVE_MINGW_STDINT_H 0
// Set define if we have header: <inttypes.h>
#define HAVE_INTTYPES_H 0
//**********************************************************************
//**** Default environment

View File

@ -22,10 +22,6 @@ include Vvgen.mk
CPPFLAGS += -DVL_DEBUG=1
CPPFLAGS += $(CPPFLAGS_ADD)
# 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.
CPPFLAGS += -Wno-div-by-zero
#######################################################################
# Linking final exe -- presumes have a sim_main.cpp