source: trunk/gcc/libf2c/libU77/aclocal.m4@ 3003

Last change on this file since 3003 was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1dnl Check:
2dnl * If we have gettimeofday;
3dnl * If we have struct timezone for use in calling it;
4dnl * If calling it with a timezone pointer actually works -- this is deemed
5dnl obsolete or undefined on some systems which say you should use a null
6dnl pointer -- and undefine HAVE_TIMEZONE if so;
7dnl * Whether it only takes one arg.
8AC_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.
18 AC_TRY_RUN([
19#ifdef TIME_WITH_SYS_TIME
20#include <sys/time.h>
21#include <time.h>
22#else
23#ifdef HAVE_SYS_TIME_H
24#include <sys/time.h>
25#else
26#include <time.h>
27#endif
28#endif
29main ()
30{
31 struct timeval time;
32 struct timezone dummy;
33 if (gettimeofday (&time, &dummy))
34 exit (1);
35 else
36 exit (0);
37}],
38 [AC_DEFINE(HAVE_TIMEZONE)], ,[AC_DEFINE(HAVE_TIMEZONE)])
39 fi
40 AC_REQUIRE([AC_HEADER_TIME])
41 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
42 emacs_cv_gettimeofday_two_arguments,
43 AC_TRY_LINK([
44#ifdef TIME_WITH_SYS_TIME
45#include <sys/time.h>
46#include <time.h>
47#else
48#ifdef HAVE_SYS_TIME_H
49#include <sys/time.h>
50#else
51#include <time.h>
52#endif
53#endif
54 ],
55 [
56 struct timeval time;
57#ifdef HAVE_TIMEZONE
58 struct timezone dummy;
59#define DUMMY &dummy
60#else
61#define DUMMY NULL
62#endif
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)
68 fi
69 fi])
Note: See TracBrowser for help on using the repository browser.