parse-datetime.m4 1.44 KB
Newer Older
1
# parse-datetime.m4 serial 22
2
dnl Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
3 4 5
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.
6

7 8 9 10 11 12
dnl Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals
dnl as in ISO C99.
dnl Note that compound literals such as (struct s) { 3, 4 } can be used for
dnl initialization of stack-allocated variables, but are not constant
dnl expressions and therefore cannot be used as initializer for global or
dnl static variables (even though gcc supports this in pre-C99 mode).
13 14
AC_DEFUN([gl_C_COMPOUND_LITERALS],
[
15
  AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
16 17 18
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
      [[struct s t = (struct s) { 3, 4 };
        if (t.i != 0) return 0;]])],
19 20 21
    gl_cv_compound_literals=yes,
    gl_cv_compound_literals=no)])
  if test $gl_cv_compound_literals = yes; then
22
    AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
23 24 25 26
      [Define if you have compound literals.])
  fi
])

27
AC_DEFUN([gl_PARSE_DATETIME],
28
[
29
  dnl Prerequisites of lib/parse-datetime.h.
Paul Eggert's avatar
Paul Eggert committed
30 31
  AC_REQUIRE([AM_STDBOOL_H])
  AC_REQUIRE([gl_TIMESPEC])
32

33
  dnl Prerequisites of lib/parse-datetime.y.
34
  AC_REQUIRE([gl_BISON])
35
  AC_REQUIRE([gl_C_COMPOUND_LITERALS])
36
  AC_STRUCT_TIMEZONE
Paul Eggert's avatar
Paul Eggert committed
37
  AC_REQUIRE([gl_CLOCK_TIME])
38 39
  AC_REQUIRE([gl_TM_GMTOFF])
])