configure: use the nghttp2 path correctly with pkg-config

When --with-nghttp2 was used (without a given path), the
PKG_CONFIG_LIBDIR varialbe could get clobbered and ruin a proper
detection of the library.

Reported-by: Dilyan Palauzov
Bug: http://curl.haxx.se/mail/lib-2014-04/0159.html
This commit is contained in:
Daniel Stenberg 2014-04-22 00:24:44 +02:00
parent 11ce2f2182
commit a5d7ec1848
1 changed files with 7 additions and 9 deletions

View File

@ -2737,13 +2737,12 @@ AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
case "$OPT_H2" in
no)
dnl --without-nghttp2 option used
want_idn="no"
want_h2="no"
AC_MSG_RESULT([no])
;;
default)
dnl configure option not specified
want_h2="no"
want_h2_path="default"
AC_MSG_RESULT([no])
;;
yes)
@ -2755,31 +2754,30 @@ case "$OPT_H2" in
*)
dnl --with-nghttp2 option used with path
want_h2="yes"
want_h2_path="$withval"
want_h2_path="$withval/lib/pkgconfig"
AC_MSG_RESULT([yes ($withval)])
;;
esac
curl_h2_msg="disabled (--with-nghttp2)"
if test X"$OPT_H2" != Xno; then
if test X"$want_h2" != Xno; then
dnl backup the pre-nghttp2 variables
CLEANLDFLAGS="$LDFLAGS"
CLEANCPPFLAGS="$CPPFLAGS"
CLEANLIBS="$LIBS"
h2pcdir=${want_h2_path}/lib/pkgconfig
CURL_CHECK_PKGCONFIG(libnghttp2, $h2pcdir)
CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
if test "$PKGCONFIG" != "no" ; then
LIB_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
$PKGCONFIG --libs-only-l libnghttp2`
AC_MSG_NOTICE([-l is $LIB_H2])
CPP_H2=`CURL_EXPORT_PCDIR([$h2pcdir]) dnl
CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
$PKGCONFIG --cflags-only-I libnghttp2`
AC_MSG_NOTICE([-I is $CPP_H2])
LD_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
$PKGCONFIG --libs-only-L libnghttp2`
AC_MSG_NOTICE([-L is $LD_H2])