summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorTom Lane2008-05-18 20:13:12 +0000
committerTom Lane2008-05-18 20:13:12 +0000
commit2dad10f467165ad87dace65ae9aa1cf19fae0867 (patch)
treeca2318ae03e3b2118be17d578cab8f22b8de7773 /configure.in
parent07d08a8828cd31dd5911971ab768fe8d4ab793c7 (diff)
Make another try at using -Wl,--as-needed to suppress linking of unnecessary
shared libraries. We've tried this before and had problems with libreadline not linking properly on some platforms, but that seems to be a libreadline bug that may have been fixed by now. In any case, it's early enough in the 8.4 devel cycle that we can afford to have some transient breakage while we work out any portability problems. On Darwin, we try -Wl,-dead_strip_dylibs, which seems to be the equivalent incantation there.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index b8f83960308..a888e352749 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.560 2008/05/03 00:24:05 adunstan Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.561 2008/05/18 20:13:12 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@@ -450,6 +450,16 @@ fi
AC_PROG_CPP
AC_SUBST(GCC)
+# If compiler will take -Wl,--as-needed then add that to LDFLAGS.
+# This is much easier than trying to filter LIBS to the minimum for each
+# executable. (Note that shared libraries won't use this switch, though.)
+# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere
+if test "$PORTNAME" != "darwin"; then
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed])
+else
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs])
+fi
+
# Create compiler version string
if test x"$GCC" = x"yes" ; then
cc_string="GCC `${CC} --version | sed q`"