summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-04-25 23:27:31 +0200
committerLudovic Courtès <ludo@gnu.org>2011-04-25 23:59:37 +0200
commitdd7d0148f221c3180ab6f31c8742aaf4d0e5926a (patch)
tree1aec441600e3d3ff9aec482ba26656e523b90a72
parenteb0ffdd8190bff165120b881ca3e1702be82c83a (diff)
Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.
* m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'. * configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'. * libguile/script.c: Don't include <version-etc.h>.
-rwxr-xr-xbuild-aux/gendocs.sh4
-rwxr-xr-xbuild-aux/useless-if-before-free6
-rw-r--r--configure.ac4
-rw-r--r--doc/gendocs_template31
-rw-r--r--lib/Makefile.am236
-rw-r--r--lib/arpa_inet.in.h4
-rw-r--r--lib/canonicalize-lgpl.c3
-rw-r--r--lib/close-hook.h72
-rw-r--r--lib/close.c4
-rw-r--r--lib/fd-hook.c (renamed from lib/close-hook.c)63
-rw-r--r--lib/fd-hook.h119
-rw-r--r--lib/malloc.c5
-rw-r--r--lib/malloca.c4
-rw-r--r--lib/netdb.in.h3
-rw-r--r--lib/read.c59
-rw-r--r--lib/sockets.c43
-rw-r--r--lib/stat-time.h2
-rw-r--r--lib/stdio.in.h280
-rw-r--r--lib/stdlib.in.h14
-rw-r--r--lib/strcasecmp.c63
-rw-r--r--lib/strftime.c11
-rw-r--r--lib/string.in.h15
-rw-r--r--lib/strings.in.h94
-rw-r--r--lib/strncasecmp.c63
-rw-r--r--lib/sys_socket.in.h18
-rw-r--r--lib/sys_stat.in.h16
-rw-r--r--lib/sys_uio.in.h (renamed from lib/stdarg.in.h)39
-rw-r--r--lib/unistd.in.h27
-rw-r--r--lib/unistr.in.h28
-rw-r--r--lib/verify.h61
-rw-r--r--lib/version-etc-fsf.c30
-rw-r--r--lib/version-etc.c258
-rw-r--r--lib/version-etc.h78
-rw-r--r--lib/wchar.in.h88
-rw-r--r--lib/write.c87
-rw-r--r--libguile/script.c2
-rw-r--r--m4/alloca.m43
-rw-r--r--m4/byteswap.m43
-rw-r--r--m4/errno_h.m43
-rw-r--r--m4/float_h.m43
-rw-r--r--m4/getaddrinfo.m47
-rw-r--r--m4/gnulib-cache.m44
-rw-r--r--m4/gnulib-common.m45
-rw-r--r--m4/gnulib-comp.m454
-rw-r--r--m4/iconv_h.m44
-rw-r--r--m4/memchr.m416
-rw-r--r--m4/netinet_in_h.m43
-rw-r--r--m4/read.m420
-rw-r--r--m4/socklen.m450
-rw-r--r--m4/sockpfaf.m428
-rw-r--r--m4/stdarg.m475
-rw-r--r--m4/stdbool.m43
-rw-r--r--m4/stddef_h.m46
-rw-r--r--m4/stdint.m43
-rw-r--r--m4/stdio_h.m460
-rw-r--r--m4/strcase.m444
-rw-r--r--m4/string_h.m43
-rw-r--r--m4/strings_h.m439
-rw-r--r--m4/sys_socket_h.m48
-rw-r--r--m4/sys_uio_h.m431
-rw-r--r--m4/unistd_h.m487
-rw-r--r--m4/version-etc.m433
-rw-r--r--m4/write.m412
-rw-r--r--maint.mk71
64 files changed, 1361 insertions, 1251 deletions
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index 34ef112e3..c8abd55fb 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2010-11-29.11
+scriptversion=2011-04-08.14
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
@@ -305,10 +305,10 @@ if test -n "$docbook"; then
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
mv $PACKAGE-db.xml "$outdir/"
+ split_html_db_dir=html_node_db
cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook HTML... ($cmd)"
eval "$cmd"
- split_html_db_dir=html_node_db
(
cd ${split_html_db_dir} || exit 1
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index a6c228bcf..b8f5a2635 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -4,7 +4,7 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
-my $VERSION = '2011-01-09 01:39'; # UTC
+my $VERSION = '2011-04-20 13:43'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -132,7 +132,7 @@ sub is_NULL ($)
while ($line =~
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
# 1 2 3
- (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
+ (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
{
my $all = $1;
@@ -179,7 +179,7 @@ free=xfree
git grep -l -z "$free *(" \
| xargs -0 useless-if-before-free -l --name="$free" \
| xargs -0 perl -0x3b -pi -e \
- 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
+ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
# Use the following to remove redundant uses of kfree inside braces.
# Note that -0777 puts perl in slurp-whole-file mode;
diff --git a/configure.ac b/configure.ac
index 685f9c18b..c34114825 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1519,8 +1519,10 @@ case "$GCC" in
## less than exasperating.
## -Wpointer-arith was here too, but something changed in gcc/glibc
## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
+ ## -Wundef was removed because Gnulib prevented it (see
+ ## <http://thread.gmane.org/gmane.lisp.guile.bugs/5329>.)
POTENTIAL_GCC_CFLAGS="-Wall -Wmissing-prototypes \
- -Wdeclaration-after-statement -Wundef \
+ -Wdeclaration-after-statement \
-Wswitch-enum"
# Do this here so we don't screw up any of the tests above that might
# not be "warning free"
diff --git a/doc/gendocs_template b/doc/gendocs_template
index ccce0be2a..0c557243e 100644
--- a/doc/gendocs_template
+++ b/doc/gendocs_template
@@ -3,12 +3,6 @@
<!--#include virtual="/server/banner.html" -->
<h2>%%TITLE%%</h2>
-<!-- This document is in XML, and xhtml 1.0 -->
-<!-- Please make sure to properly nest your tags -->
-<!-- and ensure that your final document validates -->
-<!-- consistent with W3C xhtml 1.0 and CSS standards -->
-<!-- See validator.w3.org -->
-
<address>Free Software Foundation</address>
<address>last updated %%DATE%%</address>
@@ -66,29 +60,28 @@ this helps support FSF activities.</p>
<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
script</a>.)</p>
-<!-- If needed, change the copyright block at the bottom. In general, -->
-<!-- all pages on the GNU web server should have the section about -->
-<!-- verbatim copying. Please do NOT remove this without talking -->
-<!-- with the webmasters first. -->
-<!-- Please make sure the copyright date is consistent with the document -->
-<!-- and that it is like this "2001, 2002" not this "2001-2002." -->
+<!-- If needed, change the copyright block at the bottom. In general,
+ all pages on the GNU web server should have the section about
+ verbatim copying. Please do NOT remove this without talking
+ with the webmasters first.
+ Please make sure the copyright date is consistent with the document
+ and that it is like this: "2001, 2002", not this: "2001-2002". -->
</div><!-- for id="content", starts in the include above -->
<!--#include virtual="/server/footer.html" -->
<div id="footer">
-<p>
-Please send FSF &amp; GNU inquiries to
+<p>Please send general FSF &amp; GNU inquiries to
<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
There are also <a href="/contact/">other ways to contact</a>
the FSF.<br />
Please send broken links and other corrections or suggestions to
-<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.
-</p>
+<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
-<p>Copyright &copy; 2010 Free Software Foundation, Inc.</p>
+<p>Copyright &copy; 2011 Free Software Foundation, Inc.</p>
-<p>Verbatim copying and distribution of this entire article is
-permitted in any medium, provided this notice is preserved.</p>
+<p>Verbatim copying and distribution of this entire article are
+permitted worldwide, without royalty, in any medium, provided this
+notice, and the copyright notice, are preserved.</p>
</div>
</div>
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5d0c22971..217fcf6a4 100644
--- a/lib/Makefile.am
+++ b/lib/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=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc verify version-etc-fsf vsnprintf warnings wchar
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@@ -78,12 +78,17 @@ BUILT_SOURCES += $(ALLOCA_H)
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
-alloca.h: alloca.in.h
+if GL_GENERATE_ALLOCA_H
+alloca.h: alloca.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
cat $(srcdir)/alloca.in.h; \
} > $@-t && \
mv -f $@-t $@
+else
+alloca.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += alloca.h alloca.h-t
EXTRA_DIST += alloca.in.h
@@ -127,7 +132,7 @@ BUILT_SOURCES += arpa/inet.h
# We need the following in order to create <arpa/inet.h> when the system
# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) arpa
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -169,12 +174,17 @@ BUILT_SOURCES += $(BYTESWAP_H)
# We need the following in order to create <byteswap.h> when the system
# doesn't have one.
-byteswap.h: byteswap.in.h
+if GL_GENERATE_BYTESWAP_H
+byteswap.h: byteswap.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
cat $(srcdir)/byteswap.in.h; \
} > $@-t && \
mv -f $@-t $@
+else
+byteswap.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += byteswap.h byteswap.h-t
EXTRA_DIST += byteswap.in.h
@@ -251,14 +261,6 @@ EXTRA_libgnu_la_SOURCES += close.c
## end gnulib module close
-## begin gnulib module close-hook
-
-libgnu_la_SOURCES += close-hook.c
-
-EXTRA_DIST += close-hook.h
-
-## end gnulib module close-hook
-
## begin gnulib module connect
@@ -290,7 +292,8 @@ BUILT_SOURCES += $(ERRNO_H)
# We need the following in order to create <errno.h> when the system
# doesn't have one that is POSIX compliant.
-errno.h: errno.in.h
+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' \
@@ -306,6 +309,10 @@ errno.h: errno.in.h
< $(srcdir)/errno.in.h; \
} > $@-t && \
mv $@-t $@
+else
+errno.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += errno.h errno.h-t
EXTRA_DIST += errno.in.h
@@ -321,13 +328,22 @@ EXTRA_libgnu_la_SOURCES += fclose.c
## end gnulib module fclose
+## begin gnulib module fd-hook
+
+libgnu_la_SOURCES += fd-hook.c
+
+EXTRA_DIST += fd-hook.h
+
+## end gnulib module fd-hook
+
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
# We need the following in order to create <float.h> when the system
# doesn't have one that works with the given compiler.
-float.h: float.in.h
+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' \
@@ -337,6 +353,10 @@ float.h: float.in.h
< $(srcdir)/float.in.h; \
} > $@-t && \
mv $@-t $@
+else
+float.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += float.h float.h-t
EXTRA_DIST += float.in.h
@@ -374,6 +394,10 @@ EXTRA_libgnu_la_SOURCES += frexp.c
libgnu_la_SOURCES += full-read.h full-read.c
+EXTRA_DIST += full-write.c
+
+EXTRA_libgnu_la_SOURCES += full-write.c
+
## end gnulib module full-read
## begin gnulib module full-write
@@ -488,7 +512,8 @@ BUILT_SOURCES += $(ICONV_H)
# We need the following in order to create <iconv.h> when the system
# doesn't have one that works with the given compiler.
-iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+if GL_GENERATE_ICONV_H
+iconv.h: iconv.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' \
@@ -506,6 +531,10 @@ iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
< $(srcdir)/iconv.in.h; \
} > $@-t && \
mv $@-t $@
+else
+iconv.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += iconv.h iconv.h-t
EXTRA_DIST += iconv.in.h
@@ -644,7 +673,7 @@ BUILT_SOURCES += locale.h
# We need the following in order to create <locale.h> when the system
# doesn't have one that provides all definitions.
-locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+locale.h: locale.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' \
@@ -716,7 +745,7 @@ BUILT_SOURCES += math.h
# We need the following in order to create <math.h> when the system
# doesn't have one that works with the given compiler.
-math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+math.h: math.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_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
@@ -839,7 +868,7 @@ BUILT_SOURCES += netdb.h
# We need the following in order to create <netdb.h> when the system
# doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+netdb.h: netdb.in.h $(top_builddir)/config.status $(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' \
@@ -870,7 +899,8 @@ BUILT_SOURCES += $(NETINET_IN_H)
# We need the following in order to create <netinet/in.h> when the system
# doesn't have one.
-netinet/in.h: netinet_in.in.h
+if GL_GENERATE_NETINET_IN_H
+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! */'; \
@@ -882,6 +912,10 @@ netinet/in.h: netinet_in.in.h
< $(srcdir)/netinet_in.in.h; \
} > $@-t && \
mv $@-t $@
+else
+netinet/in.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
MOSTLYCLEANDIRS += netinet
@@ -913,6 +947,15 @@ EXTRA_libgnu_la_SOURCES += putenv.c
## end gnulib module putenv
+## begin gnulib module read
+
+
+EXTRA_DIST += read.c
+
+EXTRA_libgnu_la_SOURCES += read.c
+
+## end gnulib module read
+
## begin gnulib module readlink
@@ -952,9 +995,9 @@ EXTRA_libgnu_la_SOURCES += safe-read.c
## begin gnulib module safe-write
-EXTRA_DIST += safe-write.c safe-write.h
+EXTRA_DIST += safe-read.c safe-write.c safe-write.h
-EXTRA_libgnu_la_SOURCES += safe-write.c
+EXTRA_libgnu_la_SOURCES += safe-read.c safe-write.c
## end gnulib module safe-write
@@ -1042,40 +1085,23 @@ EXTRA_DIST += stat-time.h
## end gnulib module stat-time
-## begin gnulib module stdarg
-
-BUILT_SOURCES += $(STDARG_H)
-
-# We need the following in order to create <stdarg.h> when the system
-# doesn't have one that works with the given compiler.
-stdarg.h: stdarg.in.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -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' \
- < $(srcdir)/stdarg.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += stdarg.h stdarg.h-t
-
-EXTRA_DIST += stdarg.in.h
-
-## end gnulib module stdarg
-
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
-stdbool.h: stdbool.in.h
+if GL_GENERATE_STDBOOL_H
+stdbool.h: stdbool.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t && \
mv $@-t $@
+else
+stdbool.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
EXTRA_DIST += stdbool.in.h
@@ -1088,7 +1114,8 @@ BUILT_SOURCES += $(STDDEF_H)
# We need the following in order to create <stddef.h> when the system
# doesn't have one that works with the given compiler.
-stddef.h: stddef.in.h
+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' \
@@ -1100,6 +1127,10 @@ stddef.h: stddef.in.h
< $(srcdir)/stddef.in.h; \
} > $@-t && \
mv $@-t $@
+else
+stddef.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += stddef.h stddef.h-t
EXTRA_DIST += stddef.in.h
@@ -1112,7 +1143,8 @@ BUILT_SOURCES += $(STDINT_H)
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
-stdint.h: stdint.in.h
+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' \
@@ -1144,6 +1176,10 @@ stdint.h: stdint.in.h
< $(srcdir)/stdint.in.h; \
} > $@-t && \
mv $@-t $@
+else
+stdint.h: $(top_builddir)/config.status
+ rm -f $@
+endif
MOSTLYCLEANFILES += stdint.h stdint.h-t
EXTRA_DIST += stdint.in.h
@@ -1156,7 +1192,7 @@ BUILT_SOURCES += stdio.h
# We need the following in order to create <stdio.h> when the system
# doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \
@@ -1166,20 +1202,27 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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' \
@@ -1192,14 +1235,18 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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' \
@@ -1241,6 +1288,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
-e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
-e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+ -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
-e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
-e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
@@ -1267,7 +1315,7 @@ 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 $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+stdlib.h: stdlib.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' \
@@ -1350,15 +1398,6 @@ EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
-## begin gnulib module strcase
-
-
-EXTRA_DIST += strcasecmp.c strncasecmp.c
-
-EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
-
-## end gnulib module strcase
-
## begin gnulib module strftime
@@ -1385,7 +1424,7 @@ BUILT_SOURCES += string.h
# We need the following in order to create <string.h> when the system
# doesn't have one that works with the given compiler.
-string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \
@@ -1451,6 +1490,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
-e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
-e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
-e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
@@ -1473,39 +1513,13 @@ EXTRA_DIST += string.in.h
## end gnulib module string
-## begin gnulib module strings
-
-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 $(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' \
- -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|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
- -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
- -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; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += strings.h strings.h-t
-
-EXTRA_DIST += strings.in.h
-
-## end gnulib module strings
-
## begin gnulib module sys_file
BUILT_SOURCES += sys/file.h
# We need the following in order to create <sys/file.h> when the system
# has one that is incomplete.
-sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
+sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1533,7 +1547,7 @@ BUILT_SOURCES += sys/socket.h
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1583,7 +1597,7 @@ BUILT_SOURCES += sys/stat.h
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1642,7 +1656,7 @@ BUILT_SOURCES += sys/time.h
# We need the following in order to create <sys/time.h> when the system
# doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1667,13 +1681,38 @@ EXTRA_DIST += sys_time.in.h
## end gnulib module sys_time
+## begin gnulib module sys_uio
+
+BUILT_SOURCES += sys/uio.h
+
+# We need the following in order to create <sys/uio.h> when the system
+# doesn't have one that works with the given compiler.
+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' \
+ -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' \
+ -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \
+ < $(srcdir)/sys_uio.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t
+MOSTLYCLEANDIRS += sys
+
+EXTRA_DIST += sys_uio.in.h
+
+## end gnulib module sys_uio
+
## begin gnulib module time
BUILT_SOURCES += time.h
# We need the following in order to create <time.h> when the system
# doesn't have one that works with the given compiler.
-time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \
@@ -1732,7 +1771,7 @@ BUILT_SOURCES += unistd.h
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \
@@ -1768,6 +1807,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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' \
@@ -1776,6 +1816,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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' \
@@ -1836,6 +1877,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
-e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
+ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
@@ -1984,18 +2026,6 @@ libgnu_la_SOURCES += verify.h
## end gnulib module verify
-## begin gnulib module version-etc
-
-libgnu_la_SOURCES += version-etc.h version-etc.c
-
-## end gnulib module version-etc
-
-## begin gnulib module version-etc-fsf
-
-libgnu_la_SOURCES += version-etc-fsf.c
-
-## end gnulib module version-etc-fsf
-
## begin gnulib module vsnprintf
@@ -2030,7 +2060,7 @@ BUILT_SOURCES += wchar.h
# We need the following in order to create <wchar.h> when the system
# version does not work standalone.
-wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 3df6fd2a4..1fa1f5289 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -27,8 +27,8 @@
# include <features.h> /* for __GLIBC__ */
#endif
-/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
- under MinGW.
+/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
+ for pulling in winsock2.h etc. under MinGW.
But avoid namespace pollution on glibc systems. */
#ifndef __GLIBC__
# include <sys/socket.h>
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 7e2fdbd5e..73ed4f8f9 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
+# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
@@ -68,8 +69,6 @@
# endif
# define __readlink readlink
# define __set_errno(e) errno = (e)
-/* Use the system functions, not the gnulib overrides in this file. */
-# undef malloc
# ifndef MAXSYMLINKS
# ifdef SYMLOOP_MAX
# define MAXSYMLINKS SYMLOOP_MAX
diff --git a/lib/close-hook.h b/lib/close-hook.h
deleted file mode 100644
index adcf11c22..000000000
--- a/lib/close-hook.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Hook for making the close() function extensible.
- Copyright (C) 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 Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef CLOSE_HOOK_H
-#define CLOSE_HOOK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
- on native Windows platforms. */
-#if WINDOWS_SOCKETS
-
-
-/* An element of the list of close hooks.
- The fields of this structure are considered private. */
-struct close_hook
-{
- /* Doubly linked list. */
- struct close_hook *private_next;
- struct close_hook *private_prev;
- /* Function that treats the types of FD that it knows about and calls
- execute_close_hooks (FD, REMAINING_LIST) as a fallback. */
- int (*private_fn) (int fd, const struct close_hook *remaining_list);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
- types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
- for the other FD types. */
-typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
-
-/* Execute the close hooks in REMAINING_LIST.
- Return 0 or -1, like close() would do. */
-extern int execute_close_hooks (int fd, const struct close_hook *remaining_list);
-
-/* Execute all close hooks.
- Return 0 or -1, like close() would do. */
-extern int execute_all_close_hooks (int fd);
-
-/* Add a function to the list of close hooks.
- The LINK variable points to a piece of memory which is guaranteed to be
- accessible until the corresponding call to unregister_close_hook. */
-extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
-
-/* Removes a function from the list of close hooks. */
-extern void unregister_close_hook (struct close_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CLOSE_HOOK_H */
diff --git a/lib/close.c b/lib/close.c
index 9d72f7cad..378c4f145 100644
--- a/lib/close.c
+++ b/lib/close.c
@@ -19,7 +19,7 @@
/* Specification. */
#include <unistd.h>
-#include "close-hook.h"
+#include "fd-hook.h"
/* Override close() to call into other gnulib modules. */
@@ -28,7 +28,7 @@ rpl_close (int fd)
#undef close
{
#if WINDOWS_SOCKETS
- int retval = execute_all_close_hooks (fd);
+ int retval = execute_all_close_hooks (close, fd);
#else
int retval = close (fd);
#endif
diff --git a/lib/close-hook.c b/lib/fd-hook.c
index 0fdf32358..40fbeeb34 100644
--- a/lib/close-hook.c
+++ b/lib/fd-hook.c
@@ -1,4 +1,4 @@
-/* Hook for making the close() function extensible.
+/* Hook for making making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
@@ -18,13 +18,9 @@
#include <config.h>
/* Specification. */
-#include "close-hook.h"
+#include "fd-hook.h"
#include <stdlib.h>
-#include <unistd.h>
-
-#undef close
-
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
@@ -32,49 +28,77 @@
/* The first and last link in the doubly linked list.
Initially the list is empty. */
-static struct close_hook anchor = { &anchor, &anchor, NULL };
+static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
+
+int
+execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
+ int fd)
+{
+ if (remaining_list == &anchor)
+ /* End of list reached. */
+ return primary (fd);
+ else
+ return remaining_list->private_close_fn (remaining_list->private_next,
+ primary, fd);
+}
int
-execute_close_hooks (int fd, const struct close_hook *remaining_list)
+execute_all_close_hooks (gl_close_fn primary, int fd)
+{
+ return execute_close_hooks (anchor.private_next, primary, fd);
+}
+
+int
+execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
+ int fd, int request, void *arg)
{
if (remaining_list == &anchor)
/* End of list reached. */
- return close (fd);
+ return primary (fd, request, arg);
else
- return remaining_list->private_fn (fd, remaining_list->private_next);
+ return remaining_list->private_ioctl_fn (remaining_list->private_next,
+ primary, fd, request, arg);
}
int
-execute_all_close_hooks (int fd)
+execute_all_ioctl_hooks (gl_ioctl_fn primary,
+ int fd, int request, void *arg)
{
- return execute_close_hooks (fd, anchor.private_next);
+ return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
}
void
-register_close_hook (close_hook_fn hook, struct close_hook *link)
+register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
{
+ if (close_hook == NULL)
+ close_hook = execute_close_hooks;
+ if (ioctl_hook == NULL)
+ ioctl_hook = execute_ioctl_hooks;
+
if (link->private_next == NULL && link->private_prev == NULL)
{
/* Add the link to the doubly linked list. */
link->private_next = anchor.private_next;
link->private_prev = &anchor;
- link->private_fn = hook;
+ link->private_close_fn = close_hook;
+ link->private_ioctl_fn = ioctl_hook;
anchor.private_next->private_prev = link;
anchor.private_next = link;
}
else
{
/* The link is already in use. */
- if (link->private_fn != hook)
+ if (link->private_close_fn != close_hook
+ || link->private_ioctl_fn != ioctl_hook)
abort ();
}
}
void
-unregister_close_hook (struct close_hook *link)
+unregister_fd_hook (struct fd_hook *link)
{
- struct close_hook *next = link->private_next;
- struct close_hook *prev = link->private_prev;
+ struct fd_hook *next = link->private_next;
+ struct fd_hook *prev = link->private_prev;
if (next != NULL && prev != NULL)
{
@@ -84,7 +108,8 @@ unregister_close_hook (struct close_hook *link)
/* Clear the link, to mark it unused. */
link->private_next = NULL;
link->private_prev = NULL;
- link->private_fn = NULL;
+ link->private_close_fn = NULL;
+ link->private_ioctl_fn = NULL;
}
}
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
new file mode 100644
index 000000000..aab4d913c
--- /dev/null
+++ b/lib/fd-hook.h
@@ -0,0 +1,119 @@
+/* Hook for making making file descriptor functions close(), ioctl() extensible.
+ Copyright (C) 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 Lesser 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#ifndef FD_HOOK_H
+#define FD_HOOK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Currently, this entire code is only needed for the handling of sockets
+ on native Windows platforms. */
+#if WINDOWS_SOCKETS
+
+
+/* Type of function that closes FD. */
+typedef int (*gl_close_fn) (int fd);
+
+/* Type of function that applies a control request to FD. */
+typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
+
+/* An element of the list of file descriptor hooks.
+ In CLOS (Common Lisp Object System) speak, it consists of an "around"
+ method for the close() function and an "around" method for the ioctl()
+ function.
+ The fields of this structure are considered private. */
+struct fd_hook
+{
+ /* Doubly linked list. */
+ struct fd_hook *private_next;
+ struct fd_hook *private_prev;
+ /* Function that treats the types of FD that it knows about and calls
+ execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */
+ int (*private_close_fn) (const struct fd_hook *remaining_list,
+ gl_close_fn primary,
+ int fd);
+ /* Function that treats the types of FD that it knows about and calls
+ execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
+ fallback. */
+ int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
+ gl_ioctl_fn primary,
+ int fd, int request, void *arg);
+};
+
+/* This type of function closes FD, applying special knowledge for the FD
+ types it knows about, and calls
+ execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
+ for the other FD types.
+ In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+ and PRIMARY is the "primary" method for close(). */
+typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
+ gl_close_fn primary,
+ int fd);
+
+/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+ Return 0 or -1, like close() would do. */
+extern int execute_close_hooks (const struct fd_hook *remaining_list,
+ gl_close_fn primary,
+ int fd);
+
+/* Execute all close hooks, with PRIMARY as "primary" method.
+ Return 0 or -1, like close() would do. */
+extern int execute_all_close_hooks (gl_close_fn primary, int fd);
+
+/* This type of function applies a control request to FD, applying special
+ knowledge for the FD types it knows about, and calls
+ execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
+ for the other FD types.
+ In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+ and PRIMARY is the "primary" method for ioctl(). */
+typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
+ gl_ioctl_fn primary,
+ int fd, int request, void *arg);
+
+/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+ Return 0 or -1, like ioctl() would do. */
+extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
+ gl_ioctl_fn primary,
+ int fd, int request, void *arg);
+
+/* Execute all ioctl hooks, with PRIMARY as "primary" method.
+ Return 0 or -1, like ioctl() would do. */
+extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
+ int fd, int request, void *arg);
+
+/* Add a function pair to the list of file descriptor hooks.
+ CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
+ The LINK variable points to a piece of memory which is guaranteed to be
+ accessible until the corresponding call to unregister_fd_hook. */
+extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
+ struct fd_hook *link);
+
+/* Removes a hook from the list of file descriptor hooks. */
+extern void unregister_fd_hook (struct fd_hook *link);
+
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FD_HOOK_H */
diff --git a/lib/malloc.c b/lib/malloc.c
index 6a417c37a..b06ef3f18 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -18,6 +18,7 @@
/* written by Jim Meyering and Bruno Haible */
+#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
#ifdef malloc
@@ -28,14 +29,10 @@
# define NEED_MALLOC_GNU 1
#endif
-/* Specification. */
#include <stdlib.h>
#include <errno.h>
-/* Call the system's malloc below. */
-#undef malloc
-
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
diff --git a/lib/malloca.c b/lib/malloca.c
index b79e7d7a6..7bb1fbec5 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -16,6 +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. */
+#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Specification. */
@@ -23,9 +24,6 @@
#include "verify.h"
-/* Use the system functions, not the gnulib overrides in this file. */
-#undef malloc
-
/* The speed critical point in this file is freea() applied to an alloca()
result: it must be fast, to match the speed of alloca(). The speed of
mmalloca() and freea() in the other case are not critical, because they
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 21e3d55eb..5b64e486b 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -37,7 +37,8 @@
#ifndef _GL_NETDB_H
#define _GL_NETDB_H
-/* Get netdb.h definitions such as struct hostent for MinGW. */
+/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
+ 'struct hostent' on MinGW. */
#include <sys/socket.h>
/* The definition of _GL_ARG_NONNULL is copied here. */
diff --git a/lib/read.c b/lib/read.c
new file mode 100644
index 000000000..d161a40c2
--- /dev/null
+++ b/lib/read.c
@@ -0,0 +1,59 @@
+/* POSIX compatible read() function.
+ Copyright (C) 2008-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 Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+/* Replace this function only if module 'nonblocking' is requested. */
+#if GNULIB_NONBLOCKING
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+# include <errno.h>
+# include <io.h>
+
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+
+ssize_t
+rpl_read (int fd, void *buf, size_t count)
+#undef read
+{
+ ssize_t ret = read (fd, buf, count);
+
+ if (ret < 0
+ && GetLastError () == ERROR_NO_DATA)
+ {
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (GetFileType (h) == FILE_TYPE_PIPE)
+ {
+ /* h is a pipe or socket. */
+ DWORD state;
+ if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0)
+ && (state & PIPE_NOWAIT) != 0)
+ /* h is a pipe in non-blocking mode.
+ Change errno from EINVAL to EAGAIN. */
+ errno = EAGAIN;
+ }
+ }
+ return ret;
+}
+
+# endif
+#endif
diff --git a/lib/sockets.c b/lib/sockets.c
index 27da15f8d..25ab97f3d 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -27,13 +27,15 @@
/* This includes winsock2.h on MinGW. */
# include <sys/socket.h>
-# include "close-hook.h"
+# include "fd-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
# include "w32sock.h"
static int
-close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
+close_fd_maybe_socket (const struct fd_hook *remaining_list,
+ gl_close_fn primary,
+ int fd)
{
SOCKET sock;
WSANETWORKEVENTS ev;
@@ -64,10 +66,38 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
}
else
/* Some other type of file descriptor. */
- return execute_close_hooks (fd, remaining_list);
+ return execute_close_hooks (remaining_list, primary, fd);
}
-static struct close_hook close_sockets_hook;
+static int
+ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
+ gl_ioctl_fn primary,
+ int fd, int request, void *arg)
+{
+ SOCKET sock;
+ WSANETWORKEVENTS ev;
+
+ /* Test whether fd refers to a socket. */
+ sock = FD_TO_SOCKET (fd);
+ ev.lNetworkEvents = 0xDEADBEEF;
+ WSAEnumNetworkEvents (sock, NULL, &ev);
+ if (ev.lNetworkEvents != 0xDEADBEEF)
+ {
+ /* fd refers to a socket. */
+ if (ioctlsocket (sock, request, arg) < 0)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return 0;
+ }
+ else
+ /* Some other type of file descriptor. */
+ return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
+}
+
+static struct fd_hook fd_sockets_hook;
static int initialized_sockets_version /* = 0 */;
@@ -90,7 +120,8 @@ gl_sockets_startup (int version _GL_UNUSED)
return 2;
if (initialized_sockets_version == 0)
- register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+ register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
+ &fd_sockets_hook);
initialized_sockets_version = version;
}
@@ -107,7 +138,7 @@ gl_sockets_cleanup (void)
initialized_sockets_version = 0;
- unregister_close_hook (&close_sockets_hook);
+ unregister_fd_hook (&fd_sockets_hook);
err = WSACleanup ();
if (err != 0)
diff --git a/lib/stat-time.h b/lib/stat-time.h
index b4a914c71..47a288a7e 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -175,7 +175,7 @@ get_stat_birthtime (struct stat const *st)
using zero. Attempt to work around this problem. Alas, this can
report failure even for valid time stamps. Also, NetBSD
sometimes returns junk in the birth time fields; work around this
- bug if it it is detected. There's no need to detect negative
+ bug if it is detected. There's no need to detect negative
tv_nsec junk as negative tv_nsec already indicates an error. */
if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
t.tv_nsec = -1;
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 4a82174de..b4469a9b8 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -67,9 +67,45 @@
#else
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
-#define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF
+ indicates to GCC that the function takes a format string and arguments,
+ where the format string directives are the ones standardized by ISO C99
+ and POSIX. */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
+#else
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
+ except that it indicates to GCC that the supported format string directives
+ are the ones of the system printf(), rather than the ones standardized by
+ ISO C99 and POSIX. */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+/* _GL_ATTRIBUTE_FORMAT_SCANF
+ indicates to GCC that the function takes a format string and arguments,
+ where the format string directives are the ones standardized by ISO C99
+ and POSIX. */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
+#else
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
+ except that it indicates to GCC that the supported format string directives
+ are the ones of the system scanf(), rather than the ones standardized by
+ ISO C99 and POSIX. */
+#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+
/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
@@ -158,11 +194,34 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
"use gnulib module fflush for portable POSIX compliance");
#endif
-/* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
-#undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#if @GNULIB_FGETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fgetc
+# define fgetc rpl_fgetc
+# endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
+# endif
+_GL_CXXALIASWARN (fgetc);
+#endif
+
+#if @GNULIB_FGETS@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fgets
+# define fgets rpl_fgets
+# endif
+_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
+ _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fgets);
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
@@ -186,14 +245,20 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
- || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+ || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define fprintf rpl_fprintf
# endif
# define GNULIB_overrides_fprintf 1
+# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
+# else
+_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+# endif
_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
# else
_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
@@ -239,7 +304,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
#endif
#if @GNULIB_FPUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fputc
# define fputc rpl_fputc
@@ -253,7 +318,7 @@ _GL_CXXALIASWARN (fputc);
#endif
#if @GNULIB_FPUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fputs
# define fputs rpl_fputs
@@ -267,6 +332,21 @@ _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
_GL_CXXALIASWARN (fputs);
#endif
+#if @GNULIB_FREAD@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fread
+# define fread rpl_fread
+# endif
+_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
+ _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fread);
+#endif
+
#if @GNULIB_FREOPEN@
# if @REPLACE_FREOPEN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -291,6 +371,22 @@ _GL_WARN_ON_USE (freopen,
"use gnulib module freopen for portability");
#endif
+#if @GNULIB_FSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fscanf
+# define fscanf rpl_fscanf
+# endif
+_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
+# else
+_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
+# endif
+_GL_CXXALIASWARN (fscanf);
+#endif
+
/* Set up the following warnings, based on which modules are in use.
GNU Coding Standards discourage the use of fseek, since it imposes
@@ -483,7 +579,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
#if @GNULIB_FWRITE@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fwrite
# define fwrite rpl_fwrite
@@ -496,10 +592,55 @@ _GL_CXXALIAS_RPL (fwrite, size_t,
# else
_GL_CXXALIAS_SYS (fwrite, size_t,
(const void *ptr, size_t s, size_t n, FILE *stream));
+
+/* Work around glibc bug 11959
+ <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
+ which sometimes causes an unwanted diagnostic for fwrite calls.
+ This affects only function declaration attributes, so it's not
+ needed for C++. */
+# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
+static inline size_t _GL_ARG_NONNULL ((1, 4))
+rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+{
+ size_t r = fwrite (ptr, s, n, stream);
+ (void) r;
+ return r;
+}
+# undef fwrite
+# define fwrite rpl_fwrite
+# endif
# endif
_GL_CXXALIASWARN (fwrite);
#endif
+#if @GNULIB_GETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getc
+# define getc rpl_fgetc
+# endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
+# endif
+_GL_CXXALIASWARN (getc);
+#endif
+
+#if @GNULIB_GETCHAR@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getchar
+# define getchar rpl_getchar
+# endif
+_GL_FUNCDECL_RPL (getchar, int, (void));
+_GL_CXXALIAS_RPL (getchar, int, (void));
+# else
+_GL_CXXALIAS_SYS (getchar, int, (void));
+# endif
+_GL_CXXALIASWARN (getchar);
+#endif
+
#if @GNULIB_GETDELIM@
/* Read input, up to (and including) the next occurrence of DELIMITER, from
STREAM, store it in *LINEPTR (and NUL-terminate it).
@@ -576,6 +717,26 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
# endif
#endif
+#if @GNULIB_GETS@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gets
+# define gets rpl_gets
+# endif
+_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gets, char *, (char *s));
+# else
+_GL_CXXALIAS_SYS (gets, char *, (char *s));
+# undef gets
+# endif
+_GL_CXXALIASWARN (gets);
+/* It is very rare that the developer ever has full control of stdin,
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
+
+
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
/* Grow an obstack with formatted output. Return the number of
@@ -671,18 +832,27 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
- || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+ || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if defined __GNUC__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
/* Don't break __attribute__((format(printf,M,N))). */
# define printf __printf__
# endif
+# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL_1 (__printf__, int,
(const char *format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
_GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
_GL_ARG_NONNULL ((1)));
+# else
+_GL_FUNCDECL_RPL_1 (__printf__, int,
+ (const char *format, ...)
+ __asm__ (@ASM_SYMBOL_PREFIX@
+ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
+ _GL_ARG_NONNULL ((1)));
+# endif
_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
# else
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -711,7 +881,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
#endif
#if @GNULIB_PUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef putc
# define putc rpl_fputc
@@ -725,7 +895,7 @@ _GL_CXXALIASWARN (putc);
#endif
#if @GNULIB_PUTCHAR@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef putchar
# define putchar rpl_putchar
@@ -739,7 +909,7 @@ _GL_CXXALIASWARN (putchar);
#endif
#if @GNULIB_PUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef puts
# define puts rpl_puts
@@ -823,6 +993,37 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
# endif
#endif
+#if @GNULIB_SCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if defined __GNUC__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef scanf
+/* Don't break __attribute__((format(scanf,M,N))). */
+# define scanf __scanf__
+# endif
+_GL_FUNCDECL_RPL_1 (__scanf__, int,
+ (const char *format, ...)
+ __asm__ (@ASM_SYMBOL_PREFIX@
+ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
+# else
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef scanf
+# define scanf rpl_scanf
+# endif
+_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
+# endif
+# else
+_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
+# endif
+_GL_CXXALIASWARN (scanf);
+#endif
+
#if @GNULIB_SNPRINTF@
# if @REPLACE_SNPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -982,14 +1183,20 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
- || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+ || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vfprintf rpl_vfprintf
# endif
# define GNULIB_overrides_vfprintf 1
+# if @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
+# else
+_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
+# endif
_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
# else
/* Need to cast, because on Solaris, the third parameter is
@@ -1010,16 +1217,41 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
"POSIX compliance");
#endif
+#if @GNULIB_VFSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef vfscanf
+# define vfscanf rpl_vfscanf
+# endif
+_GL_FUNCDECL_RPL (vfscanf, int,
+ (FILE *stream, const char *format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vfscanf, int,
+ (FILE *stream, const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vfscanf, int,
+ (FILE *stream, const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vfscanf);
+#endif
+
#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
- || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+ || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vprintf rpl_vprintf
# endif
# define GNULIB_overrides_vprintf 1
+# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
_GL_ARG_NONNULL ((1)));
+# else
+_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
+ _GL_ARG_NONNULL ((1)));
+# endif
_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
# else
/* Need to cast, because on Solaris, the second parameter is
@@ -1039,6 +1271,22 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
"POSIX compliance");
#endif
+#if @GNULIB_VSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef vscanf
+# define vscanf rpl_vscanf
+# endif
+_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vscanf);
+#endif
+
#if @GNULIB_VSNPRINTF@
# if @REPLACE_VSNPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 980b909af..9651e94cd 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -255,9 +255,14 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
# endif
#endif
+/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
+ rely on GNU or POSIX semantics for malloc and realloc (for example,
+ by never specifying a zero size), so it does not need malloc or
+ realloc to be redefined. */
#if @GNULIB_MALLOC_POSIX@
# if @REPLACE_MALLOC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+ || _GL_USE_STDLIB_ALLOC)
# undef malloc
# define malloc rpl_malloc
# endif
@@ -267,7 +272,7 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
# endif
_GL_CXXALIASWARN (malloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
# undef malloc
/* Assume malloc is always declared. */
_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
@@ -531,7 +536,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@
# if @REPLACE_REALLOC@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+ || _GL_USE_STDLIB_ALLOC)
# undef realloc
# define realloc rpl_realloc
# endif
@@ -541,7 +547,7 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
# endif
_GL_CXXALIASWARN (realloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
# undef realloc
/* Assume realloc is always declared. */
_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c
deleted file mode 100644
index a98a3a0ca..000000000
--- a/lib/strcasecmp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-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 Lesser General Public License as published by
- the Free Software Foundation; either version 2, 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-#include <ctype.h>
-#include <limits.h>
-
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
-
-/* 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.
- Note: This function does not work with multibyte strings! */
-
-int
-strcasecmp (const char *s1, const char *s2)
-{
- const unsigned char *p1 = (const unsigned char *) s1;
- const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2)
- return 0;
-
- do
- {
- c1 = TOLOWER (*p1);
- c2 = TOLOWER (*p2);
-
- if (c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
diff --git a/lib/strftime.c b/lib/strftime.c
index be7750de1..df09be9ca 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -172,15 +172,16 @@ extern char *tzname[];
#define add(n, f) \
do \
{ \
- int _n = (n); \
- int _delta = width - _n; \
- int _incr = _n + (_delta > 0 ? _delta : 0); \
- if ((size_t) _incr >= maxsize - i) \
+ size_t _n = (n); \
+ size_t _w = (width < 0 ? 0 : width); \
+ size_t _incr = _n < _w ? _w : _n; \
+ if (_incr >= maxsize - i) \
return 0; \
if (p) \
{ \
- if (digits == 0 && _delta > 0) \
+ if (digits == 0 && _n < _w) \
{ \
+ size_t _delta = width - _n; \
if (pad == L_('0')) \
memset_zero (p, _delta); \
else \
diff --git a/lib/string.in.h b/lib/string.in.h
index 3926c0c60..9eb0d5c30 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -277,17 +277,28 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
/* Find the first occurrence of C in S or the final NUL byte. */
#if @GNULIB_STRCHRNUL@
-# if ! @HAVE_STRCHRNUL@
+# if @REPLACE_STRCHRNUL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define strchrnul rpl_strchrnul
+# endif
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strchrnul, char *,
+ (const char *str, int ch));
+# else
+# if ! @HAVE_STRCHRNUL@
_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" { const char * std::strchrnul (const char *, int); }
extern "C++" { char * std::strchrnul (char *, int); } */
_GL_CXXALIAS_SYS_CAST2 (strchrnul,
char *, (char const *__s, int __c_in),
char const *, (char const *__s, int __c_in));
+# endif
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
diff --git a/lib/strings.in.h b/lib/strings.in.h
deleted file mode 100644
index d8f1770c8..000000000
--- a/lib/strings.in.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* A substitute <strings.h>.
-
- 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 Lesser General Public License as published by
- the Free Software Foundation; either version 2, 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GL_STRINGS_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
-
-#ifndef _GL_STRINGS_H
-#define _GL_STRINGS_H
-
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-#ifdef __cplusplus
-extern "C" {
-#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.
- Note: This function does not work in multibyte locales. */
-#if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2)
- _GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strcasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strcasecmp
-# if HAVE_RAW_DECL_STRCASECMP
-_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
- "strings in multibyte locales - "
- "use mbscasecmp if you care about "
- "internationalization, or use c_strcasecmp , "
- "gnulib module c-strcase) if you want a locale "
- "independent function");
-# endif
-#endif
-
-/* Compare no more than N bytes of 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.
- Note: This function cannot work correctly in multibyte locales. */
-#if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n)
- _GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strncasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strncasecmp
-# if HAVE_RAW_DECL_STRNCASECMP
-_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
- "strings in multibyte locales - "
- "use mbsncasecmp or mbspcasecmp if you care about "
- "internationalization, or use c_strncasecmp , "
- "gnulib module c-strcase) if you want a locale "
- "independent function");
-# endif
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_STRING_H */
-#endif /* _GL_STRING_H */
diff --git a/lib/strncasecmp.c b/lib/strncasecmp.c
deleted file mode 100644
index 35cd4cccd..000000000
--- a/lib/strncasecmp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* strncasecmp.c -- case insensitive string comparator
- Copyright (C) 1998-1999, 2005-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 Lesser General Public License as published by
- the Free Software Foundation; either version 2, 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-#include <ctype.h>
-#include <limits.h>
-
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
-
-/* Compare no more than N bytes of 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.
- Note: This function cannot work correctly in multibyte locales. */
-
-int
-strncasecmp (const char *s1, const char *s2, size_t n)
-{
- register const unsigned char *p1 = (const unsigned char *) s1;
- register const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2 || n == 0)
- return 0;
-
- do
- {
- c1 = TOLOWER (*p1);
- c2 = TOLOWER (*p2);
-
- if (--n == 0 || c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 12f6d1bc7..c13f33663 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -50,6 +50,10 @@
<sys/types.h>. */
# include <sys/types.h>
+/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
+ is defined. */
+# include <stddef.h>
+
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
@@ -142,7 +146,6 @@ struct sockaddr_storage
suggests that getaddrinfo should be available on all Windows
releases. */
-
# if @HAVE_WINSOCK2_H@
# include <winsock2.h>
# endif
@@ -173,6 +176,19 @@ typedef int socklen_t;
# endif
+/* For struct iovec */
+# include <sys/uio.h>
+
+/* Rudimentary 'struct msghdr'; this works as long as you don't try to
+ access msg_control or msg_controllen. */
+struct msghdr {
+ void *msg_name;
+ socklen_t msg_namelen;
+ struct iovec *msg_iov;
+ int msg_iovlen;
+ int msg_flags;
+};
+
#endif
#if @HAVE_WINSOCK2_H@
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 3755e4e64..cc5ab1b37 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -355,7 +355,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
#if @GNULIB_FUTIMENS@
-# if @REPLACE_FUTIMENS@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
+ implementation relies on futimesat, which on Solaris 10 makes an invocation
+ to futimens that is meant to invoke the libc's futimens(), not gnulib's
+ futimens(). */
+# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef futimens
# define futimens rpl_futimens
@@ -368,7 +372,9 @@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
# endif
_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
# endif
+# if @HAVE_FUTIMENS@
_GL_CXXALIASWARN (futimens);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef futimens
# if HAVE_RAW_DECL_FUTIMENS
@@ -612,7 +618,11 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
#if @GNULIB_UTIMENSAT@
-# if @REPLACE_UTIMENSAT@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
+ implementation relies on futimesat, which on Solaris 10 makes an invocation
+ to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
+ utimensat(). */
+# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef utimensat
# define utimensat rpl_utimensat
@@ -631,7 +641,9 @@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag));
# endif
+# if @HAVE_UTIMENSAT@
_GL_CXXALIASWARN (utimensat);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef utimensat
# if HAVE_RAW_DECL_UTIMENSAT
diff --git a/lib/stdarg.in.h b/lib/sys_uio.in.h
index 957fa9a8b..28aea2838 100644
--- a/lib/stdarg.in.h
+++ b/lib/sys_uio.in.h
@@ -1,5 +1,5 @@
-/* Substitute for and wrapper around <stdarg.h>.
- Copyright (C) 2008-2011 Free Software Foundation, Inc.
+/* Substitute for <sys/uio.h>.
+ 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 Lesser General Public License as published by
@@ -15,22 +15,35 @@
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
-
-#if __GNUC__ >= 3
+# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
-#endif
+# endif
@PRAGMA_COLUMNS@
+#ifndef _GL_SYS_UIO_H
+
+#if @HAVE_SYS_UIO_H@
+
/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STDARG_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
+
+#endif
+
+#ifndef _GL_SYS_UIO_H
+#define _GL_SYS_UIO_H
-#ifndef _GL_STDARG_H
-#define _GL_STDARG_H
+#if !@HAVE_SYS_UIO_H@
+/* A platform that lacks <sys/uio.h>. */
+/* Get 'ssize_t'. */
+# include <sys/types.h>
-#ifndef va_copy
-# define va_copy(a,b) ((a) = (b))
+/* All known platforms that lack <sys/uio.h> also lack any declaration
+ of struct iovec in any other header. */
+struct iovec {
+ void *iov_base;
+ size_t iov_len;
+};
#endif
-#endif /* _GL_STDARG_H */
-#endif /* _GL_STDARG_H */
+#endif /* _GL_SYS_UIO_H */
+#endif /* _GL_SYS_UIO_H */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index adc9b24df..1bbab0fe1 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -97,7 +97,8 @@
# include <netdb.h>
#endif
-#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
+ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
/* Get ssize_t. */
# include <sys/types.h>
@@ -1105,6 +1106,28 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
#endif
+#if @GNULIB_READ@
+/* Read up to COUNT bytes from file descriptor FD into the buffer starting
+ at BUF. See the POSIX:2001 specification
+ <http://www.opengroup.org/susv3xsh/read.html>. */
+# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef read
+# define read rpl_read
+# endif
+_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# else
+/* Need to cast, because on mingw, the third parameter is
+ unsigned int count
+ and the return type is 'int'. */
+_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#endif
+
+
#if @GNULIB_READLINK@
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
bytes of it into BUF. Return the number of bytes placed into BUF if
@@ -1359,7 +1382,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/write.html>. */
-# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef write
# define write rpl_write
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index a06c6b47b..c665aa8a5 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -134,7 +134,7 @@ extern int
/* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */
-#if defined GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
@@ -157,7 +157,7 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
@@ -180,7 +180,7 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
@@ -191,11 +191,11 @@ u32_mbtouc_unsafe (ucs4_t *puc,
{
uint32_t c = *s;
-# ifdef CONFIG_UNICODE_SAFETY
+# if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
# endif
*puc = c;
-# ifdef CONFIG_UNICODE_SAFETY
+# if CONFIG_UNICODE_SAFETY
else
/* invalid multibyte character */
*puc = 0xfffd;
@@ -205,7 +205,7 @@ u32_mbtouc_unsafe (ucs4_t *puc,
# endif
#endif
-#if defined GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
@@ -228,7 +228,7 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
@@ -251,7 +251,7 @@ u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
@@ -279,17 +279,17 @@ u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
/* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */
-#if defined GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif
@@ -300,7 +300,7 @@ extern int
/* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */
-#if defined GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
@@ -322,7 +322,7 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
@@ -344,7 +344,7 @@ u16_uctomb (uint16_t *s, ucs4_t uc, int n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n);
diff --git a/lib/verify.h b/lib/verify.h
index a40d58a63..9fa5111b6 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -20,6 +20,26 @@
#ifndef VERIFY_H
# define VERIFY_H 1
+/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
+ C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and
+ later, in C mode, and its use here generates easier-to-read diagnostics
+ when verify (R) fails.
+
+ Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the
+ C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4).
+ This will likely be supported by future GCC versions, in C++ mode.
+
+ For now, use this only with GCC. Eventually whether _Static_assert
+ and static_assert works should be determined by 'configure'. */
+# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
+# define HAVE__STATIC_ASSERT 1
+# endif
+/* The condition (99 < __GNUC__) is temporary, until we know about the
+ first G++ release that supports static_assert. */
+# if (99 < __GNUC__) && defined __cplusplus
+# define HAVE_STATIC_ASSERT 1
+# endif
+
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
assert (R), there is no run-time overhead.
@@ -31,7 +51,12 @@
Symbols ending in "__" are private to this header.
- The code below uses several ideas.
+ If _Static_assert works, verify (R) uses it directly. Similarly,
+ verify_true (R) works by packaging a _Static_assert inside a struct
+ that is an operand of sizeof.
+
+ The code below uses several ideas for C++ compilers, and for C
+ compilers that do not support _Static_assert:
* The first step is ((R) ? 1 : -1). Given an expression R, of
integral or boolean or floating-point type, this yields an
@@ -109,15 +134,9 @@
__COUNTER__ macro that can let us generate unique identifiers for
each dummy function, to suppress this warning.
- * This implementation exploits the fact that GCC does not warn about
- the last declaration mentioned above. If a future version of GCC
- introduces a warning for this, the problem could be worked around
- by using code specialized to GCC, just as __COUNTER__ is already
- being used if available.
-
- #if 4 <= __GNUC__
- # define verify(R) [another version to keep GCC happy]
- #endif
+ * This implementation exploits the fact that older versions of GCC,
+ which do not support _Static_assert, also do not warn about the
+ last declaration mentioned above.
* In C++, any struct definition inside sizeof is invalid.
Use a template type to work around the problem. */
@@ -148,6 +167,20 @@ template <int w>
struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
# define verify_true(R) \
(!!sizeof (verify_type__<(R) ? 1 : -1>))
+# elif HAVE__STATIC_ASSERT
+# define verify_true(R) \
+ (!!sizeof \
+ (struct { \
+ _Static_assert (R, "verify_true (" #R ")"); \
+ int verify_dummy__; \
+ }))
+# elif HAVE_STATIC_ASSERT
+# define verify_true(R) \
+ (!!sizeof \
+ (struct { \
+ static_assert (R, "verify_true (" #R ")"); \
+ int verify_dummy__; \
+ }))
# else
# define verify_true(R) \
(!!sizeof \
@@ -157,7 +190,13 @@ template <int w>
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) \
+# if HAVE__STATIC_ASSERT
+# define verify(R) _Static_assert (R, "verify (" #R ")")
+# elif HAVE_STATIC_ASSERT
+# define verify(R) static_assert (R, "verify (" #R ")")
+# else
+# define verify(R) \
extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
+# endif
#endif
diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c
deleted file mode 100644
index 17c8bc3c4..000000000
--- a/lib/version-etc-fsf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Variable with FSF copyright information, for version-etc.
- Copyright (C) 1999-2006, 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 Lesser 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Jim Meyering. */
-
-#include <config.h>
-
-/* Specification. */
-#include "version-etc.h"
-
-/* Default copyright goes to the FSF. */
-
-const char version_etc_copyright[] =
- /* Do *not* mark this string for translation. %s is a copyright
- symbol suitable for this locale, and %d is the copyright
- year. */
- "Copyright %s %d Free Software Foundation, Inc.";
diff --git a/lib/version-etc.c b/lib/version-etc.c
deleted file mode 100644
index 60c6f01c7..000000000
--- a/lib/version-etc.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999-2011 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Jim Meyering. */
-
-#include <config.h>
-
-/* Specification. */
-#include "version-etc.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-
-/* If you use AM_INIT_AUTOMAKE's no-define option,
- PACKAGE is not defined. Use PACKAGE_TARNAME instead. */
-#if ! defined PACKAGE && defined PACKAGE_TARNAME
-# define PACKAGE PACKAGE_TARNAME
-#endif
-
-enum { COPYRIGHT_YEAR = 2011 };
-
-/* The three functions below display the --version information the
- standard way.
-
- If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
- the program. The formats are therefore:
-
- PACKAGE VERSION
-
- or
-
- COMMAND_NAME (PACKAGE) VERSION.
-
- The functions differ in the way they are passed author names. */
-
-/* Display the --version information the standard way.
-
- Author names are given in the array AUTHORS. N_AUTHORS is the
- number of elements in the array. */
-void
-version_etc_arn (FILE *stream,
- const char *command_name, const char *package,
- const char *version,
- const char * const * authors, size_t n_authors)
-{
- if (command_name)
- fprintf (stream, "%s (%s) %s\n", command_name, package, version);
- else
- fprintf (stream, "%s %s\n", package, version);
-
-#ifdef PACKAGE_PACKAGER
-# ifdef PACKAGE_PACKAGER_VERSION
- fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
- PACKAGE_PACKAGER_VERSION);
-# else
- fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
-# endif
-#endif
-
- /* TRANSLATORS: Translate "(C)" to the copyright symbol
- (C-in-a-circle), if this symbol is available in the user's
- locale. Otherwise, do not translate "(C)"; leave it as-is. */
- fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
-
- fputs (_("\
-\n\
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\
-This is free software: you are free to change and redistribute it.\n\
-There is NO WARRANTY, to the extent permitted by law.\n\
-\n\
-"),
- stream);
-
- switch (n_authors)
- {
- case 0:
- /* The caller must provide at least one author name. */
- abort ();
- case 1:
- /* TRANSLATORS: %s denotes an author name. */
- fprintf (stream, _("Written by %s.\n"), authors[0]);
- break;
- case 2:
- /* TRANSLATORS: Each %s denotes an author name. */
- fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
- break;
- case 3:
- /* TRANSLATORS: Each %s denotes an author name. */
- fprintf (stream, _("Written by %s, %s, and %s.\n"),
- authors[0], authors[1], authors[2]);
- break;
- case 4:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
- authors[0], authors[1], authors[2], authors[3]);
- break;
- case 5:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4]);
- break;
- case 6:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4],
- authors[5]);
- break;
- case 7:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4],
- authors[5], authors[6]);
- break;
- case 8:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("\
-Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4],
- authors[5], authors[6], authors[7]);
- break;
- case 9:
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("\
-Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4],
- authors[5], authors[6], authors[7], authors[8]);
- break;
- default:
- /* 10 or more authors. Use an abbreviation, since the human reader
- will probably not want to read the entire list anyway. */
- /* TRANSLATORS: Each %s denotes an author name.
- You can use line breaks, estimating that each author name occupies
- ca. 16 screen columns and that a screen line has ca. 80 columns. */
- fprintf (stream, _("\
-Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
- authors[0], authors[1], authors[2], authors[3], authors[4],
- authors[5], authors[6], authors[7], authors[8]);
- break;
- }
-}
-
-/* Display the --version information the standard way. See the initial
- comment to this module, for more information.
-
- Author names are given in the NULL-terminated array AUTHORS. */
-void
-version_etc_ar (FILE *stream,
- const char *command_name, const char *package,
- const char *version, const char * const * authors)
-{
- size_t n_authors;
-
- for (n_authors = 0; authors[n_authors]; n_authors++)
- ;
- version_etc_arn (stream, command_name, package, version, authors, n_authors);
-}
-
-/* Display the --version information the standard way. See the initial
- comment to this module, for more information.
-
- Author names are given in the NULL-terminated va_list AUTHORS. */
-void
-version_etc_va (FILE *stream,
- const char *command_name, const char *package,
- const char *version, va_list authors)
-{
- size_t n_authors;
- const char *authtab[10];
-
- for (n_authors = 0;
- n_authors < 10
- && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
- n_authors++)
- ;
- version_etc_arn (stream, command_name, package, version,
- authtab, n_authors);
-}
-
-
-/* Display the --version information the standard way.
-
- If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
- the program. The formats are therefore:
-
- PACKAGE VERSION
-
- or
-
- COMMAND_NAME (PACKAGE) VERSION.
-
- The authors names are passed as separate arguments, with an additional
- NULL argument at the end. */
-void
-version_etc (FILE *stream,
- const char *command_name, const char *package,
- const char *version, /* const char *author1, ...*/ ...)
-{
- va_list authors;
-
- va_start (authors, version);
- version_etc_va (stream, command_name, package, version, authors);
- va_end (authors);
-}
-
-void
-emit_bug_reporting_address (void)
-{
- /* TRANSLATORS: The placeholder indicates the bug-reporting address
- for this package. Please add _another line_ saying
- "Report translation bugs to <...>\n" with the address for translation
- bugs (typically your translation team's web or email address). */
- printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
-#ifdef PACKAGE_PACKAGER_BUG_REPORTS
- printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
- PACKAGE_PACKAGER_BUG_REPORTS);
-#endif
-#ifdef PACKAGE_URL
- printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
-#else
- printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
- PACKAGE_NAME, PACKAGE);
-#endif
- fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
- stdout);
-}
diff --git a/lib/version-etc.h b/lib/version-etc.h
deleted file mode 100644
index b197ad11f..000000000
--- a/lib/version-etc.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999, 2003, 2005, 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 Lesser 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Jim Meyering. */
-
-#ifndef VERSION_ETC_H
-# define VERSION_ETC_H 1
-
-# include <stdarg.h>
-# include <stdio.h>
-
-/* The `sentinel' attribute was added in gcc 4.0. */
-#ifndef _GL_ATTRIBUTE_SENTINEL
-# if 4 <= __GNUC__
-# define _GL_ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
-# else
-# define _GL_ATTRIBUTE_SENTINEL /* empty */
-# endif
-#endif
-
-extern const char version_etc_copyright[];
-
-/* The three functions below display the --version information in the
- standard way: command and package names, package version, followed
- by a short GPLv3+ notice and a list of up to 10 author names.
-
- If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
- the program. The formats are therefore:
-
- PACKAGE VERSION
-
- or
-
- COMMAND_NAME (PACKAGE) VERSION.
-
- The functions differ in the way they are passed author names: */
-
-/* N_AUTHORS names are supplied in array AUTHORS. */
-extern void version_etc_arn (FILE *stream,
- const char *command_name, const char *package,
- const char *version,
- const char * const * authors, size_t n_authors);
-
-/* Names are passed in the NULL-terminated array AUTHORS. */
-extern void version_etc_ar (FILE *stream,
- const char *command_name, const char *package,
- const char *version, const char * const * authors);
-
-/* Names are passed in the NULL-terminated va_list. */
-extern void version_etc_va (FILE *stream,
- const char *command_name, const char *package,
- const char *version, va_list authors);
-
-/* Names are passed as separate arguments, with an additional
- NULL argument at the end. */
-extern void version_etc (FILE *stream,
- const char *command_name, const char *package,
- const char *version,
- /* const char *author1, ..., NULL */ ...)
- _GL_ATTRIBUTE_SENTINEL;
-
-/* Display the usual `Report bugs to' stanza */
-extern void emit_bug_reporting_address (void);
-
-#endif /* VERSION_ETC_H */
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 4abc8759a..3cc0fc4b3 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -61,9 +61,13 @@
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
included before <wchar.h>.
+ In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
+ by <stddef.h>.
But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
# include <stddef.h>
+#endif
+#ifndef __GLIBC__
# include <stdio.h>
# include <time.h>
#endif
@@ -435,8 +439,22 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
# if !@HAVE_WMEMCHR@
_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
# endif
-_GL_CXXALIAS_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+ /* On some systems, this function is defined as an overloaded function:
+ extern "C++" {
+ const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
+ wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
+ } */
+_GL_CXXALIAS_SYS_CAST2 (wmemchr,
+ wchar_t *, (const wchar_t *, wchar_t, size_t),
+ const wchar_t *, (const wchar_t *, wchar_t, size_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
+ (const wchar_t *s, wchar_t c, size_t n));
+# else
_GL_CXXALIASWARN (wmemchr);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef wmemchr
# if HAVE_RAW_DECL_WMEMCHR
@@ -776,8 +794,21 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
# if !@HAVE_WCSCHR@
_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
# endif
-_GL_CXXALIAS_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+ /* On some systems, this function is defined as an overloaded function:
+ extern "C++" {
+ const wchar_t * std::wcschr (const wchar_t *, wchar_t);
+ wchar_t * std::wcschr (wchar_t *, wchar_t);
+ } */
+_GL_CXXALIAS_SYS_CAST2 (wcschr,
+ wchar_t *, (const wchar_t *, wchar_t),
+ const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# else
_GL_CXXALIASWARN (wcschr);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef wcschr
# if HAVE_RAW_DECL_WCSCHR
@@ -792,8 +823,21 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
# if !@HAVE_WCSRCHR@
_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
# endif
-_GL_CXXALIAS_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+ /* On some systems, this function is defined as an overloaded function:
+ extern "C++" {
+ const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
+ wchar_t * std::wcsrchr (wchar_t *, wchar_t);
+ } */
+_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
+ wchar_t *, (const wchar_t *, wchar_t),
+ const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# else
_GL_CXXALIASWARN (wcsrchr);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef wcsrchr
# if HAVE_RAW_DECL_WCSRCHR
@@ -843,9 +887,23 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
(const wchar_t *wcs, const wchar_t *accept));
# endif
-_GL_CXXALIAS_SYS (wcspbrk, wchar_t *,
- (const wchar_t *wcs, const wchar_t *accept));
+ /* On some systems, this function is defined as an overloaded function:
+ extern "C++" {
+ const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
+ wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
+ } */
+_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
+ wchar_t *, (const wchar_t *, const wchar_t *),
+ const wchar_t *, (const wchar_t *, const wchar_t *));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
+ (wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
+ (const wchar_t *wcs, const wchar_t *accept));
+# else
_GL_CXXALIASWARN (wcspbrk);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef wcspbrk
# if HAVE_RAW_DECL_WCSPBRK
@@ -861,9 +919,23 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
(const wchar_t *haystack, const wchar_t *needle));
# endif
-_GL_CXXALIAS_SYS (wcsstr, wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle));
+ /* On some systems, this function is defined as an overloaded function:
+ extern "C++" {
+ const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
+ wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
+ } */
+_GL_CXXALIAS_SYS_CAST2 (wcsstr,
+ wchar_t *, (const wchar_t *, const wchar_t *),
+ const wchar_t *, (const wchar_t *, const wchar_t *));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
+ (wchar_t *haystack, const wchar_t *needle));
+_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
+ (const wchar_t *haystack, const wchar_t *needle));
+# else
_GL_CXXALIASWARN (wcsstr);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef wcsstr
# if HAVE_RAW_DECL_WCSSTR
diff --git a/lib/write.c b/lib/write.c
index 7d02daabd..3093df2d8 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -20,8 +20,9 @@
/* Specification. */
#include <unistd.h>
-/* Replace this function only if module 'sigpipe' is requested. */
-#if GNULIB_SIGPIPE
+/* Replace this function only if module 'nonblocking' or module 'sigpipe' is
+ requested. */
+#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE
/* On native Windows platforms, SIGPIPE does not exist. When write() is
called on a pipe with no readers, WriteFile() fails with error
@@ -41,21 +42,81 @@ ssize_t
rpl_write (int fd, const void *buf, size_t count)
#undef write
{
- ssize_t ret = write (fd, buf, count);
-
- if (ret < 0)
+ for (;;)
{
- if (GetLastError () == ERROR_NO_DATA
- && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)
+ ssize_t ret = write (fd, buf, count);
+
+ if (ret < 0)
{
- /* Try to raise signal SIGPIPE. */
- raise (SIGPIPE);
- /* If it is currently blocked or ignored, change errno from EINVAL
- to EPIPE. */
- errno = EPIPE;
+# if GNULIB_NONBLOCKING
+ if (errno == ENOSPC)
+ {
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (GetFileType (h) == FILE_TYPE_PIPE)
+ {
+ /* h is a pipe or socket. */
+ DWORD state;
+ if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL,
+ NULL, 0)
+ && (state & PIPE_NOWAIT) != 0)
+ {
+ /* h is a pipe in non-blocking mode.
+ We can get here in four situations:
+ 1. When the pipe buffer is full.
+ 2. When count <= pipe_buf_size and the number of
+ free bytes in the pipe buffer is < count.
+ 3. When count > pipe_buf_size and the number of free
+ bytes in the pipe buffer is > 0, < pipe_buf_size.
+ 4. When count > pipe_buf_size and the pipe buffer is
+ entirely empty.
+ The cases 1 and 2 are POSIX compliant. In cases 3 and
+ 4 POSIX specifies that write() must split the request
+ and succeed with a partial write. We fix case 4.
+ We don't fix case 3 because it is not essential for
+ programs. */
+ DWORD out_size; /* size of the buffer for outgoing data */
+ DWORD in_size; /* size of the buffer for incoming data */
+ if (GetNamedPipeInfo (h, NULL, &out_size, &in_size, NULL))
+ {
+ size_t reduced_count = count;
+ /* In theory we need only one of out_size, in_size.
+ But I don't know which of the two. The description
+ is ambiguous. */
+ if (out_size != 0 && out_size < reduced_count)
+ reduced_count = out_size;
+ if (in_size != 0 && in_size < reduced_count)
+ reduced_count = in_size;
+ if (reduced_count < count)
+ {
+ /* Attempt to write only the first part. */
+ count = reduced_count;
+ continue;
+ }
+ }
+ /* Change errno from ENOSPC to EAGAIN. */
+ errno = EAGAIN;
+ }
+ }
+ }
+ else
+# endif
+ {
+# if GNULIB_SIGPIPE
+ if (GetLastError () == ERROR_NO_DATA
+ && GetFileType ((HANDLE) _get_osfhandle (fd))
+ == FILE_TYPE_PIPE)
+ {
+ /* Try to raise signal SIGPIPE. */
+ raise (SIGPIPE);
+ /* If it is currently blocked or ignored, change errno from
+ EINVAL to EPIPE. */
+ errno = EPIPE;
+ }
+# endif
+ }
}
+ return ret;
}
- return ret;
}
# endif
diff --git a/libguile/script.c b/libguile/script.c
index 7f6116242..83dcdd5b9 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -27,8 +27,6 @@
#include <errno.h>
#include <ctype.h>
-#include <version-etc.h>
-
#include "libguile/_scm.h"
#include "libguile/eval.h"
#include "libguile/feature.h"
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index e2e8a05a6..689da75a2 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 10
+# alloca.m4 serial 11
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -36,6 +36,7 @@ AC_DEFUN([gl_FUNC_ALLOCA],
ALLOCA_H=alloca.h
fi
AC_SUBST([ALLOCA_H])
+ AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
])
# Prerequisites of lib/alloca.c.
diff --git a/m4/byteswap.m4 b/m4/byteswap.m4
index a033acd8d..2d4de4659 100644
--- a/m4/byteswap.m4
+++ b/m4/byteswap.m4
@@ -1,4 +1,4 @@
-# byteswap.m4 serial 3
+# byteswap.m4 serial 4
dnl Copyright (C) 2005, 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,
@@ -15,4 +15,5 @@ AC_DEFUN([gl_BYTESWAP],
BYTESWAP_H='byteswap.h'
])
AC_SUBST([BYTESWAP_H])
+ AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"])
])
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
index 687bafff2..a6d37f3b3 100644
--- a/m4/errno_h.m4
+++ b/m4/errno_h.m4
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 8
+# errno_h.m4 serial 9
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,
@@ -54,6 +54,7 @@ booboo
ERRNO_H='errno.h'
fi
AC_SUBST([ERRNO_H])
+ AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
gl_REPLACE_ERRNO_VALUE([ENOLINK])
gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
diff --git a/m4/float_h.m4 b/m4/float_h.m4
index 265a4c1a6..21a7529fe 100644
--- a/m4/float_h.m4
+++ b/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 5
+# float_h.m4 serial 6
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,
@@ -16,4 +16,5 @@ AC_DEFUN([gl_FLOAT_H],
;;
esac
AC_SUBST([FLOAT_H])
+ AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
])
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index 94c276f83..e57623694 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 23
+# getaddrinfo.m4 serial 24
dnl Copyright (C) 2004-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,
@@ -105,7 +105,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
dnl Including sys/socket.h is wrong for Windows, but Windows does not
dnl have sa_len so the result is correct anyway.
- AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])
+ AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
AC_CHECK_HEADERS_ONCE([netinet/in.h])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 2d84c7f24..70f8b9ae5 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc verify version-etc-fsf vsnprintf warnings wchar
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
@@ -77,14 +77,12 @@ gl_MODULES([
socket
stat-time
stdlib
- strcase
strftime
striconveh
string
sys_stat
trunc
verify
- version-etc-fsf
vsnprintf
warnings
wchar
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index ecbf33694..c4d7a20ea 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 23
+# gnulib-common.m4 serial 24
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,
@@ -109,7 +109,8 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
[
dnl Override gl_WARN_ON_USE_PREPARE.
- AC_DEFUN([gl_WARN_ON_USE_PREPARE], [])
+ dnl But hide this definition from 'aclocal'.
+ AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
])
# gl_ASSERT_NO_GNULIB_TESTS
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 8a70734a3..257258734 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -44,7 +44,6 @@ AC_DEFUN([gl_EARLY],
# Code from module canonicalize-lgpl:
# Code from module ceil:
# Code from module close:
- # Code from module close-hook:
# Code from module connect:
# Code from module dosname:
# Code from module duplocale:
@@ -53,6 +52,7 @@ AC_DEFUN([gl_EARLY],
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module fclose:
+ # Code from module fd-hook:
# Code from module float:
# Code from module flock:
# Code from module floor:
@@ -110,6 +110,7 @@ AC_DEFUN([gl_EARLY],
# Code from module nproc:
# Code from module pathmax:
# Code from module putenv:
+ # Code from module read:
# Code from module readlink:
# Code from module recv:
# Code from module recvfrom:
@@ -129,26 +130,19 @@ AC_DEFUN([gl_EARLY],
# Code from module ssize_t:
# Code from module stat:
# Code from module stat-time:
- # Code from module stdarg:
- dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
- dnl for the builtin va_copy to work. With Autoconf 2.60 or later,
- dnl AC_PROG_CC_STDC arranges for this. With older Autoconf AC_PROG_CC_STDC
- dnl shouldn't hurt, though installers are on their own to set c99 mode.
- AC_REQUIRE([AC_PROG_CC_STDC])
# Code from module stdbool:
# Code from module stddef:
# Code from module stdint:
# Code from module stdio:
# Code from module stdlib:
- # Code from module strcase:
# Code from module strftime:
# Code from module striconveh:
# Code from module string:
- # Code from module strings:
# Code from module sys_file:
# Code from module sys_socket:
# Code from module sys_stat:
# Code from module sys_time:
+ # Code from module sys_uio:
# Code from module time:
# Code from module time_r:
# Code from module trunc:
@@ -165,8 +159,6 @@ AC_DEFUN([gl_EARLY],
# Code from module vasnprintf:
# Code from module vc-list-files:
# Code from module verify:
- # Code from module version-etc:
- # Code from module version-etc-fsf:
# Code from module vsnprintf:
# Code from module warn-on-use:
# Code from module warnings:
@@ -227,7 +219,6 @@ AC_DEFUN([gl_INIT],
# Code from module close:
gl_FUNC_CLOSE
gl_UNISTD_MODULE_INDICATOR([close])
- # Code from module close-hook:
# Code from module connect:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
@@ -247,6 +238,7 @@ AC_DEFUN([gl_INIT],
# Code from module fclose:
gl_FUNC_FCLOSE
gl_STDIO_MODULE_INDICATOR([fclose])
+ # Code from module fd-hook:
# Code from module float:
gl_FLOAT_H
# Code from module flock:
@@ -299,9 +291,9 @@ AC_DEFUN([gl_INIT],
# 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], [],
+ m4_defn([m4_PACKAGE_VERSION])), [1], [],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
- [GNUmakefile=$GNUmakefile])])
+ [GNUmakefile=$GNUmakefile])])
# Code from module gnupload:
# Code from module gperf:
# Code from module havelib:
@@ -394,6 +386,9 @@ AC_DEFUN([gl_INIT],
# Code from module putenv:
gl_FUNC_PUTENV
gl_STDLIB_MODULE_INDICATOR([putenv])
+ # Code from module read:
+ gl_FUNC_READ
+ gl_UNISTD_MODULE_INDICATOR([read])
# Code from module readlink:
gl_FUNC_READLINK
gl_UNISTD_MODULE_INDICATOR([readlink])
@@ -474,8 +469,6 @@ AC_DEFUN([gl_INIT],
# Code from module stat-time:
gl_STAT_TIME
gl_STAT_BIRTHTIME
- # Code from module stdarg:
- gl_STDARG_H
# Code from module stdbool:
AM_STDBOOL_H
# Code from module stddef:
@@ -486,8 +479,6 @@ AC_DEFUN([gl_INIT],
gl_STDIO_H
# Code from module stdlib:
gl_STDLIB_H
- # Code from module strcase:
- gl_STRCASE
# Code from module strftime:
gl_FUNC_GNU_STRFTIME
# Code from module striconveh:
@@ -497,8 +488,6 @@ AC_DEFUN([gl_INIT],
fi
# Code from module string:
gl_HEADER_STRING_H
- # Code from module strings:
- gl_HEADER_STRINGS_H
# Code from module sys_file:
gl_HEADER_SYS_FILE_H
AC_PROG_MKDIR_P
@@ -511,6 +500,9 @@ AC_DEFUN([gl_INIT],
# Code from module sys_time:
gl_HEADER_SYS_TIME_H
AC_PROG_MKDIR_P
+ # Code from module sys_uio:
+ gl_HEADER_SYS_UIO
+ AC_PROG_MKDIR_P
# Code from module time:
gl_HEADER_TIME_H
# Code from module time_r:
@@ -545,9 +537,6 @@ AC_DEFUN([gl_INIT],
gl_FUNC_VASNPRINTF
# Code from module vc-list-files:
# Code from module verify:
- # Code from module version-etc:
- gl_VERSION_ETC
- # Code from module version-etc-fsf:
# Code from module vsnprintf:
gl_FUNC_VSNPRINTF
gl_STDIO_MODULE_INDICATOR([vsnprintf])
@@ -726,14 +715,14 @@ AC_DEFUN([gl_FILE_LIST], [
lib/c-strncasecmp.c
lib/canonicalize-lgpl.c
lib/ceil.c
- lib/close-hook.c
- lib/close-hook.h
lib/close.c
lib/connect.c
lib/dosname.h
lib/duplocale.c
lib/errno.in.h
lib/fclose.c
+ lib/fd-hook.c
+ lib/fd-hook.h
lib/float+.h
lib/float.in.h
lib/flock.c
@@ -788,6 +777,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/printf-parse.c
lib/printf-parse.h
lib/putenv.c
+ lib/read.c
lib/readlink.c
lib/recv.c
lib/recvfrom.c
@@ -806,24 +796,21 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sockets.h
lib/stat-time.h
lib/stat.c
- lib/stdarg.in.h
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
- lib/strcasecmp.c
lib/strftime.c
lib/strftime.h
lib/striconveh.c
lib/striconveh.h
lib/string.in.h
- lib/strings.in.h
- lib/strncasecmp.c
lib/sys_file.in.h
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/sys_time.in.h
+ lib/sys_uio.in.h
lib/time.in.h
lib/time_r.c
lib/trunc.c
@@ -841,9 +828,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/vasnprintf.c
lib/vasnprintf.h
lib/verify.h
- lib/version-etc-fsf.c
- lib/version-etc.c
- lib/version-etc.h
lib/vsnprintf.c
lib/w32sock.h
lib/wchar.in.h
@@ -915,6 +899,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/pathmax.m4
m4/printf.m4
m4/putenv.m4
+ m4/read.m4
m4/readlink.m4
m4/safe-read.m4
m4/safe-write.m4
@@ -928,28 +913,25 @@ AC_DEFUN([gl_FILE_LIST], [
m4/ssize_t.m4
m4/stat-time.m4
m4/stat.m4
- m4/stdarg.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdint_h.m4
m4/stdio_h.m4
m4/stdlib_h.m4
- m4/strcase.m4
m4/strftime.m4
m4/string_h.m4
- m4/strings_h.m4
m4/sys_file_h.m4
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
+ m4/sys_uio_h.m4
m4/time_h.m4
m4/time_r.m4
m4/tm_gmtoff.m4
m4/trunc.m4
m4/unistd_h.m4
m4/vasnprintf.m4
- m4/version-etc.m4
m4/visibility.m4
m4/vsnprintf.m4
m4/warn-on-use.m4
diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4
index abfacffb4..8cca7fd80 100644
--- a/m4/iconv_h.m4
+++ b/m4/iconv_h.m4
@@ -1,4 +1,4 @@
-# iconv_h.m4 serial 7
+# iconv_h.m4 serial 8
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,
@@ -18,6 +18,7 @@ AC_DEFUN([gl_REPLACE_ICONV_H],
[
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
ICONV_H='iconv.h'
+ AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
])
AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
@@ -36,4 +37,5 @@ AC_DEFUN([gl_ICONV_H_DEFAULTS],
REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF])
ICONV_H=''; AC_SUBST([ICONV_H])
+ AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
])
diff --git a/m4/memchr.m4 b/m4/memchr.m4
index 3c2b31391..a544e2b4e 100644
--- a/m4/memchr.m4
+++ b/m4/memchr.m4
@@ -1,4 +1,4 @@
-# memchr.m4 serial 10
+# memchr.m4 serial 11
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,
@@ -11,10 +11,16 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
- dnl These days, we assume memchr is present. But just in case...
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([memchr])
- if test $ac_cv_func_memchr = yes; then
+ m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
+ dnl These days, we assume memchr is present. But if support for old
+ dnl platforms is desired:
+ AC_CHECK_FUNCS_ONCE([memchr])
+ if test $ac_cv_func_memchr = no; then
+ HAVE_MEMCHR=0
+ fi
+ ])
+ if test $HAVE_MEMCHR = 1; then
# Detect platform-specific bugs in some versions of glibc:
# memchr should not dereference anything with length 0
# http://bugzilla.redhat.com/499689
@@ -73,8 +79,6 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
if test "$gl_cv_func_memchr_works" != yes; then
REPLACE_MEMCHR=1
fi
- else
- HAVE_MEMCHR=0
fi
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
AC_LIBOBJ([memchr])
diff --git a/m4/netinet_in_h.m4 b/m4/netinet_in_h.m4
index e2d022df7..87235b73b 100644
--- a/m4/netinet_in_h.m4
+++ b/m4/netinet_in_h.m4
@@ -1,4 +1,4 @@
-# netinet_in_h.m4 serial 4
+# netinet_in_h.m4 serial 5
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,
@@ -27,4 +27,5 @@ AC_DEFUN([gl_HEADER_NETINET_IN],
AC_SUBST([HAVE_NETINET_IN_H])
fi
AC_SUBST([NETINET_IN_H])
+ AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"])
])
diff --git a/m4/read.m4 b/m4/read.m4
new file mode 100644
index 000000000..032761f1b
--- /dev/null
+++ b/m4/read.m4
@@ -0,0 +1,20 @@
+# read.m4 serial 1
+dnl Copyright (C) 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],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ dnl This ifdef is just an optimization, to avoid performing a configure
+ dnl check whose result is not used. It does not make the test of
+ dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_nonblocking != yes; then
+ REPLACE_READ=1
+ AC_LIBOBJ([read])
+ fi
+ ])
+])
diff --git a/m4/socklen.m4 b/m4/socklen.m4
index 5e4c69ed7..447515444 100644
--- a/m4/socklen.m4
+++ b/m4/socklen.m4
@@ -1,4 +1,4 @@
-# socklen.m4 serial 8
+# socklen.m4 serial 10
dnl Copyright (C) 2005-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,15 +9,11 @@ dnl From Albert Chin, Windows fixes from Simon Josefsson.
dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc.:
-dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.
+dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
dnl So we have to test to find something that will work.
-dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
-dnl it there first. That file is included by gnulib's sys_socket.in.h, which
-dnl all users of this module should include. Cygwin must not include
-dnl ws2tcpip.h.
AC_DEFUN([gl_TYPE_SOCKLEN_T],
- [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
+ [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl
AC_CHECK_TYPE([socklen_t], ,
[AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([gl_cv_socklen_t_equiv],
@@ -45,9 +41,37 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
[type to use in place of socklen_t if not defined])],
- [#include <sys/types.h>
- #if HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #elif HAVE_WS2TCPIP_H
- # include <ws2tcpip.h>
- #endif])])
+ [gl_SOCKET_HEADERS])])
+
+dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
+dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users
+dnl of this module should use the same include pattern as gl_SOCKET_HEADERS.
+dnl When you change this macro, keep also in sync:
+dnl - gl_CHECK_SOCKET_HEADERS,
+dnl - the Include section of modules/socklen.
+AC_DEFUN([gl_SOCKET_HEADERS],
+[
+/* <sys/types.h> is not needed according to POSIX, but the
+ <sys/socket.h> in i386-unknown-freebsd4.10 and
+ powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+])
+
+dnl Tests for the existence of the header for socket facilities.
+dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H.
+dnl This macro must match gl_SOCKET_HEADERS.
+AC_DEFUN([gl_CHECK_SOCKET_HEADERS],
+ [AC_CHECK_HEADERS_ONCE([sys/socket.h])
+ if test $ac_cv_header_sys_socket_h = no; 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([ws2tcpip.h])
+ fi
+ ])
diff --git a/m4/sockpfaf.m4 b/m4/sockpfaf.m4
index 27899aa59..c38daea5b 100644
--- a/m4/sockpfaf.m4
+++ b/m4/sockpfaf.m4
@@ -1,4 +1,4 @@
-# sockpfaf.m4 serial 7
+# sockpfaf.m4 serial 8
dnl Copyright (C) 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,
@@ -59,3 +59,29 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
fi
])
+
+AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
+[
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_CHECK_HEADERS_ONCE([sys/un.h])
+
+ AC_MSG_CHECKING([for UNIX domain sockets])
+ AC_CACHE_VAL([gl_cv_socket_unix],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif]],
+[[int x = AF_UNIX; struct sockaddr_un y;
+ if (&x && &y) return 0;]])],
+ gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
+ AC_MSG_RESULT([$gl_cv_socket_unix])
+ if test $gl_cv_socket_unix = yes; then
+ AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
+ fi
+])
diff --git a/m4/stdarg.m4 b/m4/stdarg.m4
deleted file mode 100644
index a1ef178c5..000000000
--- a/m4/stdarg.m4
+++ /dev/null
@@ -1,75 +0,0 @@
-# stdarg.m4 serial 5
-dnl Copyright (C) 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,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-dnl Provide a working va_copy in combination with <stdarg.h>.
-
-AC_DEFUN([gl_STDARG_H],
-[
- STDARG_H=''; AC_SUBST([STDARG_H])
- NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
- AC_MSG_CHECKING([for va_copy])
- AC_CACHE_VAL([gl_cv_func_va_copy], [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdarg.h>]],
- [[
-#ifndef va_copy
-void (*func) (va_list, va_list) = va_copy;
-#endif
- ]])],
- [gl_cv_func_va_copy=yes],
- [gl_cv_func_va_copy=no])])
- AC_MSG_RESULT([$gl_cv_func_va_copy])
- if test $gl_cv_func_va_copy = no; then
- dnl Provide a substitute.
- dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5
- dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h>
- dnl which does '#undef va_copy', leading to a missing va_copy symbol. For
- dnl this platform, we use an <stdarg.h> substitute. But we cannot use this
- dnl approach on other platforms, because <stdarg.h> often defines only
- dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do
- dnl not work in this situation.
- AC_EGREP_CPP([vaccine],
- [#if defined _AIX && !defined __GNUC__
- AIX vaccine
- #endif
- ], [gl_aixcc=yes], [gl_aixcc=no])
- if test $gl_aixcc = yes; then
- dnl Provide a substitute <stdarg.h> file.
- STDARG_H=stdarg.h
- gl_NEXT_HEADERS([stdarg.h])
- dnl Fallback for the case when <stdarg.h> contains only macro definitions.
- if test "$gl_cv_next_stdarg_h" = '""'; then
- gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
- NEXT_STDARG_H="$gl_cv_next_stdarg_h"
- fi
- else
- dnl Provide a substitute in <config.h>, either __va_copy or as a simple
- dnl assignment.
- gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdarg.h>]],
- [[
-#ifndef __va_copy
-error, bail out
-#endif
- ]])],
- [gl_cv_func___va_copy=yes],
- [gl_cv_func___va_copy=no])])
- if test $gl_cv_func___va_copy = yes; then
- AC_DEFINE([va_copy], [__va_copy],
- [Define as a macro for copying va_list variables.])
- else
- AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */
-#define gl_va_copy(a,b) ((a) = (b))])
- AC_DEFINE([va_copy], [gl_va_copy],
- [Define as a macro for copying va_list variables.])
- fi
- fi
- fi
-])
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
index 838cf0f46..1ebf3e680 100644
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -5,7 +5,7 @@ dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-#serial 4
+#serial 5
# Prepare for substituting <stdbool.h> if it is not supported.
@@ -21,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H],
STDBOOL_H='stdbool.h'
fi
AC_SUBST([STDBOOL_H])
+ AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
if test "$ac_cv_type__Bool" = yes; then
HAVE__BOOL=1
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index 1942b6aa0..1ae234431 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,5 +1,5 @@
dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 3
+# stddef_h.m4 serial 4
dnl Copyright (C) 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,6 +9,7 @@ AC_DEFUN([gl_STDDEF_H],
[
AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
AC_REQUIRE([gt_TYPE_WCHAR_T])
+ STDDEF_H=
if test $gt_cv_c_wchar_t = no; then
HAVE_WCHAR_T=0
STDDEF_H=stddef.h
@@ -24,6 +25,8 @@ AC_DEFUN([gl_STDDEF_H],
REPLACE_NULL=1
STDDEF_H=stddef.h
fi
+ AC_SUBST([STDDEF_H])
+ AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
if test -n "$STDDEF_H"; then
gl_NEXT_HEADERS([stddef.h])
fi
@@ -41,5 +44,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS],
dnl Assume proper GNU behavior unless another module says otherwise.
REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
- STDDEF_H=''; AC_SUBST([STDDEF_H])
])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index e7d0d0765..dff37fe1b 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 39
+# stdint.m4 serial 40
dnl Copyright (C) 2001-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,
@@ -305,6 +305,7 @@ static const char *macro_values[] =
STDINT_H=stdint.h
fi
AC_SUBST([STDINT_H])
+ AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
])
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 7f3ae5629..8b013c2f3 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 33
+# stdio_h.m4 serial 36
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,
@@ -9,6 +9,32 @@ AC_DEFUN([gl_STDIO_H],
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_C_INLINE])
gl_NEXT_HEADERS([stdio.h])
+
+ dnl No need to create extra modules for these functions. Everyone who uses
+ dnl <stdio.h> likely needs them.
+ GNULIB_FSCANF=1
+ GNULIB_SCANF=1
+ GNULIB_VFSCANF=1
+ GNULIB_VSCANF=1
+ GNULIB_FGETC=1
+ GNULIB_GETC=1
+ GNULIB_GETCHAR=1
+ GNULIB_FGETS=1
+ GNULIB_GETS=1
+ GNULIB_FREAD=1
+ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
+ dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+ dnl also an optimization, to avoid performing a configure check whose result
+ dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
+ dnl or GNULIB_NONBLOCKING redundant.
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_nonblocking != yes; then
+ REPLACE_STDIO_READ_FUNCS=1
+ AC_LIBOBJ([stdio-read])
+ fi
+ ])
+
dnl No need to create extra modules for these functions. Everyone who uses
dnl <stdio.h> likely needs them.
GNULIB_FPRINTF=1
@@ -21,9 +47,11 @@ AC_DEFUN([gl_STDIO_H],
GNULIB_FPUTS=1
GNULIB_PUTS=1
GNULIB_FWRITE=1
- dnl This ifdef is just an optimization, to avoid performing a configure
- dnl check whose result is not used. It does not make the test of
- dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
+ dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+ dnl also an optimization, to avoid performing a configure check whose result
+ dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
+ dnl GNULIB_SIGPIPE redundant.
m4_ifdef([gl_SIGNAL_SIGPIPE], [
gl_SIGNAL_SIGPIPE
if test $gl_cv_header_signal_h_SIGPIPE != yes; then
@@ -31,6 +59,18 @@ AC_DEFUN([gl_STDIO_H],
AC_LIBOBJ([stdio-write])
fi
])
+ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
+ dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+ dnl also an optimization, to avoid performing a configure check whose result
+ dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
+ dnl or GNULIB_NONBLOCKING redundant.
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_nonblocking != yes; then
+ REPLACE_STDIO_WRITE_FUNCS=1
+ AC_LIBOBJ([stdio-write])
+ fi
+ ])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, and which is not
@@ -54,20 +94,27 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
+ GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
+ GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
+ GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
+ GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
+ GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
+ GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
+ GNULIB_GETS=0; AC_SUBST([GNULIB_GETS])
GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
@@ -80,11 +127,15 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
+ GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
+ GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
+ GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
+ GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
@@ -129,6 +180,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
+ REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS])
REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
diff --git a/m4/strcase.m4 b/m4/strcase.m4
deleted file mode 100644
index 1c553ff21..000000000
--- a/m4/strcase.m4
+++ /dev/null
@@ -1,44 +0,0 @@
-# strcase.m4 serial 10
-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,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_STRCASE],
-[
- gl_FUNC_STRCASECMP
- gl_FUNC_STRNCASECMP
-])
-
-AC_DEFUN([gl_FUNC_STRCASECMP],
-[
- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
- AC_REPLACE_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
- fi
- AC_CHECK_DECLS([strncasecmp])
- if test $ac_cv_have_decl_strncasecmp = no; then
- HAVE_DECL_STRNCASECMP=0
- fi
-])
-
-# Prerequisites of lib/strcasecmp.c.
-AC_DEFUN([gl_PREREQ_STRCASECMP], [
- :
-])
-
-# Prerequisites of lib/strncasecmp.c.
-AC_DEFUN([gl_PREREQ_STRNCASECMP], [
- :
-])
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 30ddfbc3a..df8c40353 100644
--- a/m4/string_h.m4
+++ b/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 19
+# serial 20
# Written by Paul Eggert.
@@ -104,6 +104,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
+ REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
diff --git a/m4/strings_h.m4 b/m4/strings_h.m4
deleted file mode 100644
index 71d284b63..000000000
--- a/m4/strings_h.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-# Configure a replacement for <string.h>.
-# serial 3
-
-# Copyright (C) 2007, 2009-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.
-
-AC_DEFUN([gl_HEADER_STRINGS_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_STRINGS_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
-[
- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
- gl_CHECK_NEXT_HEADERS([strings.h])
-
- 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])
-])
-
-AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-])
-
-AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
-[
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
- HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
-])
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index 12dc05d42..7da91a4a3 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 21
+# sys_socket_h.m4 serial 22
dnl Copyright (C) 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,
@@ -101,17 +101,13 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
[
dnl Check prerequisites of the <sys/socket.h> replacement.
+ AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
gl_CHECK_NEXT_HEADERS([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
HAVE_SYS_SOCKET_H=1
HAVE_WS2TCPIP_H=0
else
HAVE_SYS_SOCKET_H=0
- 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([ws2tcpip.h])
if test $ac_cv_header_ws2tcpip_h = yes; then
HAVE_WS2TCPIP_H=1
else
diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4
new file mode 100644
index 000000000..bafa0ac45
--- /dev/null
+++ b/m4/sys_uio_h.m4
@@ -0,0 +1,31 @@
+# sys_uio_h.m4 serial 1
+dnl Copyright (C) 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_HEADER_SYS_UIO],
+[
+ AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+ dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([sys/uio.h])
+ if test $ac_cv_header_sys_uio_h = yes; then
+ HAVE_SYS_UIO_H=1
+ else
+ HAVE_SYS_UIO_H=0
+ fi
+ AC_SUBST([HAVE_SYS_UIO_H])
+])
+
+AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SYS_UIO_H_DEFAULTS],
+[
+])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index c81a1138e..eeb3360b0 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 53
+# unistd_h.m4 serial 55
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,
@@ -52,47 +52,49 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
AC_DEFUN([gl_UNISTD_H_DEFAULTS],
[
- GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
- GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
- GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
- GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
- GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
- GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
- GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
- GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
- GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
- GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
- GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
- GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
- GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
- GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
- GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
- GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
- GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
- GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
- GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
- GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
- GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
- GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
- GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
- GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
- GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
- GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
- GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
- GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
- GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
- GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
- GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
- GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
- GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
- GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
- GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
- GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
- GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
- GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
- GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
- GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
- GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
+ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
+ GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
+ GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
+ GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
+ GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
+ GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
+ GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
+ GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
+ GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
+ GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
+ GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
+ GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
+ GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
+ GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
+ GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
+ GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
+ GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
+ GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
+ GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
+ GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
+ GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
+ GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
+ GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
+ GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
+ GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
+ GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
+ GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
+ GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
+ GNULIB_READ=0; AC_SUBST([GNULIB_READ])
+ GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
+ GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
+ GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
+ GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
+ GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
+ GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
+ GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
+ GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
+ GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
+ GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
+ GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
+ GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
+ GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
+ GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
@@ -147,6 +149,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
+ REPLACE_READ=0; AC_SUBST([REPLACE_READ])
REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
diff --git a/m4/version-etc.m4 b/m4/version-etc.m4
deleted file mode 100644
index 5032bf855..000000000
--- a/m4/version-etc.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-# version-etc.m4 serial 1
-# Copyright (C) 2009-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.
-
-dnl $1 - configure flag and define name
-dnl $2 - human readable description
-m4_define([gl_VERSION_ETC_FLAG],
-[dnl
- AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
- [dnl
- case $withval in
- yes|no) ;;
- *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
- esac
- ])
-])
-
-AC_DEFUN([gl_VERSION_ETC],
-[dnl
- gl_VERSION_ETC_FLAG([packager],
- [String identifying the packager of this software])
- gl_VERSION_ETC_FLAG([packager-version],
- [Packager-specific version information])
- gl_VERSION_ETC_FLAG([packager-bug-reports],
- [Packager info for bug reports (URL/e-mail/...)])
- if test "X$with_packager" = "X" && \
- test "X$with_packager_version$with_packager_bug_reports" != "X"
- then
- AC_MSG_ERROR([The --with-packager-{bug-reports,version} options require --with-packager])
- fi
-])
diff --git a/m4/write.m4 b/m4/write.m4
index 8695c8962..63ab5e4c0 100644
--- a/m4/write.m4
+++ b/m4/write.m4
@@ -1,4 +1,4 @@
-# write.m4 serial 1
+# write.m4 serial 2
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,
@@ -14,7 +14,15 @@ AC_DEFUN([gl_FUNC_WRITE],
gl_SIGNAL_SIGPIPE
if test $gl_cv_header_signal_h_SIGPIPE != yes; then
REPLACE_WRITE=1
- AC_LIBOBJ([write])
fi
])
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_nonblocking != yes; then
+ REPLACE_WRITE=1
+ fi
+ ])
+ if test $REPLACE_WRITE = 1; then
+ AC_LIBOBJ([write])
+ fi
])
diff --git a/maint.mk b/maint.mk
index 90c22cfed..47cb44ee2 100644
--- a/maint.mk
+++ b/maint.mk
@@ -33,7 +33,7 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
GIT = git
VC = $(GIT)
-VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
+VC-tag = git tag -s -m '$(VERSION)' 'v$(VERSION)' -u '$(gpg_key_ID)'
VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
@@ -57,11 +57,13 @@ endif
# In order to be able to consistently filter "."-relative names,
# (i.e., with no $(srcdir) prefix), this definition is careful to
# remove any $(srcdir) prefix, and to restore what it removes.
+_sc_excl = \
+ $(if $(exclude_file_name_regexp--$@),$(exclude_file_name_regexp--$@),^$$)
VC_LIST_EXCEPT = \
$(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
| if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
- | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
+ | grep -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \
$(_prepend_srcdir_prefix)
ifeq ($(origin prev_version_file), undefined)
@@ -196,6 +198,16 @@ syntax-check: $(local-check)
# halt
#
# Message to display before to halting execution.
+#
+# Finally, you may exempt files based on an ERE matching file names.
+# For example, to exempt from the sc_space_tab check all files with the
+# .diff suffix, set this Make variable:
+#
+# exclude_file_name_regexp--sc_space_tab = \.diff$
+#
+# Note that while this functionality is mostly inherited via VC_LIST_EXCEPT,
+# when filtering by name via in_files, we explicitly filter out matching
+# names here as well.
# By default, _sc_search_regexp does not ignore case.
export ignore_case =
@@ -233,7 +245,8 @@ define _sc_search_regexp
\
: Filter by file name; \
if test -n "$$in_files"; then \
- files=$$(find $(srcdir) | grep -E "$$in_files"); \
+ files=$$(find $(srcdir) | grep -E "$$in_files" \
+ | grep -Ev '$(exclude_file_name_regexp--$@)'); \
else \
files=$$($(VC_LIST_EXCEPT)); \
if test -n "$$in_vc_files"; then \
@@ -659,7 +672,7 @@ sc_two_space_separator_in_usage:
sc_unmarked_diagnostics:
@grep -nE \
'\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
- | grep -v '_''(' && \
+ | grep -Ev '(_|ngettext ?)\(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
@@ -810,8 +823,8 @@ require_exactly_one_NL_at_EOF_ = \
END { exit defined $$fail }
sc_prohibit_empty_lines_at_EOF:
@perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
- || { echo '$(ME): empty line(s) or no newline at EOF' \
- 1>&2; exit 1; } || :; \
+ || { echo '$(ME): empty line(s) or no newline at EOF' \
+ 1>&2; exit 1; } || :
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
@@ -828,6 +841,31 @@ sc_prohibit_S_IS_definition:
halt='do not define S_IS* macros; include <sys/stat.h>' \
$(_sc_search_regexp)
+prohibit_doubled_word_RE_ ?= \
+ /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims
+prohibit_doubled_word_ = \
+ -e 'while ($(prohibit_doubled_word_RE_))' \
+ -e ' {' \
+ -e ' $$n = ($$` =~ tr/\n/\n/ + 1);' \
+ -e ' ($$v = $$&) =~ s/\n/\\n/g;' \
+ -e ' print "$$ARGV:$$n:$$v\n";' \
+ -e ' }'
+
+# Define this to a regular expression that matches
+# any filename:dd:match lines you want to ignore.
+# The default is to ignore no matches.
+ignore_doubled_word_match_RE_ ?= ^$$
+
+sc_prohibit_doubled_word:
+ @perl -n -0777 $(prohibit_doubled_word_) $$($(VC_LIST_EXCEPT)) \
+ | grep -vE '$(ignore_doubled_word_match_RE_)' \
+ | grep . && { echo '$(ME): doubled words' 1>&2; exit 1; } || :
+
+sc_prohibit_can_not:
+ @prohibit='\<can[ ]not\>' \
+ halt='use "cannot", not "can'' not"' \
+ $(_sc_search_regexp)
+
_ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
_ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
# Using test's -a and -o operators is not portable.
@@ -904,16 +942,23 @@ update-NEWS-hash: NEWS
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
-# We use perl rather than "grep -nE ..." to exempt a single
-# use of an @...@-delimited variable name in src/Makefile.am.
+# However, there is still one case in which @VAR@ use is not just
+# legitimate, but actually required: when augmenting an automake-defined
+# variable with a prefix. For example, gettext uses this:
+# MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
+# otherwise, makeinfo would put German or French (current locale)
+# navigation hints in the otherwise-English documentation.
+#
# Allow the package to add exceptions via a hook in cfg.mk;
# for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by
# setting this to ' && !/PRAGMA_SYSTEM_HEADER/'.
_makefile_at_at_check_exceptions ?=
sc_makefile_at_at_check:
- @perl -ne '/\@[A-Z_0-9]+\@/'$(_makefile_at_at_check_exceptions) \
+ @perl -ne '/\@[A-Z_0-9]+\@/' \
+ -e ' && !/([A-Z_0-9]+)\s+=.*\@\1\@$$/' \
+ -e ''$(_makefile_at_at_check_exceptions) \
-e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \
- $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \
+ $$($(VC_LIST_EXCEPT) | grep -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
news-check: NEWS
@@ -942,13 +987,13 @@ fix_po_file_diag = \
apply the above patch\n'
# Verify that all source files using _() are listed in po/POTFILES.in.
-po_file = po/POTFILES.in
+po_file ?= $(srcdir)/po/POTFILES.in
sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
- for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
+ for file in $$($(VC_LIST_EXCEPT)) $(srcdir)/lib/*.[ch]; do \
test -r $$file || continue; \
case $$file in \
*.m4|*.mk) continue ;; \
@@ -963,7 +1008,7 @@ sc_po_check:
files="$$files $$file"; \
done; \
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
- | sort -u > $@-2; \
+ | sed 's|^$(_dot_escaped_srcdir)/||' | sort -u > $@-2; \
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
rm -f $@-1 $@-2; \