summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-09-09 07:04:28 +0200
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-09-09 07:04:28 +0200
commitdb47597e0a08161aef1c07156a4d486cb22fb3fc (patch)
treef9aa180eebc6592550a852ff85d953c1e6884976 /aclocal.m4
parentcca3241ac686b54e54e04beac18d59d023c57201 (diff)
downloadtcpdump-db47597e0a08161aef1c07156a4d486cb22fb3fc.tar.gz
Fix incorrect detection of '-Wstrict-prototypes' option
Revert "Simplify AC_LBL_CHECK_COMPILER_OPT a bit." (commit 43e88cd5b8e9d9d643bbad585743123492452041) The problem shows itself because 'configure' displays "checking whether the compiler supports the -Wstrict-prototypes option... no" even if '-Wstrict-prototypes' option is supported. Moreover: Update configure accordingly. Fix a trailing space.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m433
1 files changed, 32 insertions, 1 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 7c6d5b24..a50c2f0b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -219,6 +219,36 @@ AC_DEFUN(AC_LBL_C_INIT,
])
dnl
+dnl Check whether, if you pass an unknown warning option to the
+dnl compiler, it fails or just prints a warning message and succeeds.
+dnl Set ac_lbl_unknown_warning_option_error to the appropriate flag
+dnl to force an error if it would otherwise just print a warning message
+dnl and succeed.
+dnl
+AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR,
+ [
+ AC_MSG_CHECKING([whether the compiler fails when given an unknown warning option])
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy"
+ AC_TRY_COMPILE(
+ [],
+ [return 0],
+ [
+ AC_MSG_RESULT([no])
+ #
+ # We're assuming this is clang, where
+ # -Werror=unknown-warning-option is the appropriate
+ # option to force the compiler to fail.
+ #
+ ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ ])
+ CFLAGS="$save_CFLAGS"
+ ])
+
+dnl
dnl Check whether the compiler option specified as the second argument
dnl is supported by the compiler and, if so, add it to the macro
dnl specified as the first argument
@@ -227,7 +257,7 @@ AC_DEFUN(AC_LBL_CHECK_COMPILER_OPT,
[
AC_MSG_CHECKING([whether the compiler supports the $2 option])
save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors $2"
+ CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error $2"
AC_TRY_COMPILE(
[],
[return 0],
@@ -942,6 +972,7 @@ AC_DEFUN(AC_LBL_DEVEL,
# Skip all the warning option stuff on some compilers.
#
if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
+ AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR()
AC_LBL_CHECK_COMPILER_OPT($1, -Wall)
AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-prototypes)
AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)