(jm_FUNC_GNU_STRFTIME):
[gnulib.git] / m4 / strftime.m4
1 #serial 16
2
3 dnl This macro is intended to be used solely in this file.
4 dnl These are the prerequisite macros for GNU's strftime.c replacement.
5 AC_DEFUN(_jm_STRFTIME_PREREQS,
6 [
7  dnl strftime.c uses localtime_r and the underyling system strftime
8  dnl if they exist.
9  AC_CHECK_FUNCS(localtime_r strftime)
10
11  AC_CHECK_HEADERS(limits.h)
12  AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
13
14  # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
15  AC_STRUCT_TIMEZONE
16
17  AC_CHECK_FUNCS(mblen mbrlen)
18
19  AC_CHECK_MEMBER([struct tm.tm_gmtoff],
20                  [AC_DEFINE(HAVE_TM_GMTOFF, 1,
21                             [Define if struct tm has the tm_gmtoff member.])],
22                  ,
23                  [#include <time.h>])
24 ])
25
26 dnl From Jim Meyering.
27 dnl
28 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
29 [AC_REQUIRE([AC_HEADER_TIME])dnl
30
31  _jm_STRFTIME_PREREQS
32
33  AC_REQUIRE([AC_C_CONST])dnl
34  AC_REQUIRE([AC_HEADER_STDC])dnl
35  AC_CHECK_HEADERS(sys/time.h)
36  AC_LIBOBJ(strftime)
37  AC_DEFINE([my_strftime], [nstrftime],
38    [Define to the name of the strftime replacement function.])
39 ])
40
41 AC_DEFUN(jm_FUNC_STRFTIME,
42 [
43   _jm_STRFTIME_PREREQS
44   AC_REPLACE_FUNCS(strftime)
45 ])