In order to use nested functions on some versions of GCC (e.g. GCC on OS X),
the -fnested-functions flag must be passed to the compiler. This patch adds
detection logic to ./configure to add the flag if necessary.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@402192
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
_ASTCFLAGS+=-Wall
endif
-_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
+_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(DEBUG)
ifeq ($(AST_DEVMODE),yes)
_ASTCFLAGS+=-Werror
#! /bin/sh
-# From configure.ac Revision: 400073 .
+# From configure.ac Revision: 400767 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for asterisk trunk.
#
PBX_IP_MTU_DISCOVER
PBX_GLOB_BRACE
PBX_GLOB_NOMAGIC
+AST_NESTED_FUNCTIONS
AST_NATIVE_ARCH
AST_SHADOW_WARNINGS
AST_NO_STRICT_OVERFLOW
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fnested-functions" >&5
+$as_echo_n "checking for -fnested-functions... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+auto void foo(void); void foo(void) {}
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ AST_NESTED_FUNCTIONS=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: required" >&5
+$as_echo "required" >&6; }
+ AST_NESTED_FUNCTIONS=-fnested-functions
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysinfo" >&5
$as_echo_n "checking for sysinfo... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
fi
AC_SUBST(AST_NATIVE_ARCH)
+dnl Nested functions required for RAII implementation
+AC_MSG_CHECKING(for -fnested-functions)
+AC_COMPILE_IFELSE(
+ dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
+ [AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
+ AC_MSG_RESULT(no)
+ [AST_NESTED_FUNCTIONS=],
+ AC_MSG_RESULT(required)
+ [AST_NESTED_FUNCTIONS=-fnested-functions]
+)
+AC_SUBST(AST_NESTED_FUNCTIONS)
+
AC_MSG_CHECKING(for sysinfo)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@
+AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@
AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
ALSA_INCLUDE=@ALSA_INCLUDE@