Ticket #863: 0002-configure.ac-fix-building-against-static-openssl.patch

File 0002-configure.ac-fix-building-against-static-openssl.patch, 1.6 KB (added by Steffan Karger, 4 years ago)
  • configure.ac

    From f852d349350c2e0d7f709a3b007e0d6ade2be521 Mon Sep 17 00:00:00 2001
    From: Steffan Karger <steffan@karger.me>
    Date: Wed, 29 Mar 2017 22:12:39 +0200
    Subject: [PATCH] configure.ac: fix building against static openssl
    
    Instead of searching for both libssl and libcrypto, just search for
    openssl as a whole (which depends on libssl and libcrypto).  The previous
    discovery order would result in "-lcrypto -lssl" link flags, while we
    need "-lssl -lcrypto".
    
    Also, link to libdl (if available) when testing for OpenSSL functions, as
    OpenSSL requires that.  (This already worked for shared libs, because the
    linker could detect that the .so needed libdl.)
    
    Signed-off-by: Steffan Karger <steffan@karger.me>
    ---
     configure.ac | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/configure.ac b/configure.ac
    index 2406ad8..e43d568 100644
    a b if test "${enable_crypto}" = "yes" -a "${with_crypto_library}" = "openssl"; then 
    859859                # if the user did not explicitly specify flags, try to autodetect
    860860                PKG_CHECK_MODULES(
    861861                        [OPENSSL],
    862                         [libcrypto >= 0.9.8, libssl >= 0.9.8],
     862                        [openssl >= 0.9.8],
    863863                [have_openssl="yes"],
    864864                        [have_openssl="no"] # Provide if-not-found to prevent erroring out
    865865                )
    if test "${enable_crypto}" = "yes" -a "${with_crypto_library}" = "openssl"; then 
    870870        saved_CFLAGS="${CFLAGS}"
    871871        saved_LIBS="${LIBS}"
    872872        CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
    873         LIBS="${LIBS} ${OPENSSL_LIBS}"
     873        LIBS="${LIBS} ${OPENSSL_LIBS} ${DL_LIBS}"
    874874
    875875        AC_CHECK_FUNCS([SSL_CTX_new EVP_CIPHER_CTX_set_key_length],
    876876                                   ,