view m4/time_r.m4 @ 7356:0af37e82a5e3

* fsusage.m4 (gl_STATFS_TRUNCATES): Avoid unused variable. * getdate.m4 (gl_C_COMPOUND_LITERALS): Likewise. * jm-winsz1.m4 (gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H): Likewise; also add missing comma that caused broken test. * link-follow.m4 (gl_AC_FUNC_LINK_FOLLOWS_SYMLINK): Include stdlib.h, for `abort'. * ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Avoid unused variables. * mkdir-slash.m4 (gl_FUNC_MKDIR_TRAILING_SLASH): Check for and include unistd.h if present, for `rmdir'. * physmem.m4 (gl_SYS__SYSTEM_CONFIGURATION): Avoid unused variables. * putenv.m4 (gl_FUNC_PUTENV): Rewrite using AC_RUN_IFELSE, and in the process include standard headers for prototypes. * readutmp.m4 (gl_READUTMP): Require AC_GNU_SOURCE, so utmpxname gets declared on GNU/Linux. * rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Check for and include unistd.h, for `rmdir'. * time_r.m4 (gl_TIME_R): Avoid unused variables.
author Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
date Fri, 22 Sep 2006 18:09:47 +0000
parents be9e01d008cb
children b31580167c2b
line wrap: on
line source

dnl Reentrant time functions like localtime_r.

dnl Copyright (C) 2003, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl Written by Paul Eggert.

AC_DEFUN([gl_TIME_R],
[
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
  AC_REQUIRE([AC_C_RESTRICT])

  AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
    [gl_cv_time_r_posix],
    [AC_TRY_COMPILE(
       [#include <time.h>],
       [/* We don't need to append 'restrict's to the argument types,
	   even though the POSIX signature has the 'restrict's,
	   since C99 says they can't affect type compatibility.  */
	struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
        if (ptr) return 0;],
       [gl_cv_time_r_posix=yes],
       [gl_cv_time_r_posix=no])])
  if test $gl_cv_time_r_posix = yes; then
    AC_DEFINE([HAVE_TIME_R_POSIX], 1,
      [Define to 1 if localtime_r, etc. have the type signatures that
       POSIX requires.])
  else
    AC_LIBOBJ([time_r])
    gl_PREREQ_TIME_R
  fi
])

# Prerequisites of lib/time_r.c.
AC_DEFUN([gl_PREREQ_TIME_R], [
  :
])