summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2007-07-24 12:31:01 +0000
committerRichard Hughes <richard@hughsie.com>2007-07-24 12:31:01 +0000
commit13c56943b6a7730079680df95f8d04be2f6bb53a (patch)
tree62ec7795257b8386386d847248fd5125d191c385 /configure.in
parentea3bdfba1023a9977e8da7a06541bb879f59c846 (diff)
2007-07-24 Richard Hughes <richard@hughsie.com>
* configure.in: Check for -Wl,--gc-sections so we can really reduce the size of the setuid binary.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in26
1 files changed, 26 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 877bc0a7..cf0d8ecf 100644
--- a/configure.in
+++ b/configure.in
@@ -243,6 +243,32 @@ else
fi
fi
+# Check for -Wl,--gc-sections
+AC_MSG_CHECKING([for ld that supports "-Wl,--gc-sections"])
+AC_TRY_LINK([
+ int one(void) { return 1; }
+ int two(void) { return 2; }
+ ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
+
+if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+fi
+if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ CFLAGS="-ffunction-sections -fdata-sections $CFLAGS"
+fi
+AC_SUBST(SECTION_FLAGS)
+AC_SUBST(SECTION_LDFLAGS)
+AC_MSG_RESULT($ac_gcsections)
+
# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
#
case $target_os in