2 dnl * If we have gettimeofday;
3 dnl * If we have struct timezone for use in calling it;
4 dnl * If calling it with a timezone pointer actually works -- this is deemed
5 dnl obsolete or undefined on some systems which say you should use a null
6 dnl pointer -- and undefine HAVE_TIMEZONE if so;
7 dnl * Whether it only takes one arg.
8 AC_DEFUN(LIBU77_GETTIMEOFDAY, [
9 AC_CHECK_FUNCS(gettimeofday)
10 if test "$ac_cv_func_gettimeofday" = yes; then
11 AC_CACHE_CHECK([for struct timezone], g77_cv_struct_timezone,
12 [AC_TRY_COMPILE([#include <sys/time.h>],
13 [struct timezone tz;],
14 g77_cv_struct_timezone=yes, g77_cv_struct_timezone=no)])
15 if test $g77_cv_struct_timezone = yes; then
16 dnl It may be that we can't call gettimeofday with a non-null pointer.
17 dnl In that case we'll lie about struct timezone.
19 #ifdef TIME_WITH_SYS_TIME
23 #ifdef HAVE_SYS_TIME_H
32 struct timezone dummy;
33 if (gettimeofday (&time, &dummy))
38 [AC_DEFINE(HAVE_TIMEZONE)], ,[AC_DEFINE(HAVE_TIMEZONE)])
40 AC_REQUIRE([AC_HEADER_TIME])
41 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
42 emacs_cv_gettimeofday_two_arguments,
44 #ifdef TIME_WITH_SYS_TIME
48 #ifdef HAVE_SYS_TIME_H
58 struct timezone dummy;
63 gettimeofday (&time, DUMMY);],
64 emacs_cv_gettimeofday_two_arguments=yes,
65 emacs_cv_gettimeofday_two_arguments=no))
66 if test $emacs_cv_gettimeofday_two_arguments = no; then
67 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT)