-AC_ARG_WITH(gnutls, [ --with-gnutls[=PFX] Compile in GNU TLS support for POP/IMAP],
-[ if test "$need_ssl" = "yes"
- then
- AC_MSG_ERROR([In order to compile in GNU TLS support, you must first disable SSL support])
- fi
- if test "$with_gnutls" != "no"
- then
- if test "$need_socket" != "yes"; then
- AC_MSG_ERROR([GNU TLS support is only useful with POP or IMAP support])
- fi
- if test "$with_gnutls" != "yes"
- then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- fi
-#saved_LIBS="$LIBS"
-
- AC_CHECK_LIB([gnutls], [gnutls_init],, AC_MSG_ERROR(Unable to find GNU TLS library))
-
- AC_DEFINE(USE_GNUTLS,1,[ Define if you want support for GNU TLS. ])
-#LIBS="$saved_LIBS"
-#MUTTLIBS="$MUTTLIBS -lgnutls"
- MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
- need_gnutls=yes
- fi
-])
-AM_CONDITIONAL(USE_GNUTLS, test x$need_gnutls = xyes)
-
-dnl SSL support via NSS
-AC_ARG_WITH(nss, [ --with-nss[=PFX] Compile in SSL support for POP/IMAP via NSS],
-[ if test "$with_nss" != no
- then
- if test "$need_socket" != "yes"; then
- AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
- fi
-
- if test "$with_nss" != "yes"
- then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/public/security"
- fi
-
- AC_DEFINE(USE_NSS,1,[ Define if you want support for SSL via the NSS library. ])
- MUTTLIBS="$MUTTLIBS -lssl -lnss -lcertdb -lcerthi -lcryptohi"
- MUTTLIBS="$MUTTLIBS -lpk11wrap -lsoftoken -lsecutil -ldbm -lplds4 -lplc4 -lfreebl"
- MUTTLIBS="$MUTTLIBS -lnspr4"
-
- MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_nss.o"
- need_ssl=yes
- fi
-])
-
-AC_ARG_WITH(sasl, [ --with-sasl[=PFX] Use Cyrus SASL library for POP/IMAP authentication],
- [
- if test "$need_socket" != "yes"
- then
- AC_MSG_ERROR([SASL support is only useful with POP or IMAP support])
- fi
-
- if test "$with_sasl" != "no"
- then
- if test "$with_sasl" != "yes"
- then
- CPPFLAGS="$CPPFLAGS -I$with_sasl/include"
- LDFLAGS="$LDFLAGS -L$with_sasl/lib"
- fi
-
- saved_LIBS="$LIBS"
-
- AC_CHECK_LIB(sasl, sasl_client_init,,
- AC_MSG_ERROR([could not find libsasl]),)
+AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]),
+ [gnutls_prefix="$withval"], [gnutls_prefix="no"])
+if test "$gnutls_prefix" != "no"
+then
+ if test "$need_socket" != "yes"
+ then
+ AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
+ fi
+ if test x"$need_ssl" = x"yes"
+ then
+ AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
+ fi
+ MUTT_AM_PATH_GNUTLS([$gnutls_prefix],
+ [dnl GNUTLS found
+ CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
+ MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"
+ AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.])
+
+ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
+ need_ssl=yes],
+ [dnl GNUTLS not found
+ AC_MSG_ERROR([could not find libgnutls])
+ ])
+fi