]> sjero.net Git - wget/blobdiff - configure.in
[svn] Make the MD5 references even more generic.
[wget] / configure.in
index ee755dfa275a138192a74186662c826094741dae..0ed629bf81f803c5d95db2b7cb92701fda4a1a51 100644 (file)
@@ -63,14 +63,15 @@ AC_ARG_ENABLE(debug,
 DEBUG=$enableval, DEBUG=yes)
 test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG)
 
+wget_need_md5=no
+
 case "${USE_OPIE}${USE_DIGEST}" in
 *yes*)
-       MD5_OBJ='md5$o'
+       wget_need_md5=yes
 esac
 if test x"$USE_OPIE" = xyes; then
   OPIE_OBJ='ftp-opie$o'
 fi
-AC_SUBST(MD5_OBJ)
 AC_SUBST(OPIE_OBJ)
 
 dnl
@@ -154,7 +155,7 @@ dnl
 dnl Checks for headers
 dnl
 AC_CHECK_HEADERS(string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h)
-AC_CHECK_HEADERS(sys/select.h sys/utsname.h pwd.h signal.h)
+AC_CHECK_HEADERS(sys/ioctl.h sys/select.h sys/utsname.h pwd.h signal.h)
 AC_HEADER_TIME
 
 dnl
@@ -171,10 +172,18 @@ dnl Checks for library functions.
 dnl
 AC_FUNC_ALLOCA
 AC_FUNC_MMAP
-AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp)
+AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp strpbrk)
 AC_CHECK_FUNCS(gettimeofday mktime strptime)
 AC_CHECK_FUNCS(strerror snprintf vsnprintf select signal symlink access isatty)
-AC_CHECK_FUNCS(uname gethostname)
+AC_CHECK_FUNCS(uname gethostname usleep)
+
+dnl
+dnl Check if we need to compile in getopt.c.
+dnl
+AC_CHECK_FUNC(getopt_long, [], [
+  GETOPT_OBJ='getopt$o'
+])
+AC_SUBST(GETOPT_OBJ)
 
 dnl
 dnl Checks for libraries.
@@ -327,6 +336,47 @@ main(){return 0;}
   CC=$wget_save_CC
 fi
 
+dnl
+dnl Find an md5 implementation.
+dnl
+
+dnl On Solaris, we use libmd5.  If we're compiled with OpenSSL, use
+dnl OpenSSL's md5 support.  Otherwise, use our own md5.
+
+if test x$wget_need_md5 = xyes
+then
+  MD5_OBJ='gen-md5$o'
+
+  found_md5=no
+
+  dnl First check for Solaris md5.
+  if test x$found_md5 = xno; then
+    AC_CHECK_LIB(md5, MD5Update, [
+      AC_DEFINE(HAVE_SOLARIS_MD5)
+      LIBS="-lmd5 $LIBS"
+      found_md5=yes
+    ])
+  fi
+
+  dnl Then see if we're linking OpenSSL anyway; if yes, use its md5
+  dnl implementation.
+  if test x$found_md5 = xno; then
+    if test x$ssl_linked = xyes; then
+      AC_DEFINE(HAVE_OPENSSL_MD5)
+      found_md5=yes
+    fi
+  fi
+
+  dnl If none of the above worked, use the builtin one.
+  if test x$found_md5 = xno; then
+    AC_DEFINE(HAVE_BUILTIN_MD5)
+    found_md5=yes
+    MD5_OBJ="$MD5_OBJ gnu-md5\$o"
+  fi
+fi
+AC_DEFINE(HAVE_MD5)
+AC_SUBST(MD5_OBJ)
+
 dnl
 dnl Set of available languages.
 dnl