]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
gcc -Winit-self is used only if it is understood
authorDave Hart <hart@ntp.org>
Sun, 26 Apr 2009 06:10:27 +0000 (06:10 +0000)
committerDave Hart <hart@ntp.org>
Sun, 26 Apr 2009 06:10:27 +0000 (06:10 +0000)
bk: 49f3fad3wqu0OmkHwkjhQCA5eJGDrw

ChangeLog
configure.ac

index 00470104e00f8bd76dd7aa33f7ef0f4f27c3d99a..d9c92e4f5555c61fc493d1152c46315772096392 100644 (file)
--- 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 <stenn@ntp.org>
 
index a32015dbbd78398a9a004e73085af1ddd447096e..efbff501b44e1dd0a88cf8e417e1f6f6b3991988 100644 (file)
@@ -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"