diff options
| author | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-09-09 07:04:28 +0200 |
|---|---|---|
| committer | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-09-09 07:04:28 +0200 |
| commit | db47597e0a08161aef1c07156a4d486cb22fb3fc (patch) | |
| tree | f9aa180eebc6592550a852ff85d953c1e6884976 | |
| parent | cca3241ac686b54e54e04beac18d59d023c57201 (diff) | |
| download | tcpdump-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.
| -rw-r--r-- | aclocal.m4 | 33 | ||||
| -rwxr-xr-x | configure | 58 |
2 files changed, 79 insertions, 12 deletions
@@ -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) @@ -3352,7 +3352,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -ffloat-store option" >&5 $as_echo_n "checking whether the compiler supports the -ffloat-store option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -ffloat-store" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -ffloat-store" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7656,10 +7656,46 @@ rm -f os-proto.h # if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler fails when given an unknown warning option" >&5 +$as_echo_n "checking whether the compiler fails when given an unknown warning option... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # + # 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" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wall option" >&5 $as_echo_n "checking whether the compiler supports the -Wall option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wall" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wall" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7691,7 +7727,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-prototypes option" >&5 $as_echo_n "checking whether the compiler supports the -Wmissing-prototypes option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wmissing-prototypes" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-prototypes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7723,7 +7759,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wstrict-prototypes option" >&5 $as_echo_n "checking whether the compiler supports the -Wstrict-prototypes option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wstrict-prototypes" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wstrict-prototypes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7755,7 +7791,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wwrite-strings option" >&5 $as_echo_n "checking whether the compiler supports the -Wwrite-strings option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wwrite-strings" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wwrite-strings" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7787,7 +7823,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpointer-arith option" >&5 $as_echo_n "checking whether the compiler supports the -Wpointer-arith option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wpointer-arith" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpointer-arith" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7819,7 +7855,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcast-qual option" >&5 $as_echo_n "checking whether the compiler supports the -Wcast-qual option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wcast-qual" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wcast-qual" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7851,7 +7887,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wshadow option" >&5 $as_echo_n "checking whether the compiler supports the -Wshadow option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wshadow" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wshadow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7883,7 +7919,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wdeclaration-after-statement option" >&5 $as_echo_n "checking whether the compiler supports the -Wdeclaration-after-statement option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wdeclaration-after-statement" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wdeclaration-after-statement" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7915,7 +7951,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpedantic option" >&5 $as_echo_n "checking whether the compiler supports the -Wpedantic option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wpedantic" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpedantic" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7947,7 +7983,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -W option" >&5 $as_echo_n "checking whether the compiler supports the -W option... " >&6; } save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -W" + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -W" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ |
