diff options
author | Rob Austein <sra@hactrn.net> | 2010-12-29 23:28:29 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2010-12-29 23:28:29 +0000 |
commit | 0ab93d5e0fe55b22704a264ff572af598b3e632e (patch) | |
tree | b05b14ab3b54ef78e6a043bd0645302b55912905 /configure | |
parent | e246518ca96404e443bbbbdcf4d078243451a27d (diff) |
Try to use autoconf to save us from shared libraries if it can
svn path=/configure; revision=3584
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 62 |
1 files changed, 53 insertions, 9 deletions
@@ -702,6 +702,7 @@ PYTHON TOP_LEVEL_SUBDIRS RPKITOOLS_TOP_BUILDDIR OPENSSL_CONFIG_COMMAND +OPENSSL_SHARED_LIBRARIES PYWRAP LIBOBJS LTLIBOBJS' @@ -4137,6 +4138,35 @@ else have_usable_openssl=no fi +# Figure out whether we need to use shared libraries to build POW. +# This is a world of hurt, but appears to be required on some 64-bit +# platforms due to a deficiency in the GNU linker: it flat out refuses +# to build a shared object (.so) file that uses functions from a +# static library (.a) or static object (.o) file. This in turn +# creates a nightmare of library version dependency issues, so we use +# static libraries where we can, dynamic where we must. +# +# My autoconf-fu isn't strong enough to construct a test for the real +# condition, so for the moment I'm just testing word length. If you +# know how to write the real test, please do so and send it to me. So +# far the least silly idea I've had for how to do this would be to use +# AC_LINK_IFELSE() to test a fragment of C code calling some ISO C +# math function with LDFLAGS='-Wl,--library=:libm.a -shared' and +# CFLAGS='-fPIC' to see if the linker explodes. + +{ $as_echo "$as_me:$LINENO: checking whether building Python extension will require need shared OpenSSL libraries" >&5 +$as_echo_n "checking whether building Python extension will require need shared OpenSSL libraries... " >&6; } +if test "$ac_cv_sizeof_long" -eq 4 +then + need_openssl_shared=no +else + need_openssl_shared=yes +fi +{ $as_echo "$as_me:$LINENO: result: $need_openssl_shared" >&5 +$as_echo "$need_openssl_shared" >&6; } + +# Now a bunch of checks to figure out what we can do with Python. + # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -4184,6 +4214,7 @@ then have_python_h=no need_pywrap=no have_django=no + need_openssl_shared=no else have_python=yes @@ -4340,7 +4371,7 @@ fi $as_echo_n "checking whether Python links against libcrypto... " >&6; } if ldd $PYTHON 2>&5 | $PYTHON -c 'import sys; sys.exit("libcrypto" not in sys.stdin.read())' then - need_pywrap=yes + need_pywrap=$need_openssl_shared else need_pywrap=no fi @@ -4445,10 +4476,10 @@ case $enable_pywrap in $as_echo "$as_me: error: Building pywrap without Python makes no sense" >&2;} { (exit 1); exit 1; }; } fi - if test $build_openssl = no + if test $build_openssl = no || test $need_openssl_shared = no then - { $as_echo "$as_me:$LINENO: WARNING: Building pywrap when using system OpenSSL library makes no sense (but I'll try to do it anyway)" >&5 -$as_echo "$as_me: WARNING: Building pywrap when using system OpenSSL library makes no sense (but I'll try to do it anyway)" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pywrap not needed for this platform (but I'll try to build it anyway)" >&5 +$as_echo "$as_me: WARNING: pywrap not needed for this platform (but I'll try to build it anyway)" >&2;} fi ;; no) build_pywrap=no @@ -4514,9 +4545,10 @@ RPKITOOLS_TOP_BUILDDIR=`pwd` # anything but itself. On at least one platform, OpenSSL's opinion on # the right thing to do is so completely at odds with everything else # that the resulting libraries require special compilation options for -# any program that wants to use them. Feh. +# any program that wants to use them. We also have to sort out whether +# the linker is going to require shared libraries. Feh. # -# Don't bother with this unless we're building our own OpenSSL. +# Don't bother with this unless we're building OpenSSL. if test $build_openssl = yes then @@ -4538,10 +4570,22 @@ $as_echo_n "checking what configuration target to use when building OpenSSL... " { $as_echo "$as_me:$LINENO: result: $OPENSSL_CONFIG_COMMAND" >&5 $as_echo "$OPENSSL_CONFIG_COMMAND" >&6; } - # This -rpath insanity will need to change once we install this stuff - - LDFLAGS="$LDFLAGS -L$RPKITOOLS_TOP_BUILDDIR/openssl/openssl -Wl,-rpath,$RPKITOOLS_TOP_BUILDDIR/openssl/openssl" + LDFLAGS="$LDFLAGS -L$RPKITOOLS_TOP_BUILDDIR/openssl/openssl" CFLAGS="$CFLAGS -I$RPKITOOLS_TOP_BUILDDIR/openssl/openssl/include" + + if test $need_openssl_shared = yes + then + OPENSSL_SHARED_LIBRARIES='enable-shared' + + # This -rpath insanity will need to change once we install this stuff + LDFLAGS="$LDFLAGS -Wl,-rpath,$RPKITOOLS_TOP_BUILDDIR/openssl/openssl" + + else + OPENSSL_SHARED_LIBRARIES='disable-shared' + fi + + { $as_echo "$as_me:$LINENO: result: $OPENSSL_SHARED_LIBRARIES" >&5 +$as_echo "$OPENSSL_SHARED_LIBRARIES" >&6; } fi # Sort out which interpreter POW-using Python programs should use. |