~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to m4/time_h.m4

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Configure a more-standard replacement for <time.h>.
 
2
 
 
3
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
 
4
# Foundation, Inc.
 
5
 
 
6
# This file is free software; the Free Software Foundation
 
7
# gives unlimited permission to copy and/or distribute it,
 
8
# with or without modifications, as long as this notice is preserved.
 
9
 
 
10
# Written by Paul Eggert and Jim Meyering.
 
11
 
 
12
AC_DEFUN([gl_HEADER_TIME_H],
 
13
[
 
14
  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
 
15
  dnl once only, before all statements that occur in other macros.
 
16
  AC_REQUIRE([gl_HEADER_TIME_H_BODY])
 
17
])
 
18
 
 
19
AC_DEFUN([gl_HEADER_TIME_H_BODY],
 
20
[
 
21
  AC_REQUIRE([AC_C_RESTRICT])
 
22
  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
 
23
  gl_CHECK_NEXT_HEADERS([time.h])
 
24
  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
 
25
])
 
26
 
 
27
AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
 
28
[
 
29
  dnl If another module says to replace or to not replace, do that.
 
30
  dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
 
31
  dnl this lets maintainers check for portability.
 
32
  REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
 
33
  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
 
34
  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
 
35
  REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
 
36
  REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
 
37
])
 
38
 
 
39
dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
 
40
dnl in time.h or sys/time.h.
 
41
 
 
42
AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
 
43
[
 
44
  AC_CHECK_HEADERS_ONCE([sys/time.h])
 
45
  AC_CACHE_CHECK([for struct timespec in <time.h>],
 
46
    [gl_cv_sys_struct_timespec_in_time_h],
 
47
    [AC_COMPILE_IFELSE(
 
48
       [AC_LANG_PROGRAM(
 
49
          [[#include <time.h>
 
50
          ]],
 
51
          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
 
52
       [gl_cv_sys_struct_timespec_in_time_h=yes],
 
53
       [gl_cv_sys_struct_timespec_in_time_h=no])])
 
54
 
 
55
  TIME_H_DEFINES_STRUCT_TIMESPEC=0
 
56
  SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
 
57
  if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
 
58
    TIME_H_DEFINES_STRUCT_TIMESPEC=1
 
59
  else
 
60
    AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
 
61
      [gl_cv_sys_struct_timespec_in_sys_time_h],
 
62
      [AC_COMPILE_IFELSE(
 
63
         [AC_LANG_PROGRAM(
 
64
            [[#include <sys/time.h>
 
65
            ]],
 
66
            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
 
67
         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
 
68
         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
 
69
    if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
 
70
      SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
 
71
    fi
 
72
  fi
 
73
  AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
 
74
  AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
 
75
])