From b54c25af2199aecaa6763fc6f48b6ebc981d80d0 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] (cherry picked from commit 61eea10d81b260d19a742a1f7f2edf13fa8f8d30) --- CHANGES | 2 ++ configure | 33 ++++++++++++++++++++++++++------- configure.in | 32 +++++++++++++++++++++++++------- 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 0964f49f80..374205c130 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 1ee9a76f5c..46c5ae3f8e 100755 --- a/configure +++ b/configure @@ -661,6 +661,7 @@ CONTRIB_DLZ PG_CONFIG SO_TARGETS SO_LD +SO_LDFLAGS SO_CFLAGS SO BIND9_CONFIGARGS @@ -18896,6 +18897,7 @@ DLZ_SYSTEM_TEST="" # SO="so" SO_CFLAGS="" +SO_LDFLAGS="" SO_LD="" SO_TARGETS="" @@ -18979,29 +18981,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" @@ -19010,7 +19019,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. @@ -19027,6 +19045,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 213bf680cb..b3c5a7bdbd 100644 --- a/configure.in +++ b/configure.in @@ -3341,6 +3341,7 @@ DLZ_SYSTEM_TEST="" # SO="so" SO_CFLAGS="" +SO_LDFLAGS="" SO_LD="" SO_TARGETS="" @@ -3365,29 +3366,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" @@ -3396,7 +3404,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. @@ -3409,6 +3426,7 @@ fi AC_SUBST(SO) AC_SUBST(SO_CFLAGS) +AC_SUBST(SO_LDFLAGS) AC_SUBST(SO_LD) AC_SUBST(SO_TARGETS)