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 |
859 | 859 | # if the user did not explicitly specify flags, try to autodetect |
860 | 860 | PKG_CHECK_MODULES( |
861 | 861 | [OPENSSL], |
862 | | [libcrypto >= 0.9.8, libssl >= 0.9.8], |
| 862 | [openssl >= 0.9.8], |
863 | 863 | [have_openssl="yes"], |
864 | 864 | [have_openssl="no"] # Provide if-not-found to prevent erroring out |
865 | 865 | ) |
… |
… |
if test "${enable_crypto}" = "yes" -a "${with_crypto_library}" = "openssl"; then |
870 | 870 | saved_CFLAGS="${CFLAGS}" |
871 | 871 | saved_LIBS="${LIBS}" |
872 | 872 | CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}" |
873 | | LIBS="${LIBS} ${OPENSSL_LIBS}" |
| 873 | LIBS="${LIBS} ${OPENSSL_LIBS} ${DL_LIBS}" |
874 | 874 | |
875 | 875 | AC_CHECK_FUNCS([SSL_CTX_new EVP_CIPHER_CTX_set_key_length], |
876 | 876 | , |