From 72ff420d2c99926353a5823f9c46790c3c44f0b3 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Sun, 24 Mar 2019 19:30:08 +0900
Subject: [PATCH] Compile with nghttp3

---
 configure.ac         | 8 ++++++++
 examples/Makefile.am | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index ee3c8b8d..b159378c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,6 +126,13 @@ if test "x${have_openssl}" = "xno"; then
   AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
 fi
 
+# nghttp3 (for examples)
+PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 0.0.0],
+                  [have_libnghttp3=yes], [have_libnghttp3=no])
+if test "${have_libnghttp3}" = "xno"; then
+  AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS)
+fi
+
 # libev (for examples)
 # libev does not have pkg-config file.  Check it in an old way.
 save_LIBS=$LIBS
@@ -325,4 +332,5 @@ AC_MSG_NOTICE([summary of build options:
     Libs:
       OpenSSL:        ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}')
       Libev:          ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}')
+      Libnghttp3:     ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}')
 ])
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 7492038c..16a1d243 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -29,12 +29,14 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/third-party \
 	@OPENSSL_CFLAGS@ \
 	@LIBEV_CFLAGS@ \
+	@LIBNGHTTP3_CFLAGS@ \
 	@DEFS@
 AM_LDFLAGS = -no-install
 LDADD = $(top_builddir)/lib/libngtcp2.la \
 	$(top_builddir)/third-party/libhttp-parser.la \
 	@OPENSSL_LIBS@ \
-	@LIBEV_LIBS@
+	@LIBEV_LIBS@ \
+	@LIBNGHTTP3_LIBS@
 
 noinst_PROGRAMS = client server
 
-- 
GitLab