~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-m4/sys_time_h.m4

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Configure a replacement for <sys/time.h>.
 
2
# serial 6
2
3
 
3
 
# Copyright (C) 2007 Free Software Foundation, Inc.
 
4
# Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
4
5
# This file is free software; the Free Software Foundation
5
6
# gives unlimited permission to copy and/or distribute it,
6
7
# with or without modifications, as long as this notice is preserved.
18
19
AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
19
20
[
20
21
  AC_REQUIRE([AC_C_RESTRICT])
 
22
  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
 
23
  AC_CHECK_HEADERS_ONCE([sys/time.h])
21
24
  gl_CHECK_NEXT_HEADERS([sys/time.h])
22
25
 
23
 
  if test $ac_cv_header_sys_time_h = yes; then
24
 
    HAVE_SYS_TIME_H=1
25
 
  else
 
26
  if test $ac_cv_header_sys_time_h != yes; then
26
27
    HAVE_SYS_TIME_H=0
27
28
  fi
28
 
  AC_SUBST([HAVE_SYS_TIME_H])
29
29
 
30
30
  AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
31
31
    [AC_COMPILE_IFELSE(
32
32
       [AC_LANG_PROGRAM(
33
 
          [[#if HAVE_SYS_TIME_H
34
 
             #include <sys/time.h>
35
 
            #endif
36
 
            #include <time.h>
37
 
          ]],
38
 
          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
 
33
          [[#if HAVE_SYS_TIME_H
 
34
             #include <sys/time.h>
 
35
            #endif
 
36
            #include <time.h>
 
37
          ]],
 
38
          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
39
39
       [gl_cv_sys_struct_timeval=yes],
40
40
       [gl_cv_sys_struct_timeval=no])])
41
 
  if test $gl_cv_sys_struct_timeval = yes; then
42
 
    HAVE_STRUCT_TIMEVAL=1
43
 
  else
 
41
  if test $gl_cv_sys_struct_timeval != yes; then
44
42
    HAVE_STRUCT_TIMEVAL=0
45
43
  fi
46
 
  AC_SUBST([HAVE_STRUCT_TIMEVAL])
47
 
 
 
44
 
 
45
  dnl Check for declarations of anything we want to poison if the
 
46
  dnl corresponding gnulib module is not in use.
 
47
  gl_WARN_ON_USE_PREPARE([[
 
48
#if HAVE_SYS_TIME_H
 
49
# include <sys/time.h>
 
50
#endif
 
51
#include <time.h>
 
52
    ]], [gettimeofday])
 
53
])
 
54
 
 
55
AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
 
56
[
 
57
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
 
58
  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
 
59
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
 
60
  dnl Define it also as a C macro, for the benefit of the unit tests.
 
61
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 
62
])
 
63
 
 
64
AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
 
65
[
 
66
  GNULIB_GETTIMEOFDAY=0;     AC_SUBST([GNULIB_GETTIMEOFDAY])
48
67
  dnl Assume POSIX behavior unless another module says otherwise.
49
 
  REPLACE_GETTIMEOFDAY=0
50
 
  AC_SUBST([REPLACE_GETTIMEOFDAY])
51
 
  if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then
52
 
    SYS_TIME_H=sys/time.h
53
 
  else
54
 
    SYS_TIME_H=
55
 
  fi
56
 
  AC_SUBST([SYS_TIME_H])
 
68
  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
 
69
  HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
 
70
  HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
 
71
  REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
57
72
])