nghttp3: required when ngtcp2 is used for QUIC

- checked for by configure
- updated docs/HTTP3.md
- shown in the version string

Closes #4210
This commit is contained in:
Daniel Stenberg 2019-08-10 23:19:55 +02:00
parent 17d1e27d30
commit d85a1cf11d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 128 additions and 9 deletions

View File

@ -3402,14 +3402,12 @@ if test X"$want_tcp2" != Xno; then
AC_CHECK_LIB(ngtcp2, ngtcp2_conn_client_new,
[
AC_CHECK_HEADERS(ngtcp2/ngtcp2.h,
curl_h3_msg="enabled (ngtcp2)"
NGTCP2_ENABLED=1
AC_DEFINE(USE_NGTCP2, 1, [if ngtcp2 is in use])
AC_SUBST(USE_NGTCP2, [1])
CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_TCP2"
export CURL_LIBRARY_PATH
AC_MSG_NOTICE([Added $DIR_TCP2 to CURL_LIBRARY_PATH])
experimental="$experimental HTTP3"
)
],
dnl not found, revert back to clean variables
@ -3429,6 +3427,97 @@ if test X"$want_tcp2" != Xno; then
fi
dnl **********************************************************************
dnl Check for nghttp3 (HTTP/3 with ngtcp2)
dnl **********************************************************************
OPT_NGHTTP3="yes"
if test "x$NGTCP2_ENABLED" = "x"; then
# without ngtcp2, nghttp3 is of no use for us
OPT_NGHTTP3="no"
fi
AC_ARG_WITH(nghttp3,
AC_HELP_STRING([--with-nghttp3=PATH],[Enable nghttp3 usage])
AC_HELP_STRING([--without-nghttp3],[Disable nghttp3 usage]),
[OPT_NGHTTP3=$withval])
case "$OPT_NGHTTP3" in
no)
dnl --without-nghttp3 option used
want_nghttp3="no"
;;
yes)
dnl --with-nghttp3 option used without path
want_nghttp3="default"
want_nghttp3_path=""
;;
*)
dnl --with-nghttp3 option used with path
want_nghttp3="yes"
want_nghttp3_path="$withval/lib/pkgconfig"
;;
esac
curl_http3_msg="disabled (--with-nghttp3)"
if test X"$want_nghttp3" != Xno; then
dnl backup the pre-nghttp3 variables
CLEANLDFLAGS="$LDFLAGS"
CLEANCPPFLAGS="$CPPFLAGS"
CLEANLIBS="$LIBS"
CURL_CHECK_PKGCONFIG(libnghttp3, $want_nghttp3_path)
if test "$PKGCONFIG" != "no" ; then
LIB_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
$PKGCONFIG --libs-only-l libnghttp3`
AC_MSG_NOTICE([-l is $LIB_NGHTTP3])
CPP_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) dnl
$PKGCONFIG --cflags-only-I libnghttp3`
AC_MSG_NOTICE([-I is $CPP_NGHTTP3])
LD_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
$PKGCONFIG --libs-only-L libnghttp3`
AC_MSG_NOTICE([-L is $LD_NGHTTP3])
LDFLAGS="$LDFLAGS $LD_NGHTTP3"
CPPFLAGS="$CPPFLAGS $CPP_NGHTTP3"
LIBS="$LIB_NGHTTP3 $LIBS"
if test "x$cross_compiling" != "xyes"; then
DIR_NGHTTP3=`echo $LD_NGHTTP3 | $SED -e 's/-L//'`
fi
AC_CHECK_LIB(nghttp3, nghttp3_conn_client_new,
[
AC_CHECK_HEADERS(nghttp3/nghttp3.h,
curl_h3_msg="enabled (ngtcp2 + nghttp3)"
NGHTTP3_ENABLED=1
AC_DEFINE(USE_NGHTTP3, 1, [if nghttp3 is in use])
AC_SUBST(USE_NGHTTP3, [1])
CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGHTTP3"
export CURL_LIBRARY_PATH
AC_MSG_NOTICE([Added $DIR_NGHTTP3 to CURL_LIBRARY_PATH])
experimental="$experimental HTTP3"
)
],
dnl not found, revert back to clean variables
LDFLAGS=$CLEANLDFLAGS
CPPFLAGS=$CLEANCPPFLAGS
LIBS=$CLEANLIBS
)
else
dnl no nghttp3 pkg-config found, deal with it
if test X"$want_nghttp3" != Xdefault; then
dnl To avoid link errors, we do not allow --with-nghttp3 without
dnl a pkgconfig file
AC_MSG_ERROR([--with-nghttp3 was specified but could not find nghttp3 pkg-config file.])
fi
fi
fi
dnl **********************************************************************
dnl Check for quiche (QUIC)
dnl **********************************************************************

View File

@ -31,12 +31,42 @@ in the master branch using pull-requests, just like ordinary changes.
## Build
1. clone ngtcp2 from git (the draft-22 branch)
2. build and install ngtcp2's custom OpenSSL version (the quic-draft-22 branch)
3. build and install nghttp3
4. build and install ngtcp2 according to its instructions
5. configure curl with ngtcp2 support: `./configure --with-ngtcp2=<install prefix>`
6. build curl "normally"
Build (patched) OpenSSL
% git clone --depth 1 -b quic-draft-22 https://github.com/tatsuhiro-t/openssl
% cd openssl
% ./config enable-tls1_3 --prefix=<somewhere1>
% make
% make install_sw
Build nghttp3
% cd ..
% git clone https://github.com/ngtcp2/nghttp3
% cd nghttp3
% autoreconf -i
% ./configure --prefix=<somewhere2> --enable-lib-only
% make
% make install
Build ngtcp2
% cd ..
% git clone -b draft-20 https://github.com/ngtcp2/ngtcp2
% cd ngtcp2
% autoreconf -i
% ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somehere1>/lib" --prefix==<somewhere3>
% make
% make install
Build curl
% cd ..
% git clone https://github.com/curl/curl
% cd curl
% ./buildconf
% LDFLAGS="-Wl,-rpath,<somewhere1>/lib" ./configure -with-ssl=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3>
% make
## Running

View File

@ -1055,7 +1055,7 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
*/
int Curl_quic_ver(char *p, size_t len)
{
return msnprintf(p, len, " ngtcp2/blabla");
return msnprintf(p, len, " ngtcp2/blabla nghttp3/bloblo");
}
CURLcode Curl_quic_is_connected(struct connectdata *conn, int sockindex,