aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-26 16:45:35 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-26 16:45:35 +0000
commitda5141501bbaee1750bd85d88dd86d8b5acbb040 (patch)
tree9a2fde65d5e68d945737adfbf3732993de3886b5 /configure.ac
parentcdffda3e50f00b25b011a6d8e16b5eddee0b6d23 (diff)
more optimizations for embedded systems:
when LOADABLE_MODULES is off, don't export symbols from the main binary when LOADABLE_MODULES is off, and the compiler/linker support it, strip out code not used in the final binary git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41166 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac35
1 files changed, 29 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 46e5ad734..a62d24380 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,6 +251,35 @@ AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides at
AC_MSG_RESULT(no)
)
+AST_GCC_ATTRIBUTE(pure)
+AST_GCC_ATTRIBUTE(malloc)
+AST_GCC_ATTRIBUTE(const)
+AST_GCC_ATTRIBUTE(unused)
+AST_GCC_ATTRIBUTE(always_inline)
+
+AC_MSG_CHECKING(checking for -ffunction-sections support)
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -ffunction-sections"
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([], [int x = 1;]),
+ AC_MSG_RESULT(yes)
+ [saved_LDFLAGS="${LDFLAGS}"]
+ [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
+ AC_MSG_CHECKING(checking for --gc-sections support)
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM([], [int x = 1;]),
+ AC_MSG_RESULT(yes)
+ [GC_CFLAGS="-ffunction-sections"]
+ [[GC_LDFLAGS="-Wl,--gc-sections"]],
+ AC_MSG_RESULT(no)
+ )
+ [LDFLAGS="${saved_LDFLAGS}"],
+ AC_MSG_RESULT(no)
+)
+CFLAGS="${saved_CFLAGS}"
+AC_SUBST(GC_CFLAGS)
+AC_SUBST(GC_LDFLAGS)
+
AC_MSG_CHECKING(checking for res_ninit)
AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include <resolv.h>],
@@ -269,12 +298,6 @@ AC_LINK_IFELSE(
AC_MSG_RESULT(no)
)
-AST_GCC_ATTRIBUTE(pure)
-AST_GCC_ATTRIBUTE(malloc)
-AST_GCC_ATTRIBUTE(const)
-AST_GCC_ATTRIBUTE(unused)
-AST_GCC_ATTRIBUTE(always_inline)
-
AC_CHECK_HEADER([libkern/OSAtomic.h],
[AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])