On xenial, cc -o foo -lssl -lcrypto doesn't always
record libssl.so libcrypto.so as runtime library dependencies.
It is necessary to actually *use* a function from the library before
it gets recorded. The ld(1) options "--as-needed" and "no-as-needed"
control this. Evidently the default has changed in xenial.
That caused my smart "soname" detecting logic for openssl to
stop working. To make it work, the test program has to
actually reference routines or variables inside the library.
This is a quick fix for xenial / autoconf. There needs to be
a better fix for cmake and master.
Signed-off-by: Marcus Watts <mwatts@redhat.com>
AC_MSG_CHECKING(for radosgw/civetweb: sonames for openssl libraries)
saved_LIBS="${LIBS}"
LIBS="$OPENSSL_LIBS"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>
+#include <openssl/evp.h>], [SSL *s = 0;printf ("%p %d\n", (void*)EVP_md5(), SSL_get_fd(s))])],
[AC_MSG_RESULT([linked])
eval `$OBJDUMP -p ./conftest$ac_exeext | sed -n 's/^ NEEDED *libssl/LIBSSL_SONAME=libssl/p;
s/^ NEEDED *libcrypto/LIBCRYPTO_SONAME=libcrypto/p'`],