Apparently some builds of gcc don't have declaration-after-statement.
authorJason Parker <jparker@digium.com>
Thu, 28 Jun 2007 21:31:00 +0000 (21:31 +0000)
committerJason Parker <jparker@digium.com>
Thu, 28 Jun 2007 21:31:00 +0000 (21:31 +0000)
This checks for it in configure, and only uses it if it's available.

If it's wrong, somebody please yell at me and tell me why.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72539 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
configure
configure.ac
makeopts.in

index a53890d..fb54046 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -193,7 +193,7 @@ ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declar
 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
 
 ifeq ($(AST_DEVMODE),yes)
-  ASTCFLAGS+=-Werror -Wunused -Wundef -Wdeclaration-after-statement
+  ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)
index c58a758..5e36bac 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 69703 .
+# From configure.ac Revision: 71732 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -902,6 +902,7 @@ LIBOBJS
 POW_LIB
 GC_CFLAGS
 GC_LDFLAGS
+AST_DECLARATION_AFTER_STATEMENT
 GSM_INTERNAL
 KDEINIT
 KDEDIR
@@ -15672,6 +15673,20 @@ CFLAGS="${saved_CFLAGS}"
 
 
 
+{ echo "$as_me:$LINENO: checking for -Wdeclaration-after-statement support" >&5
+echo $ECHO_N "checking for -Wdeclaration-after-statement support... $ECHO_C" >&6; }
+if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
+else
+       { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+       AST_DECLARATION_AFTER_STATEMENT=
+fi
+
+
+
 { echo "$as_me:$LINENO: checking for sysinfo" >&5
 echo $ECHO_N "checking for sysinfo... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
@@ -36831,6 +36846,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 POW_LIB!$POW_LIB$ac_delim
 GC_CFLAGS!$GC_CFLAGS$ac_delim
 GC_LDFLAGS!$GC_LDFLAGS$ac_delim
+AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
 GSM_INTERNAL!$GSM_INTERNAL$ac_delim
 KDEINIT!$KDEINIT$ac_delim
 KDEDIR!$KDEDIR$ac_delim
@@ -36838,7 +36854,6 @@ NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
 PG_CONFIG!$PG_CONFIG$ac_delim
 PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim
 PWLIBDIR!$PWLIBDIR$ac_delim
-PWLIB_INCDIR!$PWLIB_INCDIR$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -36880,6 +36895,7 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+PWLIB_INCDIR!$PWLIB_INCDIR$ac_delim
 PWLIB_LIBDIR!$PWLIB_LIBDIR$ac_delim
 PWLIB_PLATFORM!$PWLIB_PLATFORM$ac_delim
 OPENH323DIR!$OPENH323DIR$ac_delim
@@ -36903,7 +36919,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 936dc54..4c4a48c 100644 (file)
@@ -326,6 +326,17 @@ CFLAGS="${saved_CFLAGS}"
 AC_SUBST(GC_CFLAGS)
 AC_SUBST(GC_LDFLAGS)
 
+AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
+if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       AC_MSG_RESULT(yes)
+       AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
+else
+       AC_MSG_RESULT(no)
+       AST_DECLARATION_AFTER_STATEMENT=
+fi
+AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
+
+
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(
         AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
index 69d1255..1bbbdbb 100644 (file)
@@ -62,6 +62,8 @@ sysconfdir = @sysconfdir@
 
 AST_DEVMODE=@AST_DEVMODE@
 
+AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
+
 ASOUND_INCLUDE=@ALSA_INCLUDE@
 ASOUND_LIB=@ALSA_LIB@