1dnl Reentrant time functions like localtime_r. 2 3dnl Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. 4dnl This file is free software; the Free Software Foundation 5dnl gives unlimited permission to copy and/or distribute it, 6dnl with or without modifications, as long as this notice is preserved. 7 8dnl Written by Paul Eggert. 9 10AC_DEFUN([gl_TIME_R], 11[ 12 dnl Persuade glibc and Solaris <time.h> to declare localtime_r. 13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 14 15 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 16 AC_REQUIRE([AC_C_RESTRICT]) 17 18 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], 19 [gl_cv_time_r_posix], 20 [AC_TRY_COMPILE( 21 [#include <time.h>], 22 [/* We don't need to append 'restrict's to the argument types, 23 even though the POSIX signature has the 'restrict's, 24 since C99 says they can't affect type compatibility. */ 25 struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; 26 if (ptr) return 0;], 27 [gl_cv_time_r_posix=yes], 28 [gl_cv_time_r_posix=no])]) 29 if test $gl_cv_time_r_posix = yes; then 30 REPLACE_LOCALTIME_R=0 31 else 32 REPLACE_LOCALTIME_R=1 33 AC_LIBOBJ([time_r]) 34 gl_PREREQ_TIME_R 35 fi 36]) 37 38# Prerequisites of lib/time_r.c. 39AC_DEFUN([gl_PREREQ_TIME_R], [ 40 : 41]) 42