summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2012-09-18 15:50:35 +0000
committerDavid M. Lee <dlee@digium.com>2012-09-18 15:50:35 +0000
commitf8d815e19f925c7122f4bf4ead01b0111336866a (patch)
treeb289596496e0461f1a5d44ec85f2ae305e66b4a5 /configure.ac
parentb0f01e5a6f871f42ded30d77984b32aeb05817a6 (diff)
Add -fnested-functions compile flag, if needed.
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. It also adds a comment to utils.h as to why the nested function needs a prototype. (closes issue ASTERISK-20399) Reported by: David M. Lee Review: https://reviewboard.asterisk.org/r/2102/ ........ Merged revisions 373119 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 032b7a0e0..5d56dfa76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1038,6 +1038,18 @@ else
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>],