1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 09:08:49 -05:00

configure: use pkg-config to detect quiche

This removes the need to hard-code the quiche target path in
configure.ac.

This depends on https://github.com/cloudflare/quiche/pull/128

Closes #4237
This commit is contained in:
Alessandro Ghedini 2019-08-18 15:03:51 +01:00 committed by Daniel Stenberg
parent 6a90c9e0c4
commit 08b99e17df
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 60 additions and 36 deletions

View File

@ -101,7 +101,7 @@ matrix:
compiler: gcc compiler: gcc
dist: xenial dist: xenial
env: env:
- T=novalgrind BORINGSSL=yes QUICHE="yes" C="--with-ssl=$HOME/boringssl --with-quiche=$home/quiche --enable-alt-svc" LD_LIBRARY_PATH=/home/travis/boringssl/lib:/usr/local/lib - T=novalgrind BORINGSSL=yes QUICHE="yes" C="--with-ssl=$HOME/boringssl --with-quiche=$HOME/quiche/target/release --enable-alt-svc" LD_LIBRARY_PATH=/home/travis/boringssl/lib:$HOME/quiche/target/release:/usr/local/lib
- OVERRIDE_CC="CC=gcc-8" OVERRIDE_CXX="CXX=g++-8" - OVERRIDE_CC="CC=gcc-8" OVERRIDE_CXX="CXX=g++-8"
addons: addons:
apt: apt:
@ -435,7 +435,7 @@ before_script:
curl https://sh.rustup.rs -sSf | sh -s -- -y && curl https://sh.rustup.rs -sSf | sh -s -- -y &&
source $HOME/.cargo/env && source $HOME/.cargo/env &&
cd quiche && cd quiche &&
QUICHE_BSSL_PATH=$HOME/boringssl cargo build -v --release) QUICHE_BSSL_PATH=$HOME/boringssl cargo build -v --release --features pkg-config-meta)
fi fi
- | - |
if [ $TRAVIS_OS_NAME = linux ]; then if [ $TRAVIS_OS_NAME = linux ]; then

View File

@ -3534,14 +3534,19 @@ AC_HELP_STRING([--with-quiche=PATH],[Enable quiche usage])
AC_HELP_STRING([--without-quiche],[Disable quiche usage]), AC_HELP_STRING([--without-quiche],[Disable quiche usage]),
[OPT_QUICHE=$withval]) [OPT_QUICHE=$withval])
case "$OPT_QUICHE" in case "$OPT_QUICHE" in
*) no)
dnl --without-quiche option used
want_quiche="no"
;;
yes)
dnl --with-quiche option used without path dnl --with-quiche option used without path
want_quiche="default" want_quiche="default"
want_quiche_path="" want_quiche_path=""
;; ;;
no) *)
dnl --without-quiche option used dnl --with-quiche option used with path
want_quiche="no" want_quiche="yes"
want_quiche_path="$withval"
;; ;;
esac esac
@ -3551,9 +3556,20 @@ if test X"$want_quiche" != Xno; then
CLEANCPPFLAGS="$CPPFLAGS" CLEANCPPFLAGS="$CPPFLAGS"
CLEANLIBS="$LIBS" CLEANLIBS="$LIBS"
LIB_QUICHE="-lquiche -ldl -lpthread" CURL_CHECK_PKGCONFIG(quiche, $want_quiche_path)
CPP_QUICHE="-I$OPT_QUICHE/include"
LD_QUICHE="-L$OPT_QUICHE/target/release" if test "$PKGCONFIG" != "no" ; then
LIB_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
$PKGCONFIG --libs-only-l quiche`
AC_MSG_NOTICE([-l is $LIB_QUICHE])
CPP_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) dnl
$PKGCONFIG --cflags-only-I quiche`
AC_MSG_NOTICE([-I is $CPP_QUICHE])
LD_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
$PKGCONFIG --libs-only-L quiche`
AC_MSG_NOTICE([-L is $LD_QUICHE])
LDFLAGS="$LDFLAGS $LD_QUICHE" LDFLAGS="$LDFLAGS $LD_QUICHE"
CPPFLAGS="$CPPFLAGS $CPP_QUICHE" CPPFLAGS="$CPPFLAGS $CPP_QUICHE"
@ -3581,6 +3597,14 @@ if test X"$want_quiche" != Xno; then
CPPFLAGS=$CLEANCPPFLAGS CPPFLAGS=$CLEANCPPFLAGS
LIBS=$CLEANLIBS LIBS=$CLEANLIBS
) )
else
dnl no nghttp3 pkg-config found, deal with it
if test X"$want_quiche" != Xdefault; then
dnl To avoid link errors, we do not allow --with-nghttp3 without
dnl a pkgconfig file
AC_MSG_ERROR([--with-quiche was specified but could not find quiche pkg-config file.])
fi
fi
fi fi
dnl ********************************************************************** dnl **********************************************************************

View File

@ -84,10 +84,10 @@ you'll just get ld.so linker errors.
Clone quiche and BoringSSL: Clone quiche and BoringSSL:
% git clone --recursive https://github.com/cloudflare/quiche % git clone --recursive https://github.com/cloudflare/quiche
% cd quiche/deps/boringssl
Build BoringSSL (it needs to be built manually so it can be reused with curl): Build BoringSSL (it needs to be built manually so it can be reused with curl):
% cd quiche/deps/boringssl
% mkdir build % mkdir build
% cd build % cd build
% cmake -DCMAKE_POSITION_INDEPENDENT_CODE=on .. % cmake -DCMAKE_POSITION_INDEPENDENT_CODE=on ..
@ -100,7 +100,7 @@ Build BoringSSL (it needs to be built manually so it can be reused with curl):
Build quiche: Build quiche:
% cd ../.. % cd ../..
% QUICHE_BSSL_PATH=$PWD/deps/boringssl cargo build --release % QUICHE_BSSL_PATH=$PWD/deps/boringssl cargo build --release --features pkg-config-meta
Clone and build curl: Clone and build curl:
@ -108,7 +108,7 @@ Clone and build curl:
% git clone https://github.com/curl/curl % git clone https://github.com/curl/curl
% cd curl % cd curl
% ./buildconf % ./buildconf
% ./configure --with-ssl=$PWD/../quiche/deps/boringssl/.openssl --with-quiche=$PWD/../quiche --enable-debug % ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/.openssl --with-quiche=$PWD/../quiche/target/release
% make -j`nproc` % make -j`nproc`
## Running ## Running