- AC_CACHE_CHECK([for struct timeval], fu_cv_sys_struct_timeval,
- [AC_TRY_COMPILE(
- [
-# if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-# else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
- ],
- [static struct timeval x; x.tv_sec = x.tv_usec;],
- fu_cv_sys_struct_timeval=yes,
- fu_cv_sys_struct_timeval=no)
- ])
-
- if test $fu_cv_sys_struct_timeval = yes; then
- AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1,
- [Define if struct timeval is declared in <time.h> or <sys/time.h>. ])
- fi
-
- AC_CACHE_CHECK([for gettimeofday whose signature conforms to POSIX],
- [ac_cv_func_gettimeofday_posix_signature],
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/time.h>
- time_t a;
- suseconds_t b;
- struct timeval c;
- ]],
- [[
- int x = gettimeofday (&c, 0);
- int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
- return !(x | c.tv_sec | c.tv_usec);
- ]])],
- [ac_cv_func_gettimeofday_posix_signature=yes],
- [ac_cv_func_gettimeofday_posix_signature=no]))
- if test $ac_cv_func_gettimeofday_posix_signature = yes; then
- AC_DEFINE([HAVE_GETTIMEOFDAY_POSIX_SIGNATURE], 1,
- [Define if gettimeofday's signature conforms to POSIX.])
- AC_FUNC_GETTIMEOFDAY_CLOBBER
- fi
- if test $ac_cv_func_gettimeofday_posix_signature != yes; then
- gl_PREREQ_GETTIMEOFDAY