Skip to content

Instantly share code, notes, and snippets.

@bagder
Last active February 21, 2022 16:13
Show Gist options
  • Save bagder/238cfa513f4941de375a9638f9683cec to your computer and use it in GitHub Desktop.
Save bagder/238cfa513f4941de375a9638f9683cec to your computer and use it in GitHub Desktop.
configure patch to detect the msh3 library (without pkg-config)
From 7777d7bffac52b240ceedbb65d4dce75ade9874d Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 21 Feb 2022 17:09:23 +0100
Subject: [PATCH] configure: detect msh3
---
configure.ac | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/configure.ac b/configure.ac
index c039a0453..e5d0f0aa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3033,10 +3033,82 @@ AC_INCLUDES_DEFAULT
AC_MSG_ERROR([--with-quiche was specified but could not find quiche pkg-config file.])
fi
fi
fi
+dnl **********************************************************************
+dnl Check for msh3 (QUIC)
+dnl **********************************************************************
+
+OPT_MSH3="no"
+
+if test "x$disable_http" = "xyes" -o "x$USE_NGTCP" = "x1"; then
+ # without HTTP or with ngtcp2, msh3 is no use
+ OPT_MSH3="no"
+fi
+
+AC_ARG_WITH(msh3,
+AS_HELP_STRING([--with-msh3=PATH],[Enable msh3 usage])
+AS_HELP_STRING([--without-msh3],[Disable msh3 usage]),
+ [OPT_MSH3=$withval])
+case "$OPT_MSH3" in
+ no)
+ dnl --without-msh3 option used
+ want_msh3="no"
+ ;;
+ yes)
+ dnl --with-msh3 option used without path
+ want_msh3="default"
+ want_msh3_path=""
+ ;;
+ *)
+ dnl --with-msh3 option used with path
+ want_msh3="yes"
+ want_msh3_path="$withval"
+ ;;
+esac
+
+if test X"$want_msh3" != Xno; then
+
+ if test "$NGHTTP3_ENABLED" = 1; then
+ AC_MSG_ERROR([--with-msh3 and --with-ngtcp2 are mutually exclusive])
+ fi
+
+ dnl backup the pre-msh3 variables
+ CLEANLDFLAGS="$LDFLAGS"
+ CLEANCPPFLAGS="$CPPFLAGS"
+ CLEANLIBS="$LIBS"
+
+ if test -n "$want_msh3_path"; then
+ LD_MSH3="-L$want_msh3_path/lib"
+ CPP_MSH3="-I$want_msh3_path/include"
+ DIR_MSH3="$want_msh3_path/lib"
+ LDFLAGS="$LDFLAGS $LD_MSH3"
+ CPPFLAGS="$CPPFLAGS $CPP_MSH3"
+ fi
+ LIBS="-lmsquic $LIBS"
+
+ AC_CHECK_LIB(msh3, MsH3ConnectionOpen,
+ [
+ AC_CHECK_HEADERS(msh3.h,
+ curl_h3_msg="enabled (msh3)"
+ MSH3_ENABLED=1
+ AC_DEFINE(USE_MSH3, 1, [if msh3 is in use])
+ AC_SUBST(USE_MSH3, [1])
+ CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_MSH3"
+ export CURL_LIBRARY_PATH
+ AC_MSG_NOTICE([Added $DIR_MSH3 to CURL_LIBRARY_PATH]),
+ experimental="$experimental HTTP3"
+ )
+ ],
+ dnl not found, revert back to clean variables
+ LDFLAGS=$CLEANLDFLAGS
+ CPPFLAGS=$CLEANCPPFLAGS
+ LIBS=$CLEANLIBS
+ )
+fi
+
dnl **********************************************************************
dnl Check for zsh completion path
dnl **********************************************************************
OPT_ZSH_FPATH=default
--
2.35.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment