summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2011-08-03 01:16:03 +0200
committerSimon Josefsson <simon@josefsson.org>2011-08-03 01:54:47 +0200
commitae155d81b9b0282e1fe2fdfc18f3bfa3ec6a5074 (patch)
treee66003dc5af9746fbe3b652414362cc704bc6de8 /gl
parent5ca16d756ababb14e31d09ac4f1c1514de2ff5b9 (diff)
downloadgnutls-ae155d81b9b0282e1fe2fdfc18f3bfa3ec6a5074.tar.gz
Update gnulib files. Fix syntax-check usage.
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am769
-rw-r--r--gl/alignof.h2
-rw-r--r--gl/alloca.c31
-rw-r--r--gl/errno.in.h20
-rw-r--r--gl/error.c6
-rw-r--r--gl/float.c33
-rw-r--r--gl/float.in.h121
-rw-r--r--gl/fseek.c30
-rw-r--r--gl/fseeko.c3
-rw-r--r--gl/ftell.c37
-rw-r--r--gl/intprops.h47
-rw-r--r--gl/m4/alloca.m479
-rw-r--r--gl/m4/errno_h.m48
-rw-r--r--gl/m4/error.m417
-rw-r--r--gl/m4/extensions.m47
-rw-r--r--gl/m4/float_h.m435
-rw-r--r--gl/m4/fpieee.m452
-rw-r--r--gl/m4/fseek.m415
-rw-r--r--gl/m4/fseeko.m456
-rw-r--r--gl/m4/ftell.m415
-rw-r--r--gl/m4/ftello.m410
-rw-r--r--gl/m4/getdelim.m416
-rw-r--r--gl/m4/getline.m47
-rw-r--r--gl/m4/getpagesize.m43
-rw-r--r--gl/m4/getpass.m426
-rw-r--r--gl/m4/gettime.m44
-rw-r--r--gl/m4/gettimeofday.m419
-rw-r--r--gl/m4/gnulib-cache.m44
-rw-r--r--gl/m4/gnulib-common.m499
-rw-r--r--gl/m4/gnulib-comp.m4163
-rw-r--r--gl/m4/hmac-md5.m410
-rw-r--r--gl/m4/include_next.m414
-rw-r--r--gl/m4/largefile.m4104
-rw-r--r--gl/m4/lseek.m415
-rw-r--r--gl/m4/malloc.m412
-rw-r--r--gl/m4/md5.m44
-rw-r--r--gl/m4/memchr.m46
-rw-r--r--gl/m4/memmem.m411
-rw-r--r--gl/m4/memxor.m43
-rw-r--r--gl/m4/mmap-anon.m48
-rw-r--r--gl/m4/po.m419
-rw-r--r--gl/m4/printf.m415
-rw-r--r--gl/m4/read-file.m48
-rw-r--r--gl/m4/realloc.m412
-rw-r--r--gl/m4/snprintf.m413
-rw-r--r--gl/m4/strcase.m413
-rw-r--r--gl/m4/strdup.m411
-rw-r--r--gl/m4/strerror.m486
-rw-r--r--gl/m4/string_h.m412
-rw-r--r--gl/m4/strings_h.m414
-rw-r--r--gl/m4/strverscmp.m45
-rw-r--r--gl/m4/time_r.m44
-rw-r--r--gl/m4/vsnprintf.m413
-rw-r--r--gl/m4/warn-on-use.m48
-rw-r--r--gl/m4/warnings.m415
-rw-r--r--gl/netdb.in.h10
-rw-r--r--gl/netinet_in.in.h10
-rw-r--r--gl/stdarg.in.h10
-rw-r--r--gl/stddef.in.h14
-rw-r--r--gl/stdint.in.h110
-rw-r--r--gl/stdio.in.h48
-rw-r--r--gl/stdlib.in.h18
-rw-r--r--gl/strerror-override.c279
-rw-r--r--gl/strerror-override.h52
-rw-r--r--gl/strerror.c358
-rw-r--r--gl/string.in.h44
-rw-r--r--gl/strings.in.h32
-rw-r--r--gl/sys_socket.in.h66
-rw-r--r--gl/sys_stat.in.h10
-rw-r--r--gl/sys_time.in.h6
-rw-r--r--gl/sys_uio.in.h10
-rw-r--r--gl/tests/Makefile.am202
-rw-r--r--gl/tests/fcntl.in.h10
-rw-r--r--gl/tests/fpucw.h107
-rw-r--r--gl/tests/init.sh12
-rw-r--r--gl/tests/macros.h4
-rw-r--r--gl/tests/test-float.c384
-rw-r--r--gl/tests/test-fseek.c70
-rwxr-xr-xgl/tests/test-fseek.sh5
-rwxr-xr-xgl/tests/test-fseek2.sh3
-rw-r--r--gl/tests/test-ftell.c107
-rwxr-xr-xgl/tests/test-ftell.sh5
-rwxr-xr-xgl/tests/test-ftell2.sh3
-rw-r--r--gl/tests/test-ftell3.c78
-rw-r--r--gl/tests/test-intprops.c462
-rw-r--r--gl/tests/test-snprintf.c8
-rw-r--r--gl/tests/test-strerror.c21
-rwxr-xr-xgl/tests/test-vc-list-files-cvs.sh54
-rwxr-xr-xgl/tests/test-vc-list-files-git.sh42
-rw-r--r--gl/tests/test-verify.c4
-rw-r--r--gl/tests/test-vsnprintf.c8
-rw-r--r--gl/time.in.h4
-rw-r--r--gl/timespec.h19
-rw-r--r--gl/unistd.in.h153
-rw-r--r--gl/verify.h23
-rw-r--r--gl/wchar.in.h10
96 files changed, 3469 insertions, 1575 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index b295abeee2..2d4e3ccc6b 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 error extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 error extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits
@@ -84,30 +84,6 @@ EXTRA_DIST += alloca.in.h
## end gnulib module alloca-opt
-## begin gnulib module arg-nonnull
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# 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
-# The arg-nonnull.h that gets inserted into generated .h files is the same as
-# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
-arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/GL_ARG_NONNULL/,$$p' \
- < $(top_srcdir)/build-aux/arg-nonnull.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
-
-ARG_NONNULL_H=arg-nonnull.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
-
-## end gnulib module arg-nonnull
-
## begin gnulib module byteswap
BUILT_SOURCES += $(BYTESWAP_H)
@@ -131,30 +107,6 @@ EXTRA_DIST += byteswap.in.h
## end gnulib module byteswap
-## begin gnulib module c++defs
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# 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 += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/build-aux/c++defs.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/_GL_CXXDEFS/,$$p' \
- < $(top_srcdir)/build-aux/c++defs.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h
-
-## end gnulib module c++defs
-
## begin gnulib module c-ctype
libgnu_la_SOURCES += c-ctype.h c-ctype.c
@@ -163,19 +115,17 @@ libgnu_la_SOURCES += c-ctype.h c-ctype.c
## begin gnulib module crypto/hmac-md5
+libgnu_la_SOURCES += hmac-md5.c
-EXTRA_DIST += hmac-md5.c hmac.h
-
-EXTRA_libgnu_la_SOURCES += hmac-md5.c
+EXTRA_DIST += hmac.h
## end gnulib module crypto/hmac-md5
## begin gnulib module crypto/md5
+libgnu_la_SOURCES += md5.c
-EXTRA_DIST += md5.c md5.h
-
-EXTRA_libgnu_la_SOURCES += md5.c
+EXTRA_DIST += md5.h
## end gnulib module crypto/md5
@@ -189,7 +139,8 @@ if GL_GENERATE_ERRNO_H
errno.h: errno.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
@@ -239,7 +190,8 @@ if GL_GENERATE_FLOAT_H
float.h: float.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
@@ -252,10 +204,21 @@ float.h: $(top_builddir)/config.status
endif
MOSTLYCLEANFILES += float.h float.h-t
-EXTRA_DIST += float.in.h
+EXTRA_DIST += float.c float.in.h
+
+EXTRA_libgnu_la_SOURCES += float.c
## end gnulib module float
+## begin gnulib module fseek
+
+
+EXTRA_DIST += fseek.c
+
+EXTRA_libgnu_la_SOURCES += fseek.c
+
+## end gnulib module fseek
+
## begin gnulib module fseeko
@@ -265,6 +228,15 @@ EXTRA_libgnu_la_SOURCES += fseeko.c
## end gnulib module fseeko
+## begin gnulib module ftell
+
+
+EXTRA_DIST += ftell.c
+
+EXTRA_libgnu_la_SOURCES += ftell.c
+
+## end gnulib module ftell
+
## begin gnulib module ftello
@@ -325,10 +297,7 @@ libgnu_la_SOURCES += gettext.h
## begin gnulib module gettime
-
-EXTRA_DIST += gettime.c
-
-EXTRA_libgnu_la_SOURCES += gettime.c
+libgnu_la_SOURCES += gettime.c
## end gnulib module gettime
@@ -341,6 +310,16 @@ EXTRA_libgnu_la_SOURCES += gettimeofday.c
## end gnulib module gettimeofday
+## begin gnulib module gnumakefile
+
+distclean-local: clean-GNUmakefile
+clean-GNUmakefile:
+ test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || :
+
+EXTRA_DIST += $(top_srcdir)/GNUmakefile
+
+## end gnulib module gnumakefile
+
## begin gnulib module havelib
@@ -364,6 +343,12 @@ EXTRA_libgnu_la_SOURCES += lseek.c
## end gnulib module lseek
+## begin gnulib module maintainer-makefile
+
+EXTRA_DIST += $(top_srcdir)/maint.mk
+
+## end gnulib module maintainer-makefile
+
## begin gnulib module malloc-posix
@@ -393,10 +378,9 @@ EXTRA_libgnu_la_SOURCES += memmem.c
## begin gnulib module memxor
+libgnu_la_SOURCES += memxor.c
-EXTRA_DIST += memxor.c memxor.h
-
-EXTRA_libgnu_la_SOURCES += memxor.c
+EXTRA_DIST += memxor.h
## end gnulib module memxor
@@ -415,12 +399,13 @@ BUILT_SOURCES += netdb.h
netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
- -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
+ -e 's/@''GNULIB_GETADDRINFO''@/$(GNULIB_GETADDRINFO)/g' \
-e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
-e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
-e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
@@ -450,7 +435,8 @@ netinet/in.h: netinet_in.in.h $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) netinet
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
@@ -477,10 +463,9 @@ libgnu_la_SOURCES += progname.h progname.c
## begin gnulib module read-file
+libgnu_la_SOURCES += read-file.c
-EXTRA_DIST += read-file.c read-file.h
-
-EXTRA_libgnu_la_SOURCES += read-file.c
+EXTRA_DIST += read-file.h
## end gnulib module read-file
@@ -499,6 +484,87 @@ libgnu_la_SOURCES += size_max.h
## end gnulib module size_max
+## begin gnulib module snippet/_Noreturn
+
+# Because this Makefile snippet defines a variable used by other
+# gnulib Makefile snippets, it must be present in all Makefile.am that
+# need it. This is ensured by the applicability 'all' defined above.
+
+_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+## end gnulib module snippet/_Noreturn
+
+## begin gnulib module snippet/arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# 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
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
+# off.
+arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/GL_ARG_NONNULL/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+
+## end gnulib module snippet/arg-nonnull
+
+## begin gnulib module snippet/c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# 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 += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/_GL_CXXDEFS/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/c++defs.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
+
+## end gnulib module snippet/c++defs
+
+## begin gnulib module snippet/warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
+# off.
+warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/^.ifndef/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/warn-on-use.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
+
+## end gnulib module snippet/warn-on-use
+
## begin gnulib module snprintf
@@ -526,7 +592,8 @@ if GL_GENERATE_STDARG_H
stdarg.h: stdarg.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
@@ -576,7 +643,8 @@ if GL_GENERATE_STDDEF_H
stddef.h: stddef.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
@@ -605,7 +673,8 @@ if GL_GENERATE_STDINT_H
stdint.h: stdint.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -653,62 +722,63 @@ BUILT_SOURCES += stdio.h
stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
- -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
- -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
- -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
- -e 's|@''GNULIB_FGETC''@|$(GNULIB_FGETC)|g' \
- -e 's|@''GNULIB_FGETS''@|$(GNULIB_FGETS)|g' \
- -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
- -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
- -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
- -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
- -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
- -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
- -e 's|@''GNULIB_FREAD''@|$(GNULIB_FREAD)|g' \
- -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
- -e 's|@''GNULIB_FSCANF''@|$(GNULIB_FSCANF)|g' \
- -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
- -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
- -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
- -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
- -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
- -e 's|@''GNULIB_GETC''@|$(GNULIB_GETC)|g' \
- -e 's|@''GNULIB_GETCHAR''@|$(GNULIB_GETCHAR)|g' \
- -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
- -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
- -e 's|@''GNULIB_GETS''@|$(GNULIB_GETS)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
- -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
- -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \
- -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
- -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
- -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
- -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
- -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
- -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \
- -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \
- -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \
- -e 's|@''GNULIB_SCANF''@|$(GNULIB_SCANF)|g' \
- -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
- -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
- -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \
- -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
- -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \
- -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
- -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
- -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
- -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
- -e 's|@''GNULIB_VFSCANF''@|$(GNULIB_VFSCANF)|g' \
- -e 's|@''GNULIB_VSCANF''@|$(GNULIB_VSCANF)|g' \
- -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
- -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
- -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
- -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+ -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
+ -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
+ -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
+ -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
+ -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
+ -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \
+ -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \
+ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \
+ -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \
+ -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \
+ -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \
+ -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \
+ -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \
+ -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \
+ -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \
+ -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \
+ -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \
+ -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \
+ -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
+ -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
+ -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
+ -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
+ -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
+ -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
+ -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
+ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \
+ -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \
+ -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \
+ -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \
+ -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \
+ -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \
+ -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \
+ -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \
+ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \
+ -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \
+ -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \
+ -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \
+ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
+ -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \
+ -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \
+ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
+ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
< $(srcdir)/stdio.in.h | \
sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
-e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
@@ -773,41 +843,43 @@ BUILT_SOURCES += stdlib.h
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
+ $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
- -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
- -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
- -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
- -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
- -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
- -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
- -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
- -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
- -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \
- -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
- -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
- -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
- -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
- -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
- -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
- -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
- -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
- -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
- -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
- -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
- -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
- -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
- -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
- -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
- -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
- -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
- -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
- -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \
+ -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
+ -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
+ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
+ -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
+ -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
+ -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
+ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
+ -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
+ -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
+ -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
+ -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
+ -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
+ -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+ -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
+ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
+ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
+ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
+ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
+ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
+ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
+ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
+ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
+ -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
+ -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
+ -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
< $(srcdir)/stdlib.in.h | \
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
@@ -846,6 +918,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _Noreturn/r $(_NORETURN_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
@@ -883,6 +956,15 @@ EXTRA_libgnu_la_SOURCES += strerror.c
## end gnulib module strerror
+## begin gnulib module strerror-override
+
+
+EXTRA_DIST += strerror-override.c strerror-override.h
+
+EXTRA_libgnu_la_SOURCES += strerror-override.c
+
+## end gnulib module strerror-override
+
## begin gnulib module string
BUILT_SOURCES += string.h
@@ -892,47 +974,52 @@ BUILT_SOURCES += string.h
string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
- -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
- -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
- -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
- -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
- -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
- -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
- -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
- -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
- -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
- -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
- -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
- -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
- -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
- -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
- -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \
- -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
- -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
- -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
- -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \
- -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
- -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
- -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
- -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
- -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \
- -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
- -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
- -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
- -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
- -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
- -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
- -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
- -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
- -e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \
- -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
- -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
+ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
+ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
+ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
+ -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
+ -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
+ -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
+ -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
+ -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
+ -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
+ -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
+ -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
+ -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
+ -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
+ -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
+ -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
+ -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
+ -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
+ -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
+ -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
+ -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
+ -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
+ -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
+ -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
+ -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
+ -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
+ -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
+ -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
+ -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
+ -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
+ -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
+ -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
+ -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
+ -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
+ -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
+ -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
+ -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
+ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
< $(srcdir)/string.in.h | \
- sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+ sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
+ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
+ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
@@ -984,15 +1071,19 @@ BUILT_SOURCES += strings.h
# We need the following in order to create <strings.h> when the system
# doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
+ -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
+ -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/strings.in.h; \
@@ -1023,27 +1114,28 @@ sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
- -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
- -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \
- -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \
- -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \
- -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \
- -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \
- -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \
- -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \
- -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \
- -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \
- -e 's|@''GNULIB_SEND''@|$(GNULIB_SEND)|g' \
- -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \
- -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
- -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
- -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \
- -e 's|@''GNULIB_ACCEPT4''@|$(GNULIB_ACCEPT4)|g' \
+ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
+ -e 's/@''GNULIB_SOCKET''@/$(GNULIB_SOCKET)/g' \
+ -e 's/@''GNULIB_CONNECT''@/$(GNULIB_CONNECT)/g' \
+ -e 's/@''GNULIB_ACCEPT''@/$(GNULIB_ACCEPT)/g' \
+ -e 's/@''GNULIB_BIND''@/$(GNULIB_BIND)/g' \
+ -e 's/@''GNULIB_GETPEERNAME''@/$(GNULIB_GETPEERNAME)/g' \
+ -e 's/@''GNULIB_GETSOCKNAME''@/$(GNULIB_GETSOCKNAME)/g' \
+ -e 's/@''GNULIB_GETSOCKOPT''@/$(GNULIB_GETSOCKOPT)/g' \
+ -e 's/@''GNULIB_LISTEN''@/$(GNULIB_LISTEN)/g' \
+ -e 's/@''GNULIB_RECV''@/$(GNULIB_RECV)/g' \
+ -e 's/@''GNULIB_SEND''@/$(GNULIB_SEND)/g' \
+ -e 's/@''GNULIB_RECVFROM''@/$(GNULIB_RECVFROM)/g' \
+ -e 's/@''GNULIB_SENDTO''@/$(GNULIB_SENDTO)/g' \
+ -e 's/@''GNULIB_SETSOCKOPT''@/$(GNULIB_SETSOCKOPT)/g' \
+ -e 's/@''GNULIB_SHUTDOWN''@/$(GNULIB_SHUTDOWN)/g' \
+ -e 's/@''GNULIB_ACCEPT4''@/$(GNULIB_ACCEPT4)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
@@ -1073,22 +1165,23 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
- -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
- -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
- -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
- -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
- -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
- -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
- -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
- -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
- -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
- -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
- -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
- -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
+ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
+ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
+ -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
+ -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
+ -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
+ -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
+ -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \
+ -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \
+ -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \
+ -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \
+ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \
+ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
@@ -1132,7 +1225,8 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -1163,7 +1257,8 @@ sys/uio.h: sys_uio.in.h $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \
@@ -1187,15 +1282,16 @@ BUILT_SOURCES += time.h
time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
- -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
- -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
- -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
- -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
- -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
+ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
+ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
+ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
+ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
+ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
-e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
-e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
@@ -1251,55 +1347,56 @@ BUILT_SOURCES += unistd.h
unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
- -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
- -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
- -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
- -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \
- -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
- -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
- -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \
- -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
- -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \
- -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
- -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
- -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
- -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
- -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
- -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
- -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
- -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \
- -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
- -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
- -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
- -e 's|@''GNULIB_GROUP_MEMBER''@|$(GNULIB_GROUP_MEMBER)|g' \
- -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
- -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
- -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
- -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
- -e 's|@''GNULIB_PIPE''@|$(GNULIB_PIPE)|g' \
- -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
- -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
- -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \
- -e 's|@''GNULIB_READ''@|$(GNULIB_READ)|g' \
- -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
- -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
- -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
- -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
- -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \
- -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \
- -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \
- -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
- -e 's|@''GNULIB_UNISTD_H_NONBLOCKING''@|$(GNULIB_UNISTD_H_NONBLOCKING)|g' \
- -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
- -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
- -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
- -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
- -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
+ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
+ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
+ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
+ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
+ -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
+ -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \
+ -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
+ -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
+ -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
+ -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
+ -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
+ -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
+ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
+ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
+ -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
+ -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
+ -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
+ -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \
+ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
+ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
+ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
+ -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
+ -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
+ -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
+ -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \
+ -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \
+ -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \
+ -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \
+ -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \
+ -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \
+ -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
+ -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
+ -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
+ -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
+ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
+ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
+ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
+ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \
+ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
+ -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \
+ -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \
+ -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \
< $(srcdir)/unistd.in.h | \
sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
@@ -1379,6 +1476,13 @@ EXTRA_DIST += unistd.in.h
## end gnulib module unistd
+## begin gnulib module useless-if-before-free
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free
+
+## end gnulib module useless-if-before-free
+
## begin gnulib module vasnprintf
@@ -1397,6 +1501,13 @@ EXTRA_libgnu_la_SOURCES += asprintf.c vasprintf.c
## end gnulib module vasprintf
+## begin gnulib module vc-list-files
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files
+
+## end gnulib module vc-list-files
+
## begin gnulib module verify
@@ -1425,25 +1536,6 @@ EXTRA_libgnu_la_SOURCES += vsnprintf.c
## end gnulib module vsnprintf
-## begin gnulib module warn-on-use
-
-BUILT_SOURCES += warn-on-use.h
-# The warn-on-use.h that gets inserted into generated .h files is the same as
-# build-aux/warn-on-use.h, except that it has the copyright header cut off.
-warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/^.ifndef/,$$p' \
- < $(top_srcdir)/build-aux/warn-on-use.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
-
-WARN_ON_USE_H=warn-on-use.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
-
-## end gnulib module warn-on-use
-
## begin gnulib module wchar
BUILT_SOURCES += wchar.h
@@ -1453,51 +1545,52 @@ BUILT_SOURCES += wchar.h
wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
- -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
- -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
- -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
- -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
- -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
- -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
- -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
- -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
- -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
- -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
- -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
- -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
- -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
- -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
- -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
- -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
- -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
- -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
- -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
- -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
- -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
- -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
- -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
- -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
- -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
- -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
- -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
- -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
- -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
- -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
- -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
- -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
- -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
- -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
- -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
- -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
- -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
- -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
- -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
+ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \
+ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \
+ -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \
+ -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \
+ -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \
+ -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \
+ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \
+ -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \
+ -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \
+ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \
+ -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \
+ -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \
+ -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
+ -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
+ -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
+ -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
+ -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
+ -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
+ -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \
+ -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \
+ -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \
+ -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \
+ -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \
+ -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \
+ -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \
+ -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \
+ -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \
+ -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \
+ -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \
+ -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \
+ -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \
+ -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \
+ -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \
+ -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \
+ -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \
+ -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \
+ -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \
+ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \
+ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \
< $(srcdir)/wchar.in.h | \
sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
diff --git a/gl/alignof.h b/gl/alignof.h
index 03bed6f4a9..1c1f75c5e7 100644
--- a/gl/alignof.h
+++ b/gl/alignof.h
@@ -31,7 +31,7 @@
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
#endif
-/* Determine the good alignment of a object of the given type at compile time.
+/* Determine the good alignment of an object of the given type at compile time.
Note that this is not necessarily the same as alignof_slot(type).
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
- when -malign-double is not specified: alignof_slot(double) = 4,
diff --git a/gl/alloca.c b/gl/alloca.c
index 771c2faa34..06b12a7bff 100644
--- a/gl/alloca.c
+++ b/gl/alloca.c
@@ -93,25 +93,15 @@ long i00afunc ();
static int stack_dir; /* 1 or -1 once known. */
# define STACK_DIR stack_dir
-static void
-find_stack_direction (char **ptr)
+static int
+find_stack_direction (int *addr, int depth)
{
- auto char dummy; /* To get stack address. */
-
- if (*ptr == NULL)
- { /* Initial entry. */
- *ptr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (ptr); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > *ptr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
+ int dir, dummy = 0;
+ if (! addr)
+ addr = &dummy;
+ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+ dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+ return dir + dummy;
}
# endif /* STACK_DIRECTION == 0 */
@@ -154,10 +144,7 @@ alloca (size_t size)
# if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
- {
- char *addr = NULL; /* Address of first `dummy', once known. */
- find_stack_direction (&addr);
- }
+ STACK_DIR = find_stack_direction (NULL, (size & 1) + 20);
# endif
/* Reclaim garbage, defined as all alloca'd storage that
diff --git a/gl/errno.in.h b/gl/errno.in.h
index a91f5912ea..5a7533aab9 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -16,7 +16,7 @@
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_ERRNO_H
+#ifndef _@GUARD_PREFIX@_ERRNO_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
-#ifndef _GL_ERRNO_H
-#define _GL_ERRNO_H
+#ifndef _@GUARD_PREFIX@_ERRNO_H
+#define _@GUARD_PREFIX@_ERRNO_H
/* On native Windows platforms, many macros are not defined. */
@@ -147,6 +147,16 @@
# define GNULIB_defined_ENOTSUP 1
# endif
+# ifndef ENETRESET
+# define ENETRESET 2011
+# define GNULIB_defined_ENETRESET 1
+# endif
+
+# ifndef ECONNABORTED
+# define ECONNABORTED 2012
+# define GNULIB_defined_ECONNABORTED 1
+# endif
+
# ifndef ESTALE
# define ESTALE 2009
# define GNULIB_defined_ESTALE 1
@@ -163,5 +173,5 @@
# endif
-#endif /* _GL_ERRNO_H */
-#endif /* _GL_ERRNO_H */
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/gl/error.c b/gl/error.c
index a2d1c1be33..7482baacfb 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -97,11 +97,15 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
/* The gnulib override of fcntl is not needed in this file. */
# undef fcntl
-# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
+# if !HAVE_DECL_STRERROR_R
# ifndef HAVE_DECL_STRERROR_R
"this configure-time declaration test was not run"
# endif
+# if STRERROR_R_CHAR_P
char *strerror_r ();
+# else
+int strerror_r ();
+# endif
# endif
/* The calling program should define program_name and set it to the
diff --git a/gl/float.c b/gl/float.c
new file mode 100644
index 0000000000..c453d6d195
--- /dev/null
+++ b/gl/float.c
@@ -0,0 +1,33 @@
+/* Auxiliary definitions for <float.h>.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+ 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 <config.h>
+
+/* Specification. */
+#include <float.h>
+
+#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
+const union gl_long_double_union gl_LDBL_MAX =
+ { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
+#elif defined __i386__
+const union gl_long_double_union gl_LDBL_MAX =
+ { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
+#else
+/* This declaration is solely to ensure that after preprocessing
+ this file is never empty. */
+typedef int dummy;
+#endif
diff --git a/gl/float.in.h b/gl/float.in.h
index d32f20ee4d..57b7bc93a2 100644
--- a/gl/float.in.h
+++ b/gl/float.in.h
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GL_FLOAT_H
+#ifndef _@GUARD_PREFIX@_FLOAT_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -25,10 +25,11 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
-#ifndef _GL_FLOAT_H
-#define _GL_FLOAT_H
+#ifndef _@GUARD_PREFIX@_FLOAT_H
+#define _@GUARD_PREFIX@_FLOAT_H
/* 'long double' properties. */
+
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
/* Number of mantissa units, in base FLT_RADIX. */
# undef LDBL_MANT_DIG
@@ -59,5 +60,115 @@
# define LDBL_MAX_10_EXP 4932
#endif
-#endif /* _GL_FLOAT_H */
-#endif /* _GL_FLOAT_H */
+/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
+ precision in the compiler but 64 bits of precision at runtime. See
+ <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>. */
+#if defined __i386__ && defined __FreeBSD__
+/* Number of mantissa units, in base FLT_RADIX. */
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG 64
+/* Number of decimal digits that is sufficient for representing a number. */
+# undef LDBL_DIG
+# define LDBL_DIG 18
+/* x-1 where x is the smallest representable number > 1. */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
+/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP (-16381)
+/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */
+# undef LDBL_MAX_EXP
+# define LDBL_MAX_EXP 16384
+/* Minimum positive normalized number. */
+# undef LDBL_MIN
+# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */
+/* Maximum representable finite number. */
+# undef LDBL_MAX
+/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
+ But the largest literal that GCC allows us to write is
+ 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
+ So, define it like this through a reference to an external variable
+
+ const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
+ extern const long double LDBL_MAX;
+
+ Unfortunately, this is not a constant expression. */
+union gl_long_double_union
+ {
+ struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
+ long double ld;
+ };
+extern const union gl_long_double_union gl_LDBL_MAX;
+# define LDBL_MAX (gl_LDBL_MAX.ld)
+/* Minimum e such that 10^e is in the range of normalized numbers. */
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP (-4931)
+/* Maximum e such that 10^e is in the range of representable finite numbers. */
+# undef LDBL_MAX_10_EXP
+# define LDBL_MAX_10_EXP 4932
+#endif
+
+/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
+ wrong. */
+#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP DBL_MIN_EXP
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+# undef LDBL_MIN
+# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
+# undef LDBL_MAX
+/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
+ It is not easy to define:
+ #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
+ is too small, whereas
+ #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
+ is too large. Apparently a bug in GCC decimal-to-binary conversion.
+ Also, I can't get values larger than
+ #define LDBL63 ((long double) (1ULL << 63))
+ #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+ #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+ #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+ #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
+ which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
+ So, define it like this through a reference to an external variable
+
+ const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
+ extern const long double LDBL_MAX;
+
+ or through a pointer cast
+
+ #define LDBL_MAX \
+ (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
+
+ Unfortunately, this is not a constant expression, and the latter expression
+ does not work well when GCC is optimizing.. */
+union gl_long_double_union
+ {
+ struct { double hi; double lo; } dd;
+ long double ld;
+ };
+extern const union gl_long_double_union gl_LDBL_MAX;
+# define LDBL_MAX (gl_LDBL_MAX.ld)
+#endif
+
+/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
+ On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
+ are wrong. */
+#if defined __sgi && (LDBL_MANT_DIG >= 106)
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG 106
+# if defined __GNUC__
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP DBL_MIN_EXP
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+# undef LDBL_MIN
+# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
diff --git a/gl/fseek.c b/gl/fseek.c
new file mode 100644
index 0000000000..bcb76d8bc7
--- /dev/null
+++ b/gl/fseek.c
@@ -0,0 +1,30 @@
+/* An fseek() function that, together with fflush(), is POSIX compliant.
+ Copyright (C) 2007, 2009-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 <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+/* Get off_t. */
+#include <unistd.h>
+
+int
+fseek (FILE *fp, long offset, int whence)
+{
+ /* Use the replacement fseeko function with all its workarounds. */
+ return fseeko (fp, (off_t)offset, whence);
+}
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 2dd4cdcd94..715b6289ea 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -69,6 +69,9 @@ fseeko (FILE *fp, off_t offset, int whence)
&& fp->_rcount == 0
&& fp->_wcount == 0
&& fp->_ungetc_count == 0)
+#elif defined __minix /* Minix */
+ if (fp_->_ptr == fp_->_buf
+ && (fp_->_ptr == NULL || fp_->_count == 0))
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
if (fp_->_ptr == fp_->_base
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
diff --git a/gl/ftell.c b/gl/ftell.c
new file mode 100644
index 0000000000..74ec986e27
--- /dev/null
+++ b/gl/ftell.c
@@ -0,0 +1,37 @@
+/* An ftell() function that works around platform bugs.
+ Copyright (C) 2007-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 <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#include <errno.h>
+#include <limits.h>
+
+long
+ftell (FILE *fp)
+{
+ /* Use the replacement ftello function with all its workarounds. */
+ off_t offset = ftello (fp);
+ if (LONG_MIN <= offset && offset <= LONG_MAX)
+ return /* (long) */ offset;
+ else
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
+}
diff --git a/gl/intprops.h b/gl/intprops.h
index a84bd6af53..1f6a539c18 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -22,10 +22,13 @@
#include <limits.h>
-/* Return a integer value, converted to the same type as the integer
- expression E after integer type promotion. V is the unconverted value.
- E should not have side effects. */
-#define _GL_INT_CONVERT(e, v) ((e) - (e) + (v))
+/* Return an integer value, converted to the same type as the integer
+ expression E after integer type promotion. V is the unconverted value. */
+#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
+
+/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */
+#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
/* The extra casts in the following macros work around compiler bugs,
e.g., in Cray C 5.0.3.0. */
@@ -49,8 +52,8 @@
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* Return 1 if the integer expression E, after integer promotion, has
- a signed type. E should not have side effects. */
-#define _GL_INT_SIGNED(e) (_GL_INT_CONVERT (e, -1) < 0)
+ a signed type. */
+#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
/* Minimum and maximum values for integer types and expressions. These
@@ -79,7 +82,7 @@
#define _GL_INT_MAXIMUM(e) \
(_GL_INT_SIGNED (e) \
? _GL_SIGNED_INT_MAXIMUM (e) \
- : _GL_INT_CONVERT (e, -1))
+ : _GL_INT_NEGATE_CONVERT (e, 1))
#define _GL_SIGNED_INT_MAXIMUM(e) \
(((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
@@ -179,16 +182,21 @@
: 0 < (a))
/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
- See above for restrictions. */
+ See above for restrictions. Avoid && and || as they tickle
+ bugs in Sun C 5.11 2010/08/13 and other compilers; see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \
((b) < 0 \
? ((a) < 0 \
? (a) < (max) / (b) \
- : (b) < -1 && (min) / (b) < (a)) \
- : (0 < (b) \
- && ((a) < 0 \
- ? (a) < (min) / (b) \
- : (max) / (b) < (a))))
+ : (b) == -1 \
+ ? 0 \
+ : (min) / (b) < (a)) \
+ : (b) == 0 \
+ ? 0 \
+ : ((a) < 0 \
+ ? (a) < (min) / (b) \
+ : (max) / (b) < (a)))
/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
See above for restrictions. Do not check for division by zero. */
@@ -234,11 +242,11 @@
(((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
|| INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \
+ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
: (a) < 0 ? (b) <= (a) + (b) - 1 \
: (b) < 0 && (a) + (b) <= (a))
#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \
+ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
: (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
: (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
@@ -302,13 +310,10 @@
/* Return 1 if the expression A <op> B would overflow,
where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
assuming MIN and MAX are the minimum and maximum for the result type.
-
- This macro assumes that A | B is a valid integer if both A and B are,
- which is true of all known practical hosts. If this is a problem
- for you, please let us know how to fix it for your host. */
+ Arguments should be free of side effects. */
#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \
op_result_overflow (a, b, \
- _GL_INT_MINIMUM ((a) | (b)), \
- _GL_INT_MAXIMUM ((a) | (b)))
+ _GL_INT_MINIMUM (0 * (b) + (a)), \
+ _GL_INT_MAXIMUM (0 * (b) + (a)))
#endif /* _GL_INTPROPS_H */
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index 689da75a2a..a8744a844f 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 11
+# alloca.m4 serial 13
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -42,3 +42,80 @@ AC_DEFUN([gl_FUNC_ALLOCA],
# Prerequisites of lib/alloca.c.
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
+
+# This works around a bug in autoconf <= 2.68.
+# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>.
+
+m4_version_prereq([2.69], [] ,[
+
+# This is taken from the following Autoconf patch:
+# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
+
+# _AC_LIBOBJ_ALLOCA
+# -----------------
+# Set up the LIBOBJ replacement of `alloca'. Well, not exactly
+# AC_LIBOBJ since we actually set the output variable `ALLOCA'.
+# Nevertheless, for Automake, AC_LIBSOURCES it.
+m4_define([_AC_LIBOBJ_ALLOCA],
+[# The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+AC_LIBSOURCES(alloca.c)
+AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
+AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.])
+
+AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray,
+[AC_EGREP_CPP(webecray,
+[#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ AC_CHECK_FUNC($ac_func,
+ [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
+ [Define to one of `_getb67', `GETB67',
+ `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for
+ `alloca.c' support on those systems.])
+ break])
+ done
+fi
+
+AC_CACHE_CHECK([stack direction for C alloca],
+ [ac_cv_c_stack_direction],
+[AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+int
+find_stack_direction (int *addr, int depth)
+{
+ int dir, dummy = 0;
+ if (! addr)
+ addr = &dummy;
+ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+ dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+ return dir + dummy;
+}
+
+int
+main (int argc, char **argv)
+{
+ return find_stack_direction (0, argc + !argv + 20) < 0;
+}])],
+ [ac_cv_c_stack_direction=1],
+ [ac_cv_c_stack_direction=-1],
+ [ac_cv_c_stack_direction=0])])
+AH_VERBATIM([STACK_DIRECTION],
+[/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+@%:@undef STACK_DIRECTION])dnl
+AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
+])# _AC_LIBOBJ_ALLOCA
+])
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index a6d37f3b32..560adbafed 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 9
+# errno_h.m4 serial 10
dnl Copyright (C) 2004, 2006, 2008-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,
@@ -34,6 +34,12 @@ booboo
#if !defined ENOTSUP
booboo
#endif
+#if !defined ENETRESET
+booboo
+#endif
+#if !defined ECONNABORTED
+booboo
+#endif
#if !defined ESTALE
booboo
#endif
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 6ea75ac029..e7022fe460 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,4 +1,4 @@
-#serial 13
+#serial 14
# Copyright (C) 1996-1998, 2001-2004, 2009-2011 Free Software Foundation, Inc.
#
@@ -8,16 +8,8 @@
AC_DEFUN([gl_ERROR],
[
- AC_FUNC_ERROR_AT_LINE
- dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
- gl_PREREQ_ERROR
-])
-
-# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in
-# Autoconf.
-AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
-[
- AC_LIBSOURCES([error.h, error.c])dnl
+ dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer
+ dnl maintained in Autoconf and because it invokes AC_LIBOBJ.
AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
@@ -25,9 +17,6 @@ AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
[[error_at_line (0, 0, "", 0, "an error occurred");]])],
[ac_cv_lib_error_at_line=yes],
[ac_cv_lib_error_at_line=no])])
- if test $ac_cv_lib_error_at_line = no; then
- AC_LIBOBJ([error])
- fi
])
# Prerequisites of lib/error.c.
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 1330503f0d..22156e068c 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 9 -*- Autoconf -*-
+# serial 10 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
@@ -67,6 +67,10 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
+/* Enable general extensions on MacOS X. */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
@@ -95,6 +99,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_ALL_SOURCE])
+ AC_DEFINE([_DARWIN_C_SOURCE])
AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index 21a7529fe0..261f1ac3af 100644
--- a/gl/m4/float_h.m4
+++ b/gl/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 6
+# float_h.m4 serial 7
dnl Copyright (C) 2007, 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,
@@ -9,12 +9,41 @@ AC_DEFUN([gl_FLOAT_H],
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
FLOAT_H=
+ REPLACE_FLOAT_LDBL=0
case "$host_os" in
- beos* | openbsd* | mirbsd*)
+ aix* | beos* | openbsd* | mirbsd* | irix*)
FLOAT_H=float.h
- gl_NEXT_HEADERS([float.h])
+ ;;
+ freebsd*)
+ case "$host_cpu" in
+changequote(,)dnl
+ i[34567]86 )
+changequote([,])dnl
+ FLOAT_H=float.h
+ ;;
+ x86_64 )
+ # On x86_64 systems, the C compiler may still be generating
+ # 32-bit code.
+ AC_EGREP_CPP([yes],
+ [#if defined __LP64__ || defined __x86_64__ || defined __amd64__
+ yes
+ #endif],
+ [],
+ [FLOAT_H=float.h])
+ ;;
+ esac
+ ;;
+ esac
+ case "$host_os" in
+ aix* | freebsd*)
+ if test -n "$FLOAT_H"; then
+ REPLACE_FLOAT_LDBL=1
+ fi
;;
esac
+ if test -n "$FLOAT_H"; then
+ gl_NEXT_HEADERS([float.h])
+ fi
AC_SUBST([FLOAT_H])
AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
])
diff --git a/gl/m4/fpieee.m4 b/gl/m4/fpieee.m4
new file mode 100644
index 0000000000..78728762de
--- /dev/null
+++ b/gl/m4/fpieee.m4
@@ -0,0 +1,52 @@
+# fpieee.m4 serial 1
+dnl Copyright (C) 2007, 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.
+
+dnl IEEE 754 standardized three items:
+dnl - The formats of single-float and double-float - nowadays commonly
+dnl available as 'float' and 'double' in C and C++.
+dnl No autoconf test needed.
+dnl - The overflow and division by zero behaviour: The result are values
+dnl '±Inf' and 'NaN', rather than exceptions as it was before.
+dnl This file provides an autoconf macro for ensuring this behaviour of
+dnl floating-point operations.
+dnl - A set of conditions (overflow, underflow, inexact, etc.) which can
+dnl be configured to trigger an exception.
+dnl This cannot be done in a portable way: it depends on the compiler,
+dnl libc, kernel, and CPU. No autoconf macro is provided for this.
+
+dnl Ensure non-trapping behaviour of floating-point overflow and
+dnl floating-point division by zero.
+dnl (For integer overflow, see gcc's -ftrapv option; for integer division by
+dnl zero, see the autoconf macro in intdiv0.m4.)
+
+AC_DEFUN([gl_FP_IEEE],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ # IEEE behaviour is the default on all CPUs except Alpha and SH
+ # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
+ # and the GCC 4.1.2 manual).
+ case "$host_cpu" in
+ alpha*)
+ # On Alpha systems, a compiler option provides the behaviour.
+ # See the ieee(3) manual page, also available at
+ # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM>
+ if test -n "$GCC"; then
+ # GCC has the option -mieee.
+ CPPFLAGS="$CPPFLAGS -mieee"
+ else
+ # Compaq (ex-DEC) C has the option -ieee.
+ CPPFLAGS="$CPPFLAGS -ieee"
+ fi
+ ;;
+ sh*)
+ if test -n "$GCC"; then
+ # GCC has the option -mieee.
+ CPPFLAGS="$CPPFLAGS -mieee"
+ fi
+ ;;
+ esac
+])
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
new file mode 100644
index 0000000000..135a22bdc8
--- /dev/null
+++ b/gl/m4/fseek.m4
@@ -0,0 +1,15 @@
+# fseek.m4 serial 4
+dnl Copyright (C) 2007, 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.
+
+AC_DEFUN([gl_FUNC_FSEEK],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_FSEEKO])
+ dnl When fseeko needs fixes, fseek needs them too.
+ if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
+ REPLACE_FSEEK=1
+ fi
+])
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index 28da81b1cc..391948d4e3 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 12
+# fseeko.m4 serial 15
dnl Copyright (C) 2007-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,
@@ -7,34 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FSEEKO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_HAVE_FSEEKO])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
-
- AC_CHECK_DECLS_ONCE([fseeko])
- if test $ac_cv_have_decl_fseeko = no; then
- HAVE_DECL_FSEEKO=0
- fi
-
- if test $gl_cv_func_fseeko = no; then
- HAVE_FSEEKO=0
- gl_REPLACE_FSEEKO
- else
- if test $gl_cv_var_stdin_large_offset = no; then
- gl_REPLACE_FSEEKO
- fi
- fi
- m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
- gl_FUNC_FFLUSH_STDIN
- if test $gl_cv_func_fflush_stdin = no; then
- gl_REPLACE_FSEEKO
- fi
- ])
-])
-
-dnl Tests whether fseeko is available.
-dnl Result is gl_cv_func_fseeko.
-AC_DEFUN([gl_HAVE_FSEEKO],
-[
AC_REQUIRE([AC_PROG_CC])
dnl Persuade glibc <stdio.h> to declare fseeko().
@@ -46,18 +19,25 @@ AC_DEFUN([gl_HAVE_FSEEKO],
]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
-])
-AC_DEFUN([gl_REPLACE_FSEEKO],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_HAVE_FSEEKO])
- if test $gl_cv_func_fseeko = yes; then
- REPLACE_FSEEKO=1
+ AC_CHECK_DECLS_ONCE([fseeko])
+ if test $ac_cv_have_decl_fseeko = no; then
+ HAVE_DECL_FSEEKO=0
+ fi
+
+ if test $gl_cv_func_fseeko = no; then
+ HAVE_FSEEKO=0
+ else
+ if test $gl_cv_var_stdin_large_offset = no; then
+ REPLACE_FSEEKO=1
+ fi
+ m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
+ gl_FUNC_FFLUSH_STDIN
+ if test $gl_cv_func_fflush_stdin = no; then
+ REPLACE_FSEEKO=1
+ fi
+ ])
fi
- AC_LIBOBJ([fseeko])
- dnl If we are also using the fseek module, then fseek needs replacing, too.
- m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
dnl Code shared by fseeko and ftello. Determine if large files are supported,
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4
new file mode 100644
index 0000000000..c529c50302
--- /dev/null
+++ b/gl/m4/ftell.m4
@@ -0,0 +1,15 @@
+# ftell.m4 serial 3
+dnl Copyright (C) 2007, 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.
+
+AC_DEFUN([gl_FUNC_FTELL],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_FTELLO])
+ dnl When ftello needs fixes, ftell needs them too.
+ if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
+ REPLACE_FTELL=1
+ fi
+])
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
index 599f8f2047..10cf4291bf 100644
--- a/gl/m4/ftello.m4
+++ b/gl/m4/ftello.m4
@@ -1,4 +1,4 @@
-# ftello.m4 serial 9
+# ftello.m4 serial 10
dnl Copyright (C) 2007-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,
@@ -124,12 +124,4 @@ main (void)
esac
fi
fi
- if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
- gl_REPLACE_FTELLO
- fi
-])
-
-AC_DEFUN([gl_REPLACE_FTELLO],
-[
- AC_LIBOBJ([ftello])
])
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index ef1273668b..6a0f632c78 100644
--- a/gl/m4/getdelim.m4
+++ b/gl/m4/getdelim.m4
@@ -1,4 +1,4 @@
-# getdelim.m4 serial 8
+# getdelim.m4 serial 9
dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
dnl
@@ -19,6 +19,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
AC_CHECK_FUNCS_ONCE([getdelim])
if test $ac_cv_func_getdelim = yes; then
+ HAVE_GETDELIM=1
dnl Found it in some library. Verify that it works.
AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
[echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
@@ -65,21 +66,16 @@ AC_DEFUN([gl_FUNC_GETDELIM],
[gl_cv_func_working_getdelim=yes],
[gl_cv_func_working_getdelim=no])]
)])
+ if test $gl_cv_func_working_getdelim = no; then
+ REPLACE_GETDELIM=1
+ fi
else
- gl_cv_func_working_getdelim=no
+ HAVE_GETDELIM=0
fi
if test $ac_cv_have_decl_getdelim = no; then
HAVE_DECL_GETDELIM=0
fi
-
- if test $gl_cv_func_working_getdelim = no; then
- if test $ac_cv_func_getdelim = yes; then
- REPLACE_GETDELIM=1
- fi
- AC_LIBOBJ([getdelim])
- gl_PREREQ_GETDELIM
- fi
])
# Prerequisites of lib/getdelim.c.
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
index ec001b91be..4c57797259 100644
--- a/gl/m4/getline.m4
+++ b/gl/m4/getline.m4
@@ -1,4 +1,4 @@
-# getline.m4 serial 23
+# getline.m4 serial 25
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2011 Free Software Foundation,
dnl Inc.
@@ -84,14 +84,11 @@ AC_DEFUN([gl_FUNC_GETLINE],
dnl getline function among $LIBS, it may exist in libinet and the
dnl executable may be linked with -linet.
REPLACE_GETLINE=1
- AC_LIBOBJ([getline])
-
- gl_PREREQ_GETLINE
fi
])
# Prerequisites of lib/getline.c.
AC_DEFUN([gl_PREREQ_GETLINE],
[
- gl_FUNC_GETDELIM
+ :
])
diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4
index 79dfbbe493..f7ac1ef69d 100644
--- a/gl/m4/getpagesize.m4
+++ b/gl/m4/getpagesize.m4
@@ -1,4 +1,4 @@
-# getpagesize.m4 serial 8
+# getpagesize.m4 serial 9
dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2011 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -24,7 +24,6 @@ AC_DEFUN([gl_FUNC_GETPAGESIZE],
case "$host_os" in
mingw*)
REPLACE_GETPAGESIZE=1
- AC_LIBOBJ([getpagesize])
;;
esac
dnl Also check whether it's declared.
diff --git a/gl/m4/getpass.m4 b/gl/m4/getpass.m4
index c6ec427f08..64cee1ea87 100644
--- a/gl/m4/getpass.m4
+++ b/gl/m4/getpass.m4
@@ -1,4 +1,4 @@
-# getpass.m4 serial 12
+# getpass.m4 serial 13
dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -11,10 +11,12 @@ AC_DEFUN([gl_FUNC_GETPASS],
dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REPLACE_FUNCS([getpass])
+ AC_CHECK_FUNCS([getpass])
AC_CHECK_DECLS_ONCE([getpass])
- if test $ac_cv_func_getpass = no; then
- gl_PREREQ_GETPASS
+ if test $ac_cv_func_getpass = yes; then
+ HAVE_GETPASS=1
+ else
+ HAVE_GETPASS=0
fi
])
@@ -27,13 +29,15 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU],
AC_CHECK_DECLS_ONCE([getpass])
dnl TODO: Detect when GNU getpass() is already found in glibc.
- AC_LIBOBJ([getpass])
- gl_PREREQ_GETPASS
- dnl We must choose a different name for our function, since on ELF systems
- dnl an unusable getpass() in libc.so would override our getpass() if it is
- dnl compiled into a shared library.
- AC_DEFINE([getpass], [gnu_getpass],
- [Define to a replacement function name for getpass().])
+ REPLACE_GETPASS=1
+
+ if test $REPLACE_GETPASS = 1; then
+ dnl We must choose a different name for our function, since on ELF systems
+ dnl an unusable getpass() in libc.so would override our getpass() if it is
+ dnl compiled into a shared library.
+ AC_DEFINE([getpass], [gnu_getpass],
+ [Define to a replacement function name for getpass().])
+ fi
])
# Prerequisites of lib/getpass.c.
diff --git a/gl/m4/gettime.m4 b/gl/m4/gettime.m4
index 2b148abb5c..f2122dccd9 100644
--- a/gl/m4/gettime.m4
+++ b/gl/m4/gettime.m4
@@ -1,4 +1,4 @@
-# gettime.m4 serial 7
+# gettime.m4 serial 8
dnl Copyright (C) 2002, 2004-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,
@@ -6,8 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_GETTIME],
[
- AC_LIBOBJ([gettime])
-
dnl Prerequisites of lib/gettime.c.
AC_REQUIRE([gl_CLOCK_TIME])
AC_REQUIRE([gl_TIMESPEC])
diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4
index 84acadf216..47c1e1d316 100644
--- a/gl/m4/gettimeofday.m4
+++ b/gl/m4/gettimeofday.m4
@@ -1,4 +1,4 @@
-# serial 15
+# serial 17
# Copyright (C) 2001-2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -17,8 +17,6 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
gl_gettimeofday_timezone=void
if test $ac_cv_func_gettimeofday != yes; then
HAVE_GETTIMEOFDAY=0
- AC_LIBOBJ([gettimeofday])
- gl_PREREQ_GETTIMEOFDAY
else
gl_FUNC_GETTIMEOFDAY_CLOBBER
AC_CACHE_CHECK([for gettimeofday with POSIX signature],
@@ -51,9 +49,18 @@ int gettimeofday (struct timeval *restrict, struct timezone *restrict);
gl_gettimeofday_timezone='struct timezone'
elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
REPLACE_GETTIMEOFDAY=1
- AC_LIBOBJ([gettimeofday])
- gl_PREREQ_GETTIMEOFDAY
fi
+ m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
+ gl_FUNC_TZSET_CLOBBER
+ if test $gl_cv_func_tzset_clobber = yes; then
+ REPLACE_GETTIMEOFDAY=1
+ gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+ AC_DEFINE([tzset], [rpl_tzset],
+ [Define to rpl_tzset if the wrapper function should be used.])
+ AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
+ [Define if tzset clobbers localtime's static buffer.])
+ fi
+ ])
fi
AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
[Define this to 'void' or 'struct timezone' to match the system's
@@ -105,8 +112,6 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
])
AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
- AC_LIBOBJ([gettimeofday])
- gl_PREREQ_GETTIMEOFDAY
AC_DEFINE([gmtime], [rpl_gmtime],
[Define to rpl_gmtime if the replacement function should be used.])
AC_DEFINE([localtime], [rpl_localtime],
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index d1d4636e8b..1a5a945ee4 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 error extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vsnprintf warnings
+# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 error extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
@@ -34,6 +34,7 @@ gl_MODULES([
havelib
lib-msvc-compat
lib-symbol-versions
+ maintainer-makefile
manywarnings
memmem-simple
minmax
@@ -72,4 +73,5 @@ gl_MAKEFILE_NAME([])
gl_LIBTOOL
gl_MACRO_PREFIX([gl])
gl_PO_DOMAIN([])
+gl_WITNESS_C_DOMAIN([])
gl_VC_FILES([false])
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index c4d7a20ea3..9dc8fbe8e4 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 24
+# gnulib-common.m4 serial 29
dnl Copyright (C) 2007-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,
@@ -12,6 +12,19 @@ AC_DEFUN([gl_COMMON], [
AC_REQUIRE([gl_COMMON_BODY])
])
AC_DEFUN([gl_COMMON_BODY], [
+ AH_VERBATIM([_Noreturn],
+[/* The _Noreturn keyword of draft C1X. */
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+ || 0x5110 <= __SUNPRO_C)
+# define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn
+# endif
+#endif
+])
AH_VERBATIM([isoc99_inline],
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
@@ -34,6 +47,20 @@ AC_DEFUN([gl_COMMON_BODY], [
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED
+
+/* The __pure__ attribute was added in gcc 2.96. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
+/* The __const__ attribute was added in gcc 2.95. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+#else
+# define _GL_ATTRIBUTE_CONST /* empty */
+#endif
])
dnl Preparation for running test programs:
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
@@ -47,16 +74,49 @@ AC_DEFUN([gl_COMMON_BODY], [
# expands to a C preprocessor expression that evaluates to 1 or 0, depending
# whether a gnulib module that has been requested shall be considered present
# or not.
-AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1])
+m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
# sets the shell variable that indicates the presence of the given module to
# a C preprocessor expression that will evaluate to 1.
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
[
- GNULIB_[]m4_translit([[$1]],
- [abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION
+ gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
+ [GNULIB_[]m4_translit([[$1]],
+ [abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
+ [gl_MODULE_INDICATOR_CONDITION])
+])
+
+# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
+# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
+# The shell variable's value is a C preprocessor expression that evaluates
+# to 0 or 1.
+AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
+[
+ m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
+ [
+ dnl Simplify the expression VALUE || 1 to 1.
+ $1=1
+ ],
+ [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
+ [gl_MODULE_INDICATOR_CONDITION])])
+])
+
+# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
+# modifies the shell variable to include the given condition. The shell
+# variable's value is a C preprocessor expression that evaluates to 0 or 1.
+AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
+[
+ dnl Simplify the expression 1 || CONDITION to 1.
+ if test "$[]$1" != 1; then
+ dnl Simplify the expression 0 || CONDITION to CONDITION.
+ if test "$[]$1" = 0; then
+ $1=$2
+ else
+ $1="($[]$1 || $2)"
+ fi
+ fi
])
# gl_MODULE_INDICATOR([modulename])
@@ -151,6 +211,35 @@ m4_ifndef([AS_VAR_IF],
[m4_define([AS_VAR_IF],
[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+# gl_PROG_AR_RANLIB
+# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
+AC_DEFUN([gl_PROG_AR_RANLIB],
+[
+ dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
+ dnl as "cc", and GCC as "gcc". They have different object file formats and
+ dnl library formats. In particular, the GNU binutils programs ar, ranlib
+ dnl produce libraries that work only with gcc, not with cc.
+ AC_REQUIRE([AC_PROG_CC])
+ AC_EGREP_CPP([Amsterdam],
+ [
+#ifdef __ACK__
+Amsterdam
+#endif
+ ],
+ [AR='cc -c.a'
+ ARFLAGS='-o'
+ RANLIB=':'
+ ],
+ [dnl Use the Automake-documented default values for AR and ARFLAGS.
+ AR='ar'
+ ARFLAGS='cru'
+ dnl Use the ranlib program if it is available.
+ AC_PROG_RANLIB
+ ])
+ AC_SUBST([AR])
+ AC_SUBST([ARFLAGS])
+])
+
# AC_PROG_MKDIR_P
# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
# for interoperability with automake-1.9.6 from autoconf-2.62.
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 0dd6d5da85..45a8f0d16a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -25,17 +25,15 @@ AC_DEFUN([gl_EARLY],
m4_pattern_allow([^gl_ES$])dnl a valid locale name
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
+ AC_REQUIRE([gl_PROG_AR_RANLIB])
# Code from module alignof:
# Code from module alloca:
# Code from module alloca-opt:
# Code from module alloca-opt-tests:
- # Code from module arg-nonnull:
# Code from module binary-io:
# Code from module binary-io-tests:
# Code from module byteswap:
# Code from module byteswap-tests:
- # Code from module c++defs:
# Code from module c-ctype:
# Code from module c-ctype-tests:
# Code from module clock-time:
@@ -52,9 +50,17 @@ AC_DEFUN([gl_EARLY],
# Code from module fcntl-h-tests:
# Code from module fd-hook:
# Code from module float:
+ # Code from module float-tests:
+ # Code from module fpieee:
+ AC_REQUIRE([gl_FP_IEEE])
+ # Code from module fpucw:
+ # Code from module fseek:
+ # Code from module fseek-tests:
# Code from module fseeko:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module fseeko-tests:
+ # Code from module ftell:
+ # Code from module ftell-tests:
# Code from module ftello:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module ftello-tests:
@@ -71,6 +77,7 @@ AC_DEFUN([gl_EARLY],
# Code from module gettime:
# Code from module gettimeofday:
# Code from module gettimeofday-tests:
+ # Code from module gnumakefile:
# Code from module havelib:
# Code from module include_next:
# Code from module intprops:
@@ -78,9 +85,11 @@ AC_DEFUN([gl_EARLY],
# Code from module inttypes:
# Code from module inttypes-incomplete:
# Code from module inttypes-tests:
+ # Code from module largefile:
# Code from module lib-msvc-compat:
# Code from module lib-symbol-versions:
# Code from module lseek:
+ # Code from module maintainer-makefile:
# Code from module malloc-posix:
# Code from module manywarnings:
# Code from module memchr:
@@ -98,6 +107,10 @@ AC_DEFUN([gl_EARLY],
# Code from module read-file-tests:
# Code from module realloc-posix:
# Code from module size_max:
+ # Code from module snippet/_Noreturn:
+ # Code from module snippet/arg-nonnull:
+ # Code from module snippet/c++defs:
+ # Code from module snippet/warn-on-use:
# Code from module snprintf:
# Code from module snprintf-tests:
# Code from module socketlib:
@@ -123,6 +136,7 @@ AC_DEFUN([gl_EARLY],
# Code from module strcase:
# Code from module strdup-posix:
# Code from module strerror:
+ # Code from module strerror-override:
# Code from module strerror-tests:
# Code from module string:
# Code from module string-tests:
@@ -146,11 +160,14 @@ AC_DEFUN([gl_EARLY],
# Code from module u64-tests:
# Code from module unistd:
# Code from module unistd-tests:
+ # Code from module useless-if-before-free:
# Code from module valgrind-tests:
# Code from module vasnprintf:
# Code from module vasnprintf-tests:
# Code from module vasprintf:
# Code from module vasprintf-tests:
+ # Code from module vc-list-files:
+ # Code from module vc-list-files-tests:
# Code from module verify:
# Code from module verify-tests:
# Code from module version-etc:
@@ -158,7 +175,6 @@ AC_DEFUN([gl_EARLY],
# Code from module version-etc-tests:
# Code from module vsnprintf:
# Code from module vsnprintf-tests:
- # Code from module warn-on-use:
# Code from module warnings:
# Code from module wchar:
# Code from module wchar-tests:
@@ -186,40 +202,103 @@ AC_SUBST([LTALLOCA])
gl_FUNC_ALLOCA
gl_BYTESWAP
gl_CLOCK_TIME
-gl_HMAC_MD5
gl_MD5
gl_HEADER_ERRNO_H
gl_ERROR
+if test $ac_cv_lib_error_at_line = no; then
+ AC_LIBOBJ([error])
+ gl_PREREQ_ERROR
+fi
m4_ifdef([AM_XGETTEXT_OPTION],
[AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
gl_FLOAT_H
+if test $REPLACE_FLOAT_LDBL = 1; then
+ AC_LIBOBJ([float])
+fi
+gl_FUNC_FSEEK
+if test $REPLACE_FSEEK = 1; then
+ AC_LIBOBJ([fseek])
+fi
+gl_STDIO_MODULE_INDICATOR([fseek])
gl_FUNC_FSEEKO
+if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
+ AC_LIBOBJ([fseeko])
+fi
gl_STDIO_MODULE_INDICATOR([fseeko])
+gl_FUNC_FTELL
+if test $REPLACE_FTELL = 1; then
+ AC_LIBOBJ([ftell])
+fi
+gl_STDIO_MODULE_INDICATOR([ftell])
gl_FUNC_FTELLO
+if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
+ AC_LIBOBJ([ftello])
+fi
gl_STDIO_MODULE_INDICATOR([ftello])
gl_FUNC
gl_FUNC_GETDELIM
+if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
+ AC_LIBOBJ([getdelim])
+ gl_PREREQ_GETDELIM
+fi
gl_STDIO_MODULE_INDICATOR([getdelim])
gl_FUNC_GETLINE
+if test $REPLACE_GETLINE = 1; then
+ AC_LIBOBJ([getline])
+ gl_PREREQ_GETLINE
+fi
gl_STDIO_MODULE_INDICATOR([getline])
gl_FUNC_GETPASS
+if test $HAVE_GETPASS = 0; then
+ AC_LIBOBJ([getpass])
+ gl_PREREQ_GETPASS
+fi
dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
AM_GNU_GETTEXT_VERSION([0.18.1])
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
gl_GETTIME
gl_FUNC_GETTIMEOFDAY
+if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
+ AC_LIBOBJ([gettimeofday])
+ gl_PREREQ_GETTIMEOFDAY
+fi
gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
+# Autoconf 2.61a.99 and earlier don't support linking a file only
+# in VPATH builds. But since GNUmakefile is for maintainer use
+# only, it does not matter if we skip the link with older autoconf.
+# Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
+# builds, so use a shell variable to bypass this.
+GNUmakefile=GNUmakefile
+m4_if(m4_version_compare([2.61a.100],
+ m4_defn([m4_PACKAGE_VERSION])), [1], [],
+ [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
+ [GNUmakefile=$GNUmakefile])])
gl_LD_OUTPUT_DEF
gl_LD_VERSION_SCRIPT
gl_FUNC_LSEEK
+if test $REPLACE_LSEEK = 1; then
+ AC_LIBOBJ([lseek])
+fi
gl_UNISTD_MODULE_INDICATOR([lseek])
+AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
+ [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
gl_FUNC_MALLOC_POSIX
+if test $REPLACE_MALLOC = 1; then
+ AC_LIBOBJ([malloc])
+fi
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
gl_FUNC_MEMCHR
+if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
+ AC_LIBOBJ([memchr])
+ gl_PREREQ_MEMCHR
+fi
gl_STRING_MODULE_INDICATOR([memchr])
gl_FUNC_MEMMEM_SIMPLE
+if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then
+ AC_LIBOBJ([memmem])
+fi
gl_STRING_MODULE_INDICATOR([memmem])
gl_MEMXOR
gl_MINMAX
@@ -229,8 +308,11 @@ gl_HEADER_NETINET_IN
AC_PROG_MKDIR_P
AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
-gl_FUNC_READ_FILE
+gl_PREREQ_READ_FILE
gl_FUNC_REALLOC_POSIX
+if test $REPLACE_REALLOC = 1; then
+ AC_LIBOBJ([realloc])
+fi
gl_STDLIB_MODULE_INDICATOR([realloc-posix])
gl_SIZE_MAX
gl_FUNC_SNPRINTF
@@ -246,13 +328,39 @@ gl_STDINT_H
gl_STDIO_H
gl_STDLIB_H
gl_STRCASE
+if test $HAVE_STRCASECMP = 0; then
+ AC_LIBOBJ([strcasecmp])
+ gl_PREREQ_STRCASECMP
+fi
+if test $HAVE_STRNCASECMP = 0; then
+ AC_LIBOBJ([strncasecmp])
+ gl_PREREQ_STRNCASECMP
+fi
gl_FUNC_STRDUP_POSIX
+if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+ AC_LIBOBJ([strdup])
+ gl_PREREQ_STRDUP
+fi
gl_STRING_MODULE_INDICATOR([strdup])
gl_FUNC_STRERROR
+if test $REPLACE_STRERROR = 1; then
+ AC_LIBOBJ([strerror])
+fi
+gl_MODULE_INDICATOR([strerror])
gl_STRING_MODULE_INDICATOR([strerror])
+AC_REQUIRE([gl_HEADER_ERRNO_H])
+AC_REQUIRE([gl_FUNC_STRERROR_0])
+if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then
+ AC_LIBOBJ([strerror-override])
+ gl_PREREQ_SYS_H_WINSOCK2
+fi
gl_HEADER_STRING_H
gl_HEADER_STRINGS_H
gl_FUNC_STRVERSCMP
+if test $HAVE_STRVERSCMP = 0; then
+ AC_LIBOBJ([strverscmp])
+ gl_PREREQ_STRVERSCMP
+fi
gl_STRING_MODULE_INDICATOR([strverscmp])
gl_HEADER_SYS_SOCKET
AC_PROG_MKDIR_P
@@ -264,6 +372,10 @@ gl_HEADER_SYS_UIO
AC_PROG_MKDIR_P
gl_HEADER_TIME_H
gl_TIME_R
+if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
+ AC_LIBOBJ([time_r])
+ gl_PREREQ_TIME_R
+fi
gl_TIME_MODULE_INDICATOR([time_r])
gl_TIMESPEC
AC_REQUIRE([AC_C_INLINE])
@@ -330,7 +442,12 @@ changequote([, ])dnl
gl_FCNTL_H
gl_FUNC_UNGETC_WORKS
gl_FUNC_UNGETC_WORKS
+gl_FUNC_UNGETC_WORKS
+gl_FUNC_UNGETC_WORKS
gl_FUNC_GETPAGESIZE
+if test $REPLACE_GETPAGESIZE = 1; then
+ AC_LIBOBJ([getpagesize])
+fi
gl_UNISTD_MODULE_INDICATOR([getpagesize])
gl_INTTYPES_H
gl_INTTYPES_INCOMPLETE
@@ -342,6 +459,8 @@ gt_TYPE_WCHAR_T
gt_TYPE_WINT_T
AC_CHECK_FUNCS_ONCE([shutdown])
gl_VALGRIND_TESTS
+abs_aux_dir=`cd "$ac_aux_dir"; pwd`
+AC_SUBST([abs_aux_dir])
m4_popdef([gl_MODULE_INDICATOR_CONDITION])
m4_ifval(gltests_LIBSOURCES_LIST, [
m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
@@ -434,10 +553,13 @@ AC_DEFUN([gltests_LIBSOURCES], [
# This macro records the list of files which have been installed by
# gnulib-tool and may be removed by future gnulib-tool invocations.
AC_DEFUN([gl_FILE_LIST], [
- build-aux/arg-nonnull.h
- build-aux/c++defs.h
build-aux/config.rpath
- build-aux/warn-on-use.h
+ build-aux/snippet/_Noreturn.h
+ build-aux/snippet/arg-nonnull.h
+ build-aux/snippet/c++defs.h
+ build-aux/snippet/warn-on-use.h
+ build-aux/useless-if-before-free
+ build-aux/vc-list-files
lib/alignof.h
lib/alloca.c
lib/alloca.in.h
@@ -452,8 +574,11 @@ AC_DEFUN([gl_FILE_LIST], [
lib/fd-hook.c
lib/fd-hook.h
lib/float+.h
+ lib/float.c
lib/float.in.h
+ lib/fseek.c
lib/fseeko.c
+ lib/ftell.c
lib/ftello.c
lib/getdelim.c
lib/getline.c
@@ -500,6 +625,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/str-two-way.h
lib/strcasecmp.c
lib/strdup.c
+ lib/strerror-override.c
+ lib/strerror-override.h
lib/strerror.c
lib/string.in.h
lib/strings.in.h
@@ -536,7 +663,10 @@ AC_DEFUN([gl_FILE_LIST], [
m4/fcntl-o.m4
m4/fcntl_h.m4
m4/float_h.m4
+ m4/fpieee.m4
+ m4/fseek.m4
m4/fseeko.m4
+ m4/ftell.m4
m4/ftello.m4
m4/func.m4
m4/getdelim.m4
@@ -549,7 +679,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/glibc2.m4
m4/glibc21.m4
m4/gnulib-common.m4
- m4/hmac-md5.m4
m4/iconv.m4
m4/include_next.m4
m4/intdiv0.m4
@@ -561,6 +690,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/inttypes-pri.m4
m4/inttypes.m4
m4/inttypes_h.m4
+ m4/largefile.m4
m4/lcmessage.m4
m4/ld-output-def.m4
m4/ld-version-script.m4
@@ -640,9 +770,17 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-c-ctype.c
tests/test-errno.c
tests/test-fcntl-h.c
+ tests/test-float.c
+ tests/test-fseek.c
+ tests/test-fseek.sh
+ tests/test-fseek2.sh
tests/test-fseeko.c
tests/test-fseeko.sh
tests/test-fseeko2.sh
+ tests/test-ftell.c
+ tests/test-ftell.sh
+ tests/test-ftell2.sh
+ tests/test-ftell3.c
tests/test-ftello.c
tests/test-ftello.sh
tests/test-ftello2.sh
@@ -680,6 +818,8 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-unistd.c
tests/test-vasnprintf.c
tests/test-vasprintf.c
+ tests/test-vc-list-files-cvs.sh
+ tests/test-vc-list-files-git.sh
tests/test-verify.c
tests/test-verify.sh
tests/test-version-etc.c
@@ -690,6 +830,9 @@ AC_DEFUN([gl_FILE_LIST], [
tests=lib/binary-io.h
tests=lib/dummy.c
tests=lib/fcntl.in.h
+ tests=lib/fpucw.h
tests=lib/getpagesize.c
tests=lib/inttypes.in.h
+ top/GNUmakefile
+ top/maint.mk
])
diff --git a/gl/m4/hmac-md5.m4 b/gl/m4/hmac-md5.m4
deleted file mode 100644
index 2945555dea..0000000000
--- a/gl/m4/hmac-md5.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-# hmac-md5.m4 serial 2
-dnl Copyright (C) 2005-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.
-
-AC_DEFUN([gl_HMAC_MD5],
-[
- AC_LIBOBJ([hmac-md5])
-])
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index b3c7849185..ebf081a110 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 18
+# include_next.m4 serial 20
dnl Copyright (C) 2006-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,
@@ -175,11 +175,13 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
[AC_CHECK_HEADERS_ONCE([$1])
])
+dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
+dnl until we can assume autoconf 2.64 or newer.
m4_foreach_w([gl_HEADER_NAME], [$1],
[AS_VAR_PUSHDEF([gl_next_header],
[gl_cv_next_]m4_defn([gl_HEADER_NAME]))
if test $gl_cv_have_include_next = yes; then
- AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+ AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
else
AC_CACHE_CHECK(
[absolute name of <]m4_defn([gl_HEADER_NAME])[>],
@@ -208,7 +210,7 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
dnl eval is necessary to expand gl_absname_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
dnl so use subshell.
- AS_VAR_SET([gl_next_header],
+ AS_VAR_SET(gl_next_header,
['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
@@ -218,20 +220,20 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
}'`'"'])
m4_if([$2], [check],
[else
- AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+ AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
fi
])
])
fi
AC_SUBST(
AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
- [AS_VAR_GET([gl_next_header])])
+ [AS_VAR_GET(gl_next_header)])
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
gl_next_as_first_directive='<'gl_HEADER_NAME'>'
else
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
- gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+ gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
fi
AC_SUBST(
AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
new file mode 100644
index 0000000000..6986244b39
--- /dev/null
+++ b/gl/m4/largefile.m4
@@ -0,0 +1,104 @@
+# Enable large files on systems where this is not the default.
+
+# Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# The following implementation works around a problem in autoconf <= 2.68;
+# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
+m4_version_prereq([2.69], [] ,[
+
+# _AC_SYS_LARGEFILE_TEST_INCLUDES
+# -------------------------------
+m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
+[@%:@include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1]];[]dnl
+])
+
+
+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
+# CACHE-VAR,
+# DESCRIPTION,
+# PROLOGUE, [FUNCTION-BODY])
+# --------------------------------------------------------
+m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
+[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+[while :; do
+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+ [AC_LANG_PROGRAM([$5], [$6])],
+ [$3=no; break])
+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+ [AC_LANG_PROGRAM([@%:@define $1 $2
+$5], [$6])],
+ [$3=$2; break])
+ $3=unknown
+ break
+done])
+case $$3 in #(
+ no | unknown) ;;
+ *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
+esac
+rm -rf conftest*[]dnl
+])# _AC_SYS_LARGEFILE_MACRO_VALUE
+
+
+# AC_SYS_LARGEFILE
+# ----------------
+# By default, many hosts won't let programs access large files;
+# one must use special compiler options to get large-file access to work.
+# For more details about this brain damage please see:
+# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
+AC_DEFUN([AC_SYS_LARGEFILE],
+[AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+if test "$enable_largefile" != no; then
+
+ AC_CACHE_CHECK([for special C compiler options needed for large files],
+ ac_cv_sys_largefile_CC,
+ [ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
+ AC_COMPILE_IFELSE([], [break])
+ CC="$CC -n32"
+ AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi])
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+ ac_cv_sys_file_offset_bits,
+ [Number of bits in a file offset, on hosts where this is settable.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+ ac_cv_sys_large_files,
+ [Define for large files, on AIX-style hosts.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+ fi
+
+ AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
+[/* Enable large inode numbers on Mac OS X. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif])
+fi
+])# AC_SYS_LARGEFILE
+
+])# m4_version_prereq 2.69
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index f6452f6f20..b45488445d 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -1,4 +1,4 @@
-# lseek.m4 serial 6
+# lseek.m4 serial 7
dnl Copyright (C) 2007, 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,
@@ -35,15 +35,8 @@ AC_DEFUN([gl_FUNC_LSEEK],
[gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
fi])
if test $gl_cv_func_lseek_pipe = no; then
- gl_REPLACE_LSEEK
+ REPLACE_LSEEK=1
+ AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
+ [Define to 1 if lseek does not detect pipes.])
fi
])
-
-AC_DEFUN([gl_REPLACE_LSEEK],
-[
- AC_LIBOBJ([lseek])
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- REPLACE_LSEEK=1
- AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
- [Define to 1 if lseek does not detect pipes.])
-])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 8094444507..87018ec87e 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,4 +1,4 @@
-# malloc.m4 serial 12
+# malloc.m4 serial 13
dnl Copyright (C) 2007, 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,
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
[Define to 1 if your system has a GNU libc compatible 'malloc'
function, and to 0 otherwise.])],
[AC_DEFINE([HAVE_MALLOC_GNU], [0])
- gl_REPLACE_MALLOC
+ REPLACE_MALLOC=1
])
])
@@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
[Define if the 'malloc' function is POSIX compliant.])
else
- gl_REPLACE_MALLOC
+ REPLACE_MALLOC=1
fi
])
@@ -58,9 +58,3 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
[gl_cv_func_malloc_posix=no])
])
])
-
-AC_DEFUN([gl_REPLACE_MALLOC],
-[
- AC_LIBOBJ([malloc])
- REPLACE_MALLOC=1
-])
diff --git a/gl/m4/md5.m4 b/gl/m4/md5.m4
index ce7671d6ce..4b41a85b35 100644
--- a/gl/m4/md5.m4
+++ b/gl/m4/md5.m4
@@ -1,4 +1,4 @@
-# md5.m4 serial 11
+# md5.m4 serial 12
dnl Copyright (C) 2002-2006, 2008-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,
@@ -6,8 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_MD5],
[
- AC_LIBOBJ([md5])
-
dnl Prerequisites of lib/md5.c.
AC_REQUIRE([gl_BIGENDIAN])
AC_REQUIRE([AC_C_INLINE])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index a544e2b4e7..f6dc3e712b 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,4 +1,4 @@
-# memchr.m4 serial 11
+# memchr.m4 serial 12
dnl Copyright (C) 2002-2004, 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,
@@ -80,10 +80,6 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
REPLACE_MEMCHR=1
fi
fi
- if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
- AC_LIBOBJ([memchr])
- gl_PREREQ_MEMCHR
- fi
])
# Prerequisites of lib/memchr.c.
diff --git a/gl/m4/memmem.m4 b/gl/m4/memmem.m4
index dae71a968c..e912205cd0 100644
--- a/gl/m4/memmem.m4
+++ b/gl/m4/memmem.m4
@@ -1,4 +1,4 @@
-# memmem.m4 serial 22
+# memmem.m4 serial 23
dnl Copyright (C) 2002-2004, 2007-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,
@@ -11,7 +11,12 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE],
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REPLACE_FUNCS([memmem])
+ AC_CHECK_FUNCS([memmem])
+ if test $ac_cv_func_memmem = yes; then
+ HAVE_MEMMEM=1
+ else
+ HAVE_MEMMEM=0
+ fi
AC_CHECK_DECLS_ONCE([memmem])
if test $ac_cv_have_decl_memmem = no; then
HAVE_DECL_MEMMEM=0
@@ -68,7 +73,6 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE],
])
if test "$gl_cv_func_memmem_works_always" != yes; then
REPLACE_MEMMEM=1
- AC_LIBOBJ([memmem])
fi
fi
gl_PREREQ_MEMMEM
@@ -133,7 +137,6 @@ static void quit (int sig) { exit (sig + 128); }
])
if test "$gl_cv_func_memmem_works_fast" != yes; then
REPLACE_MEMMEM=1
- AC_LIBOBJ([memmem])
fi
fi
]) # gl_FUNC_MEMMEM
diff --git a/gl/m4/memxor.m4 b/gl/m4/memxor.m4
index 42789eb6fd..10c3313e85 100644
--- a/gl/m4/memxor.m4
+++ b/gl/m4/memxor.m4
@@ -1,4 +1,4 @@
-# memxor.m4 serial 3
+# memxor.m4 serial 4
dnl Copyright (C) 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,
@@ -6,6 +6,5 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_MEMXOR],
[
- AC_LIBOBJ([memxor])
AC_REQUIRE([AC_C_RESTRICT])
])
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 7ba7fd26b6..952536feb3 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -27,18 +27,18 @@ AC_DEFUN([gl_FUNC_MMAP_ANON],
gl_have_mmap_anonymous=no
if test $gl_have_mmap = yes; then
AC_MSG_CHECKING([for MAP_ANONYMOUS])
- AC_EGREP_CPP([I cant identify this map.], [
+ AC_EGREP_CPP([I cant identify this map], [
#include <sys/mman.h>
#ifdef MAP_ANONYMOUS
- I cant identify this map.
+ I cant identify this map
#endif
],
[gl_have_mmap_anonymous=yes])
if test $gl_have_mmap_anonymous != yes; then
- AC_EGREP_CPP([I cant identify this map.], [
+ AC_EGREP_CPP([I cant identify this map], [
#include <sys/mman.h>
#ifdef MAP_ANON
- I cant identify this map.
+ I cant identify this map
#endif
],
[AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index a3e99d6e72..9a0cca8897 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,4 +1,4 @@
-# po.m4 serial 17 (gettext-0.18)
+# po.m4 serial 17a
dnl Copyright (C) 1995-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,
@@ -118,7 +118,8 @@ changequote([,])dnl
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
rm -f "$ac_dir/POTFILES"
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
- cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ gt_tab=`printf '\t'`
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
POMAKEFILEDEPS="POTFILES.in"
# ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
# on $ac_dir but don't depend on user-specified configuration
@@ -254,6 +255,7 @@ EOT
fi
# A sed script that extracts the value of VARIABLE from a Makefile.
+ tab=`printf '\t'`
sed_x_variable='
# Test if the hold space is empty.
x
@@ -261,9 +263,9 @@ s/P/P/
x
ta
# Yes it was empty. Look if we have the expected variable definition.
-/^[ ]*VARIABLE[ ]*=/{
+/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
# Seen the first line of the variable definition.
- s/^[ ]*VARIABLE[ ]*=//
+ s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
ba
}
bd
@@ -405,14 +407,15 @@ changequote([,])dnl
fi
sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+ tab=`printf '\t'`
if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
# Add dependencies that cannot be formulated as a simple suffix rule.
for lang in $ALL_LINGUAS; do
frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
cat >> "$ac_file.tmp" <<EOF
$frobbedlang.msg: $lang.po
- @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
- \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
EOF
done
fi
@@ -422,8 +425,8 @@ EOF
frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
cat >> "$ac_file.tmp" <<EOF
$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
- @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
- \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
EOF
done
fi
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index 9c2ed1ef2f..1538d23fd4 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 42
+# printf.m4 serial 43
dnl Copyright (C) 2003, 2007-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,
@@ -892,7 +892,8 @@ dnl On mingw, precisions larger than 512 are treated like 512, in integer,
dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC,
dnl precisions larger than 510 in floating-point output yield wrong results.
-dnl On BeOS, precisions larger than 1044 crash the program.
+dnl On AIX 7.1, precisions larger than 998 in floating-point output yield
+dnl wrong results. On BeOS, precisions larger than 1044 crash the program.
dnl Result is gl_cv_func_printf_precision.
AC_DEFUN([gl_PRINTF_PRECISION],
@@ -921,6 +922,9 @@ int main ()
if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
|| buf[0] != '1')
result |= 4;
+ if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
+ || buf[0] != '1')
+ result |= 4;
return result;
}]])],
[gl_cv_func_printf_precision=yes],
@@ -1465,7 +1469,8 @@ dnl Solaris 11 2010-11 . . # # # . . # . . . # . . .
dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
-dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . .
+dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . .
+dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . .
dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
@@ -1478,4 +1483,6 @@ dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? .
dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
-dnl mingw # # # # # # . . # # . # # ? . # # # . .
+dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . .
+dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . .
+dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . .
diff --git a/gl/m4/read-file.m4 b/gl/m4/read-file.m4
index 60d03600a8..93e0ac3546 100644
--- a/gl/m4/read-file.m4
+++ b/gl/m4/read-file.m4
@@ -1,14 +1,8 @@
-# read-file.m4 serial 2
+# read-file.m4 serial 3
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.
-AC_DEFUN([gl_FUNC_READ_FILE],
-[
- AC_LIBOBJ([read-file])
- gl_PREREQ_READ_FILE
-])
-
# Prerequisites of lib/read-file.c.
AC_DEFUN([gl_PREREQ_READ_FILE], [:])
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index a403d9fb32..5cc1340d13 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,4 +1,4 @@
-# realloc.m4 serial 11
+# realloc.m4 serial 12
dnl Copyright (C) 2007, 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,
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
[Define to 1 if your system has a GNU libc compatible 'realloc'
function, and to 0 otherwise.])],
[AC_DEFINE([HAVE_REALLOC_GNU], [0])
- gl_REPLACE_REALLOC
+ REPLACE_REALLOC=1
])
])# gl_FUNC_REALLOC_GNU
@@ -33,12 +33,6 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
AC_DEFINE([HAVE_REALLOC_POSIX], [1],
[Define if the 'realloc' function is POSIX compliant.])
else
- gl_REPLACE_REALLOC
+ REPLACE_REALLOC=1
fi
])
-
-AC_DEFUN([gl_REPLACE_REALLOC],
-[
- AC_LIBOBJ([realloc])
- REPLACE_REALLOC=1
-])
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 8aa5dbe598..6f716239cb 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,9 +1,13 @@
-# snprintf.m4 serial 5
+# snprintf.m4 serial 6
dnl Copyright (C) 2002-2004, 2007-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.
+dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
+dnl but defers to any gnulib snprintf replacements. Therefore, gnulib
+dnl must guarantee that the decision for replacing snprintf is a superset
+dnl of the reasons checked by libintl.
AC_DEFUN([gl_FUNC_SNPRINTF],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
@@ -16,7 +20,12 @@ AC_DEFUN([gl_FUNC_SNPRINTF],
gl_SNPRINTF_RETVAL_C99
case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- gl_cv_func_snprintf_usable=yes
+ gl_PRINTF_POSITIONS
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ gl_cv_func_snprintf_usable=yes
+ ;;
+ esac
;;
esac
;;
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4
index 1c553ff210..c676176c83 100644
--- a/gl/m4/strcase.m4
+++ b/gl/m4/strcase.m4
@@ -1,4 +1,4 @@
-# strcase.m4 serial 10
+# strcase.m4 serial 11
dnl Copyright (C) 2002, 2005-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,
@@ -13,19 +13,20 @@ AC_DEFUN([gl_STRCASE],
AC_DEFUN([gl_FUNC_STRCASECMP],
[
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
- AC_REPLACE_FUNCS([strcasecmp])
+ AC_CHECK_FUNCS([strcasecmp])
if test $ac_cv_func_strcasecmp = no; then
HAVE_STRCASECMP=0
- gl_PREREQ_STRCASECMP
fi
])
AC_DEFUN([gl_FUNC_STRNCASECMP],
[
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
- AC_REPLACE_FUNCS([strncasecmp])
- if test $ac_cv_func_strncasecmp = no; then
- gl_PREREQ_STRNCASECMP
+ AC_CHECK_FUNCS([strncasecmp])
+ if test $ac_cv_func_strncasecmp = yes; then
+ HAVE_STRNCASECMP=1
+ else
+ HAVE_STRNCASECMP=0
fi
AC_CHECK_DECLS([strncasecmp])
if test $ac_cv_have_decl_strncasecmp = no; then
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
index 3fb36dd9ae..d744ad5af8 100644
--- a/gl/m4/strdup.m4
+++ b/gl/m4/strdup.m4
@@ -1,4 +1,4 @@
-# strdup.m4 serial 12
+# strdup.m4 serial 13
dnl Copyright (C) 2002-2011 Free Software Foundation, Inc.
@@ -10,10 +10,6 @@ AC_DEFUN([gl_FUNC_STRDUP],
[
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([strdup])
- if test $ac_cv_func_strdup != yes; then
- AC_LIBOBJ([strdup])
- gl_PREREQ_STRDUP
- fi
AC_CHECK_DECLS_ONCE([strdup])
if test $ac_cv_have_decl_strdup = no; then
HAVE_DECL_STRDUP=0
@@ -28,12 +24,7 @@ AC_DEFUN([gl_FUNC_STRDUP_POSIX],
if test $ac_cv_func_strdup = yes; then
if test $gl_cv_func_malloc_posix != yes; then
REPLACE_STRDUP=1
- AC_LIBOBJ([strdup])
- gl_PREREQ_STRDUP
fi
- else
- AC_LIBOBJ([strdup])
- gl_PREREQ_STRDUP
fi
AC_CHECK_DECLS_ONCE([strdup])
if test $ac_cv_have_decl_strdup = no; then
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index 73d1d54d81..ca05be6b26 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,4 +1,4 @@
-# strerror.m4 serial 9
+# strerror.m4 serial 16
dnl Copyright (C) 2002, 2007-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,
@@ -6,63 +6,73 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRERROR],
[
- AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
- if test $REPLACE_STRERROR = 1; then
- AC_LIBOBJ([strerror])
- AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
- [Define this to 1 if strerror is broken.])
- fi
-])
-
-# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
-AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
-[
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
AC_REQUIRE([gl_HEADER_ERRNO_H])
- if test -z "$ERRNO_H"; then
+ AC_REQUIRE([gl_FUNC_STRERROR_0])
+ m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
+ AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
+ ])
+ if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
AC_CACHE_CHECK([for working strerror function],
[gl_cv_func_working_strerror],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
]],
- [[return !*strerror (-2);]])],
+ [[if (!*strerror (-2)) return 1;]])],
[gl_cv_func_working_strerror=yes],
[gl_cv_func_working_strerror=no],
- [dnl Assume crossbuild works if it compiles.
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <string.h>
- ]],
- [[return !*strerror (-2);]])],
- [gl_cv_func_working_strerror=yes],
- [gl_cv_func_working_strerror=no])
- ])
+ [dnl Be pessimistic on cross-compiles for now.
+ gl_cv_func_working_strerror="guessing no"])
])
- if test $gl_cv_func_working_strerror = no; then
+ if test "$gl_cv_func_working_strerror" != yes; then
dnl The system's strerror() fails to return a string for out-of-range
dnl integers. Replace it.
REPLACE_STRERROR=1
fi
+ m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
+ dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
+ dnl buffer, we must replace strerror.
+ case "$gl_cv_func_strerror_r_works" in
+ *no) REPLACE_STRERROR=1 ;;
+ esac
+ ])
else
dnl The system's strerror() cannot know about the new errno values we add
- dnl to <errno.h>. Replace it.
+ dnl to <errno.h>, or any fix for strerror(0). Replace it.
REPLACE_STRERROR=1
fi
- if test $REPLACE_STRERROR = 1; then
- gl_PREREQ_STRERROR
- fi
])
-# Prerequisites of lib/strerror.c.
-AC_DEFUN([gl_PREREQ_STRERROR], [
- AC_CHECK_DECLS([strerror])
- AC_CHECK_HEADERS_ONCE([sys/socket.h])
- if test $ac_cv_header_sys_socket_h != yes; then
- dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
- dnl the check for those headers unconditional; yet cygwin reports
- dnl that the headers are present but cannot be compiled (since on
- dnl cygwin, all socket information should come from sys/socket.h).
- AC_CHECK_HEADERS([winsock2.h])
+dnl Detect if strerror(0) passes (that is, does not set errno, and does not
+dnl return a string that matches strerror(-1)).
+AC_DEFUN([gl_FUNC_STRERROR_0],
+[
+ REPLACE_STRERROR_0=0
+ AC_CACHE_CHECK([whether strerror(0) succeeds],
+ [gl_cv_func_strerror_0_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <string.h>
+ #include <errno.h>
+ ]],
+ [[int result = 0;
+ char *str;
+ errno = 0;
+ str = strerror (0);
+ if (!*str) result |= 1;
+ if (errno) result |= 2;
+ if (strstr (str, "nknown") || strstr (str, "ndefined"))
+ result |= 4;
+ return result;]])],
+ [gl_cv_func_strerror_0_works=yes],
+ [gl_cv_func_strerror_0_works=no],
+ [dnl Be pessimistic on cross-compiles for now.
+ gl_cv_func_strerror_0_works="guessing no"])
+ ])
+ if test "$gl_cv_func_strerror_0_works" != yes; then
+ REPLACE_STRERROR_0=1
+ AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
+ does not return a message implying success.])
fi
])
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index df8c40353b..4f9f5114b3 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 20
+# serial 21
# Written by Paul Eggert.
@@ -27,9 +27,9 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
dnl guaranteed by C89.
gl_WARN_ON_USE_PREPARE([[#include <string.h>
]],
- [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
- strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r
- strsignal strverscmp])
+ [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
+ strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
+ strerror_r strsignal strverscmp])
])
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -43,6 +43,8 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR],
AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
[
+ GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
+ GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
@@ -80,6 +82,8 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
+ HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4
index 71d284b633..12ca5eb4a2 100644
--- a/gl/m4/strings_h.m4
+++ b/gl/m4/strings_h.m4
@@ -1,5 +1,5 @@
-# Configure a replacement for <string.h>.
-# serial 3
+# Configure a replacement for <strings.h>.
+# serial 5
# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -20,8 +20,12 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <strings.h>
- ]], [strcasecmp strncasecmp])
+ gl_WARN_ON_USE_PREPARE([[
+ /* Minix 3.1.8 has a bug: <sys/types.h> must be included before
+ <strings.h>. */
+ #include <sys/types.h>
+ #include <strings.h>
+ ]], [ffs strcasecmp strncasecmp])
])
AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
@@ -33,7 +37,9 @@ AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
[
+ GNULIB_FFS=0; AC_SUBST([GNULIB_FFS])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_FFS=1; AC_SUBST([HAVE_FFS])
HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
])
diff --git a/gl/m4/strverscmp.m4 b/gl/m4/strverscmp.m4
index 5d1a9bab12..394b4c3a84 100644
--- a/gl/m4/strverscmp.m4
+++ b/gl/m4/strverscmp.m4
@@ -1,4 +1,4 @@
-# strverscmp.m4 serial 7
+# strverscmp.m4 serial 8
dnl Copyright (C) 2002, 2005-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,
@@ -10,9 +10,8 @@ AC_DEFUN([gl_FUNC_STRVERSCMP],
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REPLACE_FUNCS([strverscmp])
+ AC_CHECK_FUNCS([strverscmp])
if test $ac_cv_func_strverscmp = no; then
- gl_PREREQ_STRVERSCMP
HAVE_STRVERSCMP=0
fi
])
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index 9bb28005fc..d646edc2d3 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -50,10 +50,6 @@ AC_DEFUN([gl_TIME_R],
else
HAVE_LOCALTIME_R=0
fi
- if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
- AC_LIBOBJ([time_r])
- gl_PREREQ_TIME_R
- fi
])
# Prerequisites of lib/time_r.c.
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index e4725e453f..d6ce1e6a10 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,9 +1,13 @@
-# vsnprintf.m4 serial 5
+# vsnprintf.m4 serial 6
dnl Copyright (C) 2002-2004, 2007-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.
+dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
+dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib
+dnl must guarantee that the decision for replacing vsnprintf is a superset
+dnl of the reasons checked by libintl.
AC_DEFUN([gl_FUNC_VSNPRINTF],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
@@ -16,7 +20,12 @@ AC_DEFUN([gl_FUNC_VSNPRINTF],
gl_SNPRINTF_RETVAL_C99
case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- gl_cv_func_vsnprintf_usable=yes
+ gl_PRINTF_POSITIONS
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ gl_cv_func_vsnprintf_usable=yes
+ ;;
+ esac
;;
esac
;;
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4
index e0d0f27640..f09deef456 100644
--- a/gl/m4/warn-on-use.m4
+++ b/gl/m4/warn-on-use.m4
@@ -1,4 +1,4 @@
-# warn-on-use.m4 serial 2
+# warn-on-use.m4 serial 4
dnl Copyright (C) 2010-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,
@@ -27,6 +27,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE],
[AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])),
[Define to 1 if ]m4_defn([gl_decl])[ is declared even after
undefining macros.])])dnl
+dnl FIXME: gl_Symbol must be used unquoted until we can assume
+dnl autoconf 2.64 or newer.
for gl_func in m4_flatten([$2]); do
AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
AC_CACHE_CHECK([whether $gl_func is declared without a macro],
@@ -35,8 +37,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE],
[@%:@undef $gl_func
(void) $gl_func;])],
[AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
- AS_VAR_IF(gl_Symbol, [yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
+ AS_VAR_IF(gl_Symbol, [yes],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
dnl shortcut - if the raw declaration exists, then set a cache
dnl variable to allow skipping any later AC_CHECK_DECL efforts
eval ac_cv_have_decl_$gl_func=yes])
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index b2d1a29e2a..a4a750af36 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 3
+# warnings.m4 serial 5
dnl Copyright (C) 2008-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,
@@ -19,18 +19,19 @@ m4_ifdef([AS_VAR_APPEND],
# Adds parameter to WARN_CFLAGS if the compiler supports it. For example,
# gl_WARN_ADD([-Wparentheses]).
AC_DEFUN([gl_WARN_ADD],
+dnl FIXME: gl_Warn must be used unquoted until we can assume
+dnl autoconf 2.64 or newer.
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
-AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
+AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [
gl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} $1"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
- [AS_VAR_SET([gl_Warn], [yes])],
- [AS_VAR_SET([gl_Warn], [no])])
+ [AS_VAR_SET(gl_Warn, [yes])],
+ [AS_VAR_SET(gl_Warn, [no])])
CPPFLAGS="$gl_save_CPPFLAGS"
])
-AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
-AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
-AS_VAR_POPDEF([gl_Flags])dnl
+AS_VAR_IF(gl_Warn, [yes],
+ [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])])
AS_VAR_POPDEF([gl_Warn])dnl
m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
])
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index 25d7a42509..69b6d5d782 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -20,7 +20,7 @@
It is intended to provide definitions and prototypes needed by an
application. */
-#ifndef _GL_NETDB_H
+#ifndef _@GUARD_PREFIX@_NETDB_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -34,8 +34,8 @@
#endif
-#ifndef _GL_NETDB_H
-#define _GL_NETDB_H
+#ifndef _@GUARD_PREFIX@_NETDB_H
+#define _@GUARD_PREFIX@_NETDB_H
/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
'struct hostent' on MinGW. */
@@ -262,5 +262,5 @@ _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
#endif
-#endif /* _GL_NETDB_H */
-#endif /* _GL_NETDB_H */
+#endif /* _@GUARD_PREFIX@_NETDB_H */
+#endif /* _@GUARD_PREFIX@_NETDB_H */
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index f5eea43d69..966d6a5625 100644
--- a/gl/netinet_in.in.h
+++ b/gl/netinet_in.in.h
@@ -15,7 +15,7 @@
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_NETINET_IN_H
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -33,8 +33,8 @@
#endif
-#ifndef _GL_NETINET_IN_H
-#define _GL_NETINET_IN_H
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
+#define _@GUARD_PREFIX@_NETINET_IN_H
#if !@HAVE_NETINET_IN_H@
@@ -44,5 +44,5 @@
#endif
-#endif /* _GL_NETINET_IN_H */
-#endif /* _GL_NETINET_IN_H */
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h
index 4469d54e4f..43f9607070 100644
--- a/gl/stdarg.in.h
+++ b/gl/stdarg.in.h
@@ -15,7 +15,7 @@
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_STDARG_H
+#ifndef _@GUARD_PREFIX@_STDARG_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -25,12 +25,12 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDARG_H@
-#ifndef _GL_STDARG_H
-#define _GL_STDARG_H
+#ifndef _@GUARD_PREFIX@_STDARG_H
+#define _@GUARD_PREFIX@_STDARG_H
#ifndef va_copy
# define va_copy(a,b) ((a) = (b))
#endif
-#endif /* _GL_STDARG_H */
-#endif /* _GL_STDARG_H */
+#endif /* _@GUARD_PREFIX@_STDARG_H */
+#endif /* _@GUARD_PREFIX@_STDARG_H */
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index 62a91a7a6a..c7b98e7dcc 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -38,9 +38,9 @@
remember if special invocation has ever been used to obtain wint_t,
in which case we need to clean up NULL yet again. */
-# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
+# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t
-# undef _GL_STDDEF_H
+# undef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_WINT_T
# endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
@@ -49,14 +49,14 @@
#else
/* Normal invocation convention. */
-# ifndef _GL_STDDEF_H
+# ifndef _@GUARD_PREFIX@_STDDEF_H
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# ifndef _GL_STDDEF_H
-# define _GL_STDDEF_H
+# ifndef _@GUARD_PREFIX@_STDDEF_H
+# define _@GUARD_PREFIX@_STDDEF_H
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
#if @REPLACE_NULL@
@@ -82,6 +82,6 @@
# define wchar_t int
#endif
-# endif /* _GL_STDDEF_H */
-# endif /* _GL_STDDEF_H */
+# endif /* _@GUARD_PREFIX@_STDDEF_H */
+# endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index b32227bb04..b6d08c754a 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -21,7 +21,7 @@
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
-#ifndef _GL_STDINT_H
+#ifndef _@GUARD_PREFIX@_STDINT_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -52,13 +52,13 @@
/* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because
- _GL_STDINT_H is defined.
+ _@GUARD_PREFIX@_STDINT_H is defined.
The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#endif
-#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
-#define _GL_STDINT_H
+#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+#define _@GUARD_PREFIX@_STDINT_H
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
@@ -93,7 +93,7 @@
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-/* Minimum and maximum values for a integer type under the usual assumption.
+/* Minimum and maximum values for an integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */
@@ -270,26 +270,36 @@ typedef unsigned long int gl_uintptr_t;
/* Note: These types are compiler dependent. It may be unwise to use them in
public header files. */
-#undef intmax_t
-#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+/* If the system defines INTMAX_MAX, assume that intmax_t works, and
+ similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
+ assuming one type where another is used by the system. */
+
+#ifndef INTMAX_MAX
+# undef INTMAX_C
+# undef intmax_t
+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
typedef long long int gl_intmax_t;
-# define intmax_t gl_intmax_t
-#elif defined GL_INT64_T
-# define intmax_t int64_t
-#else
+# define intmax_t gl_intmax_t
+# elif defined GL_INT64_T
+# define intmax_t int64_t
+# else
typedef long int gl_intmax_t;
-# define intmax_t gl_intmax_t
+# define intmax_t gl_intmax_t
+# endif
#endif
-#undef uintmax_t
-#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#ifndef UINTMAX_MAX
+# undef UINTMAX_C
+# undef uintmax_t
+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
typedef unsigned long long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
-#elif defined GL_UINT64_T
-# define uintmax_t uint64_t
-#else
+# define uintmax_t gl_uintmax_t
+# elif defined GL_UINT64_T
+# define uintmax_t uint64_t
+# else
typedef unsigned long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
+# define uintmax_t gl_uintmax_t
+# endif
#endif
/* Verify that intmax_t and uintmax_t have the same size. Too much code
@@ -431,21 +441,23 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* 7.18.2.5. Limits of greatest-width integer types */
-#undef INTMAX_MIN
-#undef INTMAX_MAX
-#ifdef INT64_MAX
-# define INTMAX_MIN INT64_MIN
-# define INTMAX_MAX INT64_MAX
-#else
-# define INTMAX_MIN INT32_MIN
-# define INTMAX_MAX INT32_MAX
+#ifndef INTMAX_MAX
+# undef INTMAX_MIN
+# ifdef INT64_MAX
+# define INTMAX_MIN INT64_MIN
+# define INTMAX_MAX INT64_MAX
+# else
+# define INTMAX_MIN INT32_MIN
+# define INTMAX_MAX INT32_MAX
+# endif
#endif
-#undef UINTMAX_MAX
-#ifdef UINT64_MAX
-# define UINTMAX_MAX UINT64_MAX
-#else
-# define UINTMAX_MAX UINT32_MAX
+#ifndef UINTMAX_MAX
+# ifdef UINT64_MAX
+# define UINTMAX_MAX UINT64_MAX
+# else
+# define UINTMAX_MAX UINT32_MAX
+# endif
#endif
/* 7.18.3. Limits of other integer types */
@@ -568,25 +580,27 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* 7.18.4.2. Macros for greatest-width integer constants */
-#undef INTMAX_C
-#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define INTMAX_C(x) x##LL
-#elif defined GL_INT64_T
-# define INTMAX_C(x) INT64_C(x)
-#else
-# define INTMAX_C(x) x##L
+#ifndef INTMAX_C
+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# define INTMAX_C(x) x##LL
+# elif defined GL_INT64_T
+# define INTMAX_C(x) INT64_C(x)
+# else
+# define INTMAX_C(x) x##L
+# endif
#endif
-#undef UINTMAX_C
-#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define UINTMAX_C(x) x##ULL
-#elif defined GL_UINT64_T
-# define UINTMAX_C(x) UINT64_C(x)
-#else
-# define UINTMAX_C(x) x##UL
+#ifndef UINTMAX_C
+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x) x##ULL
+# elif defined GL_UINT64_T
+# define UINTMAX_C(x) UINT64_C(x)
+# else
+# define UINTMAX_C(x) x##UL
+# endif
#endif
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-#endif /* _GL_STDINT_H */
-#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
+#endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 0b85d0c28c..473c84ce3e 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -35,7 +35,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_STDIO_H
+#ifndef _@GUARD_PREFIX@_STDIO_H
#define _GL_ALREADY_INCLUDING_STDIO_H
@@ -44,8 +44,8 @@
#undef _GL_ALREADY_INCLUDING_STDIO_H
-#ifndef _GL_STDIO_H
-#define _GL_STDIO_H
+#ifndef _@GUARD_PREFIX@_STDIO_H
+#define _@GUARD_PREFIX@_STDIO_H
/* Get va_list. Needed on many systems, including glibc 2.8. */
#include <stdarg.h>
@@ -461,25 +461,6 @@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
# endif
_GL_CXXALIASWARN (fseeko);
-# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
- /* Provide an fseek function that is consistent with fseeko. */
- /* In order to avoid that fseek gets defined as a macro here, the
- developer can request the 'fseek' module. */
-# if !GNULIB_defined_fseek_function
-# undef fseek
-# define fseek rpl_fseek
-static inline int _GL_ARG_NONNULL ((1))
-rpl_fseek (FILE *fp, long offset, int whence)
-{
-# if @REPLACE_FSEEKO@
- return rpl_fseeko (fp, offset, whence);
-# else
- return fseeko (fp, offset, whence);
-# endif
-}
-# define GNULIB_defined_fseek_function 1
-# endif
-# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */
# undef fseek
@@ -539,25 +520,6 @@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
# endif
_GL_CXXALIASWARN (ftello);
-# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
- /* Provide an ftell function that is consistent with ftello. */
- /* In order to avoid that ftell gets defined as a macro here, the
- developer can request the 'ftell' module. */
-# if !GNULIB_defined_ftell_function
-# undef ftell
-# define ftell rpl_ftell
-static inline long _GL_ARG_NONNULL ((1))
-rpl_ftell (FILE *f)
-{
-# if @REPLACE_FTELLO@
- return rpl_ftello (f);
-# else
- return ftello (f);
-# endif
-}
-# define GNULIB_defined_ftell_function 1
-# endif
-# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */
# undef ftell
@@ -1345,6 +1307,6 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
#endif
-#endif /* _GL_STDIO_H */
-#endif /* _GL_STDIO_H */
+#endif /* _@GUARD_PREFIX@_STDIO_H */
+#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index 7513553b67..047fac18b8 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -28,13 +28,13 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_STDLIB_H
+#ifndef _@GUARD_PREFIX@_STDLIB_H
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-#ifndef _GL_STDLIB_H
-#define _GL_STDLIB_H
+#ifndef _@GUARD_PREFIX@_STDLIB_H
+#define _@GUARD_PREFIX@_STDLIB_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
@@ -89,11 +89,7 @@ struct random_data
# include <unistd.h>
#endif
-#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
-# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#else
-# define _GL_ATTRIBUTE_NORETURN
-#endif
+/* The definition of _Noreturn is copied here. */
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -120,7 +116,7 @@ struct random_data
/* Terminate the current process with the given return code, without running
the 'atexit' handlers. */
# if !@HAVE__EXIT@
-_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
+_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
# endif
_GL_CXXALIAS_SYS (_Exit, void, (int status));
_GL_CXXALIASWARN (_Exit);
@@ -761,6 +757,6 @@ _GL_CXXALIASWARN (wctomb);
#endif
-#endif /* _GL_STDLIB_H */
-#endif /* _GL_STDLIB_H */
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
new file mode 100644
index 0000000000..d6ecf2ecae
--- /dev/null
+++ b/gl/strerror-override.c
@@ -0,0 +1,279 @@
+/* strerror-override.c --- POSIX compatible system error routine
+
+ Copyright (C) 2010-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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010. */
+
+#include <config.h>
+
+#include "strerror-override.h"
+
+#include <errno.h>
+
+#if GNULIB_defined_ESOCK /* native Windows platforms */
+# if HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+#endif
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+ describing the error. Otherwise return NULL. */
+const char *
+strerror_override (int errnum)
+{
+ /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
+ switch (errnum)
+ {
+#if REPLACE_STRERROR_0
+ case 0:
+ return "Success";
+#endif
+
+#if GNULIB_defined_ETXTBSY
+ case ETXTBSY:
+ return "Text file busy";
+#endif
+
+#if GNULIB_defined_ESOCK /* native Windows platforms */
+ /* EWOULDBLOCK is the same as EAGAIN. */
+ case EINPROGRESS:
+ return "Operation now in progress";
+ case EALREADY:
+ return "Operation already in progress";
+ case ENOTSOCK:
+ return "Socket operation on non-socket";
+ case EDESTADDRREQ:
+ return "Destination address required";
+ case EMSGSIZE:
+ return "Message too long";
+ case EPROTOTYPE:
+ return "Protocol wrong type for socket";
+ case ENOPROTOOPT:
+ return "Protocol not available";
+ case EPROTONOSUPPORT:
+ return "Protocol not supported";
+ case ESOCKTNOSUPPORT:
+ return "Socket type not supported";
+ case EOPNOTSUPP:
+ return "Operation not supported";
+ case EPFNOSUPPORT:
+ return "Protocol family not supported";
+ case EAFNOSUPPORT:
+ return "Address family not supported by protocol";
+ case EADDRINUSE:
+ return "Address already in use";
+ case EADDRNOTAVAIL:
+ return "Cannot assign requested address";
+ case ENETDOWN:
+ return "Network is down";
+ case ENETUNREACH:
+ return "Network is unreachable";
+ case ENETRESET:
+ return "Network dropped connection on reset";
+ case ECONNABORTED:
+ return "Software caused connection abort";
+ case ECONNRESET:
+ return "Connection reset by peer";
+ case ENOBUFS:
+ return "No buffer space available";
+ case EISCONN:
+ return "Transport endpoint is already connected";
+ case ENOTCONN:
+ return "Transport endpoint is not connected";
+ case ESHUTDOWN:
+ return "Cannot send after transport endpoint shutdown";
+ case ETOOMANYREFS:
+ return "Too many references: cannot splice";
+ case ETIMEDOUT:
+ return "Connection timed out";
+ case ECONNREFUSED:
+ return "Connection refused";
+ case ELOOP:
+ return "Too many levels of symbolic links";
+ case EHOSTDOWN:
+ return "Host is down";
+ case EHOSTUNREACH:
+ return "No route to host";
+ case EPROCLIM:
+ return "Too many processes";
+ case EUSERS:
+ return "Too many users";
+ case EDQUOT:
+ return "Disk quota exceeded";
+ case ESTALE:
+ return "Stale NFS file handle";
+ case EREMOTE:
+ return "Object is remote";
+# if HAVE_WINSOCK2_H
+ /* WSA_INVALID_HANDLE maps to EBADF */
+ /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
+ /* WSA_INVALID_PARAMETER maps to EINVAL */
+ case WSA_OPERATION_ABORTED:
+ return "Overlapped operation aborted";
+ case WSA_IO_INCOMPLETE:
+ return "Overlapped I/O event object not in signaled state";
+ case WSA_IO_PENDING:
+ return "Overlapped operations will complete later";
+ /* WSAEINTR maps to EINTR */
+ /* WSAEBADF maps to EBADF */
+ /* WSAEACCES maps to EACCES */
+ /* WSAEFAULT maps to EFAULT */
+ /* WSAEINVAL maps to EINVAL */
+ /* WSAEMFILE maps to EMFILE */
+ /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
+ /* WSAEINPROGRESS is EINPROGRESS */
+ /* WSAEALREADY is EALREADY */
+ /* WSAENOTSOCK is ENOTSOCK */
+ /* WSAEDESTADDRREQ is EDESTADDRREQ */
+ /* WSAEMSGSIZE is EMSGSIZE */
+ /* WSAEPROTOTYPE is EPROTOTYPE */
+ /* WSAENOPROTOOPT is ENOPROTOOPT */
+ /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
+ /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
+ /* WSAEOPNOTSUPP is EOPNOTSUPP */
+ /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
+ /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
+ /* WSAEADDRINUSE is EADDRINUSE */
+ /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
+ /* WSAENETDOWN is ENETDOWN */
+ /* WSAENETUNREACH is ENETUNREACH */
+ /* WSAENETRESET is ENETRESET */
+ /* WSAECONNABORTED is ECONNABORTED */
+ /* WSAECONNRESET is ECONNRESET */
+ /* WSAENOBUFS is ENOBUFS */
+ /* WSAEISCONN is EISCONN */
+ /* WSAENOTCONN is ENOTCONN */
+ /* WSAESHUTDOWN is ESHUTDOWN */
+ /* WSAETOOMANYREFS is ETOOMANYREFS */
+ /* WSAETIMEDOUT is ETIMEDOUT */
+ /* WSAECONNREFUSED is ECONNREFUSED */
+ /* WSAELOOP is ELOOP */
+ /* WSAENAMETOOLONG maps to ENAMETOOLONG */
+ /* WSAEHOSTDOWN is EHOSTDOWN */
+ /* WSAEHOSTUNREACH is EHOSTUNREACH */
+ /* WSAENOTEMPTY maps to ENOTEMPTY */
+ /* WSAEPROCLIM is EPROCLIM */
+ /* WSAEUSERS is EUSERS */
+ /* WSAEDQUOT is EDQUOT */
+ /* WSAESTALE is ESTALE */
+ /* WSAEREMOTE is EREMOTE */
+ case WSASYSNOTREADY:
+ return "Network subsystem is unavailable";
+ case WSAVERNOTSUPPORTED:
+ return "Winsock.dll version out of range";
+ case WSANOTINITIALISED:
+ return "Successful WSAStartup not yet performed";
+ case WSAEDISCON:
+ return "Graceful shutdown in progress";
+ case WSAENOMORE: case WSA_E_NO_MORE:
+ return "No more results";
+ case WSAECANCELLED: case WSA_E_CANCELLED:
+ return "Call was canceled";
+ case WSAEINVALIDPROCTABLE:
+ return "Procedure call table is invalid";
+ case WSAEINVALIDPROVIDER:
+ return "Service provider is invalid";
+ case WSAEPROVIDERFAILEDINIT:
+ return "Service provider failed to initialize";
+ case WSASYSCALLFAILURE:
+ return "System call failure";
+ case WSASERVICE_NOT_FOUND:
+ return "Service not found";
+ case WSATYPE_NOT_FOUND:
+ return "Class type not found";
+ case WSAEREFUSED:
+ return "Database query was refused";
+ case WSAHOST_NOT_FOUND:
+ return "Host not found";
+ case WSATRY_AGAIN:
+ return "Nonauthoritative host not found";
+ case WSANO_RECOVERY:
+ return "Nonrecoverable error";
+ case WSANO_DATA:
+ return "Valid name, no data record of requested type";
+ /* WSA_QOS_* omitted */
+# endif
+#endif
+
+#if GNULIB_defined_ENOMSG
+ case ENOMSG:
+ return "No message of desired type";
+#endif
+
+#if GNULIB_defined_EIDRM
+ case EIDRM:
+ return "Identifier removed";
+#endif
+
+#if GNULIB_defined_ENOLINK
+ case ENOLINK:
+ return "Link has been severed";
+#endif
+
+#if GNULIB_defined_EPROTO
+ case EPROTO:
+ return "Protocol error";
+#endif
+
+#if GNULIB_defined_EMULTIHOP
+ case EMULTIHOP:
+ return "Multihop attempted";
+#endif
+
+#if GNULIB_defined_EBADMSG
+ case EBADMSG:
+ return "Bad message";
+#endif
+
+#if GNULIB_defined_EOVERFLOW
+ case EOVERFLOW:
+ return "Value too large for defined data type";
+#endif
+
+#if GNULIB_defined_ENOTSUP
+ case ENOTSUP:
+ return "Not supported";
+#endif
+
+#if GNULIB_defined_ENETRESET
+ case ENETRESET:
+ return "Network dropped connection on reset";
+#endif
+
+#if GNULIB_defined_ECONNABORTED
+ case ECONNABORTED:
+ return "Software caused connection abort";
+#endif
+
+#if GNULIB_defined_ESTALE
+ case ESTALE:
+ return "Stale NFS file handle";
+#endif
+
+#if GNULIB_defined_EDQUOT
+ case EDQUOT:
+ return "Disk quota exceeded";
+#endif
+
+#if GNULIB_defined_ECANCELED
+ case ECANCELED:
+ return "Operation canceled";
+#endif
+
+ default:
+ return NULL;
+ }
+}
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
new file mode 100644
index 0000000000..81e4a50759
--- /dev/null
+++ b/gl/strerror-override.h
@@ -0,0 +1,52 @@
+/* strerror-override.h --- POSIX compatible system error routine
+
+ Copyright (C) 2010-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/>. */
+
+#ifndef _GL_STRERROR_OVERRIDE_H
+# define _GL_STRERROR_OVERRIDE_H
+
+# include <errno.h>
+# include <stddef.h>
+
+/* Reasonable buffer size that should never trigger ERANGE; if this
+ proves too small, we intentionally abort(), to remind us to fix
+ this value. */
+# define STACKBUF_LEN 256
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+ describing the error. Otherwise return NULL. */
+# if REPLACE_STRERROR_0 \
+ || GNULIB_defined_ETXTBSY \
+ || GNULIB_defined_ESOCK \
+ || GNULIB_defined_ENOMSG \
+ || GNULIB_defined_EIDRM \
+ || GNULIB_defined_ENOLINK \
+ || GNULIB_defined_EPROTO \
+ || GNULIB_defined_EMULTIHOP \
+ || GNULIB_defined_EBADMSG \
+ || GNULIB_defined_EOVERFLOW \
+ || GNULIB_defined_ENOTSUP \
+ || GNULIB_defined_ENETRESET \
+ || GNULIB_defined_ECONNABORTED \
+ || GNULIB_defined_ESTALE \
+ || GNULIB_defined_EDQUOT \
+ || GNULIB_defined_ECANCELED
+extern const char *strerror_override (int errnum);
+# else
+# define strerror_override(ignored) NULL
+# endif
+
+#endif /* _GL_STRERROR_OVERRIDE_H */
diff --git a/gl/strerror.c b/gl/strerror.c
index 5dae1111a2..63899ca6b2 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -17,340 +17,54 @@
#include <config.h>
+/* Specification. */
#include <string.h>
-#if REPLACE_STRERROR
-
-# include <errno.h>
-# include <stdio.h>
-
-# if GNULIB_defined_ESOCK /* native Windows platforms */
-# if HAVE_WINSOCK2_H
-# include <winsock2.h>
-# endif
-# endif
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-# include "intprops.h"
+#include "intprops.h"
+#include "strerror-override.h"
+#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
-# undef sprintf
-
-# undef strerror
-# if ! HAVE_DECL_STRERROR
-# define strerror(n) NULL
-# endif
+#undef sprintf
char *
-rpl_strerror (int n)
+strerror (int n)
+#undef strerror
{
- char const *msg = NULL;
- /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
- switch (n)
- {
-# if GNULIB_defined_ETXTBSY
- case ETXTBSY:
- msg = "Text file busy";
- break;
-# endif
-
-# if GNULIB_defined_ESOCK /* native Windows platforms */
- /* EWOULDBLOCK is the same as EAGAIN. */
- case EINPROGRESS:
- msg = "Operation now in progress";
- break;
- case EALREADY:
- msg = "Operation already in progress";
- break;
- case ENOTSOCK:
- msg = "Socket operation on non-socket";
- break;
- case EDESTADDRREQ:
- msg = "Destination address required";
- break;
- case EMSGSIZE:
- msg = "Message too long";
- break;
- case EPROTOTYPE:
- msg = "Protocol wrong type for socket";
- break;
- case ENOPROTOOPT:
- msg = "Protocol not available";
- break;
- case EPROTONOSUPPORT:
- msg = "Protocol not supported";
- break;
- case ESOCKTNOSUPPORT:
- msg = "Socket type not supported";
- break;
- case EOPNOTSUPP:
- msg = "Operation not supported";
- break;
- case EPFNOSUPPORT:
- msg = "Protocol family not supported";
- break;
- case EAFNOSUPPORT:
- msg = "Address family not supported by protocol";
- break;
- case EADDRINUSE:
- msg = "Address already in use";
- break;
- case EADDRNOTAVAIL:
- msg = "Cannot assign requested address";
- break;
- case ENETDOWN:
- msg = "Network is down";
- break;
- case ENETUNREACH:
- msg = "Network is unreachable";
- break;
- case ENETRESET:
- msg = "Network dropped connection on reset";
- break;
- case ECONNABORTED:
- msg = "Software caused connection abort";
- break;
- case ECONNRESET:
- msg = "Connection reset by peer";
- break;
- case ENOBUFS:
- msg = "No buffer space available";
- break;
- case EISCONN:
- msg = "Transport endpoint is already connected";
- break;
- case ENOTCONN:
- msg = "Transport endpoint is not connected";
- break;
- case ESHUTDOWN:
- msg = "Cannot send after transport endpoint shutdown";
- break;
- case ETOOMANYREFS:
- msg = "Too many references: cannot splice";
- break;
- case ETIMEDOUT:
- msg = "Connection timed out";
- break;
- case ECONNREFUSED:
- msg = "Connection refused";
- break;
- case ELOOP:
- msg = "Too many levels of symbolic links";
- break;
- case EHOSTDOWN:
- msg = "Host is down";
- break;
- case EHOSTUNREACH:
- msg = "No route to host";
- break;
- case EPROCLIM:
- msg = "Too many processes";
- break;
- case EUSERS:
- msg = "Too many users";
- break;
- case EDQUOT:
- msg = "Disk quota exceeded";
- break;
- case ESTALE:
- msg = "Stale NFS file handle";
- break;
- case EREMOTE:
- msg = "Object is remote";
- break;
-# if HAVE_WINSOCK2_H
- /* WSA_INVALID_HANDLE maps to EBADF */
- /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
- /* WSA_INVALID_PARAMETER maps to EINVAL */
- case WSA_OPERATION_ABORTED:
- msg = "Overlapped operation aborted";
- break;
- case WSA_IO_INCOMPLETE:
- msg = "Overlapped I/O event object not in signaled state";
- break;
- case WSA_IO_PENDING:
- msg = "Overlapped operations will complete later";
- break;
- /* WSAEINTR maps to EINTR */
- /* WSAEBADF maps to EBADF */
- /* WSAEACCES maps to EACCES */
- /* WSAEFAULT maps to EFAULT */
- /* WSAEINVAL maps to EINVAL */
- /* WSAEMFILE maps to EMFILE */
- /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
- /* WSAEINPROGRESS is EINPROGRESS */
- /* WSAEALREADY is EALREADY */
- /* WSAENOTSOCK is ENOTSOCK */
- /* WSAEDESTADDRREQ is EDESTADDRREQ */
- /* WSAEMSGSIZE is EMSGSIZE */
- /* WSAEPROTOTYPE is EPROTOTYPE */
- /* WSAENOPROTOOPT is ENOPROTOOPT */
- /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
- /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
- /* WSAEOPNOTSUPP is EOPNOTSUPP */
- /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
- /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
- /* WSAEADDRINUSE is EADDRINUSE */
- /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
- /* WSAENETDOWN is ENETDOWN */
- /* WSAENETUNREACH is ENETUNREACH */
- /* WSAENETRESET is ENETRESET */
- /* WSAECONNABORTED is ECONNABORTED */
- /* WSAECONNRESET is ECONNRESET */
- /* WSAENOBUFS is ENOBUFS */
- /* WSAEISCONN is EISCONN */
- /* WSAENOTCONN is ENOTCONN */
- /* WSAESHUTDOWN is ESHUTDOWN */
- /* WSAETOOMANYREFS is ETOOMANYREFS */
- /* WSAETIMEDOUT is ETIMEDOUT */
- /* WSAECONNREFUSED is ECONNREFUSED */
- /* WSAELOOP is ELOOP */
- /* WSAENAMETOOLONG maps to ENAMETOOLONG */
- /* WSAEHOSTDOWN is EHOSTDOWN */
- /* WSAEHOSTUNREACH is EHOSTUNREACH */
- /* WSAENOTEMPTY maps to ENOTEMPTY */
- /* WSAEPROCLIM is EPROCLIM */
- /* WSAEUSERS is EUSERS */
- /* WSAEDQUOT is EDQUOT */
- /* WSAESTALE is ESTALE */
- /* WSAEREMOTE is EREMOTE */
- case WSASYSNOTREADY:
- msg = "Network subsystem is unavailable";
- break;
- case WSAVERNOTSUPPORTED:
- msg = "Winsock.dll version out of range";
- break;
- case WSANOTINITIALISED:
- msg = "Successful WSAStartup not yet performed";
- break;
- case WSAEDISCON:
- msg = "Graceful shutdown in progress";
- break;
- case WSAENOMORE: case WSA_E_NO_MORE:
- msg = "No more results";
- break;
- case WSAECANCELLED: case WSA_E_CANCELLED:
- msg = "Call was canceled";
- break;
- case WSAEINVALIDPROCTABLE:
- msg = "Procedure call table is invalid";
- break;
- case WSAEINVALIDPROVIDER:
- msg = "Service provider is invalid";
- break;
- case WSAEPROVIDERFAILEDINIT:
- msg = "Service provider failed to initialize";
- break;
- case WSASYSCALLFAILURE:
- msg = "System call failure";
- break;
- case WSASERVICE_NOT_FOUND:
- msg = "Service not found";
- break;
- case WSATYPE_NOT_FOUND:
- msg = "Class type not found";
- break;
- case WSAEREFUSED:
- msg = "Database query was refused";
- break;
- case WSAHOST_NOT_FOUND:
- msg = "Host not found";
- break;
- case WSATRY_AGAIN:
- msg = "Nonauthoritative host not found";
- break;
- case WSANO_RECOVERY:
- msg = "Nonrecoverable error";
- break;
- case WSANO_DATA:
- msg = "Valid name, no data record of requested type";
- break;
- /* WSA_QOS_* omitted */
-# endif
-# endif
-
-# if GNULIB_defined_ENOMSG
- case ENOMSG:
- msg = "No message of desired type";
- break;
-# endif
-
-# if GNULIB_defined_EIDRM
- case EIDRM:
- msg = "Identifier removed";
- break;
-# endif
-
-# if GNULIB_defined_ENOLINK
- case ENOLINK:
- msg = "Link has been severed";
- break;
-# endif
-
-# if GNULIB_defined_EPROTO
- case EPROTO:
- msg = "Protocol error";
- break;
-# endif
-
-# if GNULIB_defined_EMULTIHOP
- case EMULTIHOP:
- msg = "Multihop attempted";
- break;
-# endif
-
-# if GNULIB_defined_EBADMSG
- case EBADMSG:
- msg = "Bad message";
- break;
-# endif
-
-# if GNULIB_defined_EOVERFLOW
- case EOVERFLOW:
- msg = "Value too large for defined data type";
- break;
-# endif
-
-# if GNULIB_defined_ENOTSUP
- case ENOTSUP:
- msg = "Not supported";
- break;
-# endif
-
-# if GNULIB_defined_ESTALE
- case ESTALE:
- msg = "Stale NFS file handle";
- break;
-# endif
-
-# if GNULIB_defined_EDQUOT
- case EDQUOT:
- msg = "Disk quota exceeded";
- break;
-# endif
-
-# if GNULIB_defined_ECANCELED
- case ECANCELED:
- msg = "Operation canceled";
- break;
-# endif
- }
+ static char buf[STACKBUF_LEN];
+ size_t len;
+ /* Cast away const, due to the historical signature of strerror;
+ callers should not be modifying the string. */
+ const char *msg = strerror_override (n);
if (msg)
return (char *) msg;
- {
- char *result = strerror (n);
+ msg = strerror (n);
- if (result == NULL || result[0] == '\0')
- {
- static char const fmt[] = "Unknown error (%d)";
- static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
- sprintf (msg_buf, fmt, n);
- return msg_buf;
- }
+ /* Our strerror_r implementation might use the system's strerror
+ buffer, so all other clients of strerror have to see the error
+ copied into a buffer that we manage. This is not thread-safe,
+ even if the system strerror is, but portable programs shouldn't
+ be using strerror if they care about thread-safety. */
+ if (!msg || !*msg)
+ {
+ static char const fmt[] = "Unknown error %d";
+ verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
+ sprintf (buf, fmt, n);
+ errno = EINVAL;
+ return buf;
+ }
- return result;
- }
-}
+ /* Fix STACKBUF_LEN if this ever aborts. */
+ len = strlen (msg);
+ if (sizeof buf <= len)
+ abort ();
-#endif
+ return memcpy (buf, msg, len + 1);
+}
diff --git a/gl/string.in.h b/gl/string.in.h
index 76d26ed307..62d79940d2 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -16,7 +16,7 @@
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_STRING_H
+#ifndef _@GUARD_PREFIX@_STRING_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
-#ifndef _GL_STRING_H
-#define _GL_STRING_H
+#ifndef _@GUARD_PREFIX@_STRING_H
+#define _@GUARD_PREFIX@_STRING_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
@@ -59,6 +59,36 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
+/* Find the index of the least-significant set bit. */
+#if @GNULIB_FFSL@
+# if !@HAVE_FFSL@
+_GL_FUNCDECL_SYS (ffsl, int, (long int i));
+# endif
+_GL_CXXALIAS_SYS (ffsl, int, (long int i));
+_GL_CXXALIASWARN (ffsl);
+#elif defined GNULIB_POSIXCHECK
+# undef ffsl
+# if HAVE_RAW_DECL_FFSL
+_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
+# endif
+#endif
+
+
+/* Find the index of the least-significant set bit. */
+#if @GNULIB_FFSLL@
+# if !@HAVE_FFSLL@
+_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
+# endif
+_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
+_GL_CXXALIASWARN (ffsll);
+#elif defined GNULIB_POSIXCHECK
+# undef ffsll
+# if HAVE_RAW_DECL_FFSLL
+_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
+# endif
+#endif
+
+
/* Return the first instance of C within N bytes of S, or NULL. */
#if @GNULIB_MEMCHR@
# if @REPLACE_MEMCHR@
@@ -736,9 +766,9 @@ _GL_CXXALIASWARN (mbschr);
and return a pointer to it. Return NULL if C is not found in STRING.
Unlike strrchr(), this function works correctly in multibyte locales with
encodings such as GB18030. */
-# if defined __hpux
+# if defined __hpux || defined __INTERIX
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
_GL_ARG_NONNULL ((1)));
@@ -977,5 +1007,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
#endif
-#endif /* _GL_STRING_H */
-#endif /* _GL_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 0709aae2e5..6c1577d146 100644
--- a/gl/strings.in.h
+++ b/gl/strings.in.h
@@ -16,20 +16,28 @@
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_STRINGS_H
+#ifndef _@GUARD_PREFIX@_STRINGS_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
+/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
+ But avoid namespace pollution on glibc systems. */
+#if defined __minix && !defined __GLIBC__
+# include <sys/types.h>
+#endif
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
-#ifndef _GL_STRINGS_H
-#define _GL_STRINGS_H
+#ifndef _@GUARD_PREFIX@_STRINGS_H
+#define _@GUARD_PREFIX@_STRINGS_H
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
@@ -39,6 +47,20 @@ extern "C" {
#endif
+ /* Find the index of the least-significant set bit. */
+#if @GNULIB_FFS@
+# if !@HAVE_FFS@
+_GL_FUNCDECL_SYS (ffs, int, (int i));
+# endif
+_GL_CXXALIAS_SYS (ffs, int, (int i));
+_GL_CXXALIASWARN (ffs);
+#elif defined GNULIB_POSIXCHECK
+# undef ffs
+# if HAVE_RAW_DECL_FFS
+_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
+# endif
+#endif
+
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
@@ -90,5 +112,5 @@ _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
}
#endif
-#endif /* _GL_STRING_H */
-#endif /* _GL_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 2e6af68712..aba28f86f0 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -40,7 +40,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_SYS_SOCKET_H
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#if @HAVE_SYS_SOCKET_H@
@@ -61,8 +61,8 @@
#endif
-#ifndef _GL_SYS_SOCKET_H
-#define _GL_SYS_SOCKET_H
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
+#define _@GUARD_PREFIX@_SYS_SOCKET_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -194,6 +194,8 @@ struct msghdr {
#endif
+/* Fix some definitions from <winsock2.h>. */
+
#if @HAVE_WINSOCK2_H@
# if !GNULIB_defined_rpl_fd_isset
@@ -222,28 +224,38 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
#endif
-/* Wrap everything else to use libc file descriptors for sockets. */
+/* Hide some function declarations from <winsock2.h>. */
-#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close close_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (close,
- "close() used without including <unistd.h>");
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef close
+# define close close_used_without_including_unistd_h
+# else
+ _GL_WARN_ON_USE (close,
+ "close() used without including <unistd.h>");
+# endif
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gethostname
+# define gethostname gethostname_used_without_including_unistd_h
+# else
+ _GL_WARN_ON_USE (gethostname,
+ "gethostname() used without including <unistd.h>");
+# endif
# endif
-#endif
-
-#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (gethostname,
- "gethostname() used without including <unistd.h>");
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef select
+# define select select_used_without_including_sys_select_h
+# else
+ _GL_WARN_ON_USE (select,
+ "select() used without including <sys/select.h>");
+# endif
# endif
#endif
+/* Wrap everything else to use libc file descriptors for sockets. */
+
#if @GNULIB_SOCKET@
# if @HAVE_WINSOCK2_H@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -633,16 +645,6 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
# endif
#endif
-#if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
-#endif
-
#if @GNULIB_ACCEPT4@
/* Accept a connection on a socket, with specific opening flags.
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
@@ -676,6 +678,6 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
# endif
#endif
-#endif /* _GL_SYS_SOCKET_H */
-#endif /* _GL_SYS_SOCKET_H */
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
#endif
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 13fae7b670..5acee705f8 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -34,7 +34,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_SYS_STAT_H
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
/* Get nlink_t. */
#include <sys/types.h>
@@ -45,8 +45,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
-#ifndef _GL_SYS_STAT_H
-#define _GL_SYS_STAT_H
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
+#define _@GUARD_PREFIX@_SYS_STAT_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -653,6 +653,6 @@ _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
#endif
-#endif /* _GL_SYS_STAT_H */
-#endif /* _GL_SYS_STAT_H */
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
#endif
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index d4319d25ca..e61505823f 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -23,7 +23,7 @@
#endif
@PRAGMA_COLUMNS@
-#if defined _GL_SYS_TIME_H
+#if defined _@GUARD_PREFIX@_SYS_TIME_H
/* Simply delegate to the system's header, without adding anything. */
# if @HAVE_SYS_TIME_H@
@@ -32,7 +32,7 @@
#else
-# define _GL_SYS_TIME_H
+# define _@GUARD_PREFIX@_SYS_TIME_H
# if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -98,4 +98,4 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
# endif
# endif
-#endif /* _GL_SYS_TIME_H */
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/gl/sys_uio.in.h b/gl/sys_uio.in.h
index 5d43c33fa2..de490902ce 100644
--- a/gl/sys_uio.in.h
+++ b/gl/sys_uio.in.h
@@ -20,7 +20,7 @@
# endif
@PRAGMA_COLUMNS@
-#ifndef _GL_SYS_UIO_H
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
#if @HAVE_SYS_UIO_H@
@@ -32,8 +32,8 @@
#endif
-#ifndef _GL_SYS_UIO_H
-#define _GL_SYS_UIO_H
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
+#define _@GUARD_PREFIX@_SYS_UIO_H
#if !@HAVE_SYS_UIO_H@
/* A platform that lacks <sys/uio.h>. */
@@ -60,5 +60,5 @@ struct iovec {
#endif
-#endif /* _GL_SYS_UIO_H */
-#endif /* _GL_SYS_UIO_H */
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 4d0a31733c..4070ef4de9 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -55,30 +55,6 @@ EXTRA_DIST += test-alloca-opt.c
## end gnulib module alloca-opt-tests
-## begin gnulib module arg-nonnull
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# 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
-# The arg-nonnull.h that gets inserted into generated .h files is the same as
-# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
-arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/GL_ARG_NONNULL/,$$p' \
- < $(top_srcdir)/build-aux/arg-nonnull.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
-
-ARG_NONNULL_H=arg-nonnull.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
-
-## end gnulib module arg-nonnull
-
## begin gnulib module binary-io
libtests_a_SOURCES += binary-io.h
@@ -102,30 +78,6 @@ EXTRA_DIST += test-byteswap.c macros.h
## end gnulib module byteswap-tests
-## begin gnulib module c++defs
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# 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 += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/build-aux/c++defs.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/_GL_CXXDEFS/,$$p' \
- < $(top_srcdir)/build-aux/c++defs.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h
-
-## end gnulib module c++defs
-
## begin gnulib module c-ctype-tests
TESTS += test-c-ctype
@@ -169,14 +121,15 @@ BUILT_SOURCES += fcntl.h
fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
- -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \
- -e 's|@''GNULIB_NONBLOCKING''@|$(GNULIB_NONBLOCKING)|g' \
- -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
- -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \
+ -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
+ -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
+ -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
-e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
-e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
-e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
@@ -202,6 +155,29 @@ EXTRA_DIST += test-fcntl-h.c
## end gnulib module fcntl-h-tests
+## begin gnulib module float-tests
+
+TESTS += test-float
+check_PROGRAMS += test-float
+EXTRA_DIST += test-float.c macros.h
+
+## end gnulib module float-tests
+
+## begin gnulib module fpucw
+
+
+EXTRA_DIST += fpucw.h
+
+## end gnulib module fpucw
+
+## begin gnulib module fseek-tests
+
+TESTS += test-fseek.sh test-fseek2.sh
+check_PROGRAMS += test-fseek
+EXTRA_DIST += test-fseek.c test-fseek.sh test-fseek2.sh signature.h macros.h
+
+## end gnulib module fseek-tests
+
## begin gnulib module fseeko-tests
TESTS += test-fseeko.sh test-fseeko2.sh
@@ -210,6 +186,15 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h
## end gnulib module fseeko-tests
+## begin gnulib module ftell-tests
+
+TESTS += test-ftell.sh test-ftell2.sh test-ftell3
+check_PROGRAMS += test-ftell test-ftell3
+MOSTLYCLEANFILES += t-ftell3.tmp
+EXTRA_DIST += test-ftell.c test-ftell.sh test-ftell2.sh test-ftell3.c signature.h macros.h
+
+## end gnulib module ftell-tests
+
## begin gnulib module ftello-tests
TESTS += test-ftello.sh test-ftello2.sh test-ftello3
@@ -267,7 +252,7 @@ EXTRA_DIST += signature.h test-gettimeofday.c
TESTS += test-intprops
check_PROGRAMS += test-intprops
-EXTRA_DIST += test-intprops.c
+EXTRA_DIST += test-intprops.c macros.h
## end gnulib module intprops-tests
@@ -353,6 +338,87 @@ EXTRA_DIST += test-read-file.c
## end gnulib module read-file-tests
+## begin gnulib module snippet/_Noreturn
+
+# Because this Makefile snippet defines a variable used by other
+# gnulib Makefile snippets, it must be present in all Makefile.am that
+# need it. This is ensured by the applicability 'all' defined above.
+
+_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+## end gnulib module snippet/_Noreturn
+
+## begin gnulib module snippet/arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# 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
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
+# off.
+arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/GL_ARG_NONNULL/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+
+## end gnulib module snippet/arg-nonnull
+
+## begin gnulib module snippet/c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# 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 += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/_GL_CXXDEFS/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/c++defs.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
+
+## end gnulib module snippet/c++defs
+
+## begin gnulib module snippet/warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
+# off.
+warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/^.ifndef/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/warn-on-use.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
+
+## end gnulib module snippet/warn-on-use
+
## begin gnulib module snprintf-tests
TESTS += test-snprintf
@@ -517,6 +583,15 @@ EXTRA_DIST += test-vasprintf.c signature.h macros.h
## end gnulib module vasprintf-tests
+## begin gnulib module vc-list-files-tests
+
+TESTS += test-vc-list-files-git.sh
+TESTS += test-vc-list-files-cvs.sh
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
+EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh init.sh
+
+## end gnulib module vc-list-files-tests
+
## begin gnulib module verify-tests
TESTS_ENVIRONMENT += MAKE='$(MAKE)'
@@ -544,25 +619,6 @@ EXTRA_DIST += test-vsnprintf.c signature.h macros.h
## end gnulib module vsnprintf-tests
-## begin gnulib module warn-on-use
-
-BUILT_SOURCES += warn-on-use.h
-# The warn-on-use.h that gets inserted into generated .h files is the same as
-# build-aux/warn-on-use.h, except that it has the copyright header cut off.
-warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- sed -n -e '/^.ifndef/,$$p' \
- < $(top_srcdir)/build-aux/warn-on-use.h \
- > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
-
-WARN_ON_USE_H=warn-on-use.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
-
-## end gnulib module warn-on-use
-
## begin gnulib module wchar-tests
TESTS += test-wchar
diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h
index ce7c8c016c..0a072214a8 100644
--- a/gl/tests/fcntl.in.h
+++ b/gl/tests/fcntl.in.h
@@ -40,7 +40,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_FCNTL_H
+#ifndef _@GUARD_PREFIX@_FCNTL_H
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
@@ -55,8 +55,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
-#ifndef _GL_FCNTL_H
-#define _GL_FCNTL_H
+#ifndef _@GUARD_PREFIX@_FCNTL_H
+#define _@GUARD_PREFIX@_FCNTL_H
#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
# include <unistd.h>
@@ -320,6 +320,6 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
#endif
-#endif /* _GL_FCNTL_H */
-#endif /* _GL_FCNTL_H */
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
#endif
diff --git a/gl/tests/fpucw.h b/gl/tests/fpucw.h
new file mode 100644
index 0000000000..07403bf72b
--- /dev/null
+++ b/gl/tests/fpucw.h
@@ -0,0 +1,107 @@
+/* Manipulating the FPU control word.
+ Copyright (C) 2007-2011 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+ 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/>. */
+
+#ifndef _FPUCW_H
+#define _FPUCW_H
+
+/* The i386 floating point hardware (the 387 compatible FPU, not the modern
+ SSE/SSE2 hardware) has a controllable rounding precision. It is specified
+ through the 'PC' bits in the FPU control word ('fctrl' register). (See
+ the GNU libc i386 <fpu_control.h> header for details.)
+
+ On some platforms, such as Linux or Solaris, the default precision setting
+ is set to "extended precision". This means that 'long double' instructions
+ operate correctly, but 'double' computations often produce slightly
+ different results as on strictly IEEE 754 conforming systems.
+
+ On some platforms, such as NetBSD, the default precision is set to
+ "double precision". This means that 'long double' instructions will operate
+ only as 'double', i.e. lead wrong results.
+
+ The FPU control word is under control of the application, i.e. it is
+ not required to be set either way by the ABI. (In fact, the i386 ABI
+ http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38
+ is not clear about it. But in any case, gcc treats the control word
+ like a "preserved" register: it emits code that assumes that the control
+ word is preserved across calls, and it restores the control word at the
+ end of functions that modify it.)
+
+ See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html
+ for a good explanation.
+ See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for
+ some argumentation which setting should be the default. */
+
+/* This header file provides the following facilities:
+ fpucw_t integral type holding the value of 'fctrl'
+ FPU_PC_MASK bit mask denoting the precision control
+ FPU_PC_DOUBLE precision control for 53 bits mantissa
+ FPU_PC_EXTENDED precision control for 64 bits mantissa
+ GET_FPUCW () yields the current FPU control word
+ SET_FPUCW (word) sets the FPU control word
+ DECL_LONG_DOUBLE_ROUNDING variable declaration for
+ BEGIN/END_LONG_DOUBLE_ROUNDING
+ BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with
+ 'long double' safe operation precision
+ END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with
+ 'long double' safe operation precision
+ */
+
+/* Inline assembler like this works only with GNU C. */
+#if (defined __i386__ || defined __x86_64__) && defined __GNUC__
+
+typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
+
+# define FPU_PC_MASK 0x0300
+# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */
+# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */
+
+# define GET_FPUCW() \
+ ({ fpucw_t _cw; \
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \
+ _cw; \
+ })
+# define SET_FPUCW(word) \
+ (void)({ fpucw_t _ncw = (word); \
+ __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \
+ })
+
+# define DECL_LONG_DOUBLE_ROUNDING \
+ fpucw_t oldcw;
+# define BEGIN_LONG_DOUBLE_ROUNDING() \
+ (void)(oldcw = GET_FPUCW (), \
+ SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED))
+# define END_LONG_DOUBLE_ROUNDING() \
+ SET_FPUCW (oldcw)
+
+#else
+
+typedef unsigned int fpucw_t;
+
+# define FPU_PC_MASK 0
+# define FPU_PC_DOUBLE 0
+# define FPU_PC_EXTENDED 0
+
+# define GET_FPUCW() 0
+# define SET_FPUCW(word) (void)(word)
+
+# define DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_LONG_DOUBLE_ROUNDING()
+# define END_LONG_DOUBLE_ROUNDING()
+
+#endif
+
+#endif /* _FPUCW_H */
diff --git a/gl/tests/init.sh b/gl/tests/init.sh
index 71c6516962..0da6c1e328 100644
--- a/gl/tests/init.sh
+++ b/gl/tests/init.sh
@@ -68,8 +68,8 @@ Exit () { set +e; (exit $1); exit $1; }
# Print warnings (e.g., about skipped and failed tests) to this file number.
# Override by defining to say, 9, in init.cfg, and putting say,
-# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
-# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2
+# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file.
# This is useful when using automake's parallel tests mode, to print
# the reason for skip/failure to console, rather than to the .log files.
: ${stderr_fileno_=2}
@@ -77,6 +77,7 @@ Exit () { set +e; (exit $1); exit $1; }
warn_ () { echo "$@" 1>&$stderr_fileno_; }
fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; }
framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }
# Sanitize this shell to POSIX mode, if possible.
@@ -167,7 +168,10 @@ else
st_=$?
# $re_shell_ works just fine. Use it.
- test $st_ = 10 && break
+ if test $st_ = 10; then
+ gl_set_x_corrupts_stderr_=false
+ break
+ fi
# If this is our first marginally acceptable shell, remember it.
if test "$st_:$marginal_" = 9: ; then
@@ -400,7 +404,7 @@ mktempd_ ()
{
case $# in
2);;
- *) fail_ "Usage: $ME DIR TEMPLATE";;
+ *) fail_ "Usage: mktempd_ DIR TEMPLATE";;
esac
destdir_=$1
diff --git a/gl/tests/macros.h b/gl/tests/macros.h
index 89226758ec..adb3744d5c 100644
--- a/gl/tests/macros.h
+++ b/gl/tests/macros.h
@@ -62,3 +62,7 @@
*not* work for function parameters of array type, because they are actually
parameters of pointer type. */
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
+
+/* STREQ (str1, str2)
+ Return true if two strings compare equal. */
+#define STREQ(a, b) (strcmp (a, b) == 0)
diff --git a/gl/tests/test-float.c b/gl/tests/test-float.c
new file mode 100644
index 0000000000..530181306f
--- /dev/null
+++ b/gl/tests/test-float.c
@@ -0,0 +1,384 @@
+/* Test of <float.h> substitute.
+ Copyright (C) 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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011. */
+
+#include <config.h>
+
+#include <float.h>
+
+#include "fpucw.h"
+#include "macros.h"
+
+/* Check that FLT_RADIX is a constant expression. */
+int a[] = { FLT_RADIX };
+
+#if FLT_RADIX == 2
+
+/* Return 2^n. */
+static float
+pow2f (int n)
+{
+ int k = n;
+ volatile float x = 1;
+ volatile float y = 2;
+ /* Invariant: 2^n == x * y^k. */
+ if (k < 0)
+ {
+ y = 0.5f;
+ k = - k;
+ }
+ while (k > 0)
+ {
+ if (k != 2 * (k / 2))
+ {
+ x = x * y;
+ k = k - 1;
+ }
+ if (k == 0)
+ break;
+ y = y * y;
+ k = k / 2;
+ }
+ /* Now k == 0, hence x == 2^n. */
+ return x;
+}
+
+/* Return 2^n. */
+static double
+pow2d (int n)
+{
+ int k = n;
+ volatile double x = 1;
+ volatile double y = 2;
+ /* Invariant: 2^n == x * y^k. */
+ if (k < 0)
+ {
+ y = 0.5;
+ k = - k;
+ }
+ while (k > 0)
+ {
+ if (k != 2 * (k / 2))
+ {
+ x = x * y;
+ k = k - 1;
+ }
+ if (k == 0)
+ break;
+ y = y * y;
+ k = k / 2;
+ }
+ /* Now k == 0, hence x == 2^n. */
+ return x;
+}
+
+/* Return 2^n. */
+static long double
+pow2l (int n)
+{
+ int k = n;
+ volatile long double x = 1;
+ volatile long double y = 2;
+ /* Invariant: 2^n == x * y^k. */
+ if (k < 0)
+ {
+ y = 0.5L;
+ k = - k;
+ }
+ while (k > 0)
+ {
+ if (k != 2 * (k / 2))
+ {
+ x = x * y;
+ k = k - 1;
+ }
+ if (k == 0)
+ break;
+ y = y * y;
+ k = k / 2;
+ }
+ /* Now k == 0, hence x == 2^n. */
+ return x;
+}
+
+/* ----------------------- Check macros for 'float' ----------------------- */
+
+/* Check that the FLT_* macros expand to constant expressions. */
+int fb[] =
+ {
+ FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP,
+ FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP
+ };
+float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX };
+
+static void
+test_float (void)
+{
+ /* Check that the value of FLT_MIN_EXP is well parenthesized. */
+ ASSERT ((FLT_MIN_EXP % 101111) == (FLT_MIN_EXP) % 101111);
+
+ /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */
+ ASSERT ((FLT_MIN_10_EXP % 101111) == (FLT_MIN_10_EXP) % 101111);
+
+ /* Check that 'float' is as specified in IEEE 754. */
+ ASSERT (FLT_MANT_DIG == 24);
+ ASSERT (FLT_MIN_EXP == -125);
+ ASSERT (FLT_MAX_EXP == 128);
+
+ /* Check the value of FLT_MIN_10_EXP. */
+ ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103));
+
+ /* Check the value of FLT_DIG. */
+ ASSERT (FLT_DIG == (int) ((FLT_MANT_DIG - 1) * 0.30103));
+
+ /* Check the value of FLT_MIN_10_EXP. */
+ ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103));
+
+ /* Check the value of FLT_MAX_10_EXP. */
+ ASSERT (FLT_MAX_10_EXP == (int) (FLT_MAX_EXP * 0.30103));
+
+ /* Check the value of FLT_MAX. */
+ {
+ volatile float m = FLT_MAX;
+ int n;
+
+ ASSERT (m + m > m);
+ for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+ {
+ volatile float pow2_n = pow2f (n); /* 2^n */
+ volatile float x = m + (m / pow2_n);
+ if (x > m)
+ ASSERT (x + x == x);
+ else
+ ASSERT (!(x + x == x));
+ }
+ }
+
+ /* Check the value of FLT_MIN. */
+ {
+ volatile float m = FLT_MIN;
+ volatile float x = pow2f (FLT_MIN_EXP - 1);
+ ASSERT (m == x);
+ }
+
+ /* Check the value of FLT_EPSILON. */
+ {
+ volatile float e = FLT_EPSILON;
+ volatile float me;
+ int n;
+
+ me = 1.0f + e;
+ ASSERT (me > 1.0f);
+ ASSERT (me - 1.0f == e);
+ for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+ {
+ volatile float half_n = pow2f (- n); /* 2^-n */
+ volatile float x = me - half_n;
+ if (x < me)
+ ASSERT (x <= 1.0f);
+ }
+ }
+}
+
+/* ----------------------- Check macros for 'double' ----------------------- */
+
+/* Check that the DBL_* macros expand to constant expressions. */
+int db[] =
+ {
+ DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP,
+ DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP
+ };
+double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX };
+
+static void
+test_double (void)
+{
+ /* Check that the value of DBL_MIN_EXP is well parenthesized. */
+ ASSERT ((DBL_MIN_EXP % 101111) == (DBL_MIN_EXP) % 101111);
+
+ /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */
+ ASSERT ((DBL_MIN_10_EXP % 101111) == (DBL_MIN_10_EXP) % 101111);
+
+ /* Check that 'double' is as specified in IEEE 754. */
+ ASSERT (DBL_MANT_DIG == 53);
+ ASSERT (DBL_MIN_EXP == -1021);
+ ASSERT (DBL_MAX_EXP == 1024);
+
+ /* Check the value of DBL_MIN_10_EXP. */
+ ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103));
+
+ /* Check the value of DBL_DIG. */
+ ASSERT (DBL_DIG == (int) ((DBL_MANT_DIG - 1) * 0.30103));
+
+ /* Check the value of DBL_MIN_10_EXP. */
+ ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103));
+
+ /* Check the value of DBL_MAX_10_EXP. */
+ ASSERT (DBL_MAX_10_EXP == (int) (DBL_MAX_EXP * 0.30103));
+
+ /* Check the value of DBL_MAX. */
+ {
+ volatile double m = DBL_MAX;
+ int n;
+
+ ASSERT (m + m > m);
+ for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+ {
+ volatile double pow2_n = pow2d (n); /* 2^n */
+ volatile double x = m + (m / pow2_n);
+ if (x > m)
+ ASSERT (x + x == x);
+ else
+ ASSERT (!(x + x == x));
+ }
+ }
+
+ /* Check the value of DBL_MIN. */
+ {
+ volatile double m = DBL_MIN;
+ volatile double x = pow2d (DBL_MIN_EXP - 1);
+ ASSERT (m == x);
+ }
+
+ /* Check the value of DBL_EPSILON. */
+ {
+ volatile double e = DBL_EPSILON;
+ volatile double me;
+ int n;
+
+ me = 1.0 + e;
+ ASSERT (me > 1.0);
+ ASSERT (me - 1.0 == e);
+ for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+ {
+ volatile double half_n = pow2d (- n); /* 2^-n */
+ volatile double x = me - half_n;
+ if (x < me)
+ ASSERT (x <= 1.0);
+ }
+ }
+}
+
+/* -------------------- Check macros for 'long double' -------------------- */
+
+/* Check that the LDBL_* macros expand to constant expressions. */
+int lb[] =
+ {
+ LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP,
+ LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP
+ };
+long double lc1 = LDBL_EPSILON;
+long double lc2 = LDBL_MIN;
+#if 0 /* LDBL_MAX is not a constant expression on some platforms. */
+long double lc3 = LDBL_MAX;
+#endif
+
+static void
+test_long_double (void)
+{
+ /* Check that the value of LDBL_MIN_EXP is well parenthesized. */
+ ASSERT ((LDBL_MIN_EXP % 101111) == (LDBL_MIN_EXP) % 101111);
+
+ /* Check that the value of LDBL_MIN_10_EXP is well parenthesized. */
+ ASSERT ((LDBL_MIN_10_EXP % 101111) == (LDBL_MIN_10_EXP) % 101111);
+
+ /* Check that 'long double' is at least as wide as 'double'. */
+ ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG);
+ ASSERT (LDBL_MIN_EXP <= DBL_MIN_EXP);
+ ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP);
+
+ /* Check the value of LDBL_DIG. */
+ ASSERT (LDBL_DIG == (int)((LDBL_MANT_DIG - 1) * 0.30103));
+
+ /* Check the value of LDBL_MIN_10_EXP. */
+ ASSERT (LDBL_MIN_10_EXP == - (int) (- (LDBL_MIN_EXP - 1) * 0.30103));
+
+ /* Check the value of LDBL_MAX_10_EXP. */
+ ASSERT (LDBL_MAX_10_EXP == (int) (LDBL_MAX_EXP * 0.30103));
+
+ /* Check the value of LDBL_MAX. */
+ {
+ volatile long double m = LDBL_MAX;
+ int n;
+
+ ASSERT (m + m > m);
+ for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+ {
+ volatile long double pow2_n = pow2l (n); /* 2^n */
+ volatile long double x = m + (m / pow2_n);
+ if (x > m)
+ ASSERT (x + x == x);
+ else
+ ASSERT (!(x + x == x));
+ }
+ }
+
+ /* Check the value of LDBL_MIN. */
+ {
+ volatile long double m = LDBL_MIN;
+ volatile long double x = pow2l (LDBL_MIN_EXP - 1);
+ ASSERT (m == x);
+ }
+
+ /* Check the value of LDBL_EPSILON. */
+ {
+ volatile long double e = LDBL_EPSILON;
+ volatile long double me;
+ int n;
+
+ me = 1.0L + e;
+ ASSERT (me > 1.0L);
+ ASSERT (me - 1.0L == e);
+ for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+ {
+ volatile long double half_n = pow2l (- n); /* 2^-n */
+ volatile long double x = me - half_n;
+ if (x < me)
+ ASSERT (x <= 1.0L);
+ }
+ }
+}
+
+int
+main ()
+{
+ test_float ();
+ test_double ();
+
+ {
+ DECL_LONG_DOUBLE_ROUNDING
+
+ BEGIN_LONG_DOUBLE_ROUNDING ();
+
+ test_long_double ();
+
+ END_LONG_DOUBLE_ROUNDING ();
+ }
+
+ return 0;
+}
+
+#else
+
+int
+main ()
+{
+ fprintf (stderr, "Skipping test: FLT_RADIX is not 2.\n");
+ return 77;
+}
+
+#endif
diff --git a/gl/tests/test-fseek.c b/gl/tests/test-fseek.c
new file mode 100644
index 0000000000..150b5f0e24
--- /dev/null
+++ b/gl/tests/test-fseek.c
@@ -0,0 +1,70 @@
+/* Test of fseek() function.
+ Copyright (C) 2007-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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+ fseek link warning if the user requested GNULIB_POSIXCHECK. */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fseek, int, (FILE *, long, int));
+
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, char **argv)
+{
+ /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
+ iff argc > 1. */
+ int expected = argc > 1 ? 0 : -1;
+ ASSERT (fseek (stdin, 0, SEEK_CUR) == expected);
+ if (argc > 1)
+ {
+ /* Test that fseek discards previously read ungetc data. */
+ int ch = fgetc (stdin);
+ ASSERT (ch == '#');
+ ASSERT (ungetc (ch, stdin) == ch);
+ ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+ ch = fgetc (stdin);
+ ASSERT (ch == '/');
+ if (2 < argc)
+ {
+ if (FUNC_UNGETC_BROKEN)
+ {
+ fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+ stderr);
+ return 77;
+ }
+ /* Test that fseek discards random ungetc data. */
+ ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff));
+ }
+ ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+ ASSERT (fgetc (stdin) == EOF);
+ /* Test that fseek resets end-of-file marker. */
+ ASSERT (feof (stdin));
+ ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+ ASSERT (!feof (stdin));
+ }
+ return 0;
+}
diff --git a/gl/tests/test-fseek.sh b/gl/tests/test-fseek.sh
new file mode 100755
index 0000000000..bad6c08dda
--- /dev/null
+++ b/gl/tests/test-fseek.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./test-fseek${EXEEXT} 1 < "$srcdir/test-fseek.sh" || exit 1
+echo hi | ./test-fseek${EXEEXT} || exit 1
+exit 0
diff --git a/gl/tests/test-fseek2.sh b/gl/tests/test-fseek2.sh
new file mode 100755
index 0000000000..a4c9cb7f5c
--- /dev/null
+++ b/gl/tests/test-fseek2.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./test-fseek${EXEEXT} 1 2 < "$srcdir/test-fseek2.sh"
diff --git a/gl/tests/test-ftell.c b/gl/tests/test-ftell.c
new file mode 100644
index 0000000000..54ede0515c
--- /dev/null
+++ b/gl/tests/test-ftell.c
@@ -0,0 +1,107 @@
+/* Test of ftell() function.
+ Copyright (C) 2007-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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+ fseek link warning if we are not using the gnulib fseek module. */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ftell, long, (FILE *));
+
+#include "binary-io.h"
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, char **argv)
+{
+ int ch;
+ /* Assume stdin is seekable iff argc > 1. */
+ if (argc == 1)
+ {
+ ASSERT (ftell (stdin) == -1);
+ return 0;
+ }
+
+ /* mingw ftell is unreliable on text mode input. */
+ SET_BINARY (0);
+
+ /* Simple tests. */
+ ASSERT (ftell (stdin) == 0);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 1);
+
+ /* Test ftell after ungetc of read input. */
+ ch = ungetc ('#', stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 0);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 1);
+
+ /* Test ftell after fseek. */
+ ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+ ASSERT (ftell (stdin) == 2);
+
+ /* Test ftell after random ungetc. */
+ ch = fgetc (stdin);
+ ASSERT (ch == '/');
+ ch = ungetc ('@', stdin);
+ ASSERT (ch == '@');
+ ASSERT (ftell (stdin) == 2);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '@');
+ ASSERT (ftell (stdin) == 3);
+
+ if (2 < argc)
+ {
+ if (FUNC_UNGETC_BROKEN)
+ {
+ fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+ stderr);
+ return 77;
+ }
+ /* Test ftell after ungetc without read. */
+ ASSERT (fseek (stdin, 0, SEEK_CUR) == 0);
+ ASSERT (ftell (stdin) == 3);
+
+ ch = ungetc ('~', stdin);
+ ASSERT (ch == '~');
+ ASSERT (ftell (stdin) == 2);
+ }
+
+#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */
+ /* Test ftell beyond end of file. */
+ ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+ ch = ftell (stdin);
+ ASSERT (fseek (stdin, 10, SEEK_END) == 0);
+ ASSERT (ftell (stdin) == ch + 10);
+#endif
+
+ return 0;
+}
diff --git a/gl/tests/test-ftell.sh b/gl/tests/test-ftell.sh
new file mode 100755
index 0000000000..bf55d2e997
--- /dev/null
+++ b/gl/tests/test-ftell.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./test-ftell${EXEEXT} 1 < "$srcdir/test-ftell.sh" || exit 1
+echo hi | ./test-ftell${EXEEXT} || exit 1
+exit 0
diff --git a/gl/tests/test-ftell2.sh b/gl/tests/test-ftell2.sh
new file mode 100755
index 0000000000..3b645b8318
--- /dev/null
+++ b/gl/tests/test-ftell2.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./test-ftell${EXEEXT} 1 2 < "$srcdir/test-ftell2.sh"
diff --git a/gl/tests/test-ftell3.c b/gl/tests/test-ftell3.c
new file mode 100644
index 0000000000..a5167efe3a
--- /dev/null
+++ b/gl/tests/test-ftell3.c
@@ -0,0 +1,78 @@
+/* Test of ftell() function.
+ Copyright (C) 2007-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 <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+ fseek link warning if we are not using the gnulib fseek module. */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include <string.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-ftell3.tmp"
+
+int
+main (void)
+{
+ FILE *fp;
+
+ /* Create a file with some contents. */
+ fp = fopen (TESTFILE, "w");
+ if (fp == NULL)
+ goto skip;
+ if (fwrite ("foogarsh", 1, 8, fp) < 8)
+ goto skip;
+ if (fclose (fp))
+ goto skip;
+
+ /* The file's contents is now "foogarsh". */
+
+ /* Try writing after reading to EOF. */
+ fp = fopen (TESTFILE, "r+");
+ if (fp == NULL)
+ goto skip;
+ if (fseek (fp, -1, SEEK_END))
+ goto skip;
+ ASSERT (getc (fp) == 'h');
+ ASSERT (getc (fp) == EOF);
+ ASSERT (ftell (fp) == 8);
+ ASSERT (ftell (fp) == 8);
+ ASSERT (putc ('!', fp) == '!');
+ ASSERT (ftell (fp) == 9);
+ ASSERT (fclose (fp) == 0);
+ fp = fopen (TESTFILE, "r");
+ if (fp == NULL)
+ goto skip;
+ {
+ char buf[10];
+ ASSERT (fread (buf, 1, 10, fp) == 9);
+ ASSERT (memcmp (buf, "foogarsh!", 9) == 0);
+ }
+ ASSERT (fclose (fp) == 0);
+
+ /* The file's contents is now "foogarsh!". */
+
+ remove (TESTFILE);
+ return 0;
+
+ skip:
+ fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
+ remove (TESTFILE);
+ return 77;
+}
diff --git a/gl/tests/test-intprops.c b/gl/tests/test-intprops.c
index aae261432a..1a34d77bf5 100644
--- a/gl/tests/test-intprops.c
+++ b/gl/tests/test-intprops.c
@@ -16,6 +16,12 @@
/* Written by Paul Eggert. */
+/* Tell gcc not to warn about the many (X < 0) expressions that
+ the overflow macros expand to. */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
#include <config.h>
#include "intprops.h"
@@ -24,230 +30,246 @@
#include <stdbool.h>
#include <inttypes.h>
-/* TYPE_IS_INTEGER. */
-verify (TYPE_IS_INTEGER (bool));
-verify (TYPE_IS_INTEGER (char));
-verify (TYPE_IS_INTEGER (signed char));
-verify (TYPE_IS_INTEGER (unsigned char));
-verify (TYPE_IS_INTEGER (short int));
-verify (TYPE_IS_INTEGER (unsigned short int));
-verify (TYPE_IS_INTEGER (int));
-verify (TYPE_IS_INTEGER (unsigned int));
-verify (TYPE_IS_INTEGER (long int));
-verify (TYPE_IS_INTEGER (unsigned long int));
-verify (TYPE_IS_INTEGER (intmax_t));
-verify (TYPE_IS_INTEGER (uintmax_t));
-verify (! TYPE_IS_INTEGER (float));
-verify (! TYPE_IS_INTEGER (double));
-verify (! TYPE_IS_INTEGER (long double));
-
-/* Integer representation. */
-verify (INT_MIN + INT_MAX < 0
- ? (TYPE_TWOS_COMPLEMENT (int)
- && ! TYPE_ONES_COMPLEMENT (int) && ! TYPE_SIGNED_MAGNITUDE (int))
- : (! TYPE_TWOS_COMPLEMENT (int)
- && (TYPE_ONES_COMPLEMENT (int) || TYPE_SIGNED_MAGNITUDE (int))));
-
-/* TYPE_SIGNED. */
-/* verify (! TYPE_SIGNED (bool)); */ /* not guaranteed by gnulib substitute */
-verify (TYPE_SIGNED (signed char));
-verify (! TYPE_SIGNED (unsigned char));
-verify (TYPE_SIGNED (short int));
-verify (! TYPE_SIGNED (unsigned short int));
-verify (TYPE_SIGNED (int));
-verify (! TYPE_SIGNED (unsigned int));
-verify (TYPE_SIGNED (long int));
-verify (! TYPE_SIGNED (unsigned long int));
-verify (TYPE_SIGNED (intmax_t));
-verify (! TYPE_SIGNED (uintmax_t));
-verify (TYPE_SIGNED (float));
-verify (TYPE_SIGNED (double));
-verify (TYPE_SIGNED (long double));
-
-/* TYPE_MINIMUM, TYPE_MAXIMUM. */
-verify (TYPE_MINIMUM (char) == CHAR_MIN);
-verify (TYPE_MAXIMUM (char) == CHAR_MAX);
-verify (TYPE_MINIMUM (unsigned char) == 0);
-verify (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
-verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
-verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
-verify (TYPE_MINIMUM (short int) == SHRT_MIN);
-verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
-verify (TYPE_MINIMUM (unsigned short int) == 0);
-verify (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
-verify (TYPE_MINIMUM (int) == INT_MIN);
-verify (TYPE_MAXIMUM (int) == INT_MAX);
-verify (TYPE_MINIMUM (unsigned int) == 0);
-verify (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
-verify (TYPE_MINIMUM (long int) == LONG_MIN);
-verify (TYPE_MAXIMUM (long int) == LONG_MAX);
-verify (TYPE_MINIMUM (unsigned long int) == 0);
-verify (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
-verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
-verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
-verify (TYPE_MINIMUM (uintmax_t) == 0);
-verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
-
-/* INT_BITS_STRLEN_BOUND. */
-verify (INT_BITS_STRLEN_BOUND (1) == 1);
-verify (INT_BITS_STRLEN_BOUND (2620) == 789);
-
-/* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND. */
-#ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX hosts */
-verify (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1);
-verify (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648"));
-#endif
-#ifdef INT64_MAX
-verify (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1);
-verify (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808"));
-#endif
+#include "macros.h"
-/* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as
- INT_<op>_OVERFLOW tests, so define a single macro to do both. */
-#define check_binop(op, a, b, min, max, overflow) \
- (INT_##op##_RANGE_OVERFLOW (a, b, min, max) == (overflow) \
- && INT_##op##_OVERFLOW (a, b) == (overflow))
-#define check_unop(op, a, min, max, overflow) \
- (INT_##op##_RANGE_OVERFLOW (a, min, max) == (overflow) \
- && INT_##op##_OVERFLOW (a) == (overflow))
-
-/* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW. */
-verify (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX));
-verify (INT_ADD_OVERFLOW (INT_MAX, 1));
-verify (check_binop (ADD, INT_MAX, 1, INT_MIN, INT_MAX, true));
-verify (check_binop (ADD, INT_MAX, -1, INT_MIN, INT_MAX, false));
-verify (check_binop (ADD, INT_MIN, 1, INT_MIN, INT_MAX, false));
-verify (check_binop (ADD, INT_MIN, -1, INT_MIN, INT_MAX, true));
-verify (check_binop (ADD, UINT_MAX, 1u, 0u, UINT_MAX, true));
-verify (check_binop (ADD, 0u, 1u, 0u, UINT_MAX, false));
-
-verify (check_binop (SUBTRACT, INT_MAX, 1, INT_MIN, INT_MAX, false));
-verify (check_binop (SUBTRACT, INT_MAX, -1, INT_MIN, INT_MAX, true));
-verify (check_binop (SUBTRACT, INT_MIN, 1, INT_MIN, INT_MAX, true));
-verify (check_binop (SUBTRACT, INT_MIN, -1, INT_MIN, INT_MAX, false));
-verify (check_binop (SUBTRACT, UINT_MAX, 1u, 0u, UINT_MAX, false));
-verify (check_binop (SUBTRACT, 0u, 1u, 0u, UINT_MAX, true));
-
-verify (check_unop (NEGATE, INT_MIN, INT_MIN, INT_MAX,
- TYPE_TWOS_COMPLEMENT (int)));
-verify (check_unop (NEGATE, 0, INT_MIN, INT_MAX, false));
-verify (check_unop (NEGATE, INT_MAX, INT_MIN, INT_MAX, false));
-verify (check_unop (NEGATE, 0u, 0u, UINT_MAX, false));
-verify (check_unop (NEGATE, 1u, 0u, UINT_MAX, true));
-verify (check_unop (NEGATE, UINT_MAX, 0u, UINT_MAX, true));
-
-verify (check_binop (MULTIPLY, INT_MAX, INT_MAX, INT_MIN, INT_MAX, true));
-verify (check_binop (MULTIPLY, INT_MAX, INT_MIN, INT_MIN, INT_MAX, true));
-verify (check_binop (MULTIPLY, INT_MIN, INT_MAX, INT_MIN, INT_MAX, true));
-verify (check_binop (MULTIPLY, INT_MIN, INT_MIN, INT_MIN, INT_MAX, true));
-verify (check_binop (MULTIPLY, -1, INT_MIN, INT_MIN, INT_MAX,
- INT_NEGATE_OVERFLOW (INT_MIN)));
-verify (check_binop (MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX,
- LONG_MIN, LONG_MIN, false));
-
-verify (check_binop (DIVIDE, INT_MIN, -1, INT_MIN, INT_MAX,
- INT_NEGATE_OVERFLOW (INT_MIN)));
-verify (check_binop (DIVIDE, INT_MAX, 1, INT_MIN, INT_MAX, false));
-verify (check_binop (DIVIDE, (unsigned int) INT_MIN,
- -1u, 0u, UINT_MAX, false));
-
-verify (check_binop (REMAINDER, INT_MIN, -1, INT_MIN, INT_MAX,
- INT_NEGATE_OVERFLOW (INT_MIN)));
-verify (check_binop (REMAINDER, INT_MAX, 1, INT_MIN, INT_MAX, false));
-verify (check_binop (REMAINDER, (unsigned int) INT_MIN,
- -1u, 0u, UINT_MAX, false));
-
-verify (check_binop (LEFT_SHIFT, UINT_MAX, 1, 0u, UINT_MAX, true));
-verify (check_binop (LEFT_SHIFT, UINT_MAX / 2 + 1, 1, 0u, UINT_MAX, true));
-verify (check_binop (LEFT_SHIFT, UINT_MAX / 2, 1, 0u, UINT_MAX, false));
-
-/* INT_<op>_OVERFLOW with mixed types. */
-#define check_sum(a, b, overflow) \
- verify (INT_ADD_OVERFLOW (a, b) == (overflow)); \
- verify (INT_ADD_OVERFLOW (b, a) == (overflow))
-check_sum (-1, LONG_MIN, true);
-check_sum (-1, UINT_MAX, false);
-check_sum (-1L, INT_MIN, INT_MIN == LONG_MIN);
-check_sum (0u, -1, true);
-check_sum (0u, 0, false);
-check_sum (0u, 1, false);
-check_sum (1, LONG_MAX, true);
-check_sum (1, UINT_MAX, true);
-check_sum (1L, INT_MAX, INT_MAX == LONG_MAX);
-check_sum (1u, INT_MAX, INT_MAX == UINT_MAX);
-check_sum (1u, INT_MIN, true);
-
-verify (! INT_SUBTRACT_OVERFLOW (INT_MAX, 1u));
-verify (! INT_SUBTRACT_OVERFLOW (UINT_MAX, 1));
-verify (! INT_SUBTRACT_OVERFLOW (0u, -1));
-verify (INT_SUBTRACT_OVERFLOW (UINT_MAX, -1));
-verify (INT_SUBTRACT_OVERFLOW (INT_MIN, 1u));
-verify (INT_SUBTRACT_OVERFLOW (-1, 0u));
-
-#define check_product(a, b, overflow) \
- verify (INT_MULTIPLY_OVERFLOW (a, b) == (overflow)); \
- verify (INT_MULTIPLY_OVERFLOW (b, a) == (overflow))
-
-check_product (-1, 1u, true);
-check_product (-1, INT_MIN, INT_NEGATE_OVERFLOW (INT_MIN));
-check_product (-1, UINT_MAX, true);
-check_product (-12345, LONG_MAX / -12345 - 1, true);
-check_product (-12345, LONG_MAX / -12345, false);
-check_product (0, -1, false);
-check_product (0, 0, false);
-check_product (0, 0u, false);
-check_product (0, 1, false);
-check_product (0, INT_MAX, false);
-check_product (0, INT_MIN, false);
-check_product (0, UINT_MAX, false);
-check_product (0u, -1, false);
-check_product (0u, 0, false);
-check_product (0u, 0u, false);
-check_product (0u, 1, false);
-check_product (0u, INT_MAX, false);
-check_product (0u, INT_MIN, false);
-check_product (0u, UINT_MAX, false);
-check_product (1, INT_MAX, false);
-check_product (1, INT_MIN, false);
-check_product (1, UINT_MAX, false);
-check_product (1u, INT_MIN, true);
-check_product (1u, INT_MAX, UINT_MAX < INT_MAX);
-check_product (INT_MAX, UINT_MAX, true);
-check_product (INT_MAX, ULONG_MAX, true);
-check_product (INT_MIN, LONG_MAX / INT_MIN - 1, true);
-check_product (INT_MIN, LONG_MAX / INT_MIN, false);
-check_product (INT_MIN, UINT_MAX, true);
-check_product (INT_MIN, ULONG_MAX, true);
-
-verify (INT_DIVIDE_OVERFLOW (INT_MIN, -1L)
- == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
-verify (! INT_DIVIDE_OVERFLOW (INT_MIN, UINT_MAX));
-verify (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINTMAX_MAX));
-verify (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINT_MAX));
-verify (INT_DIVIDE_OVERFLOW (-11, 10u));
-verify (INT_DIVIDE_OVERFLOW (-10, 10u));
-verify (! INT_DIVIDE_OVERFLOW (-9, 10u));
-verify (INT_DIVIDE_OVERFLOW (11u, -10));
-verify (INT_DIVIDE_OVERFLOW (10u, -10));
-verify (! INT_DIVIDE_OVERFLOW (9u, -10));
-
-verify (INT_REMAINDER_OVERFLOW (INT_MIN, -1L)
- == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
-verify (INT_REMAINDER_OVERFLOW (-1, UINT_MAX));
-verify (INT_REMAINDER_OVERFLOW ((intmax_t) -1, UINTMAX_MAX));
-verify (INT_REMAINDER_OVERFLOW (INTMAX_MIN, UINT_MAX)
- == (INTMAX_MAX < UINT_MAX
- && - (unsigned int) INTMAX_MIN % UINT_MAX != 0));
-verify (INT_REMAINDER_OVERFLOW (INT_MIN, ULONG_MAX)
- == (INT_MIN % ULONG_MAX != 1));
-verify (! INT_REMAINDER_OVERFLOW (1u, -1));
-verify (! INT_REMAINDER_OVERFLOW (37*39u, -39));
-verify (INT_REMAINDER_OVERFLOW (37*39u + 1, -39));
-verify (INT_REMAINDER_OVERFLOW (37*39u - 1, -39));
-verify (! INT_REMAINDER_OVERFLOW (LONG_MAX, -INT_MAX));
+/* VERIFY (X) uses a static assertion for compilers that are known to work,
+ and falls back on a dynamic assertion for other compilers.
+ These tests should be checkable via 'verify' rather than 'ASSERT', but
+ using 'verify' would run into a bug with HP-UX 11.23 cc; see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
+#if __GNUC__ || __SUNPRO_C
+# define VERIFY(x) do { verify (x); } while (0)
+#else
+# define VERIFY(x) ASSERT (x)
+#endif
int
main (void)
{
+ /* Use VERIFY for tests that must be integer constant expressions,
+ ASSERT otherwise. */
+
+ /* TYPE_IS_INTEGER. */
+ ASSERT (TYPE_IS_INTEGER (bool));
+ ASSERT (TYPE_IS_INTEGER (char));
+ ASSERT (TYPE_IS_INTEGER (signed char));
+ ASSERT (TYPE_IS_INTEGER (unsigned char));
+ ASSERT (TYPE_IS_INTEGER (short int));
+ ASSERT (TYPE_IS_INTEGER (unsigned short int));
+ ASSERT (TYPE_IS_INTEGER (int));
+ ASSERT (TYPE_IS_INTEGER (unsigned int));
+ ASSERT (TYPE_IS_INTEGER (long int));
+ ASSERT (TYPE_IS_INTEGER (unsigned long int));
+ ASSERT (TYPE_IS_INTEGER (intmax_t));
+ ASSERT (TYPE_IS_INTEGER (uintmax_t));
+ ASSERT (! TYPE_IS_INTEGER (float));
+ ASSERT (! TYPE_IS_INTEGER (double));
+ ASSERT (! TYPE_IS_INTEGER (long double));
+
+ /* TYPE_SIGNED. */
+ /* VERIFY (! TYPE_SIGNED (bool)); // not guaranteed by gnulib substitute */
+ VERIFY (TYPE_SIGNED (signed char));
+ VERIFY (! TYPE_SIGNED (unsigned char));
+ VERIFY (TYPE_SIGNED (short int));
+ VERIFY (! TYPE_SIGNED (unsigned short int));
+ VERIFY (TYPE_SIGNED (int));
+ VERIFY (! TYPE_SIGNED (unsigned int));
+ VERIFY (TYPE_SIGNED (long int));
+ VERIFY (! TYPE_SIGNED (unsigned long int));
+ VERIFY (TYPE_SIGNED (intmax_t));
+ VERIFY (! TYPE_SIGNED (uintmax_t));
+ ASSERT (TYPE_SIGNED (float));
+ ASSERT (TYPE_SIGNED (double));
+ ASSERT (TYPE_SIGNED (long double));
+
+ /* Integer representation. */
+ VERIFY (INT_MIN + INT_MAX < 0
+ ? (TYPE_TWOS_COMPLEMENT (int)
+ && ! TYPE_ONES_COMPLEMENT (int) && ! TYPE_SIGNED_MAGNITUDE (int))
+ : (! TYPE_TWOS_COMPLEMENT (int)
+ && (TYPE_ONES_COMPLEMENT (int) || TYPE_SIGNED_MAGNITUDE (int))));
+
+ /* TYPE_MINIMUM, TYPE_MAXIMUM. */
+ VERIFY (TYPE_MINIMUM (char) == CHAR_MIN);
+ VERIFY (TYPE_MAXIMUM (char) == CHAR_MAX);
+ VERIFY (TYPE_MINIMUM (unsigned char) == 0);
+ VERIFY (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
+ VERIFY (TYPE_MINIMUM (signed char) == SCHAR_MIN);
+ VERIFY (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
+ VERIFY (TYPE_MINIMUM (short int) == SHRT_MIN);
+ VERIFY (TYPE_MAXIMUM (short int) == SHRT_MAX);
+ VERIFY (TYPE_MINIMUM (unsigned short int) == 0);
+ VERIFY (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
+ VERIFY (TYPE_MINIMUM (int) == INT_MIN);
+ VERIFY (TYPE_MAXIMUM (int) == INT_MAX);
+ VERIFY (TYPE_MINIMUM (unsigned int) == 0);
+ VERIFY (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
+ VERIFY (TYPE_MINIMUM (long int) == LONG_MIN);
+ VERIFY (TYPE_MAXIMUM (long int) == LONG_MAX);
+ VERIFY (TYPE_MINIMUM (unsigned long int) == 0);
+ VERIFY (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
+ VERIFY (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
+ VERIFY (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
+ VERIFY (TYPE_MINIMUM (uintmax_t) == 0);
+ VERIFY (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
+
+ /* INT_BITS_STRLEN_BOUND. */
+ VERIFY (INT_BITS_STRLEN_BOUND (1) == 1);
+ VERIFY (INT_BITS_STRLEN_BOUND (2620) == 789);
+
+ /* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND. */
+ #ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX. */
+ VERIFY (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1);
+ VERIFY (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648"));
+ #endif
+ #ifdef INT64_MAX
+ VERIFY (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1);
+ VERIFY (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808"));
+ #endif
+
+ /* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as
+ INT_<op>_OVERFLOW tests, so define a single macro to do both. */
+ #define CHECK_BINOP(op, a, b, min, max, overflow) \
+ (INT_##op##_RANGE_OVERFLOW (a, b, min, max) == (overflow) \
+ && INT_##op##_OVERFLOW (a, b) == (overflow))
+ #define CHECK_UNOP(op, a, min, max, overflow) \
+ (INT_##op##_RANGE_OVERFLOW (a, min, max) == (overflow) \
+ && INT_##op##_OVERFLOW (a) == (overflow))
+
+ /* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW. */
+ VERIFY (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX));
+ VERIFY (INT_ADD_OVERFLOW (INT_MAX, 1));
+ VERIFY (CHECK_BINOP (ADD, INT_MAX, 1, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (ADD, INT_MAX, -1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (ADD, INT_MIN, 1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (ADD, INT_MIN, -1, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (ADD, UINT_MAX, 1u, 0u, UINT_MAX, true));
+ VERIFY (CHECK_BINOP (ADD, 0u, 1u, 0u, UINT_MAX, false));
+
+ VERIFY (CHECK_BINOP (SUBTRACT, INT_MAX, 1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (SUBTRACT, INT_MAX, -1, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (SUBTRACT, INT_MIN, 1, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (SUBTRACT, INT_MIN, -1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (SUBTRACT, UINT_MAX, 1u, 0u, UINT_MAX, false));
+ VERIFY (CHECK_BINOP (SUBTRACT, 0u, 1u, 0u, UINT_MAX, true));
+
+ VERIFY (CHECK_UNOP (NEGATE, INT_MIN, INT_MIN, INT_MAX,
+ TYPE_TWOS_COMPLEMENT (int)));
+ VERIFY (CHECK_UNOP (NEGATE, 0, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_UNOP (NEGATE, INT_MAX, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_UNOP (NEGATE, 0u, 0u, UINT_MAX, false));
+ VERIFY (CHECK_UNOP (NEGATE, 1u, 0u, UINT_MAX, true));
+ VERIFY (CHECK_UNOP (NEGATE, UINT_MAX, 0u, UINT_MAX, true));
+
+ VERIFY (CHECK_BINOP (MULTIPLY, INT_MAX, INT_MAX, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (MULTIPLY, INT_MAX, INT_MIN, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (MULTIPLY, INT_MIN, INT_MAX, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (MULTIPLY, INT_MIN, INT_MIN, INT_MIN, INT_MAX, true));
+ VERIFY (CHECK_BINOP (MULTIPLY, -1, INT_MIN, INT_MIN, INT_MAX,
+ INT_NEGATE_OVERFLOW (INT_MIN)));
+ VERIFY (CHECK_BINOP (MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX,
+ LONG_MIN, LONG_MIN, false));
+
+ VERIFY (CHECK_BINOP (DIVIDE, INT_MIN, -1, INT_MIN, INT_MAX,
+ INT_NEGATE_OVERFLOW (INT_MIN)));
+ VERIFY (CHECK_BINOP (DIVIDE, INT_MAX, 1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (DIVIDE, (unsigned int) INT_MIN,
+ -1u, 0u, UINT_MAX, false));
+
+ VERIFY (CHECK_BINOP (REMAINDER, INT_MIN, -1, INT_MIN, INT_MAX,
+ INT_NEGATE_OVERFLOW (INT_MIN)));
+ VERIFY (CHECK_BINOP (REMAINDER, INT_MAX, 1, INT_MIN, INT_MAX, false));
+ VERIFY (CHECK_BINOP (REMAINDER, (unsigned int) INT_MIN,
+ -1u, 0u, UINT_MAX, false));
+
+ VERIFY (CHECK_BINOP (LEFT_SHIFT, UINT_MAX, 1, 0u, UINT_MAX, true));
+ VERIFY (CHECK_BINOP (LEFT_SHIFT, UINT_MAX / 2 + 1, 1, 0u, UINT_MAX, true));
+ VERIFY (CHECK_BINOP (LEFT_SHIFT, UINT_MAX / 2, 1, 0u, UINT_MAX, false));
+
+ /* INT_<op>_OVERFLOW with mixed types. */
+ #define CHECK_SUM(a, b, overflow) \
+ VERIFY (INT_ADD_OVERFLOW (a, b) == (overflow)); \
+ VERIFY (INT_ADD_OVERFLOW (b, a) == (overflow))
+ CHECK_SUM (-1, LONG_MIN, true);
+ CHECK_SUM (-1, UINT_MAX, false);
+ CHECK_SUM (-1L, INT_MIN, INT_MIN == LONG_MIN);
+ CHECK_SUM (0u, -1, true);
+ CHECK_SUM (0u, 0, false);
+ CHECK_SUM (0u, 1, false);
+ CHECK_SUM (1, LONG_MAX, true);
+ CHECK_SUM (1, UINT_MAX, true);
+ CHECK_SUM (1L, INT_MAX, INT_MAX == LONG_MAX);
+ CHECK_SUM (1u, INT_MAX, INT_MAX == UINT_MAX);
+ CHECK_SUM (1u, INT_MIN, true);
+
+ VERIFY (! INT_SUBTRACT_OVERFLOW (INT_MAX, 1u));
+ VERIFY (! INT_SUBTRACT_OVERFLOW (UINT_MAX, 1));
+ VERIFY (! INT_SUBTRACT_OVERFLOW (0u, -1));
+ VERIFY (INT_SUBTRACT_OVERFLOW (UINT_MAX, -1));
+ VERIFY (INT_SUBTRACT_OVERFLOW (INT_MIN, 1u));
+ VERIFY (INT_SUBTRACT_OVERFLOW (-1, 0u));
+
+ #define CHECK_PRODUCT(a, b, overflow) \
+ VERIFY (INT_MULTIPLY_OVERFLOW (a, b) == (overflow)); \
+ VERIFY (INT_MULTIPLY_OVERFLOW (b, a) == (overflow))
+
+ CHECK_PRODUCT (-1, 1u, true);
+ CHECK_PRODUCT (-1, INT_MIN, INT_NEGATE_OVERFLOW (INT_MIN));
+ CHECK_PRODUCT (-1, UINT_MAX, true);
+ CHECK_PRODUCT (-12345, LONG_MAX / -12345 - 1, true);
+ CHECK_PRODUCT (-12345, LONG_MAX / -12345, false);
+ CHECK_PRODUCT (0, -1, false);
+ CHECK_PRODUCT (0, 0, false);
+ CHECK_PRODUCT (0, 0u, false);
+ CHECK_PRODUCT (0, 1, false);
+ CHECK_PRODUCT (0, INT_MAX, false);
+ CHECK_PRODUCT (0, INT_MIN, false);
+ CHECK_PRODUCT (0, UINT_MAX, false);
+ CHECK_PRODUCT (0u, -1, false);
+ CHECK_PRODUCT (0u, 0, false);
+ CHECK_PRODUCT (0u, 0u, false);
+ CHECK_PRODUCT (0u, 1, false);
+ CHECK_PRODUCT (0u, INT_MAX, false);
+ CHECK_PRODUCT (0u, INT_MIN, false);
+ CHECK_PRODUCT (0u, UINT_MAX, false);
+ CHECK_PRODUCT (1, INT_MAX, false);
+ CHECK_PRODUCT (1, INT_MIN, false);
+ CHECK_PRODUCT (1, UINT_MAX, false);
+ CHECK_PRODUCT (1u, INT_MIN, true);
+ CHECK_PRODUCT (1u, INT_MAX, UINT_MAX < INT_MAX);
+ CHECK_PRODUCT (INT_MAX, UINT_MAX, true);
+ CHECK_PRODUCT (INT_MAX, ULONG_MAX, true);
+ CHECK_PRODUCT (INT_MIN, LONG_MAX / INT_MIN - 1, true);
+ CHECK_PRODUCT (INT_MIN, LONG_MAX / INT_MIN, false);
+ CHECK_PRODUCT (INT_MIN, UINT_MAX, true);
+ CHECK_PRODUCT (INT_MIN, ULONG_MAX, true);
+
+ VERIFY (INT_DIVIDE_OVERFLOW (INT_MIN, -1L)
+ == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
+ VERIFY (! INT_DIVIDE_OVERFLOW (INT_MIN, UINT_MAX));
+ VERIFY (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINTMAX_MAX));
+ VERIFY (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINT_MAX));
+ VERIFY (INT_DIVIDE_OVERFLOW (-11, 10u));
+ VERIFY (INT_DIVIDE_OVERFLOW (-10, 10u));
+ VERIFY (! INT_DIVIDE_OVERFLOW (-9, 10u));
+ VERIFY (INT_DIVIDE_OVERFLOW (11u, -10));
+ VERIFY (INT_DIVIDE_OVERFLOW (10u, -10));
+ VERIFY (! INT_DIVIDE_OVERFLOW (9u, -10));
+
+ VERIFY (INT_REMAINDER_OVERFLOW (INT_MIN, -1L)
+ == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
+ VERIFY (INT_REMAINDER_OVERFLOW (-1, UINT_MAX));
+ VERIFY (INT_REMAINDER_OVERFLOW ((intmax_t) -1, UINTMAX_MAX));
+ VERIFY (INT_REMAINDER_OVERFLOW (INTMAX_MIN, UINT_MAX)
+ == (INTMAX_MAX < UINT_MAX
+ && - (unsigned int) INTMAX_MIN % UINT_MAX != 0));
+ VERIFY (INT_REMAINDER_OVERFLOW (INT_MIN, ULONG_MAX)
+ == (INT_MIN % ULONG_MAX != 1));
+ VERIFY (! INT_REMAINDER_OVERFLOW (1u, -1));
+ VERIFY (! INT_REMAINDER_OVERFLOW (37*39u, -39));
+ VERIFY (INT_REMAINDER_OVERFLOW (37*39u + 1, -39));
+ VERIFY (INT_REMAINDER_OVERFLOW (37*39u - 1, -39));
+ VERIFY (! INT_REMAINDER_OVERFLOW (LONG_MAX, -INT_MAX));
+
return 0;
}
diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c
index 95a352dc5e..2b5a54c4af 100644
--- a/gl/tests/test-snprintf.c
+++ b/gl/tests/test-snprintf.c
@@ -60,5 +60,13 @@ main (int argc, char *argv[])
}
}
+ /* Test the support of the POSIX/XSI format strings with positions. */
+ {
+ char result[100];
+ retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55);
+ ASSERT (strcmp (result, "55 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
return 0;
}
diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c
index 66dbe823d1..3ffb12e8f6 100644
--- a/gl/tests/test-strerror.c
+++ b/gl/tests/test-strerror.c
@@ -33,25 +33,44 @@ main (void)
{
char *str;
+ errno = 0;
str = strerror (EACCES);
ASSERT (str);
ASSERT (*str);
+ ASSERT (errno == 0);
+ errno = 0;
str = strerror (ETIMEDOUT);
ASSERT (str);
ASSERT (*str);
+ ASSERT (errno == 0);
+ errno = 0;
str = strerror (EOVERFLOW);
ASSERT (str);
ASSERT (*str);
+ ASSERT (errno == 0);
+ /* POSIX requires strerror (0) to succeed. Reject use of "Unknown
+ error", but allow "Success", "No error", or even Solaris' "Error
+ 0" which are distinct patterns from true out-of-range strings.
+ http://austingroupbugs.net/view.php?id=382 */
+ errno = 0;
str = strerror (0);
ASSERT (str);
ASSERT (*str);
-
+ ASSERT (errno == 0);
+ ASSERT (strstr (str, "nknown") == NULL);
+ ASSERT (strstr (str, "ndefined") == NULL);
+
+ /* POSIX requires strerror to produce a non-NULL result for all
+ inputs; as an extension, we also guarantee a non-empty reseult.
+ Reporting EINVAL is optional. */
+ errno = 0;
str = strerror (-3);
ASSERT (str);
ASSERT (*str);
+ ASSERT (errno == 0 || errno == EINVAL);
return 0;
}
diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh
new file mode 100755
index 0000000000..531b2699ca
--- /dev/null
+++ b/gl/tests/test-vc-list-files-cvs.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# This file is part of the GNUlib Library.
+#
+# 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/>. */
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
+
+tmpdir=vc-cvs
+repo=`pwd`/$tmpdir/repo
+
+fail=0
+for i in with-cvsu without; do
+ # On the first iteration, test using cvsu, if it's in your path.
+ # On the second iteration, ensure that cvsu fails, so we'll
+ # exercise the awk-using code.
+ if test $i = without; then
+ printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
+ chmod a+x cvsu
+ PATH=`pwd`:$PATH
+ export PATH
+ fi
+ ok=0
+ mkdir $tmpdir && cd $tmpdir &&
+ # without cvs, skip the test
+ # The double use of 'exit' is needed for the reference to $? inside the trap.
+ { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
+ || skip_ "cvs not found in PATH"; } &&
+ mkdir w && cd w &&
+ mkdir d &&
+ touch d/a b c &&
+ cvs -Q -d "$repo" import -m imp m M M0 &&
+ cvs -Q -d "$repo" co m && cd m &&
+ printf '%s\n' b c d/a > expected &&
+ vc-list-files | sort > actual &&
+ compare expected actual &&
+ ok=1
+ test $ok = 0 && fail=1
+done
+
+Exit $fail
diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh
new file mode 100755
index 0000000000..523b2a9169
--- /dev/null
+++ b/gl/tests/test-vc-list-files-git.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# This file is part of the GNUlib Library.
+#
+# 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/>. */
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
+
+tmpdir=vc-git-$$
+GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
+
+fail=1
+mkdir $tmpdir && cd $tmpdir &&
+ # without git, skip the test
+ # The double use of 'exit' is needed for the reference to $? inside the trap.
+ { ( git init -q ) > /dev/null 2>&1 \
+ || skip_ "git not found in PATH"; } &&
+ mkdir d &&
+ touch d/a b c &&
+ git config user.email "you@example.com" &&
+ git config user.name "Your Name" &&
+ git add . > /dev/null &&
+ git commit -q -a -m log &&
+ printf '%s\n' b c d/a > expected &&
+ vc-list-files > actual &&
+ compare expected actual &&
+ fail=0
+
+Exit $fail
diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c
index 512c021b7d..454f4f456c 100644
--- a/gl/tests/test-verify.c
+++ b/gl/tests/test-verify.c
@@ -55,9 +55,9 @@ function (int n)
verify (1 == 1); verify (1 == 1); /* should be ok */
if (n)
- return ((void) verify_true (1 == 1), verify_true (1 == 1) + 7); /* should be ok */
+ return ((void) verify_expr (1 == 1, 1), verify_expr (1 == 1, 8)); /* should be ok */
#if EXP_FAIL == 5
- return (verify_true (1 == 2), 5); /* should give ERROR */
+ return verify_expr (1 == 2, 5); /* should give ERROR */
#endif
return 0;
}
diff --git a/gl/tests/test-vsnprintf.c b/gl/tests/test-vsnprintf.c
index 5060836e78..7a520824bb 100644
--- a/gl/tests/test-vsnprintf.c
+++ b/gl/tests/test-vsnprintf.c
@@ -73,5 +73,13 @@ main (int argc, char *argv[])
}
}
+ /* Test the support of the POSIX/XSI format strings with positions. */
+ {
+ char result[100];
+ retval = my_snprintf (result, sizeof (result), "%2$d %1$d", 33, 55);
+ ASSERT (strcmp (result, "55 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
return 0;
}
diff --git a/gl/time.in.h b/gl/time.in.h
index cb533a46e1..1fbebf47be 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -28,13 +28,13 @@
without adding our own declarations. */
#if (defined __need_time_t || defined __need_clock_t \
|| defined __need_timespec \
- || defined _GL_TIME_H)
+ || defined _@GUARD_PREFIX@_TIME_H)
# @INCLUDE_NEXT@ @NEXT_TIME_H@
#else
-# define _GL_TIME_H
+# define _@GUARD_PREFIX@_TIME_H
# @INCLUDE_NEXT@ @NEXT_TIME_H@
diff --git a/gl/timespec.h b/gl/timespec.h
index 74d5749df6..acf815c8db 100644
--- a/gl/timespec.h
+++ b/gl/timespec.h
@@ -57,6 +57,25 @@ timespec_cmp (struct timespec a, struct timespec b)
: (int) (a.tv_nsec - b.tv_nsec));
}
+/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
+ nonnegative. */
+static inline int
+timespec_sign (struct timespec a)
+{
+ return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
+}
+
+struct timespec timespec_add (struct timespec, struct timespec);
+struct timespec timespec_sub (struct timespec, struct timespec);
+struct timespec dtotimespec (double);
+
+/* Return an approximation to A, of type 'double'. */
+static inline double
+timespectod (struct timespec a)
+{
+ return a.tv_sec + a.tv_nsec / 1e9;
+}
+
void gettime (struct timespec *);
int settime (struct timespec const *);
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 59dd570987..769ecf0d43 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -36,7 +36,7 @@
# define _GL_WINSOCK2_H_WITNESS
/* Normal invocation. */
-#elif !defined _GL_UNISTD_H
+#elif !defined _@GUARD_PREFIX@_UNISTD_H
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_UNISTD_H@
@@ -51,8 +51,8 @@
# undef _GL_INCLUDING_WINSOCK2_H
#endif
-#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
-#define _GL_UNISTD_H
+#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
+#define _@GUARD_PREFIX@_UNISTD_H
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
#include <stddef.h>
@@ -117,78 +117,77 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
-#if @GNULIB_GETHOSTNAME@
-/* Get all possible declarations of gethostname(). */
-# if @UNISTD_H_HAVE_WINSOCK2_H@
-# if !defined _GL_SYS_SOCKET_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef socket
-# define socket socket_used_without_including_sys_socket_h
-# undef connect
-# define connect connect_used_without_including_sys_socket_h
-# undef accept
-# define accept accept_used_without_including_sys_socket_h
-# undef bind
-# define bind bind_used_without_including_sys_socket_h
-# undef getpeername
-# define getpeername getpeername_used_without_including_sys_socket_h
-# undef getsockname
-# define getsockname getsockname_used_without_including_sys_socket_h
-# undef getsockopt
-# define getsockopt getsockopt_used_without_including_sys_socket_h
-# undef listen
-# define listen listen_used_without_including_sys_socket_h
-# undef recv
-# define recv recv_used_without_including_sys_socket_h
-# undef send
-# define send send_used_without_including_sys_socket_h
-# undef recvfrom
-# define recvfrom recvfrom_used_without_including_sys_socket_h
-# undef sendto
-# define sendto sendto_used_without_including_sys_socket_h
-# undef setsockopt
-# define setsockopt setsockopt_used_without_including_sys_socket_h
-# undef shutdown
-# define shutdown shutdown_used_without_including_sys_socket_h
-# else
- _GL_WARN_ON_USE (socket,
- "socket() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (connect,
- "connect() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (accept,
- "accept() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (bind,
- "bind() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getpeername,
- "getpeername() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockname,
- "getsockname() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (getsockopt,
- "getsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (listen,
- "listen() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recv,
- "recv() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (send,
- "send() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (recvfrom,
- "recvfrom() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (sendto,
- "sendto() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (setsockopt,
- "setsockopt() used without including <sys/socket.h>");
- _GL_WARN_ON_USE (shutdown,
- "shutdown() used without including <sys/socket.h>");
-# endif
+/* Hide some function declarations from <winsock2.h>. */
+
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef socket
+# define socket socket_used_without_including_sys_socket_h
+# undef connect
+# define connect connect_used_without_including_sys_socket_h
+# undef accept
+# define accept accept_used_without_including_sys_socket_h
+# undef bind
+# define bind bind_used_without_including_sys_socket_h
+# undef getpeername
+# define getpeername getpeername_used_without_including_sys_socket_h
+# undef getsockname
+# define getsockname getsockname_used_without_including_sys_socket_h
+# undef getsockopt
+# define getsockopt getsockopt_used_without_including_sys_socket_h
+# undef listen
+# define listen listen_used_without_including_sys_socket_h
+# undef recv
+# define recv recv_used_without_including_sys_socket_h
+# undef send
+# define send send_used_without_including_sys_socket_h
+# undef recvfrom
+# define recvfrom recvfrom_used_without_including_sys_socket_h
+# undef sendto
+# define sendto sendto_used_without_including_sys_socket_h
+# undef setsockopt
+# define setsockopt setsockopt_used_without_including_sys_socket_h
+# undef shutdown
+# define shutdown shutdown_used_without_including_sys_socket_h
+# else
+ _GL_WARN_ON_USE (socket,
+ "socket() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (connect,
+ "connect() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (accept,
+ "accept() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (bind,
+ "bind() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (getpeername,
+ "getpeername() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (getsockname,
+ "getsockname() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (getsockopt,
+ "getsockopt() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (listen,
+ "listen() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (recv,
+ "recv() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (send,
+ "send() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (recvfrom,
+ "recvfrom() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (sendto,
+ "sendto() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (setsockopt,
+ "setsockopt() used without including <sys/socket.h>");
+ _GL_WARN_ON_USE (shutdown,
+ "shutdown() used without including <sys/socket.h>");
# endif
-# if !defined _GL_SYS_SELECT_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef select
+# define select select_used_without_including_sys_select_h
+# else
+ _GL_WARN_ON_USE (select,
+ "select() used without including <sys/select.h>");
# endif
# endif
#endif
@@ -1062,6 +1061,7 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
# if @REPLACE_PREAD@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef pread
# define pread rpl_pread
# endif
_GL_FUNCDECL_RPL (pread, ssize_t,
@@ -1096,6 +1096,7 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
<http://www.opengroup.org/susv3xsh/pwrite.html>. */
# if @REPLACE_PWRITE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef pwrite
# define pwrite rpl_pwrite
# endif
_GL_FUNCDECL_RPL (pwrite, ssize_t,
@@ -1416,5 +1417,5 @@ _GL_CXXALIASWARN (write);
#endif
-#endif /* _GL_UNISTD_H */
-#endif /* _GL_UNISTD_H */
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
diff --git a/gl/verify.h b/gl/verify.h
index e5065ffa00..9a8caad001 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -164,10 +164,13 @@
(!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
# ifdef __cplusplus
+# if !GNULIB_defined_struct__gl_verify_type
template <int w>
struct _gl_verify_type {
unsigned int _gl_verify_error_if_negative: w;
};
+# define GNULIB_defined_struct__gl_verify_type 1
+# endif
# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
_gl_verify_type<(R) ? 1 : -1>
# elif defined _GL_HAVE__STATIC_ASSERT
@@ -204,7 +207,9 @@ template <int w>
# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
# define static_assert _Static_assert /* Draft C1X requires this #define. */
# endif
-# else
+# endif
+
+/* @assert.h omit start@ */
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
@@ -216,15 +221,23 @@ template <int w>
contexts, e.g., the top level. */
/* Verify requirement R at compile-time, as an integer constant expression.
- Return 1. */
+ Return 1. This is equivalent to verify_expr (R, 1).
-# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+ verify_true is obsolescent; please use verify_expr instead. */
+
+# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+
+/* Verify requirement R at compile-time. Return the value of the
+ expression E. */
+
+# define verify_expr(R, E) \
+ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
-# endif
+/* @assert.h omit end@ */
#endif
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index da55f6e3de..1401ae2131 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -49,7 +49,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_WCHAR_H
+#ifndef _@GUARD_PREFIX@_WCHAR_H
#define _GL_ALREADY_INCLUDING_WCHAR_H
@@ -81,8 +81,8 @@
#undef _GL_ALREADY_INCLUDING_WCHAR_H
-#ifndef _GL_WCHAR_H
-#define _GL_WCHAR_H
+#ifndef _@GUARD_PREFIX@_WCHAR_H
+#define _@GUARD_PREFIX@_WCHAR_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -989,6 +989,6 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
#endif
-#endif /* _GL_WCHAR_H */
-#endif /* _GL_WCHAR_H */
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
#endif