* configure.ac: Use pkg-config for gpgme, libidn2 and nettle

This commit is contained in:
Tim Rühsen 2022-01-22 19:59:33 +01:00
parent c984cb316a
commit a24e67e239

View File

@ -625,32 +625,31 @@ then
if test x"$ENABLE_NTLM" != xno if test x"$ENABLE_NTLM" != xno
then then
ENABLE_NTLM=yes ENABLE_NTLM=yes
AC_DEFINE([ENABLE_NTLM], 1, AC_DEFINE([ENABLE_NTLM], 1, [Define if you want the NTLM authorization support compiled in.])
[Define if you want the NTLM authorization support compiled in.])
AC_LIBOBJ([http-ntlm]) AC_LIBOBJ([http-ntlm])
fi fi
else else
AC_CHECK_LIB(nettle, nettle_md4_init, [HAVE_NETTLE=yes], [HAVE_NETTLE=no; AC_MSG_WARN(*** libnettle was not found. You will not be able to use NTLM)]) PKG_CHECK_MODULES([NETTLE], nettle, [
HAVE_NETTLE=yes
if test x"$HAVE_NETTLE" = xyes LIBS="$NETTLE_LIBS $LIBS"
then CFLAGS="$NETTLE_CFLAGS $CFLAGS"
AC_SUBST(NETTLE_LIBS, "-lnettle") ], [
AC_DEFINE([HAVE_NETTLE], [1], [Use libnettle]) AC_CHECK_LIB(nettle, nettle_md4_init, [HAVE_NETTLE=yes], [HAVE_NETTLE=no; AC_MSG_WARN(*** libnettle was not found. You will not be able to use NTLM)])
if test x"$ENABLE_NTLM" != xno if test x"$HAVE_NETTLE" != xyes; then
then if test x"$ENABLE_NTLM" = xyes; then
ENABLE_NTLM=yes AC_MSG_ERROR([NTLM authorization requested and SSL not enabled; aborting])
AC_DEFINE([ENABLE_NTLM], 1, fi
[Define if you want the NTLM authorization support compiled in.]) else
AC_LIBOBJ([http-ntlm]) AC_SUBST(NETTLE_LIBS, "-lnettle")
LIBS="$NETTLE_LIBS $LIBS" LIBS="$NETTLE_LIBS $LIBS"
fi fi
else ])
dnl If SSL is unavailable and the user explicitly requested NTLM,
dnl abort. if test x"$HAVE_NETTLE" = xyes; then
if test x"$ENABLE_NTLM" = xyes AC_DEFINE([HAVE_NETTLE], [1], [Use libnettle])
then ENABLE_NTLM=yes
AC_MSG_ERROR([NTLM authorization requested and SSL not enabled; aborting]) AC_DEFINE([ENABLE_NTLM], 1, [Define if you want the NTLM authorization support compiled in.])
fi AC_LIBOBJ([http-ntlm])
fi fi
fi fi
@ -789,19 +788,18 @@ AS_IF([test "X$iri" != "Xno"],[
fi fi
]) ])
AC_ARG_WITH(libidn, AS_HELP_STRING([--with-libidn=[DIR]],[Support IDN2008/IRIs (needs GNU libidn2 + libunicode)]),
libidn=$withval, libidn="")
if test "X$iri" != "Xno"; then if test "X$iri" != "Xno"; then
AS_IF([test "x$with_libidn2" != xno], [ AS_IF([test "x$with_libidn2" != xno], [
AC_SEARCH_LIBS(idn2_lookup_u8, idn2, PKG_CHECK_MODULES([LIBIDN2], [libidn2 >= 0.14.0], [
[with_libidn2=yes; AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])], with_libidn2=yes
[with_libidn2=no; iri=no; AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)]) LIBS="$LIBIDN2_LIBS $LIBS"
CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
# AS_IF([test "x$with_libidn2" = xyes], [ AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])
# AC_SEARCH_LIBS(u8_tolower, unistring, ], [
# [AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])], AC_SEARCH_LIBS(idn2_lookup_u8, idn2,
# [iri=no; AC_MSG_WARN(*** LIBUNISTRING was not found. You will not be able to use IDN2008 support)]) [with_libidn2=yes; AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])],
# ]) [with_libidn2=no; iri=no; AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)])
])
]) ])
fi fi
@ -930,15 +928,22 @@ AS_IF([test x"$with_metalink" != xno], [
dnl dnl
dnl Check for GPGME dnl Check for GPGME
dnl dnl
m4_ifdef([AM_PATH_GPGME], [ PKG_CHECK_MODULES([GPGME], gpgme, [
AM_PATH_GPGME([], [ LIBS="$LIBS $GPGME_LIBS"
# Put libgpgme to the end of the library list since it introduces a -L linker flags. CFLAGS="$GPGME_CFLAGS $CFLAGS"
# That -L might break the build if there are two different version of AC_DEFINE([HAVE_GPGME], [1], [Define if GPGME is available.])
# a library (e.g. GnuTLS) in /usr/local and in the system directory. have_gpg=yes
LIBS="$LIBS $GPGME_LIBS" ], [
CFLAGS="$GPGME_CFLAGS $CFLAGS" m4_ifdef([AM_PATH_GPGME], [
AC_DEFINE([HAVE_GPGME], [1], [Define if GPGME is available.]) AM_PATH_GPGME([], [
have_gpg=yes # Put libgpgme to the end of the library list since it introduces a -L linker flags.
# That -L might break the build if there are two different version of
# a library (e.g. GnuTLS) in /usr/local and in the system directory.
LIBS="$LIBS $GPGME_LIBS"
CFLAGS="$GPGME_CFLAGS $CFLAGS"
AC_DEFINE([HAVE_GPGME], [1], [Define if GPGME is available.])
have_gpg=yes
])
]) ])
]) ])
]) ])