Build System: Strip '-std=c99' from CFLAGS provided by libraries.
authorCorey Farrell <git@cfware.com>
Wed, 4 Apr 2018 15:02:06 +0000 (11:02 -0400)
committerCorey Farrell <git@cfware.com>
Wed, 4 Apr 2018 15:04:46 +0000 (11:04 -0400)
Asterisk requires GNU C extensions.  On some systems certain libraries
may incorrectly push -std=c99 into CFLAGS, thus breaking the build.
This change causes that flag to be stripped so the Asterisk build is not
broken by those libraries.  This change is made for both pkgconfig and
tool based libraries.

ASTERISK-27629 #close

Change-Id: I13389613b194abbac77becf90cd950dc168704db

autoconf/ast_ext_tool_check.m4
autoconf/ast_pkgconfig.m4
configure
menuselect/configure

index ef762eb..cbe109e 100644 (file)
@@ -11,7 +11,7 @@ AC_DEFUN([AST_EXT_TOOL_CHECK],
                AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
                if test ! "x${CONFIG_$1}" = xNo; then
                        $1_INCLUDE=$(${CONFIG_$1} m4_default([$3],[--cflags]))
-                       $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-I|-I${$1_DIR}|g")
+                       $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-I|-I${$1_DIR}|g" -e "s|-std=c99||g")
 
                        $1_LIB=$(${CONFIG_$1} m4_default([$4],[--libs]))
                        $1_LIB=$(echo ${$1_LIB} | $SED -e "s|-L|-L${$1_DIR}|g")
index ae7bbc0..3415ed5 100644 (file)
@@ -5,7 +5,7 @@ AC_DEFUN([AST_PKG_CONFIG_CHECK],
    if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
       PKG_CHECK_MODULES($1, $2, [
             PBX_$1=1
-            $1_INCLUDE="$$1_CFLAGS"
+            $1_INCLUDE=$(echo ${$1_CFLAGS} | $SED -e "s|-std=c99||g")
             $1_LIB="$$1_LIBS"
             AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 libraries.])
          ], [
index 3a8c505..472221f 100755 (executable)
--- a/configure
+++ b/configure
@@ -13428,7 +13428,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_LIBEDIT=1
-            LIBEDIT_INCLUDE="$LIBEDIT_CFLAGS"
+            LIBEDIT_INCLUDE=$(echo ${LIBEDIT_CFLAGS} | $SED -e "s|-std=c99||g")
             LIBEDIT_LIB="$LIBEDIT_LIBS"
 
 $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h
@@ -14102,7 +14102,7 @@ fi
 
                if test ! "x${CONFIG_LIBXML2}" = xNo; then
                        LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} --cflags)
-                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g")
+                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g" -e "s|-std=c99||g")
 
                        LIBXML2_LIB=$(${CONFIG_LIBXML2} --libs)
                        LIBXML2_LIB=$(echo ${LIBXML2_LIB} | $SED -e "s|-L|-L${LIBXML2_DIR}|g")
@@ -20494,7 +20494,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_ILBC=1
-            ILBC_INCLUDE="$ILBC_CFLAGS"
+            ILBC_INCLUDE=$(echo ${ILBC_CFLAGS} | $SED -e "s|-std=c99||g")
             ILBC_LIB="$ILBC_LIBS"
 
 $as_echo "#define HAVE_ILBC 1" >>confdefs.h
@@ -22632,7 +22632,7 @@ fi
 
                if test ! "x${CONFIG_MYSQLCLIENT}" = xNo; then
                        MYSQLCLIENT_INCLUDE=$(${CONFIG_MYSQLCLIENT} --cflags)
-                       MYSQLCLIENT_INCLUDE=$(echo ${MYSQLCLIENT_INCLUDE} | $SED -e "s|-I|-I${MYSQLCLIENT_DIR}|g")
+                       MYSQLCLIENT_INCLUDE=$(echo ${MYSQLCLIENT_INCLUDE} | $SED -e "s|-I|-I${MYSQLCLIENT_DIR}|g" -e "s|-std=c99||g")
 
                        MYSQLCLIENT_LIB=$(${CONFIG_MYSQLCLIENT} --libs)
                        MYSQLCLIENT_LIB=$(echo ${MYSQLCLIENT_LIB} | $SED -e "s|-L|-L${MYSQLCLIENT_DIR}|g")
@@ -22849,7 +22849,7 @@ fi
 
                if test ! "x${CONFIG_NEON}" = xNo; then
                        NEON_INCLUDE=$(${CONFIG_NEON} --cflags)
-                       NEON_INCLUDE=$(echo ${NEON_INCLUDE} | $SED -e "s|-I|-I${NEON_DIR}|g")
+                       NEON_INCLUDE=$(echo ${NEON_INCLUDE} | $SED -e "s|-I|-I${NEON_DIR}|g" -e "s|-std=c99||g")
 
                        NEON_LIB=$(${CONFIG_NEON} --libs)
                        NEON_LIB=$(echo ${NEON_LIB} | $SED -e "s|-L|-L${NEON_DIR}|g")
@@ -22969,7 +22969,7 @@ fi
 
                if test ! "x${CONFIG_NEON29}" = xNo; then
                        NEON29_INCLUDE=$(${CONFIG_NEON29} --cflags)
-                       NEON29_INCLUDE=$(echo ${NEON29_INCLUDE} | $SED -e "s|-I|-I${NEON29_DIR}|g")
+                       NEON29_INCLUDE=$(echo ${NEON29_INCLUDE} | $SED -e "s|-I|-I${NEON29_DIR}|g" -e "s|-std=c99||g")
 
                        NEON29_LIB=$(${CONFIG_NEON29} --libs)
                        NEON29_LIB=$(echo ${NEON29_LIB} | $SED -e "s|-L|-L${NEON29_DIR}|g")
@@ -23113,7 +23113,7 @@ fi
 
                if test ! "x${CONFIG_NETSNMP}" = xNo; then
                        NETSNMP_INCLUDE=$(${CONFIG_NETSNMP} --cflags)
-                       NETSNMP_INCLUDE=$(echo ${NETSNMP_INCLUDE} | $SED -e "s|-I|-I${NETSNMP_DIR}|g")
+                       NETSNMP_INCLUDE=$(echo ${NETSNMP_INCLUDE} | $SED -e "s|-I|-I${NETSNMP_DIR}|g" -e "s|-std=c99||g")
 
                        NETSNMP_LIB=$(${CONFIG_NETSNMP} --agent-libs)
                        NETSNMP_LIB=$(echo ${NETSNMP_LIB} | $SED -e "s|-L|-L${NETSNMP_DIR}|g")
@@ -24599,7 +24599,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_PJPROJECT=1
-            PJPROJECT_INCLUDE="$PJPROJECT_CFLAGS"
+            PJPROJECT_INCLUDE=$(echo ${PJPROJECT_CFLAGS} | $SED -e "s|-std=c99||g")
             PJPROJECT_LIB="$PJPROJECT_LIBS"
 
 $as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h
@@ -25653,7 +25653,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_PYTHONDEV=1
-            PYTHONDEV_INCLUDE="$PYTHONDEV_CFLAGS"
+            PYTHONDEV_INCLUDE=$(echo ${PYTHONDEV_CFLAGS} | $SED -e "s|-std=c99||g")
             PYTHONDEV_LIB="$PYTHONDEV_LIBS"
 
 $as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h
@@ -25839,7 +25839,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_PORTAUDIO=1
-            PORTAUDIO_INCLUDE="$PORTAUDIO_CFLAGS"
+            PORTAUDIO_INCLUDE=$(echo ${PORTAUDIO_CFLAGS} | $SED -e "s|-std=c99||g")
             PORTAUDIO_LIB="$PORTAUDIO_LIBS"
 
 $as_echo "#define HAVE_PORTAUDIO 1" >>confdefs.h
@@ -32345,7 +32345,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_GMIME=1
-            GMIME_INCLUDE="$GMIME_CFLAGS"
+            GMIME_INCLUDE=$(echo ${GMIME_CFLAGS} | $SED -e "s|-std=c99||g")
             GMIME_LIB="$GMIME_LIBS"
 
 $as_echo "#define HAVE_GMIME 1" >>confdefs.h
@@ -33254,7 +33254,7 @@ fi
 
                if test ! "x${CONFIG_SDL}" = xNo; then
                        SDL_INCLUDE=$(${CONFIG_SDL} --cflags)
-                       SDL_INCLUDE=$(echo ${SDL_INCLUDE} | $SED -e "s|-I|-I${SDL_DIR}|g")
+                       SDL_INCLUDE=$(echo ${SDL_INCLUDE} | $SED -e "s|-I|-I${SDL_DIR}|g" -e "s|-std=c99||g")
 
                        SDL_LIB=$(${CONFIG_SDL} --libs)
                        SDL_LIB=$(echo ${SDL_LIB} | $SED -e "s|-L|-L${SDL_DIR}|g")
@@ -33782,7 +33782,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_GTK2=1
-            GTK2_INCLUDE="$GTK2_CFLAGS"
+            GTK2_INCLUDE=$(echo ${GTK2_CFLAGS} | $SED -e "s|-std=c99||g")
             GTK2_LIB="$GTK2_LIBS"
 
 $as_echo "#define HAVE_GTK2 1" >>confdefs.h
@@ -33893,7 +33893,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_SYSTEMD=1
-            SYSTEMD_INCLUDE="$SYSTEMD_CFLAGS"
+            SYSTEMD_INCLUDE=$(echo ${SYSTEMD_CFLAGS} | $SED -e "s|-std=c99||g")
             SYSTEMD_LIB="$SYSTEMD_LIBS"
 
 $as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h
index 6e5331e..a0aa109 100755 (executable)
@@ -4392,7 +4392,7 @@ fi
 
                if test ! "x${CONFIG_LIBXML2}" = xNo; then
                        LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} --cflags)
-                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g")
+                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g" -e "s|-std=c99||g")
 
                        LIBXML2_LIB=$(${CONFIG_LIBXML2} --libs)
                        LIBXML2_LIB=$(echo ${LIBXML2_LIB} | $SED -e "s|-L|-L${LIBXML2_DIR}|g")
@@ -4633,7 +4633,7 @@ else
 $as_echo "yes" >&6; }
 
             PBX_GTK2=1
-            GTK2_INCLUDE="$GTK2_CFLAGS"
+            GTK2_INCLUDE=$(echo ${GTK2_CFLAGS} | $SED -e "s|-std=c99||g")
             GTK2_LIB="$GTK2_LIBS"
 
 $as_echo "#define HAVE_GTK2 1" >>confdefs.h