+# fmod, logb, and frexp are found in -lm on most systems.
+# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
+AC_CHECK_LIB(m, sqrt)
+
+# Check for mail-locking functions in a "mail" library
+AC_CHECK_LIB(mail, maillock)
+dnl Debian, at least:
+dnl AC_CHECK_LIB(lockfile, maillock, [AC_DEFINE(HAVE_LIBMAIL)])
+AC_CHECK_LIB(lockfile, maillock)
+# If we have the shared liblockfile, assume we must use it for mail
+# locking (e.g. Debian). If we couldn't link against liblockfile
+# (no liblockfile.a installed), ensure that we don't need to.
+if test "$ac_cv_lib_lockfile_maillock" = no; then
+ dnl This works for files generally, not just executables.
+ dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
+ AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
+ /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
+ if test $ac_cv_prog_liblockfile = yes; then
+ AC_MSG_ERROR([Shared liblockfile found but can't link against it.
+This probably means that movemail could lose mail.
+There may be a \`development' package to install containing liblockfile.])
+ else AC_DEFINE(LIBMAIL, -llockfile)
+ fi
+ else :
+fi
+AC_CHECK_FUNCS(touchlock)
+AC_CHECK_HEADERS(maillock.h)
+
+AC_CHECK_FUNCS(gettimeofday gethostname getdomainname dup2 \
+rename closedir mkdir rmdir sysinfo \
+random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \
+strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
+utimes setrlimit setpgid getcwd shutdown strftime getaddrinfo \
+__fpending ftello getloadavg mblen mbrlen strsignal setitimer ualarm)
+
+AC_FUNC_MKTIME
+if test "$ac_cv_func_working_mktime" = no; then
+ AC_DEFINE(BROKEN_MKTIME)
+fi
+
+# Check this now, so that we will NOT find the above functions in ncurses.
+# That is because we have not set up to link ncurses in lib-src.
+# It's better to believe a function is not available
+# than to expect to find it in ncurses.
+AC_CHECK_LIB(ncurses, tparm)
+
+# These tell us which Kerberos-related libraries to use.
+if test "${with_kerberos+set}" = set; then
+ AC_CHECK_LIB(com_err, com_err)
+ AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
+ AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
+ AC_CHECK_LIB(krb5, krb5_init_context)
+ if test "${with_kerberos5+set}" != set; then
+ AC_CHECK_LIB(des425, des_cbc_encrypt,,
+ AC_CHECK_LIB(des, des_cbc_encrypt))
+ AC_CHECK_LIB(krb4, krb_get_cred,,
+ AC_CHECK_LIB(krb, krb_get_cred))
+ fi
+
+ if test "${with_kerberos5+set}" = set; then
+ AC_CHECK_HEADERS(krb5.h)
+ else
+ AC_CHECK_HEADERS(des.h,,
+ AC_CHECK_HEADERS(kerberosIV/des.h,,
+ AC_CHECK_HEADERS(kerberos/des.h)))
+ AC_CHECK_HEADERS(krb.h,,
+ AC_CHECK_HEADERS(kerberosIV/krb.h,,
+ AC_CHECK_HEADERS(kerberos/krb.h)))
+ fi
+ AC_CHECK_HEADERS(com_err.h)
+fi
+
+# Solaris requires -lintl if you want strerror (which calls dgettext)
+# to return localized messages.
+AC_CHECK_LIB(intl, dgettext)
+
+AC_MSG_CHECKING(whether localtime caches TZ)
+AC_CACHE_VAL(emacs_cv_localtime_cache,
+[if test x$ac_cv_func_tzset = xyes; then
+AC_TRY_RUN([#include <time.h>
+extern char **environ;
+unset_TZ ()
+{
+ char **from, **to;
+ for (to = from = environ; (*to = *from); from++)
+ if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
+ to++;
+}
+char TZ_GMT0[] = "TZ=GMT0";
+char TZ_PST8[] = "TZ=PST8";
+main()
+{
+ time_t now = time ((time_t *) 0);
+ int hour_GMT0, hour_unset;
+ if (putenv (TZ_GMT0) != 0)
+ exit (1);
+ hour_GMT0 = localtime (&now)->tm_hour;
+ unset_TZ ();
+ hour_unset = localtime (&now)->tm_hour;
+ if (putenv (TZ_PST8) != 0)
+ exit (1);
+ if (localtime (&now)->tm_hour == hour_GMT0)
+ exit (1);
+ unset_TZ ();
+ if (localtime (&now)->tm_hour != hour_unset)
+ exit (1);
+ exit (0);
+}], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
+[# If we have tzset, assume the worst when cross-compiling.
+emacs_cv_localtime_cache=yes])
+else
+ # If we lack tzset, report that localtime does not cache TZ,
+ # since we can't invalidate the cache if we don't have tzset.
+ emacs_cv_localtime_cache=no
+fi])dnl
+AC_MSG_RESULT($emacs_cv_localtime_cache)
+if test $emacs_cv_localtime_cache = yes; then
+ AC_DEFINE(LOCALTIME_CACHE)
+fi
+
+if test "x$HAVE_TIMEVAL" = xyes; then
+AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
+ emacs_cv_gettimeofday_two_arguments,
+AC_TRY_LINK([
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+ ],
+ [
+ struct timeval time;
+ struct timezone dummy;
+ gettimeofday (&time, &dummy);
+],
+ emacs_cv_gettimeofday_two_arguments=yes,
+ emacs_cv_gettimeofday_two_arguments=no))
+ if test $emacs_cv_gettimeofday_two_arguments = no; then
+ AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT)
+ fi
+fi