Hi everyboby,

I tried to build httpd-2.3-dev against a static SSL lib today and was
astonished to see apr-util's configure fail when trying to detect
SSL_accept().

Thinking it might be a missing reference to -lz (because my libssl is
built with compresseion enabled) I checked the config log and found
that, after the test of -lcrypto succeeded, the conftest prog
(referencing SSL_accept()) is linked against -lssl only, without a
reference to -lcrypto.

That will be successful in the shared lib case, because libssl.so
automatically references libcrypto.so as a dependency, but for
static libs it simply results in unresolved symbols.

The patch that I attach uses the 5th argument to AC_CHECK_LIB() which
allows for adding additional libraries for the library linking test.

This patch should work for both static and shared libs (because the
-lcrypto test appeared earlier, and succeeded).

   Martin
-- 
<[EMAIL PROTECTED]>        |     Fujitsu Siemens
http://www.fujitsu-siemens.com/imprint.html | 81730  Munich,  Germany
Index: build/ssl.m4
===================================================================
--- build/ssl.m4        (Revision 523652)
+++ build/ssl.m4        (Arbeitskopie)
@@ -51,7 +51,7 @@
   [
     if test "$withval" = "yes"; then
       AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
-      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1]))
+      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1],,-lcrypto))
       if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != 
"0"; then
         apu_have_openssl=1
       fi
@@ -69,7 +69,7 @@
 
       AC_MSG_NOTICE(checking for openssl in $withval)
       AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
-      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1]))
+      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1],,-lcrypto))
       if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != 
"0"; then
         apu_have_openssl=1
         APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
@@ -78,7 +78,7 @@
 
       if test "$apu_have_openssl" != "1"; then
         AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
-        AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1]))
+        AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1],,-lcrypto))
         if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != 
"0"; then
           apu_have_openssl=1
           APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
@@ -91,7 +91,7 @@
     fi
   ], [
     AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
-    AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1]))
+    AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, 
[openssl_have_libs=1],,-lcrypto))
     if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != 
"0"; then
       apu_have_openssl=1
     fi

Reply via email to