On Wednesday 13 of January 2010 00:01:55 Kamil Dudka wrote:
> On Tuesday 12 of January 2010 23:56:29 Yang Tse wrote:
> > Please. avoid using 'unset' it is not portable enough.
> >
> > We are going great lengths in other parts of our shell code in
> > configure script macros to ensure that it works even on the most
> > unsupporting shells. This would be the first 'unset' in all of them.
>
> I am of course open to any idea how to make it better.  The only other
> solution I aware of is to not use 'export' for PKG_CONFIG_LIBDIR at all.
> Because once you export the variable, there is no way to hide it from
> pkg-config when 'unset' is black-listed, or am I wrong?

Yang, please have a look at the attached patch.  It seems to work and does
not require 'unset', nor 'export'.

> Kamil
? ac-openssl-nss-v2.patch
Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.446
diff -u -p -r1.446 configure.ac
--- configure.ac	13 Jan 2010 01:13:23 -0000	1.446
+++ configure.ac	13 Jan 2010 01:30:02 -0000
@@ -1205,7 +1205,6 @@ if test X"$OPT_SSL" != Xno; then
   CLEANLDFLAGS="$LDFLAGS"
   CLEANCPPFLAGS="$CPPFLAGS"
   CLEANLIBS="$LIBS"
-  SAVE_PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR"
 
   case "$OPT_SSL" in
   yes)
@@ -1233,10 +1232,9 @@ if test X"$OPT_SSL" != Xno; then
     dnl Try pkg-config even when cross-compiling.  Since we
     dnl specify PKG_CONFIG_LIBDIR we're only looking where
     dnl the user told us to look
-    PKG_CONFIG_LIBDIR=$OPT_SSL/lib/pkgconfig
-    export PKG_CONFIG_LIBDIR
-    AC_MSG_NOTICE([set PKG_CONFIG_LIBDIR to "$PKG_CONFIG_LIBDIR"])
-    if test -e "$PKG_CONFIG_LIBDIR/openssl.pc"; then
+    OPENSSL_PCDIR=$OPT_SSL/lib/pkgconfig
+    AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
+    if test -e "$OPENSSL_PCDIR/openssl.pc"; then
       PKGTEST="yes"
     fi
 
@@ -1253,12 +1251,17 @@ if test X"$OPT_SSL" != Xno; then
 
   if test "$PKGTEST" = "yes"; then
 
-    CURL_CHECK_PKGCONFIG(openssl)
+    PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" CURL_CHECK_PKGCONFIG(openssl)
 
     if test "$PKGCONFIG" != "no" ; then
-      SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
-      SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
-      SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
+      SSL_LIBS=`PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" \
+        $PKGCONFIG --libs-only-l openssl 2>/dev/null`
+
+      SSL_LDFLAGS=`PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" \
+        $PKGCONFIG --libs-only-L openssl 2>/dev/null`
+
+      SSL_CPPFLAGS=`PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" \
+        $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
 
       AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
       AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
@@ -1276,10 +1279,6 @@ if test X"$OPT_SSL" != Xno; then
     fi
   fi
 
-  dnl we're done using pkg-config for openssl
-  PKG_CONFIG_LIBDIR="$SAVE_PKG_CONFIG_LIBDIR"
-  export PKG_CONFIG_LIBDIR
-
   dnl finally, set flags to use SSL
   CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
   LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to