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