summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Kasanen <cand@gmx.com>2014-08-21 12:08:02 +0000
committerLauri Kasanen <cand@gmx.com>2014-08-21 12:08:02 +0000
commit3113727cc9263c2825271e96b58aa303858e88f7 (patch)
treea54f009c74e1d1ea0ba03ba56dfb107ab4fa3be4
parent3a5f3f1820b899909e687cd984e402c2c711c68f (diff)
Use symbolic and sectioned builds if supported by the toolchain.
These help both shared lib size, as well as app size when statically linking. STR #3097 git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10230 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--configure.in24
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 7a21f5640..d8f99d1dd 100644
--- a/configure.in
+++ b/configure.in
@@ -1165,6 +1165,30 @@ if test -n "$GCC"; then
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
+ # See if ld supports -Bsymbolic-functions...
+ AC_MSG_CHECKING(if ld supports -Bsymbolic-functions)
+ OLDLDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
+ AC_TRY_LINK(,,
+ [DSOFLAGS="$DSOFLAGS -Wl,-Bsymbolic-functions"]
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+ LDFLAGS="$OLDLDFLAGS"
+
+ # See if toolchain supports a sectioned build...
+ AC_MSG_CHECKING(if toolchain supports sections)
+ OLDLDFLAGS="$LDFLAGS"
+ OLDCFLAGS="$CFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-gc-sections"
+ CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
+ AC_TRY_LINK(,,
+ [DSOFLAGS="$DSOFLAGS -Wl,-gc-sections"
+ OPTIM="$OPTIM -ffunction-sections -fdata-sections"]
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+ LDFLAGS="$OLDLDFLAGS"
+ CFLAGS="$OLDCFLAGS"
+
# See if we are running Solaris; if so, try the -fpermissive option...
# This option is required on some versions of Solaris to work around
# bugs in the X headers up through Solaris 7.