File: check_time.m4

package info (click to toggle)
filezilla 3.69.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,768 kB
  • sloc: cpp: 97,621; ansic: 54,984; sh: 5,225; makefile: 2,080; xml: 375
file content (58 lines) | stat: -rw-r--r-- 1,602 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
dnl We need the threadsafe variants of localtime
AC_DEFUN([CHECK_THREADSAFE_LOCALTIME],
[
  AC_CHECK_FUNCS(localtime_r, [], [
    AC_MSG_CHECKING([for localtime_s])
    dnl Checking for localtime_s is a bit more complex as it is a macro
    AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[
       #include <time.h>
       ]], [[
         time_t t;
         struct tm m;
         localtime_s(&m, &t);
         return 0;
      ]])
    ], [
      AC_MSG_RESULT([yes])
      AC_DEFINE([HAVE_LOCALTIME_S], [1], [localtime_s can be used])
    ], [
      AC_MSG_RESULT([no])
      AC_MSG_ERROR([No threadsafe variant of localtime found])
    ])
  ])
])

dnl We need the threadsafe variants of gmtime
AC_DEFUN([CHECK_THREADSAFE_GMTIME], [
  AC_CHECK_FUNCS(gmtime_r, [], [
    AC_MSG_CHECKING([for gmtime_s])
    dnl Checking for gmtime_s is a bit more complex as it is a macro
    AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[
       #include <time.h>
       ]], [[
         time_t t;
         struct tm m;
         gmtime_s(&m, &t);
         return 0;
      ]])
    ], [
      AC_MSG_RESULT([yes])
      AC_DEFINE([HAVE_GMTIME_S], [1], [gmtime_s can be used])
    ], [
      AC_MSG_RESULT([no])
      AC_MSG_ERROR([No threadsafe variant of gmtime found])
    ])
  ])
])

dnl We need an inverse for gmtime, either timegm or _mkgmtime
AC_DEFUN([CHECK_INVERSE_GMTIME], [
  # We need an inverse for gmtime, either timegm or _mkgmtime
  AC_CHECK_FUNCS(timegm, [], [
    if ! echo "${host_os}" | grep 'cygwin\|mingw\|^msys$' > /dev/null 2>&1; then
      AC_MSG_ERROR([No inverse function for gmtime was found])
    fi
  ])
])