Add a configure check for -Wextra vs -W

This patch adds a configure check to see if gcc supports -Wextra.
If it does then we use it instead of -W since -Wextra is a more
descriptive name.
This commit is contained in:
Cary R 2010-11-01 19:04:04 -07:00 committed by Stephen Williams
parent bb5ca97f2d
commit 4fae068227
1 changed files with 10 additions and 1 deletions

View File

@ -69,9 +69,18 @@ AC_SUBST(DEPENDENCY_FLAG, [-xMMD])
AC_SUBST(WARNING_FLAGS, [""])
AC_SUBST(WARNING_FLAGS_CXX, [""])
else
# Check to see if -Wextra is supported.
iverilog_temp_cflags="$CFLAGS"
CFLAGS="-Wextra $CFLAGS"
AC_MSG_CHECKING(if gcc supports -Wextra)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[[iverilog_wextra_flag="-Wextra";] AC_MSG_RESULT(yes)],
[[iverilog_wextra_flag="-W";] AC_MSG_RESULT(no)])
CFLAGS="$iverilog_temp_cflags"
AC_SUBST(DEPENDENCY_FLAG, [-MD])
AC_SUBST(WARNING_FLAGS, ["-Wall -Wshadow"])
AC_SUBST(WARNING_FLAGS_CXX, ["-W"])
AC_SUBST(WARNING_FLAGS_CXX, ["$iverilog_wextra_flag"])
fi
AC_LANG(C++)