+
+AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+ AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+ AC_CHECK_FUNCS_ONCE([gettimeofday])
+
+ AC_CACHE_CHECK([for gettimeofday with POSIX signature],
+ [gl_cv_func_gettimeofday_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/time.h>
+ struct timeval c;
+ ]],
+ [[
+ int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
+ int x = f (&c, 0);
+ return !(x | c.tv_sec | c.tv_usec);
+ ]])],
+ [gl_cv_func_gettimeofday_posix_signature=yes],
+ [gl_cv_func_gettimeofday_posix_signature=no])])
+
+ gl_FUNC_GETTIMEOFDAY_CLOBBER
+
+ if test $gl_cv_func_gettimeofday_posix_signature != yes; then
+ GETTIMEOFDAY_REPLACEMENT=1
+ SYS_TIME_H=sys/time.h
+ if test $gl_cv_func_gettimeofday_clobber != yes; then
+ AC_LIBOBJ(gettimeofday)
+ gl_PREREQ_GETTIMEOFDAY
+ fi
+ fi
+])
+
+