From: Dave Hart Date: Sun, 26 Apr 2009 06:10:27 +0000 (+0000) Subject: gcc -Winit-self is used only if it is understood X-Git-Tag: NTP_4_2_4P7_RC4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b80f781cc3654eacc351b0953fed02f078a2a4ac;p=thirdparty%2Fntp.git gcc -Winit-self is used only if it is understood bk: 49f3fad3wqu0OmkHwkjhQCA5eJGDrw --- diff --git a/ChangeLog b/ChangeLog index 00470104e..d9c92e4f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- + +* configure: gcc -Winit-self is used only if it is understood + --- (4.2.4p7-RC3) 2009/04/22 Released by Harlan Stenn diff --git a/configure.ac b/configure.ac index a32015dbb..efbff501b 100644 --- a/configure.ac +++ b/configure.ac @@ -124,7 +124,7 @@ case "$GCC" in ] ) CFLAGS="$SAVED_CFLAGS_AC" - SAVED_CFLAGS_AC= + unset SAVED_CFLAGS_AC # # $ac_cv_gcc_Wstrict_overflow is tested again later to add the # flag to CFLAGS. @@ -137,6 +137,35 @@ case "$GCC" in esac +case "$GCC" in + yes) + SAVED_CFLAGS_AC="$CFLAGS" + CFLAGS="$CFLAGS -Winit-self" + AC_CACHE_CHECK( + [if $CC can handle -Winit-self], + ac_cv_gcc_Winit_self, + [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [])], + [ac_cv_gcc_Winit_self=yes], + [ac_cv_gcc_Winit_self=no] + ) + ] + ) + CFLAGS="$SAVED_CFLAGS_AC" + unset SAVED_CFLAGS_AC + # + # $ac_cv_gcc_Winit_self is tested again later to add the + # flag to CFLAGS. + # + case "$ac_cv_gcc_Winit_self" in + yes) + AC_DEFINE(HAVE_GCC_WARN_INIT_SELF, 1, + [compiling with gcc which understands -Winit-self]) + esac +esac + + AC_MSG_CHECKING([for bin subdirectory]) AC_ARG_WITH(binsubdir, @@ -252,7 +281,10 @@ case "$GCC" in CFLAGS="$CFLAGS -Wno-strict-prototypes" # CFLAGS="$CFLAGS -Wtraditional" # CFLAGS="$CFLAGS -Wwrite-strings" - CFLAGS="$CFLAGS -Winit-self" + case "$ac_cv_gcc_Winit_self" in + yes) + CFLAGS="$CFLAGS -Winit-self" + esac case "$ac_cv_gcc_Wstrict_overflow" in yes) #not yet: CFLAGS="$CFLAGS -Wstrict-overflow"