From 4782357ff56aafbab8aecc652af840dfa5247fa1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Wed, 9 Dec 2009 08:36:43 +0000 Subject: [PATCH] Ported r137 from branches/v2_2_6_1 (test gcc options) --- CMakeLists.txt | 2 +- ChangeLog | 3 +- configure | 92 ++++++++++++++++++++++++++++++++++++++++++++++++-- configure.in | 21 +++++++++++- include/info.h | 2 +- 5 files changed, 114 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1086e16..f7d6320 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(sarg C) SET(sarg_VERSION 2) SET(sarg_REVISION 2) SET(sarg_BUILD "7rc1") -SET(sarg_BUILDDATE "Dec-08-2009") +SET(sarg_BUILDDATE "Dec-09-2009") INCLUDE(AddFileDependencies) INCLUDE(CheckIncludeFile) diff --git a/ChangeLog b/ChangeLog index 0aa19bb..6ed3df6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,9 +8,10 @@ Dec-03-2009 Version 2.2.7 - Input log file type detection partly rewritten to clearly distinguish which type is processed where. - Read the input log file from standard input if log file name is -. -Dec-08-2009 Version 2.2.6.1 +Dec-09-2009 Version 2.2.6.1 - Remove unecessary dependency on off_t. - Configuration doesn't fail if rlim_t is not available. + - Test for the availability of -Werror=xxx flags in gcc. Oct-14-2009 Version 2.2.6 - Protection against buffer overflows in getword and friends and report the origin of the error instead of always blaming access.log. diff --git a/configure b/configure index 7a61957..d6cc6f6 100755 --- a/configure +++ b/configure @@ -2773,9 +2773,98 @@ esac if test "${CC}" = "cc" ; then CFLAGS="${CFLAGS} -g -O2 -Aa" fi -CFLAGS="${CFLAGS} -Wall -Wextra -Werror=implicit-function-declaration -Werror=format -Wno-sign-compare -Wno-unused-parameter" +CFLAGS="${CFLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter" +{ echo "$as_me:$LINENO: checking for implicit-function-declaration error flag in gcc" >&5 +echo $ECHO_N "checking for implicit-function-declaration error flag in gcc... $ECHO_C" >&6; } +saved_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror=implicit-function-declaration" + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + have_implicit_function_declaration="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + have_implicit_function_declaration="no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $have_implicit_function_declaration" >&5 +echo "${ECHO_T}$have_implicit_function_declaration" >&6; } +if test "$have_implicit_function_declaration" == "no" ; then + CFLAGS="${saved_CFLAGS}" +fi + +{ echo "$as_me:$LINENO: checking for format error flag in gcc" >&5 +echo $ECHO_N "checking for format error flag in gcc... $ECHO_C" >&6; } +saved_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror=format" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + have_error_format="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + have_error_format="no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $have_error_format" >&5 +echo "${ECHO_T}$have_error_format" >&6; } +if test "$have_implicit_function_declaration" == "no" ; then + CFLAGS="${saved_CFLAGS}" +fi + case "$host" in *-solaris*) LDFLAGS="${LDFLAGS} -lsocket -lnsl" @@ -2791,7 +2880,6 @@ esac - ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` diff --git a/configure.in b/configure.in index d9c72c5..5f452ab 100644 --- a/configure.in +++ b/configure.in @@ -20,8 +20,27 @@ esac if test "${CC}" = "cc" ; then CFLAGS="${CFLAGS} -g -O2 -Aa" fi -CFLAGS="${CFLAGS} -Wall -Wextra -Werror=implicit-function-declaration -Werror=format -Wno-sign-compare -Wno-unused-parameter" +CFLAGS="${CFLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter" +dnl Check for supported gcc options + +AC_MSG_CHECKING([for implicit-function-declaration error flag in gcc]) +saved_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror=implicit-function-declaration" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"]) +AC_MSG_RESULT($have_implicit_function_declaration) +if test "$have_implicit_function_declaration" == "no" ; then + CFLAGS="${saved_CFLAGS}" +fi + +AC_MSG_CHECKING([for format error flag in gcc]) +saved_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror=format" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"]) +AC_MSG_RESULT($have_error_format) +if test "$have_implicit_function_declaration" == "no" ; then + CFLAGS="${saved_CFLAGS}" +fi case "$host" in *-solaris*) diff --git a/include/info.h b/include/info.h index 45e7027..fc91f62 100755 --- a/include/info.h +++ b/include/info.h @@ -1,3 +1,3 @@ -#define VERSION PACKAGE_VERSION" Dec-08-2009" +#define VERSION PACKAGE_VERSION" Dec-09-2009" #define PGM PACKAGE_NAME #define URL "http://sarg.sourceforge.net" -- 2.47.2