Commit 16c3e636 authored by Paul Eggert's avatar Paul Eggert

strftime: import from gnulib

parent 4eec7f8b
2011-01-30 Paul Eggert <eggert@cs.ucla.edu>
strftime: import from gnulib
* Makefile.in (GNULIB_MODULES): Add strftime.
* configure.in (AC_FUNC_STRFTIME, my_strftime): Remove; no longer
needed.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
Regenerate.
* lib/strftime.c, lib/strftime.h, lib/stdbool.in.h: New files,
imported from gnulib.
* m4/strftime.m4, m4/stdbool.m4, m4/tm_gmtoff.m4: Likewise.
This incorporates many changes from gnulib, including simpler
handling of multibyte formats, porting to mingw32 and other
platforms, and support for higher-resolution time stamps.
Emacs does not yet use the higher-resolution interface.
2011-01-30 Paul Eggert <eggert@cs.ucla.edu>
gnulib: import mktime and move-if-change fixes from gnulib
......
......@@ -330,7 +330,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
# Update modules from gnulib, for maintainers, who should have it in
# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
# as per $(gnulib_srcdir)/DEPENDENCIES.
GNULIB_MODULES = dtoastr getopt-gnu mktime
GNULIB_MODULES = dtoastr getopt-gnu mktime strftime
GNULIB_TOOL_FLAGS = \
--import --no-changelog --no-vc-files --makefile-name=gnulib.mk
sync-from-gnulib: $(gnulib_srcdir)
......
......@@ -993,8 +993,11 @@ m4_include([m4/gnulib-common.m4])
m4_include([m4/include_next.m4])
m4_include([m4/mktime.m4])
m4_include([m4/multiarch.m4])
m4_include([m4/stdbool.m4])
m4_include([m4/stddef_h.m4])
m4_include([m4/strftime.m4])
m4_include([m4/time_h.m4])
m4_include([m4/time_r.m4])
m4_include([m4/tm_gmtoff.m4])
m4_include([m4/unistd_h.m4])
m4_include([m4/wchar_t.m4])
2011-01-30 Paul Eggert <eggert@cs.ucla.edu>
strftime: import from gnulib
* notes/copyright: strftime.c moved from src to lib.
2011-01-25 Glenn Morris <rgm@gnu.org>
* bzrmerge.el (bzrmerge-skip-regexp): New variable.
......
......@@ -635,7 +635,6 @@ alone (may import them from Gnulib again). These are:
src/gmalloc.c
src/md5.c
src/md5.h
src/strftime.c
src/termcap.c
src/tparam.c
......
......@@ -682,6 +682,8 @@ NEXT_STDDEF_H
STDDEF_H
HAVE_WCHAR_T
REPLACE_NULL
HAVE__BOOL
STDBOOL_H
APPLE_UNIVERSAL_BUILD
REPLACE_TIMEGM
REPLACE_NANOSLEEP
......@@ -2658,6 +2660,7 @@ as_fn_append ac_header_list " sys/param.h"
gl_getopt_required=GNU
as_fn_append ac_header_list " getopt.h"
as_fn_append ac_func_list " alarm"
as_fn_append ac_func_list " tzset"
as_fn_append ac_header_list " sys/time.h"
as_fn_append ac_func_list " localtime_r"
# Check that the precious variables saved in the cache have kept the same
......@@ -5827,7 +5830,9 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# Code from module intprops:
# Code from module mktime:
# Code from module multiarch:
# Code from module stdbool:
# Code from module stddef:
# Code from module strftime:
# Code from module time:
# Code from module time_r:
# Code from module unistd:
......@@ -14400,6 +14405,97 @@ _ACEOF
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
if ${ac_cv_header_stdbool_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdbool.h>
#ifndef bool
"error: bool is not defined"
#endif
#ifndef false
"error: false is not defined"
#endif
#if false
"error: false is not 0"
#endif
#ifndef true
"error: true is not defined"
#endif
#if true != 1
"error: true is not 1"
#endif
#ifndef __bool_true_false_are_defined
"error: __bool_true_false_are_defined is not defined"
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
/* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
/* The following fails for
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
*/
_Bool q = true;
_Bool *pq = &q;
int
main ()
{
bool e = &s;
*pq |= q;
*pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ !m + !n + !o + !p + !q + !pq);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdbool_h=yes
else
ac_cv_header_stdbool_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
$as_echo "$ac_cv_header_stdbool_h" >&6; }
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
if test "x$ac_cv_type__Bool" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
_ACEOF
fi
if test $ac_cv_header_stdbool_h = yes; then
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
fi
REPLACE_NULL=0;
HAVE_WCHAR_T=1;
......@@ -14438,6 +14534,18 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h
fi
ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include <time.h>
"
if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then :
$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
if ${ac_cv_c_restrict+:} false; then :
......@@ -14998,6 +15106,26 @@ fi
# Code from module multiarch:
# Code from module stdbool:
# Define two additional variables used in the Makefile substitution.
if test "$ac_cv_header_stdbool_h" = yes; then
STDBOOL_H=''
else
STDBOOL_H='stdbool.h'
fi
if test "$ac_cv_type__Bool" = yes; then
HAVE__BOOL=1
else
HAVE__BOOL=0
fi
# Code from module stddef:
......@@ -15093,6 +15221,32 @@ $as_echo "$gl_cv_next_stddef_h" >&6; }
fi
# Code from module strftime:
gl_LIBOBJS="$gl_LIBOBJS strftime.$ac_objext"
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
$as_echo "#define my_strftime nstrftime" >>confdefs.h
# Code from module time:
......@@ -15292,62 +15446,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
for ac_func in strftime
do :
ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
if test "x$ac_cv_func_strftime" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRFTIME 1
_ACEOF
else
# strftime is in -lintl on SCO UNIX.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
$as_echo_n "checking for strftime in -lintl... " >&6; }
if ${ac_cv_lib_intl_strftime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lintl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char strftime ();
int
main ()
{
return strftime ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_intl_strftime=yes
else
ac_cv_lib_intl_strftime=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
$as_echo "$ac_cv_lib_intl_strftime" >&6; }
if test "x$ac_cv_lib_intl_strftime" = xyes; then :
$as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
LIBS="-lintl $LIBS"
fi
fi
done
# UNIX98 PTYs.
for ac_func in grantpt
do :
......
......@@ -517,7 +517,7 @@ case "${canonical}" in
machine=hp800 opsys=hpux11
## FIXME. Peter O'Gorman reports that dumping using unexelf.o doesn't
## work either: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6811
CANNOT_DUMP=yes
CANNOT_DUMP=yes
;;
hppa*-*-linux-gnu* )
......@@ -2675,8 +2675,6 @@ gl_ASSERT_NO_GNULIB_POSIXCHECK
gl_ASSERT_NO_GNULIB_TESTS
gl_INIT
AC_FUNC_STRFTIME
# UNIX98 PTYs.
AC_CHECK_FUNCS(grantpt)
......@@ -3528,8 +3526,6 @@ AH_BOTTOM([
#endif
#endif
#define my_strftime nstrftime /* for strftime.c */
/* These default definitions are good for almost all machines.
The exceptions override them in m/MACHINE.h. */
......
......@@ -24,7 +24,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime strftime
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
......@@ -54,10 +54,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \
$(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stddef_h.m4 \
$(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \
$(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/strftime.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
$(top_srcdir)/configure.in
$(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
......@@ -232,6 +233,7 @@ HAVE_UNLINKAT = @HAVE_UNLINKAT@
HAVE_USLEEP = @HAVE_USLEEP@
HAVE_WCHAR_T = @HAVE_WCHAR_T@
HAVE_XSERVER = @HAVE_XSERVER@
HAVE__BOOL = @HAVE__BOOL@
IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@
IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@
INCLUDE_NEXT = @INCLUDE_NEXT@
......@@ -363,6 +365,7 @@ RSVG_LIBS = @RSVG_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
START_FILES = @START_FILES@
STDBOOL_H = @STDBOOL_H@
STDDEF_H = @STDDEF_H@
STRIP = @STRIP@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
......@@ -467,23 +470,24 @@ x_default_search_path = @x_default_search_path@
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDDEF_H) time.h \
unistd.h warn-on-use.h
BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
$(STDDEF_H) time.h unistd.h warn-on-use.h
EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
ftoastr.c ftoastr.h getopt.c getopt.in.h getopt1.c \
getopt_int.h intprops.h mktime-internal.h mktime.c stddef.in.h \
time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
getopt_int.h intprops.h mktime-internal.h mktime.c \
stdbool.in.h stddef.in.h strftime.c strftime.h time.in.h \
time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
c++defs.h c++defs.h-t getopt.h getopt.h-t stddef.h stddef.h-t \
time.h time.h-t unistd.h unistd.h-t warn-on-use.h \
warn-on-use.h-t
c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \
stdbool.h-t stddef.h stddef.h-t time.h time.h-t unistd.h \
unistd.h-t warn-on-use.h warn-on-use.h-t
noinst_LIBRARIES = libgnu.a
DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
libgnu_a_SOURCES = dtoastr.c gettext.h
libgnu_a_LIBADD = $(gl_LIBOBJS)
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \
time_r.c
strftime.c time_r.c
ARG_NONNULL_H = arg-nonnull.h
CXXDEFS_H = c++defs.h
WARN_ON_USE_H = warn-on-use.h
......@@ -541,6 +545,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@
.c.o:
......@@ -789,6 +794,15 @@ getopt.h: getopt.in.h $(ARG_NONNULL_H)
} > $@-t && \
mv -f $@-t $@
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
stdbool.h: stdbool.in.h
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t && \
mv $@-t $@
# We need the following in order to create <stddef.h> when the system
# doesn't have one that works with the given compiler.
stddef.h: stddef.in.h
......
......@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime strftime
MOSTLYCLEANFILES += core *.stackdump
......@@ -127,6 +127,24 @@ EXTRA_libgnu_a_SOURCES += mktime.c
## end gnulib module mktime
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
stdbool.h: stdbool.in.h
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool
## begin gnulib module stddef
BUILT_SOURCES += $(STDDEF_H)
......@@ -151,6 +169,15 @@ EXTRA_DIST += stddef.in.h
## end gnulib module stddef
## begin gnulib module strftime
EXTRA_DIST += strftime.c strftime.h
EXTRA_libgnu_a_SOURCES += strftime.c
## end gnulib module strftime
## begin gnulib module time
BUILT_SOURCES += time.h
......
/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H
/* ISO C 99 <stdbool.h> for platforms that lack it. */
/* Usage suggestions:
Programs that use <stdbool.h> should be aware of some limitations
and standards compliance issues.
Standards compliance:
- <stdbool.h> must be #included before 'bool', 'false', 'true'
can be used.
- You cannot assume that sizeof (bool) == 1.
- Programs should not undefine the macros bool, true, and false,
as C99 lists that as an "obsolescent feature".
Limitations of this substitute, when used in a C89 environment:
- <stdbool.h> must be #included before the '_Bool' type can be used.
- You cannot assume that _Bool is a typedef; it might be a macro.
- Bit-fields of type 'bool' are not supported. Portable code
should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
performed in such a way that every nonzero value gets converted
to 'true', and zero gets converted to 'false'. This doesn't work
with this substitute. With this substitute, only the values 0 and 1
give the expected result when converted to _Bool' or 'bool'.
- C99 allows the use of (_Bool)0.0 in constant expressions, but
this substitute cannot always provide this property.
Also, it is suggested that programs use 'bool' rather than '_Bool';
this isn't required, but 'bool' is more common. */
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#if defined __BEOS__ && !defined __HAIKU__
# include <OS.h> /* defines bool but not _Bool */
# undef false
# undef true
#endif
/* For the sake of symbolic names in gdb, we define true and false as
enum constants, not only as macros.
It is tempting to write
typedef enum { false = 0, true = 1 } _Bool;
so that gdb prints values of type 'bool' symbolically. But if we do
this, values of type '_Bool' may promote to 'int' or 'unsigned int'
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
# if !@HAVE__BOOL@
typedef bool _Bool;
# endif
#else
# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
Similar bugs are likely with other compilers as well; this file
wouldn't be used if <stdbool.h> was working.
So we override the _Bool type.
If !@HAVE__BOOL@:
Need to define _Bool ourselves. As 'signed char' or as an enum type?
Use of a typedef, with SunPRO C, leads to a stupid
"warning: _Bool is a keyword in ISO C99".
Use of an enum type, with IRIX cc, leads to a stupid
"warning(1185): enumerated type mixed with another type".
Even the existence of an enum type, without a typedef,
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
The only benefit of the enum, debuggability, is not important
with these compilers. So use 'signed char' and no enum. */
# define _Bool signed char
# else
/* With this compiler, trust the _Bool type if the compiler has it. */
# if !@HAVE__BOOL@
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
#endif
#define bool _Bool
/* The other macros must be usable in preprocessor directives. */
#define false 0
#define true 1
#define __bool_true_false_are_defined 1
#endif /* _GL_STDBOOL_H */
This diff is collapsed.
/* declarations for strftime.c
Copyright (C) 2002, 2004, 2008-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Just like strftime, but with two more arguments:
POSIX requires that strftime use the local timezone information.
When __UTC is nonzero and tm->tm_zone is NULL or the empty string,
use UTC instead. Use __NS as the number of nanoseconds in the
%N directive. */
size_t nstrftime (char *, size_t, char const *, struct tm const *,
int __utc, int __ns);
#ifdef __cplusplus
}
#endif
......@@ -38,7 +38,9 @@ AC_DEFUN([gl_EARLY],
# Code from module intprops:
# Code from module mktime:
# Code from module multiarch:
# Code from module stdbool:
# Code from module stddef:
# Code from module strftime:
# Code from module time:
# Code from module time_r:
# Code from module unistd:
......@@ -81,8 +83,12 @@ AC_DEFUN([gl_INIT],
gl_TIME_MODULE_INDICATOR([mktime])
# Code from module multiarch:
gl_MULTIARCH
# Code from module stdbool:
AM_STDBOOL_H
# Code from module stddef:
gl_STDDEF_H
# Code from module strftime:
gl_FUNC_GNU_STRFTIME
# Code from module time:
gl_HEADER_TIME_H
# Code from module time_r:
......@@ -245,7 +251,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/intprops.h
lib/mktime-internal.h
lib/mktime.c
lib/stdbool.in.h
lib/stddef.in.h
lib/strftime.c
lib/strftime.h
lib/time.in.h
lib/time_r.c
lib/unistd.in.h
......@@ -257,9 +266,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/include_next.m4
m4/mktime.m4
m4/multiarch.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/strftime.m4
m4/time_h.m4
m4/time_r.m4
m4/tm_gmtoff.m4
m4/unistd_h.m4
m4/warn-on-use.m4
m4/wchar_t.m4
......
# Check for stdbool.h that conforms to C99.
dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
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.
#serial 3
# Prepare for substituting <stdbool.h> if it is not supported.
AC_DEFUN([AM_STDBOOL_H],
[
AC_REQUIRE([AC_HEADER_STDBOOL])
# Define two additional variables used in the Makefile substitution.
if test "$ac_cv_header_stdbool_h" = yes; then
STDBOOL_H=''
else
STDBOOL_H='stdbool.h'
fi
AC_SUBST([STDBOOL_H])
if test "$ac_cv_type__Bool" = yes; then
HAVE__BOOL=1
else
HAVE__BOOL=0
fi
AC_SUBST([HAVE__BOOL])
])
# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
# This version of the macro is needed in autoconf <= 2.67. Autoconf has
# it built in since 2.60, but we want the tweaks from the 2.68 version
# to avoid rejecting xlc and clang due to relying on extensions.
AC_DEFUN([AC_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdbool.h>
#ifndef bool
"error: bool is not defined"
#endif
#ifndef false
"error: false is not defined"
#endif
#if false
"error: false is not 0"
#endif
#ifndef true
"error: true is not defined"
#endif
#if true != 1
"error: true is not 1"
#endif
#ifndef __bool_true_false_are_defined
"error: __bool_true_false_are_defined is not defined"
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
/* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
/* The following fails for
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
/* Catch a bug in an HP-UX C compiler. See