cURL / Mailing Lists / curl-library / Single Mail

curl-library

Fwd: [PATCH v2] OpenSSL vs. NSS clash on PKG_CONFIG_LIBDIR

From: Yang Tse <yangsita_at_gmail.com>
Date: Wed, 13 Jan 2010 04:11:21 +0100

Forwarding to the list, et all

---------- Forwarded message ----------
From: Yang Tse <yangsita_at_gmail.com>
Date: 13/01/2010 04:04
Subject: Re: [PATCH v2] OpenSSL vs. NSS clash on PKG_CONFIG_LIBDIR
To: Kamil Dudka <kdudka_at_redhat.com>

2010/1/13, Kamil Dudka wrote:

> 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?

If the problem was that PKG_CONFIG_LIBDIR should not be set, modified,
unset or marked for export inside the configure shell script, then it
is simple we should not do anything of the above in the configure
shell script.

But nothing prevents us from setting and exporting PKG_CONFIG_LIBDIR
in a sub-shell and running pkg-config inside from that child-shell
using for example several commands inside back-ticks in order to get
the result into some variable, without actually touching the
PKG_CONFIG_LIBDIR at the configure script level.

Hmm, not sure if the above is clear enough. I mean something like ...

if test -z "$MY_PKG_CONFIG_LIBDIR"; then

SSL_LIBS=`${PKGCONFIG} --libs-only-l openssl 2>/dev/null`

else

SSL_LIBS=`PKG_CONFIG_LIBDIR=${MY_PKG_CONFIG_LIBDIR}; export
PKG_CONFIG_LIBDIR; ${PKGCONFIG} --libs-only-l openssl 2>/dev/null`

fi

The only ticks above there are the opening and closing back-ticks
after SSL_LIBS=

In that way we should be able to run pkg-config without disturbing
PKG_CONFIG_LIBDIR in the configure shell script, it is only modified
inside the child-shell.

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

Looking at your patch...

+ 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`

I would give a try to the semicolons and export statement there,
besides not setting PKG_CONFIG_LIBDIR unless OPENSSL_PCDIR should be
used.

Relative to the next one, we are polluting current PKG_CONFIG_LIBDIR.
Wasn't this the initial problem? Something similar to the up-above
could be done when calling CURL_CHECK_PKGCONFIG, perhaps it could
benefit from an additional parameter.

+ PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" CURL_CHECK_PKGCONFIG(openssl)

--
-=[Yang]=-
-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-13