| 1 |
# parse-datetime.m4 serial 27 |
| 2 |
dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. |
| 3 |
dnl This file is free software; the Free Software Foundation |
| 4 |
dnl gives unlimited permission to copy and/or distribute it, |
| 5 |
dnl with or without modifications, as long as this notice is preserved. |
| 6 |
|
| 7 |
dnl Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals |
| 8 |
dnl as in ISO C99. |
| 9 |
dnl Note that compound literals such as (struct s) { 3, 4 } can be used for |
| 10 |
dnl initialization of stack-allocated variables, but are not constant |
| 11 |
dnl expressions and therefore cannot be used as initializer for global or |
| 12 |
dnl static variables (even though gcc supports this in pre-C99 mode). |
| 13 |
AC_DEFUN([gl_C_COMPOUND_LITERALS], |
| 14 |
[ |
| 15 |
AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals], |
| 16 |
[AC_COMPILE_IFELSE( |
| 17 |
[AC_LANG_PROGRAM( |
| 18 |
[[struct s { int i, j; };]], |
| 19 |
[[struct s t = (struct s) { 3, 4 }; |
| 20 |
if (t.i != 0) return 0;]]) |
| 21 |
], |
| 22 |
[gl_cv_compound_literals=yes], |
| 23 |
[gl_cv_compound_literals=no]) |
| 24 |
]) |
| 25 |
if test $gl_cv_compound_literals = yes; then |
| 26 |
AC_DEFINE([HAVE_COMPOUND_LITERALS], [1], |
| 27 |
[Define if you have compound literals.]) |
| 28 |
fi |
| 29 |
]) |
| 30 |
|
| 31 |
AC_DEFUN([gl_PARSE_DATETIME], |
| 32 |
[ |
| 33 |
dnl parse-datetime.c is generated from parse-datetime.y. It requires bison, |
| 34 |
dnl because parse-datetime.y uses bison specific features. It requires at |
| 35 |
dnl least bison-2.4 for %define api.pure. |
| 36 |
dnl bison is only needed for the maintainer (who touches parse-datetime.y). |
| 37 |
dnl But in order to avoid separate Makefiles or --enable-maintainer-mode, |
| 38 |
dnl we put the rule in general Makefile. Now, some people carelessly touch |
| 39 |
dnl the files or have a broken "make" program, hence the parse-datetime.c |
| 40 |
dnl rule will sometimes fire. To avoid an error, defines PARSE_DATETIME_BISON |
| 41 |
dnl to ":" if it is not present or too old. |
| 42 |
gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4]) |
| 43 |
|
| 44 |
dnl Prerequisites of lib/parse-datetime.h. |
| 45 |
AC_REQUIRE([gl_TIMESPEC]) |
| 46 |
AC_REQUIRE([AC_C_RESTRICT]) |
| 47 |
|
| 48 |
dnl Prerequisites of lib/parse-datetime.y. |
| 49 |
AC_REQUIRE([gl_BISON]) |
| 50 |
AC_REQUIRE([gl_C_COMPOUND_LITERALS]) |
| 51 |
AC_STRUCT_TIMEZONE |
| 52 |
AC_REQUIRE([gl_CLOCK_TIME]) |
| 53 |
AC_REQUIRE([gl_TM_GMTOFF]) |
| 54 |
]) |