From: Dave Hart Date: Sun, 13 Dec 2009 19:45:56 +0000 (+0000) Subject: [Bug 1413] test OpenSSL headers regarding -Wno-strict-prototypes. X-Git-Tag: NTP_4_2_7P1~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=294a72207b836f737bc199ea0abf9899a76c2afb;p=thirdparty%2Fntp.git [Bug 1413] test OpenSSL headers regarding -Wno-strict-prototypes. bk: 4b254474g8gYGZifOxYDZIGOjUQhEg --- diff --git a/ChangeLog b/ChangeLog index 6d7fc017e..ddd79f30e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- + +* [Bug 1413] test OpenSSL headers regarding -Wno-strict-prototypes. + --- (4.2.6) 2009/12/09 Released by Harlan Stenn * Include (4.2.4p8) - [Sec 1331] DoS with mode 7 packets - CVE-2009-3563. diff --git a/configure.ac b/configure.ac index 636b195b4..d89839794 100644 --- a/configure.ac +++ b/configure.ac @@ -318,7 +318,7 @@ case "$GCC" in yes) CFLAGS="$CFLAGS -Wstrict-overflow" esac - # if building with OpenSSL, -Wno-strict-prototypes is added later + # -W[no-]strict-prototypes is added later depending on OpenSSL esac case "$host" in @@ -3368,23 +3368,65 @@ case "$ntp_openssl" in esac # -# OpenSSL has a number of callback prototypes inside other function -# prototypes which trigger copious warnings with -Wstrict-prototypes, -# (which is included in -Wall). +# Older OpenSSL headers have a number of callback prototypes inside +# other function prototypes which trigger copious warnings with gcc's +# -Wstrict-prototypes, which is included in -Wall. # # An example: # # int i2d_RSA_NET(const RSA *a, unsigned char **pp, -# int (*cb)(), int sgckey); -# ^^^^^^^^^^^ +# int (*cb)(), int sgckey); +# ^^^^^^^^^^^ # -# The OpenSSL headers probably haven't been fixed in this regard -# due to the hoops you have to jump through to stay compatible with -# K&R C compilers. +# # +openssl_triggers_warnings=unknown +SAVED_CFLAGS="$CFLAGS" + case "$GCC$ntp_openssl" in yesyes) - CFLAGS="$CFLAGS -Wno-strict-prototypes" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE( + AC_LANG_SOURCE([[ /* see if -Werror breaks gcc */ ]]), + [gcc_handles_Werror=yes], + [gcc_handles_Werror=no] + ) + case "$gcc_handles_Werror" in + no) + # if this gcc doesn't do -Werror go ahead and use + # -Wstrict-prototypes. + openssl_triggers_warnings=yes + ;; + yes) + CFLAGS="$CFLAGS -Wstrict-prototypes" + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [[ + #include "openssl/asn1_mac.h" + #include "openssl/bn.h" + #include "openssl/err.h" + #include "openssl/evp.h" + #include "openssl/pem.h" + #include "openssl/rand.h" + #include "openssl/x509v3.h" + ]], + [[ /* empty body */ ]] + ), + [openssl_triggers_warnings=no], + [openssl_triggers_warnings=yes] + ) + esac + case "$openssl_triggers_warnings" in + yes) + CFLAGS="$SAVED_CFLAGS -Wno-strict-prototypes" + ;; + *) + CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes" + esac + ;; + yesno) + # gcc without OpenSSL + CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes" esac AC_MSG_CHECKING([if we want to compile with ElectricFence])