+# Check whether --with-gnutls or --without-gnutls was given.
+if test "${with_gnutls+set}" = set; then
+ withval="$with_gnutls"
+ if test "$need_ssl" = "yes"
+ then
+ { echo "configure: error: In order to compile in GNU TLS support, you must first disable SSL support" 1>&2; exit 1; }
+ fi
+ if test "$with_gnutls" != "no"
+ then
+ if test "$need_socket" != "yes"; then
+ { echo "configure: error: GNU TLS support is only useful with POP or IMAP support" 1>&2; exit 1; }
+ fi
+ if test "$with_gnutls" != "yes"
+ then
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ fi
+#saved_LIBS="$LIBS"
+
+ echo $ac_n "checking for gnutls_init in -lgnutls""... $ac_c" 1>&6
+echo "configure:5624: checking for gnutls_init in -lgnutls" >&5
+ac_lib_var=`echo gnutls'_'gnutls_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lgnutls $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5632 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gnutls_init();
+
+int main() {
+gnutls_init()
+; return 0; }
+EOF
+if { (eval echo configure:5643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo gnutls | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lgnutls $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+{ echo "configure: error: Unable to find GNU TLS library" 1>&2; exit 1; }
+fi
+
+
+ cat >> confdefs.h <<\EOF
+#define USE_GNUTLS 1
+EOF
+
+#LIBS="$saved_LIBS"
+#MUTTLIBS="$MUTTLIBS -lgnutls"
+ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
+ need_gnutls=yes
+ fi
+
+fi
+
+
+
+if test x$need_gnutls = xyes; then
+ USE_GNUTLS_TRUE=
+ USE_GNUTLS_FALSE='#'
+else
+ USE_GNUTLS_TRUE='#'
+ USE_GNUTLS_FALSE=
+fi
+