From 61eea10d81b260d19a742a1f7f2edf13fa8f8d30 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 10 Feb 2014 15:23:45 +1100 Subject: [PATCH] 3734. [bug] Improve building with libtool. [RT #35314] --- CHANGES | 2 ++ configure | 33 ++++++++++++++++++++++++++------- configure.in | 32 +++++++++++++++++++++++++------- 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 4dc3d798ca..1b6095d4af 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +3734. [bug] Improve building with libtool. [RT #35314] + 3732. [contrib] Fixed a type mismatch causing the ODBC DLZ driver to dump core on 64-bit systems. [RT #35324] diff --git a/configure b/configure index a14520663f..c793c718b6 100755 --- a/configure +++ b/configure @@ -661,6 +661,7 @@ CONTRIB_DLZ PG_CONFIG SO_TARGETS SO_LD +SO_LDFLAGS SO_CFLAGS SO BIND9_CONFIGARGS @@ -19269,6 +19270,7 @@ DLZ_SYSTEM_TEST="" # SO="so" SO_CFLAGS="" +SO_LDFLAGS="" SO_LD="" SO_TARGETS="" @@ -19352,29 +19354,36 @@ if test "$dlopen" = "yes"; then case $host in *-linux*) SO_CFLAGS="-fPIC" + SO_LDFLAGS="" if test "$have_dl" = "yes" then if test "$use_libtool" = "yes"; then - SO_LD="${CC} -Xcompiler -shared" + SO_LDFLAGS="-Xcompiler -shared" + SO_LD="${CC}" else - SO_LD="${CC} -shared" + SO_LDFLAGS="-shared" + SO_LD="${CC}" fi else - SO_LD="ld -shared" + SO_LDFLAGS="-shared" + SO_LD="ld" fi ;; *-freebsd*|*-openbsd*|*-netbsd*) SO_CFLAGS="-fpic" - SO_LD="ld -Bshareable -x" + SO_LDFLAGS="-Bshareable -x" + SO_LD="ld" ;; *-solaris*) SO_CFLAGS="-KPIC" - SO_LD="ld -G -z text" + SO_LDFLAGS="-G -z text" + SO_LD="ld" ;; *-hp-hpux*) SO=sl SO_CFLAGS="+z" - SO_LD="ld -b" + SO_LDFLAGS="-b" + SO_LD="ld" ;; *) SO_CFLAGS="-fPIC" @@ -19383,7 +19392,16 @@ if test "$dlopen" = "yes"; then if test "X$GCC" = "Xyes"; then SO_CFLAGS="-fPIC" - test -n "$SO_LD" || SO_LD="${CC} -shared" + if test -z "$SO_LD" + then + if test "$use_libtool" = "yes"; then + SO_LDFLAGS="-Xcompiler -shared" + SO_LD="${CC}" + else + SO_LDFLAGS="-shared" + SO_LD="${CC}" + fi + fi fi # If we still don't know how to make shared objects, don't make any. @@ -19400,6 +19418,7 @@ fi + # Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and distribute this software for any diff --git a/configure.in b/configure.in index 6ac8b93b5c..6af479194e 100644 --- a/configure.in +++ b/configure.in @@ -3493,6 +3493,7 @@ DLZ_SYSTEM_TEST="" # SO="so" SO_CFLAGS="" +SO_LDFLAGS="" SO_LD="" SO_TARGETS="" @@ -3517,29 +3518,36 @@ if test "$dlopen" = "yes"; then case $host in *-linux*) SO_CFLAGS="-fPIC" + SO_LDFLAGS="" if test "$have_dl" = "yes" then if test "$use_libtool" = "yes"; then - SO_LD="${CC} -Xcompiler -shared" + SO_LDFLAGS="-Xcompiler -shared" + SO_LD="${CC}" else - SO_LD="${CC} -shared" + SO_LDFLAGS="-shared" + SO_LD="${CC}" fi else - SO_LD="ld -shared" + SO_LDFLAGS="-shared" + SO_LD="ld" fi ;; *-freebsd*|*-openbsd*|*-netbsd*) SO_CFLAGS="-fpic" - SO_LD="ld -Bshareable -x" + SO_LDFLAGS="-Bshareable -x" + SO_LD="ld" ;; *-solaris*) SO_CFLAGS="-KPIC" - SO_LD="ld -G -z text" + SO_LDFLAGS="-G -z text" + SO_LD="ld" ;; *-hp-hpux*) SO=sl SO_CFLAGS="+z" - SO_LD="ld -b" + SO_LDFLAGS="-b" + SO_LD="ld" ;; *) SO_CFLAGS="-fPIC" @@ -3548,7 +3556,16 @@ if test "$dlopen" = "yes"; then if test "X$GCC" = "Xyes"; then SO_CFLAGS="-fPIC" - test -n "$SO_LD" || SO_LD="${CC} -shared" + if test -z "$SO_LD" + then + if test "$use_libtool" = "yes"; then + SO_LDFLAGS="-Xcompiler -shared" + SO_LD="${CC}" + else + SO_LDFLAGS="-shared" + SO_LD="${CC}" + fi + fi fi # If we still don't know how to make shared objects, don't make any. @@ -3561,6 +3578,7 @@ fi AC_SUBST(SO) AC_SUBST(SO_CFLAGS) +AC_SUBST(SO_LDFLAGS) AC_SUBST(SO_LD) AC_SUBST(SO_TARGETS)