Use -Werror for compiler flag support checks so that they actually work

This commit is contained in:
Thomas Goyne 2014-01-02 15:17:49 -08:00
parent a433a3f5e4
commit fc63df571b
1 changed files with 9 additions and 4 deletions

View File

@ -1,12 +1,14 @@
AC_DEFUN([AC_C_FLAG], [{
AC_LANG_PUSH(C)
ac_c_flag_save="$CFLAGS"
CFLAGS="$CFLAGS $1"
CFLAGS="$CFLAGS -Werror $1"
AC_MSG_CHECKING([[whether $CC supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CFLAGS="$ac_c_flag_save $1"
AC_MSG_RESULT([yes])
], [
CFLAGS="$ac_c_flag_save"
AC_MSG_RESULT([no])
$2
@ -16,11 +18,14 @@ AC_DEFUN([AC_C_FLAG], [{
AC_DEFUN([AC_CXX_FLAG], [{
AC_LANG_PUSH(C++)
ac_cxx_flag_save="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1"
CXXFLAGS="$CXXFLAGS -Werror $1"
AC_MSG_CHECKING([[whether $CXX supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CXXFLAGS="$ac_cxx_flag_save $1"
AC_MSG_RESULT([yes])
],
[
CXXFLAGS="$ac_cxx_flag_save"
AC_MSG_RESULT([no])