diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-08-26 16:45:35 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-08-26 16:45:35 +0000 |
commit | aa7b32d1750b732b45f5fe12a58308cb047ec959 (patch) | |
tree | 9a2fde65d5e68d945737adfbf3732993de3886b5 /configure.ac | |
parent | b374245688e8ee3bc707e8472bc04aaed2bc6078 (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: https://origsvn.digium.com/svn/asterisk/trunk@41166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 35 |
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.])]) |