From cb10e3af3a51bd7001547a5dc0034c398b87d44a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 10 Jun 2009 21:24:11 +0000 Subject: [PATCH] Support Kerberos on platforms where libcom_err depends on OpenSSL, as reportedly is true on OpenBSD. Also support OpenBSD's spelling of -Wl,--as-needed. Per Simon Bertrang. --- configure | 88 +++++++++++++++++++++++++++++++++++++++++++++------- configure.in | 22 +++++++------ 2 files changed, 89 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 84da291df7..dd924176d1 100755 --- a/configure +++ b/configure @@ -8252,7 +8252,8 @@ return com_err (); return 0; } _ACEOF -for ac_lib in '' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err; do +for ac_lib in '' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' + com_err 'com_err -lssl -lcrypto'; do if test -z "$ac_lib"; then ac_res="none required" else @@ -27133,9 +27134,10 @@ echo "$as_me: WARNING: *** skipping thread test on Win32" >&2;} fi fi -# 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 library links won't use this switch, though.) +# If compiler will take -Wl,--as-needed (or various platform-specific +# spellings thereof) then add that to LDFLAGS. This is much easier than +# trying to filter LIBS to the minimum for each executable. +# (Note that shared library links won't use this switch, though.) # On (at least) some Red-Hat-derived systems, this switch breaks linking to # libreadline; therefore we postpone testing it until we know what library # dependencies readline has. The test code will try to link with $LIBS. @@ -27144,11 +27146,74 @@ if test "$with_readline" = yes; then else link_test_func=exit fi -if test "$PORTNAME" != "darwin"; then - { echo "$as_me:$LINENO: checking if $CC supports -Wl,--as-needed" >&5 -echo $ECHO_N "checking if $CC supports -Wl,--as-needed... $ECHO_C" >&6; } + +if test "$PORTNAME" = "darwin"; then + { echo "$as_me:$LINENO: checking if $CC supports -Wl,-dead_strip_dylibs" >&5 +echo $ECHO_N "checking if $CC supports -Wl,-dead_strip_dylibs... $ECHO_C" >&6; } pgac_save_LDFLAGS=$LDFLAGS -LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed" +LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs" +if test "$cross_compiling" = yes; then + LDFLAGS="$pgac_save_LDFLAGS" + { echo "$as_me:$LINENO: result: assuming no" >&5 +echo "${ECHO_T}assuming no" >&6; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +extern void $link_test_func (); void (*fptr) () = $link_test_func; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +LDFLAGS="$pgac_save_LDFLAGS" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +elif test "$PORTNAME" = "openbsd"; then + { echo "$as_me:$LINENO: checking if $CC supports -Wl,-Bdynamic" >&5 +echo $ECHO_N "checking if $CC supports -Wl,-Bdynamic... $ECHO_C" >&6; } +pgac_save_LDFLAGS=$LDFLAGS +LDFLAGS="$pgac_save_LDFLAGS -Wl,-Bdynamic" if test "$cross_compiling" = yes; then LDFLAGS="$pgac_save_LDFLAGS" { echo "$as_me:$LINENO: result: assuming no" >&5 @@ -27207,11 +27272,10 @@ fi else - # On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere - { echo "$as_me:$LINENO: checking if $CC supports -Wl,-dead_strip_dylibs" >&5 -echo $ECHO_N "checking if $CC supports -Wl,-dead_strip_dylibs... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: checking if $CC supports -Wl,--as-needed" >&5 +echo $ECHO_N "checking if $CC supports -Wl,--as-needed... $ECHO_C" >&6; } pgac_save_LDFLAGS=$LDFLAGS -LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs" +LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed" if test "$cross_compiling" = yes; then LDFLAGS="$pgac_save_LDFLAGS" { echo "$as_me:$LINENO: result: assuming no" >&5 diff --git a/configure.in b/configure.in index 7d4157bba8..1ded4d0d93 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.597 2009/05/19 22:32:41 petere Exp $ +dnl $PostgreSQL: pgsql/configure.in,v 1.598 2009/06/10 21:24:10 tgl Exp $ dnl dnl Developers, please strive to achieve this order: dnl @@ -913,7 +913,8 @@ fi if test "$with_krb5" = yes ; then if test "$PORTNAME" != "win32"; then - AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err], [], + AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' + com_err 'com_err -lssl -lcrypto'], [], [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])]) AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [], [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])]) @@ -1777,9 +1778,10 @@ AC_MSG_WARN([*** skipping thread test on Win32]) fi fi -# 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 library links won't use this switch, though.) +# If compiler will take -Wl,--as-needed (or various platform-specific +# spellings thereof) then add that to LDFLAGS. This is much easier than +# trying to filter LIBS to the minimum for each executable. +# (Note that shared library links won't use this switch, though.) # On (at least) some Red-Hat-derived systems, this switch breaks linking to # libreadline; therefore we postpone testing it until we know what library # dependencies readline has. The test code will try to link with $LIBS. @@ -1788,11 +1790,13 @@ if test "$with_readline" = yes; then else link_test_func=exit fi -if test "$PORTNAME" != "darwin"; then - PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func) -else - # 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,-dead_strip_dylibs], $link_test_func) +elif test "$PORTNAME" = "openbsd"; then + PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-Bdynamic], $link_test_func) +else + PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func) fi