Am Donnerstag, 18. Dezember 2014, 16:06:01 schrieb Jochen Roderburg:
> Hi Tim,
>
> Am 16.12.2014 um 14:00 schrieb Tim Ruehsen:
> > That is not so easy, since when having
> > --with-libssl-prefix=/usr/local/ssl,
> > you can't just
> > OPENSSL_CFLAGS=$with_libssl_prefix/include
> > OPENSSL_LIBS=$with_libssl_prefix/lib
> > You also have to manually specify the libraries you want to link with...
> > this can be different on different systems.
>
> You are right, and this does also not ensure that the wanted libraries
> are actually used at run-time, on Linux e.g. the OPENSSL_LIBS must also
> somehow be in the dynamic library load path.
>
> > So I decided to set PKG_CONFIG_PATH before the check and unset it
> > afterwards. It works for me... but I failed to test it without
> > pkg-config. Without pkg- config I couldn't get autoreconf working :-(
>
> Unfortunately this approach has the same problems as it also does not do
> more than set the inlcude and lib paths.
>
>
> I made the following experiments on my Linux:
>
> Installed a current OPENSSL from source in /usr/local/openssl (with
> openssl configure:  ./config --prefix=/usr/local/openssl shared)
>
> Configured and built wget 1.16.1 with your PKG_CONFIG_PATH patch (with
> wget configure: configure --with-ssl=openssl
> --with-libssl-prefix=/usr/local/openssl).
>
> With an active pkg-config program I see now the following in the config
> summary:
> CFlags:  -I/usr/include/uuid   -I/usr/local/openssl/include
> -DHAVE_LIBSSL   -DNDEBUG
> Libs:    -lpcre   -luuid   -L/usr/local/openssl/lib -lssl -lcrypto -lz
>    -lidn
>
> So the compile and link phase will use the wanted files, but a ldd on
> the resulting wget binary still shows:
>
>          libssl.so.1.0.0 => /lib/libssl.so.1.0.0
>          libcrypto.so.1.0.0 => /lib/libcrypto.so.1.0.0
>
> With a deactivated pkg-config program the old library detection code
> seems to be used and I get:
>
> CFlags:   -DNDEBUG -I/usr/local/openssl/include
> Libs:     /usr/local/openssl/lib/libssl.so
> /usr/local/openssl/lib/libcrypto.so
>            Wl,-rpath -Wl,/usr/local/openssl/lib/ -ldl -lz  -lidn -luuid
> -lpcre
>
> and ldd shows now:
>
>          libssl.so.1.0.0 => /usr/local/openssl/lib/libssl.so.1.0.0
>          libcrypto.so.1.0.0 => /usr/local/openssl/lib/libcrypto.so.1.0.0
>
> The wanted openssl libraries are inserted here with full path names and
> really used.
>
>
> Therefore I see now only one possibility to keep these two prefix
> options without more problems and new questions, namely skip the
> pkg-config based completely for the SSL libraries if these options are
> used.

I attached a patch to skip pkg-config detection when --with...-prefix is given.
It works for me, but please also review and test.

Tim
From 6f62bc5cd86aa7383cded38f61871afd4964c577 Mon Sep 17 00:00:00 2001
From: Tim Ruehsen <[email protected]>
Date: Thu, 25 Dec 2014 15:21:44 +0100
Subject: [PATCH] configure.ac: Skip pkg-config for opensl and gnutls when
 prefix is given

Make --with-libssl-prefix and --with-libgnutls-prefix do the right thing,
no matter if pkg-config is installed or not.

Reported-by: Charles Diza <[email protected]>
---
 configure.ac | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 44f4d6d..01ea237 100644
--- a/configure.ac
+++ b/configure.ac
@@ -334,15 +334,19 @@ AS_IF([test x"$with_zlib" != xno], [
 ])

 AS_IF([test x"$with_ssl" = xopenssl], [
-  PKG_CHECK_MODULES([OPENSSL], [openssl], [
-    AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
-    AC_LIBOBJ([openssl])
-    LIBS="$OPENSSL_LIBS $LIBS"
-    CFLAGS="$OPENSSL_CFLAGS -DHAVE_LIBSSL $CFLAGS"
-    LIBSSL=" " # ntlm check below wants this
-    AC_CHECK_FUNCS([RAND_egd])
-    AC_DEFINE([HAVE_LIBSSL], [1], [Define if using openssl.])
-  ], [
+  if [test x"$with_libssl_prefix" = x]; then
+    PKG_CHECK_MODULES([OPENSSL], [openssl], [
+      AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
+      AC_LIBOBJ([openssl])
+      LIBS="$OPENSSL_LIBS $LIBS"
+      CFLAGS="$OPENSSL_CFLAGS -DHAVE_LIBSSL $CFLAGS"
+      LIBSSL=" " # ntlm check below wants this
+      AC_CHECK_FUNCS([RAND_egd])
+      AC_DEFINE([HAVE_LIBSSL], [1], [Define if using openssl.])
+      ssl_found=yes
+    ])
+  fi
+  if [test x"$ssl_found" != xyes]; then
     dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
     dnl doesn't record its dependency on libdl, so we need to make sure
     dnl -ldl ends up in LIBS on systems that have it.  Most OSes use
@@ -399,7 +403,7 @@ AS_IF([test x"$with_ssl" = xopenssl], [
         AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.])
       fi
     ])
-  ])
+  fi
 ], [
   # --with-ssl is not openssl: check if it's no
   AS_IF([test x"$with_ssl" != xno], [
@@ -407,13 +411,17 @@ AS_IF([test x"$with_ssl" = xopenssl], [
     with_ssl=gnutls

     dnl Now actually check for -lgnutls
-    PKG_CHECK_MODULES([GNUTLS], [gnutls], [
-      AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
-      AC_LIBOBJ([gnutls])
-      LIBS="$GNUTLS_LIBS $LIBS"
-      CFLAGS="$GNUTLS_CFLAGS -DHAVE_LIBGNUTLS $CFLAGS"
-      AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define if using gnutls.])
-    ], [
+    if [test x"$with_libgnutls_prefix" = x]; then
+      PKG_CHECK_MODULES([GNUTLS], [gnutls], [
+        AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
+        AC_LIBOBJ([gnutls])
+        LIBS="$GNUTLS_LIBS $LIBS"
+        CFLAGS="$GNUTLS_CFLAGS -DHAVE_LIBGNUTLS $CFLAGS"
+        AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define if using gnutls.])
+        ssl_found=yes
+      ])
+    fi
+    if [test x"$ssl_found" != xyes]; then
       AC_LIB_HAVE_LINKFLAGS([gnutls], [], [
 #include <gnutls/gnutls.h>
       ], [gnutls_global_init()])
@@ -426,7 +434,7 @@ AS_IF([test x"$with_ssl" = xopenssl], [
       else
         AC_MSG_ERROR([GnuTLS has not been found. Use --with-ssl=openssl if you explicitly want OpenSSL.])
       fi
-    ])
+    fi

     AC_CHECK_FUNCS(gnutls_priority_set_direct)
   ]) # endif: --with-ssl != no?
--
2.1.4

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to