From 31ba404a9c0103041f6ec37de371b436aa4b1bdd Mon Sep 17 00:00:00 2001 From: Yiming Jing Date: Mon, 10 Sep 2018 13:07:40 -0700 Subject: configure.ac: add a MesaLink vtls backend --- configure.ac | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- lib/Makefile.inc | 4 +-- 2 files changed, 97 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 1e068cb37..fdfd0897c 100755 --- a/configure.ac +++ b/configure.ac @@ -158,7 +158,7 @@ AC_SUBST(PKGADD_VENDOR) dnl dnl initialize all the info variables - curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )" + curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl,mesalink} )" curl_ssh_msg="no (--with-libssh2)" curl_zlib_msg="no (--with-zlib)" curl_brotli_msg="no (--with-brotli)" @@ -2409,6 +2409,98 @@ if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" fi +dnl ---------------------------------------------------- +dnl check for MesaLink +dnl ---------------------------------------------------- + +dnl Default to compiler & linker defaults for MesaLink files & libraries. +OPT_MESALINK=no + +_cppflags=$CPPFLAGS +_ldflags=$LDFLAGS +AC_ARG_WITH(mesalink,dnl +AC_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root]) +AC_HELP_STRING([--without-mesalink], [disable MesaLink detection]), + OPT_MESALINK=$withval) + +if test -z "$ssl_backends" -o "x$OPT_MESALINK" != xno; then + ssl_msg= + + if test X"$OPT_MESALINK" != Xno; then + + if test "$OPT_MESALINK" = "yes"; then + OPT_MESALINK="" + fi + + if test -z "$OPT_MESALINK" ; then + dnl check for lib first without setting any new path + + AC_CHECK_LIB(mesalink, mesalink_library_init, + dnl libmesalink found, set the variable + [ + AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled]) + AC_SUBST(USE_MESALINK, [1]) + MESALINK_ENABLED=1 + USE_MESALINK="yes" + ssl_msg="MesaLink" + test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes + ]) + fi + + addld="" + addlib="" + addcflags="" + mesalinklib="" + + if test "x$USE_MESALINK" != "xyes"; then + dnl add the path and test again + addld=-L$OPT_MESALINK/lib$libsuff + addcflags=-I$OPT_MESALINK/include + mesalinklib=$OPT_MESALINK/lib$libsuff + + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + AC_CHECK_LIB(mesalink, mesalink_library_init, + [ + AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled]) + AC_SUBST(USE_MESALINK, [1]) + MESALINK_ENABLED=1 + USE_MESALINK="yes" + ssl_msg="MesaLink" + test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes + ], + [ + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags + ]) + fi + + if test "x$USE_MESALINK" = "xyes"; then + AC_MSG_NOTICE([detected MesaLink]) + + LIBS="-lmesalink $LIBS" + + if test -n "$mesalinklib"; then + dnl when shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl LD_LIBRARY_PATH to prevent further configure tests to fail + dnl due to this + if test "x$cross_compiling" != "xyes"; then + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mesalinklib" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $mesalinklib to LD_LIBRARY_PATH]) + fi + fi + fi + + fi dnl MesaLink not disabled + + test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" +fi + dnl ---------------------------------------------------- dnl NSS. Only check if GnuTLS and OpenSSL are not enabled dnl ---------------------------------------------------- @@ -2599,10 +2691,10 @@ if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" fi -case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in +case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED$MESALINK_ENABLED" in x) AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.]) - AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.]) + AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, --with-darwinssl, or --with-mesalink to address this.]) ;; x1) # one SSL backend is enabled diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 83a27dd0b..4aa042259 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -30,12 +30,12 @@ LIB_VAUTH_HFILES = vauth/vauth.h vauth/digest.h vauth/ntlm.h LIB_VTLS_CFILES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c \ vtls/polarssl.c vtls/polarssl_threadlock.c vtls/axtls.c \ vtls/cyassl.c vtls/schannel.c vtls/schannel_verify.c \ - vtls/darwinssl.c vtls/gskit.c vtls/mbedtls.c + vtls/darwinssl.c vtls/gskit.c vtls/mbedtls.c vtls/mesalink.c LIB_VTLS_HFILES = vtls/openssl.h vtls/vtls.h vtls/gtls.h \ vtls/nssg.h vtls/polarssl.h vtls/polarssl_threadlock.h vtls/axtls.h \ vtls/cyassl.h vtls/schannel.h vtls/darwinssl.h vtls/gskit.h \ - vtls/mbedtls.h + vtls/mbedtls.h vtls/mesalink.h LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ -- cgit v1.2.3