-dnl On Solaris, -lnsl is needed to use gethostbyname. On "NCR MP-RAS
-dnl 3.0", however, gethostbyname is in libc, but -lnsl is still needed
-dnl to use -lsocket, as well as for functions such as inet_ntoa. We
-dnl look for such known offenders and if one of them is not found, we
-dnl check if -lnsl is needed.
-
-wget_check_in_nsl=NONE
-AC_CHECK_FUNCS(gethostbyname, [], [
- wget_check_in_nsl=gethostbyname
-])
-AC_CHECK_FUNCS(inet_ntoa, [], [
- wget_check_in_nsl=inet_ntoa
-])
-if test $wget_check_in_nsl != NONE; then
- AC_CHECK_LIB(nsl, $wget_check_in_nsl)
-fi
-
-AC_CHECK_LIB(socket, socket)
-
-dnl #### This appears to be deficient with later versions of SOCKS.
-if test "x${with_socks}" = xyes
-then
- AC_CHECK_LIB(resolv, main)
- AC_CHECK_LIB(socks, Rconnect)
-fi
-
-dnl $with_ssl can be one of:
-dnl - empty string or "auto", meaning autodetect SSL and use it if found.
-dnl - "yes", meaning link with SSL or bail out.
-dnl - "no", meaning don't link with SSL.
-dnl - anything else, meaning use that as the SSL root, and bail out
-dnl if it fails.
-
-if test x"$with_ssl" = x; then
- dnl Canonicalize unspecified with-ssl setting to "auto". This
- dnl implements the "auto-detect by default" feature. If you want to
- dnl change this to "ignore SSL by default", change "auto" to "no".
- with_ssl=auto
-fi
-
-dnl Detection of OpenSSL is much hairier than the detection of other
-dnl libraries because OpenSSL can be compiled as a third-party
-dnl library, which means it will not be found without additional
-dnl linker magic. It would be really nice to rework this check into
-dnl an AC_DEFUN so that we can reuse it for other third-party
-dnl libraries.
-
-if test x"$with_ssl" != x"no"; then
-
- wget_force_ssl=no
- if test x"$with_ssl" = x"yes"; then
- wget_force_ssl=yes
- fi
-
- if test x"$with_ssl" = x"yes" || test x"$with_ssl" = x"auto"; then
- dnl OpenSSL's root was not specified, so we have to guess. First
- dnl try the system default location, then "/usr/local/ssl" (where
- dnl OpenSSL installs by default), then "/usr/local" (traditional
- dnl choice for installation root), then "/opt".
- ssl_all_roots="system-default /usr/local/ssl /usr/local /opt"
+AS_IF([test x"$with_ssl" = xgnutls], [
+ dnl Now actually check for -lssl
+ AC_LIB_HAVE_LINKFLAGS([gnutls], [], [
+#include <gnutls/gnutls.h>
+ ], [gnutls_global_init()])
+ if test x"$LIBGNUTLS" != x
+ then
+ AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
+ SSL_OBJ='gnutls.o'