+dnl
+dnl Use the md5 lib if available (Solaris).
+dnl
+
+if test x$wget_need_md5 = xyes
+then
+ AC_DEFINE(HAVE_MD5)
+ AC_CHECK_LIB(md5, MD5Update, [
+ AC_DEFINE(HAVE_SOLARIS_MD5)
+ LIBS="-lmd5 $LIBS"
+ ], [
+ MD5_OBJ='gnu-md5$o'
+ AC_DEFINE(HAVE_BUILTIN_MD5)
+ ])
+fi
+AC_SUBST(MD5_OBJ)
+
+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
+