]> sjero.net Git - wget/commitdiff
Gnulib updates.
authorMicah Cowan <micah@cowan.name>
Sun, 5 Jul 2009 16:14:08 +0000 (09:14 -0700)
committerMicah Cowan <micah@cowan.name>
Sun, 5 Jul 2009 16:14:08 +0000 (09:14 -0700)
86 files changed:
.hgignore
ChangeLog
GNUmakefile
lib/Makefile.am
lib/c-ctype.h
lib/config.charset [new file with mode: 0755]
lib/errno.in.h [new file with mode: 0644]
lib/fseeko.c
lib/getdelim.c
lib/getopt1.c
lib/gettext.h
lib/localcharset.c [new file with mode: 0644]
lib/localcharset.h [new file with mode: 0644]
lib/mbrtowc.c [new file with mode: 0644]
lib/mbsinit.c [new file with mode: 0644]
lib/quotearg.c
lib/ref-add.sin [new file with mode: 0644]
lib/ref-del.sin [new file with mode: 0644]
lib/stdint.in.h [new file with mode: 0644]
lib/stdio-impl.h
lib/stdio-write.c [new file with mode: 0644]
lib/stdio.in.h
lib/stdlib.in.h
lib/streq.h [new file with mode: 0644]
lib/strerror.c
lib/string.in.h
lib/unistd.in.h
lib/verify.h [new file with mode: 0644]
lib/wchar.in.h
lib/wctype.in.h
lib/xmalloc.c
m4/00gnulib.m4 [new file with mode: 0644]
m4/alloca.m4
m4/codeset.m4 [new file with mode: 0644]
m4/eoverflow.m4 [deleted file]
m4/errno_h.m4 [new file with mode: 0644]
m4/extensions.m4
m4/getdelim.m4
m4/getline.m4
m4/getpass.m4
m4/glibc21.m4 [new file with mode: 0644]
m4/gnulib-cache.m4
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/gnulib-tool.m4
m4/include_next.m4
m4/inline.m4
m4/localcharset.m4 [new file with mode: 0644]
m4/locale-fr.m4 [new file with mode: 0644]
m4/locale-ja.m4 [new file with mode: 0644]
m4/locale-zh.m4 [new file with mode: 0644]
m4/longlong.m4 [new file with mode: 0644]
m4/malloc.m4
m4/mbrtowc.m4
m4/mbsinit.m4 [new file with mode: 0644]
m4/mbstate_t.m4
m4/multiarch.m4 [new file with mode: 0644]
m4/quotearg.m4
m4/realloc.m4
m4/stdbool.m4
m4/stdint.m4 [new file with mode: 0644]
m4/stdio_h.m4
m4/stdlib_h.m4
m4/strerror.m4
m4/string_h.m4
m4/unistd_h.m4
m4/wchar.m4
m4/wint_t.m4
maint.mk
md5/Makefile.am
md5/m4/00gnulib.m4 [new file with mode: 0644]
md5/m4/gnulib-cache.m4
md5/m4/gnulib-common.m4
md5/m4/gnulib-comp.m4
md5/m4/gnulib-tool.m4
md5/m4/include_next.m4
md5/m4/longlong.m4
md5/m4/md5.m4
md5/m4/multiarch.m4 [new file with mode: 0644]
md5/m4/stdint.m4
md5/m4/wchar.m4
md5/m4/wint_t.m4 [new file with mode: 0644]
md5/stdint.in.h
md5/wchar.in.h
useless-if-before-free [new file with mode: 0755]
vc-list-files [new file with mode: 0755]

index b3838ac62c3cb1a1a1ee5cada804722290a04af5..c51c5b299178a7a3f02bcc4ab922b033b21a02c9 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -25,6 +25,10 @@ lib/stdio.h
 lib/stdlib.h
 lib/string.h
 lib/wchar.h
 lib/stdlib.h
 lib/string.h
 lib/wchar.h
+lib/charset.alias
+lib/configmake.h
+lib/ref-add.sed
+lib/ref-del.sed
 md5/.deps
 md5/*.o
 md5/libmd5.a
 md5/.deps
 md5/*.o
 md5/libmd5.a
index 0347142b304c502abbb932f66e11a9169ad6b492..bfc16df3e02e8dc9127d123a74a370f688a9a34b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-05  Micah Cowan  <micah@cowan.name>
+
+       * lib/*, md5/*: Updated gnulib.
+
 2009-07-04  Steven Schweda  <sms@antinode.info>
 
        * vms/COLLECT_DEPS.COM, vms/config.h_vms, vms/decc_ver.c,
 2009-07-04  Steven Schweda  <sms@antinode.info>
 
        * vms/COLLECT_DEPS.COM, vms/config.h_vms, vms/decc_ver.c,
index 0c1bc38afbd122b7b2618f1a6b03317d05f2e395..33eb3aa4d5c8fe5bc86f8e19ce88b86e8a855ba7 100644 (file)
@@ -5,7 +5,7 @@
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
-# Copyright (C) 2001, 2003, 2006-2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -38,6 +38,9 @@ ifeq ($(_have-Makefile),yes)
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
 
+# Allow the user to add to this in the Makefile.
+ALL_RECURSIVE_TARGETS =
+
 include Makefile
 
 # Some projects override e.g., _autoreconf here.
 include Makefile
 
 # Some projects override e.g., _autoreconf here.
@@ -53,19 +56,39 @@ _autoreconf ?= autoreconf
 _have-git-version-gen := \
   $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
 ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
 _have-git-version-gen := \
   $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
 ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
-  _is-dist-target = $(filter-out %clean, \
+  _is-dist-target ?= $(filter-out %clean, \
     $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
     $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
-  ifneq (,$(_is-dist-target))
-    _curr-ver := $(shell cd $(srcdir) && ./$(_build-aux)/git-version-gen \
-                   $(srcdir)/.tarball-version)
+  _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
+  ifneq (,$(_is-dist-target)$(_is-install-target))
+    _curr-ver := $(shell cd $(srcdir) \
+                   && $(_build-aux)/git-version-gen .tarball-version)
     ifneq ($(_curr-ver),$(VERSION))
     ifneq ($(_curr-ver),$(VERSION))
-      $(info INFO: running autoreconf for new version string: $(_curr-ver))
-      _dummy := $(shell cd $(srcdir) && rm -rf autom4te.cache .version \
-        && $(_autoreconf))
+      ifeq ($(_curr-ver),UNKNOWN)
+        $(info WARNING: unable to verify if $(VERSION) is the correct version)
+      else
+        ifneq (,$(_is-install-target))
+          # GNU Coding Standards state that 'make install' should not cause
+          # recompilation after 'make all'.  But as long as changing the version
+          # string alters config.h, the cost of having 'make all' always have an
+          # up-to-date version is prohibitive.  So, as a compromise, we merely
+          # warn when installing a version string that is out of date; the user
+          # should run 'autoreconf' (or something like 'make distcheck') to
+          # fix the version, 'make all' to propagate it, then 'make install'.
+          $(info WARNING: version string $(VERSION) is out of date;)
+          $(info run '$(MAKE) _version' to fix it)
+        else
+          $(info INFO: running autoreconf for new version string: $(_curr-ver))
+          _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version)
+        endif
+      endif
     endif
   endif
 endif
 
     endif
   endif
 endif
 
+.PHONY: _version
+_version:
+       cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
+
 else
 
 .DEFAULT_GOAL := abort-due-to-no-makefile
 else
 
 .DEFAULT_GOAL := abort-due-to-no-makefile
@@ -87,6 +110,18 @@ abort-due-to-no-makefile:
 endif
 
 # Tell version 3.79 and up of GNU make to not build goals in this
 endif
 
 # Tell version 3.79 and up of GNU make to not build goals in this
-# directory in parallel.  This is necessary in case someone tries to
-# build multiple targets on one command line.
+# directory in parallel, in case someone tries to build multiple
+# targets, and one of them can cause a recursive target to be invoked.
+
+# Only set this if Automake doesn't provide it.
+AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
+  $(RECURSIVE_CLEAN_TARGETS:-recursive=) \
+  dist distcheck tags ctags
+
+ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
+
+ifneq ($(word 2, $(MAKECMDGOALS)), )
+ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
 .NOTPARALLEL:
 .NOTPARALLEL:
+endif
+endif
index 210ff7d261a3deaf3c9cc814d7689e5bc6db4c28..f9995a93e06cda7666db2a88913d48d6a45c26e2 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -9,10 +9,11 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
 # 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 --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
+SUBDIRS =
 noinst_HEADERS =
 noinst_LIBRARIES =
 noinst_LTLIBRARIES =
 noinst_HEADERS =
 noinst_LIBRARIES =
 noinst_LTLIBRARIES =
@@ -26,6 +27,7 @@ DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 
 AM_CPPFLAGS =
 MAINTAINERCLEANFILES =
 
 AM_CPPFLAGS =
+AM_CFLAGS =
 
 noinst_LIBRARIES += libgnu.a
 
 
 noinst_LIBRARIES += libgnu.a
 
@@ -68,6 +70,94 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
 
 ## end   gnulib module c-ctype
 
 
 ## end   gnulib module c-ctype
 
+## begin gnulib module configmake
+
+# Retrieve values of the variables through 'configure' followed by
+# 'make', not directly through 'configure', so that a user who
+# sets some of these variables consistently on the 'make' command
+# line gets correct results.
+#
+# One advantage of this approach, compared to the classical
+# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
+# is that it protects against the use of undefined variables.
+# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
+# defined by this module, and code using LIBDIR gives a
+# compilation error.
+#
+# Another advantage is that 'make' output is shorter.
+#
+# Listed in the same order as the GNU makefile conventions.
+# The Automake-defined pkg* macros are appended, in the order
+# listed in the Automake 1.10a+ documentation.
+configmake.h: Makefile
+       rm -f $@-t
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#define PREFIX "$(prefix)"'; \
+         echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
+         echo '#define BINDIR "$(bindir)"'; \
+         echo '#define SBINDIR "$(sbindir)"'; \
+         echo '#define LIBEXECDIR "$(libexecdir)"'; \
+         echo '#define DATAROOTDIR "$(datarootdir)"'; \
+         echo '#define DATADIR "$(datadir)"'; \
+         echo '#define SYSCONFDIR "$(sysconfdir)"'; \
+         echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
+         echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+         echo '#define INCLUDEDIR "$(includedir)"'; \
+         echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
+         echo '#define DOCDIR "$(docdir)"'; \
+         echo '#define INFODIR "$(infodir)"'; \
+         echo '#define HTMLDIR "$(htmldir)"'; \
+         echo '#define DVIDIR "$(dvidir)"'; \
+         echo '#define PDFDIR "$(pdfdir)"'; \
+         echo '#define PSDIR "$(psdir)"'; \
+         echo '#define LIBDIR "$(libdir)"'; \
+         echo '#define LISPDIR "$(lispdir)"'; \
+         echo '#define LOCALEDIR "$(localedir)"'; \
+         echo '#define MANDIR "$(mandir)"'; \
+         echo '#define MANEXT "$(manext)"'; \
+         echo '#define PKGDATADIR "$(pkgdatadir)"'; \
+         echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
+         echo '#define PKGLIBDIR "$(pkglibdir)"'; \
+         echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
+       } | sed '/""/d' > $@-t
+       if test -f $@ && cmp $@-t $@ > /dev/null; then \
+         rm -f $@-t; \
+       else \
+         rm -f $@; mv $@-t $@; \
+       fi
+
+BUILT_SOURCES += configmake.h
+CLEANFILES += configmake.h configmake.h-t
+
+## end   gnulib module configmake
+
+## begin gnulib module errno
+
+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
+       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|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
+             -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
+             -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
+             -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
+             -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
+             -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
+             -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
+             < $(srcdir)/errno.in.h; \
+       } > $@-t
+       mv $@-t $@
+MOSTLYCLEANFILES += errno.h errno.h-t
+
+EXTRA_DIST += errno.in.h
+
+## end   gnulib module errno
+
 ## begin gnulib module error
 
 
 ## begin gnulib module error
 
 
@@ -172,6 +262,80 @@ EXTRA_DIST += $(top_srcdir)/./link-warning.h
 
 ## end   gnulib module link-warning
 
 
 ## end   gnulib module link-warning
 
+## begin gnulib module localcharset
+
+libgnu_a_SOURCES += localcharset.h localcharset.c
+
+# We need the following in order to install a simple file in $(libdir)
+# which is shared with other installed packages. We use a list of referencing
+# packages so that "make uninstall" will remove the file if and only if it
+# is not used by another installed package.
+# On systems with glibc-2.1 or newer, the file is redundant, therefore we
+# avoid installing it.
+
+all-local: charset.alias ref-add.sed ref-del.sed
+
+charset_alias = $(DESTDIR)$(libdir)/charset.alias
+charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
+install-exec-local: install-exec-localcharset
+install-exec-localcharset: all-local
+       if test $(GLIBC21) = no; then \
+         case '$(host_os)' in \
+           darwin[56]*) \
+             need_charset_alias=true ;; \
+           darwin* | cygwin* | mingw* | pw32* | cegcc*) \
+             need_charset_alias=false ;; \
+           *) \
+             need_charset_alias=true ;; \
+         esac ; \
+       else \
+         need_charset_alias=false ; \
+       fi ; \
+       if $$need_charset_alias; then \
+         $(mkinstalldirs) $(DESTDIR)$(libdir) ; \
+       fi ; \
+       if test -f $(charset_alias); then \
+         sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
+         $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+         rm -f $(charset_tmp) ; \
+       else \
+         if $$need_charset_alias; then \
+           sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+           rm -f $(charset_tmp) ; \
+         fi ; \
+       fi
+
+uninstall-local: uninstall-localcharset
+uninstall-localcharset: all-local
+       if test -f $(charset_alias); then \
+         sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
+         if grep '^# Packages using this file: $$' $(charset_tmp) \
+             > /dev/null; then \
+           rm -f $(charset_alias); \
+         else \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
+         fi; \
+         rm -f $(charset_tmp); \
+       fi
+
+charset.alias: config.charset
+       rm -f t-$@ $@
+       $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
+       mv t-$@ $@
+
+SUFFIXES += .sed .sin
+.sin.sed:
+       rm -f t-$@ $@
+       sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
+       mv t-$@ $@
+
+CLEANFILES += charset.alias ref-add.sed ref-del.sed
+
+EXTRA_DIST += config.charset ref-add.sin ref-del.sin
+
+## end   gnulib module localcharset
+
 ## begin gnulib module lseek
 
 
 ## begin gnulib module lseek
 
 
@@ -187,6 +351,24 @@ EXTRA_DIST += $(top_srcdir)/maint.mk
 
 ## end   gnulib module maintainer-makefile
 
 
 ## end   gnulib module maintainer-makefile
 
+## begin gnulib module mbrtowc
+
+
+EXTRA_DIST += mbrtowc.c
+
+EXTRA_libgnu_a_SOURCES += mbrtowc.c
+
+## end   gnulib module mbrtowc
+
+## begin gnulib module mbsinit
+
+
+EXTRA_DIST += mbsinit.c
+
+EXTRA_libgnu_a_SOURCES += mbsinit.c
+
+## end   gnulib module mbsinit
+
 ## begin gnulib module quote
 
 
 ## begin gnulib module quote
 
 
@@ -232,6 +414,48 @@ EXTRA_DIST += stdbool.in.h
 
 ## end   gnulib module stdbool
 
 
 ## end   gnulib module stdbool
 
+## begin gnulib module stdint
+
+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
+       rm -f $@-t $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
+             -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
+             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+             -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
+             -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
+             -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
+             -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
+             -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
+             -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
+             -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
+             -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
+             -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
+             -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
+             -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
+             < $(srcdir)/stdint.in.h; \
+       } > $@-t
+       mv $@-t $@
+MOSTLYCLEANFILES += stdint.h stdint.h-t
+
+EXTRA_DIST += stdint.in.h
+
+## end   gnulib module stdint
+
 ## begin gnulib module stdio
 
 BUILT_SOURCES += stdio.h
 ## begin gnulib module stdio
 
 BUILT_SOURCES += stdio.h
@@ -241,17 +465,26 @@ BUILT_SOURCES += stdio.h
 stdio.h: stdio.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 stdio.h: stdio.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
              -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
+             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
              -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
              -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
              -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
              -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
              -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
              -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
              -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
              -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
+             -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
              -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
              -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
+             -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
              -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
              -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
              -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
              -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
              -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
              -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
@@ -259,8 +492,19 @@ stdio.h: stdio.in.h
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
              -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
              -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
+             -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
+             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
+             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
+             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
+             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
+             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
+             -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
              -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
              -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
              -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
              -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
+             -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
+             -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
+             -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
              -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
              -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
@@ -271,8 +515,14 @@ stdio.h: stdio.in.h
              -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
              -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
              -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
+             -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
+             -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
+             -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
+             -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
              -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
              -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
+             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
              -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
              -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
              -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
@@ -280,16 +530,22 @@ stdio.h: stdio.in.h
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
+             -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdio.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdio.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
-EXTRA_DIST += stdio.in.h
+EXTRA_DIST += stdio-write.c stdio.in.h
+
+EXTRA_libgnu_a_SOURCES += stdio-write.c
 
 ## end   gnulib module stdio
 
 
 ## end   gnulib module stdio
 
@@ -302,28 +558,42 @@ BUILT_SOURCES += stdlib.h
 stdlib.h: stdlib.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 stdlib.h: stdlib.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
              -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
              -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
              -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
              -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
              -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
              -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
+             -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
+             -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
              -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
              -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
              -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
              -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+             -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
              -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
              -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
              -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
              -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
              -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
              -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
+             -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
+             -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+             -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+             -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
              -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
              -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
+             -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
+             -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
+             -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
+             -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
              -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
              -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
+             -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
@@ -338,6 +608,13 @@ EXTRA_DIST += stdlib.in.h
 
 ## end   gnulib module stdlib
 
 
 ## end   gnulib module stdlib
 
+## begin gnulib module streq
+
+
+EXTRA_DIST += streq.h
+
+## end   gnulib module streq
+
 ## begin gnulib module strerror
 
 
 ## begin gnulib module strerror
 
 
@@ -356,7 +633,8 @@ BUILT_SOURCES += string.h
 string.h: string.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 string.h: string.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
              -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
              -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
              -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
              -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
              -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
@@ -372,6 +650,7 @@ string.h: string.in.h
              -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
              -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
              -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
              -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
              -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
              -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
+             -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \
              -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
              -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
              -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
              -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
              -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
              -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
@@ -389,6 +668,7 @@ string.h: string.in.h
              -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
+             -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -406,8 +686,11 @@ string.h: string.in.h
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
              -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
              -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
              -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
              -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+             -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
+             -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+             -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
              -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
              -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
              -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
@@ -431,23 +714,41 @@ unistd.h: unistd.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
              -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
              -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+             -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
              -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
              -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
              -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
              -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
+             -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
              -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
              -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+             -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+             -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
+             -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
+             -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
+             -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
+             -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+             -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
+             -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+             -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
+             -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
+             -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+             -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
+             -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
@@ -455,11 +756,15 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+             -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
+             -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/unistd.in.h; \
        } > $@-t
        mv $@-t $@
              < $(srcdir)/unistd.in.h; \
        } > $@-t
        mv $@-t $@
@@ -469,6 +774,26 @@ EXTRA_DIST += unistd.in.h
 
 ## end   gnulib module unistd
 
 
 ## end   gnulib module unistd
 
+## begin gnulib module useless-if-before-free
+
+
+EXTRA_DIST += $(top_srcdir)/./useless-if-before-free
+
+## end   gnulib module useless-if-before-free
+
+## begin gnulib module vc-list-files
+
+
+EXTRA_DIST += $(top_srcdir)/./vc-list-files
+
+## end   gnulib module vc-list-files
+
+## begin gnulib module verify
+
+libgnu_a_SOURCES += verify.h
+
+## end   gnulib module verify
+
 ## begin gnulib module wchar
 
 BUILT_SOURCES += $(WCHAR_H)
 ## begin gnulib module wchar
 
 BUILT_SOURCES += $(WCHAR_H)
@@ -478,11 +803,44 @@ BUILT_SOURCES += $(WCHAR_H)
 wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
              -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+             -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
+             -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
+             -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
+             -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
+             -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
+             -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
+             -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
+             -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
+             -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
+             -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
+             -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
+             -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
+             -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
+             -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
+             -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
+             -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
+             -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
+             -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
+             -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
+             -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
+             -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
+             -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
+             -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
+             -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
+             -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
+             -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
+             -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
+             -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
+             -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
+             -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
+             -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
            < $(srcdir)/wchar.in.h; \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
            < $(srcdir)/wchar.in.h; \
@@ -504,7 +862,8 @@ wctype.h: wctype.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
-             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
              -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
              -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
              -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
              -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
              -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
index 76d5b0bbe8bc5bad77469568b64d4d6025194905..d78dd19d5dc9a18fbde4533e1a362ffc3af743cc 100644 (file)
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -103,6 +103,21 @@ extern "C" {
 
 /* Function declarations. */
 
 
 /* Function declarations. */
 
+/* Unlike the functions in <ctype.h>, which require an argument in the range
+   of the 'unsigned char' type, the functions here operate on values that are
+   in the 'unsigned char' range or in the 'char' range.  In other words,
+   when you have a 'char' value, you need to cast it before using it as
+   argument to a <ctype.h> function:
+
+         const char *s = ...;
+         if (isalpha ((unsigned char) *s)) ...
+
+   but you don't need to cast it for the functions defined in this file:
+
+         const char *s = ...;
+         if (c_isalpha (*s)) ...
+ */
+
 extern bool c_isascii (int c); /* not locale dependent */
 
 extern bool c_isalnum (int c);
 extern bool c_isascii (int c); /* not locale dependent */
 
 extern bool c_isalnum (int c);
diff --git a/lib/config.charset b/lib/config.charset
new file mode 100755 (executable)
index 0000000..7f91212
--- /dev/null
@@ -0,0 +1,683 @@
+#! /bin/sh
+# Output a system dependent table of character encoding aliases.
+#
+#   Copyright (C) 2000-2004, 2006-2009 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 3, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The table consists of lines of the form
+#    ALIAS  CANONICAL
+#
+# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
+# ALIAS is compared in a case sensitive way.
+#
+# CANONICAL is the GNU canonical name for this character encoding.
+# It must be an encoding supported by libiconv. Support by GNU libc is
+# also desirable. CANONICAL is case insensitive. Usually an upper case
+# MIME charset name is preferred.
+# The current list of GNU canonical charset names is as follows.
+#
+#       name              MIME?             used by which systems
+#   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin
+#   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
+#   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
+#   ISO-8859-3              Y   glibc solaris
+#   ISO-8859-4              Y   osf solaris freebsd netbsd openbsd darwin
+#   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
+#   ISO-8859-6              Y   glibc aix hpux solaris
+#   ISO-8859-7              Y   glibc aix hpux irix osf solaris netbsd openbsd darwin
+#   ISO-8859-8              Y   glibc aix hpux osf solaris
+#   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin
+#   ISO-8859-13                 glibc netbsd openbsd darwin
+#   ISO-8859-14                 glibc
+#   ISO-8859-15                 glibc aix osf solaris freebsd netbsd openbsd darwin
+#   KOI8-R                  Y   glibc solaris freebsd netbsd openbsd darwin
+#   KOI8-U                  Y   glibc freebsd netbsd openbsd darwin
+#   KOI8-T                      glibc
+#   CP437                       dos
+#   CP775                       dos
+#   CP850                       aix osf dos
+#   CP852                       dos
+#   CP855                       dos
+#   CP856                       aix
+#   CP857                       dos
+#   CP861                       dos
+#   CP862                       dos
+#   CP864                       dos
+#   CP865                       dos
+#   CP866                       freebsd netbsd openbsd darwin dos
+#   CP869                       dos
+#   CP874                       woe32 dos
+#   CP922                       aix
+#   CP932                       aix woe32 dos
+#   CP943                       aix
+#   CP949                       osf darwin woe32 dos
+#   CP950                       woe32 dos
+#   CP1046                      aix
+#   CP1124                      aix
+#   CP1125                      dos
+#   CP1129                      aix
+#   CP1131                      darwin
+#   CP1250                      woe32
+#   CP1251                      glibc solaris netbsd openbsd darwin woe32
+#   CP1252                      aix woe32
+#   CP1253                      woe32
+#   CP1254                      woe32
+#   CP1255                      glibc woe32
+#   CP1256                      woe32
+#   CP1257                      woe32
+#   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd darwin
+#   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
+#   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
+#   EUC-TW                      glibc aix hpux irix osf solaris netbsd
+#   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd darwin
+#   BIG5-HKSCS                  glibc solaris darwin
+#   GBK                         glibc aix osf solaris darwin woe32 dos
+#   GB18030                     glibc solaris netbsd darwin
+#   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
+#   JOHAB                       glibc solaris woe32
+#   TIS-620                     glibc aix hpux osf solaris
+#   VISCII                  Y   glibc
+#   TCVN5712-1                  glibc
+#   ARMSCII-8                   glibc darwin
+#   GEORGIAN-PS                 glibc
+#   PT154                       glibc
+#   HP-ROMAN8                   hpux
+#   HP-ARABIC8                  hpux
+#   HP-GREEK8                   hpux
+#   HP-HEBREW8                  hpux
+#   HP-TURKISH8                 hpux
+#   HP-KANA8                    hpux
+#   DEC-KANJI                   osf
+#   DEC-HANYU                   osf
+#   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin
+#
+# Note: Names which are not marked as being a MIME name should not be used in
+# Internet protocols for information interchange (mail, news, etc.).
+#
+# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
+# must understand both names and treat them as equivalent.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+
+host="$1"
+os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
+echo "# This file contains a table of character encoding aliases,"
+echo "# suitable for operating system '${os}'."
+echo "# It was automatically generated from config.charset."
+# List of references, updated during installation:
+echo "# Packages using this file: "
+case "$os" in
+    linux-gnulibc1*)
+       # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "C ASCII"
+       echo "POSIX ASCII"
+       for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
+                en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
+                en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
+                es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
+                et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
+                fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
+                it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
+                sv_FI sv_SE; do
+         echo "$l ISO-8859-1"
+         echo "$l.iso-8859-1 ISO-8859-1"
+         echo "$l.iso-8859-15 ISO-8859-15"
+         echo "$l.iso-8859-15@euro ISO-8859-15"
+         echo "$l@euro ISO-8859-15"
+         echo "$l.cp-437 CP437"
+         echo "$l.cp-850 CP850"
+         echo "$l.cp-1252 CP1252"
+         echo "$l.cp-1252@euro CP1252"
+         #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
+         echo "$l.utf-8 UTF-8"
+         echo "$l.utf-8@euro UTF-8"
+       done
+       for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
+                sl_SI sr sr_CS sr_YU; do
+         echo "$l ISO-8859-2"
+         echo "$l.iso-8859-2 ISO-8859-2"
+         echo "$l.cp-852 CP852"
+         echo "$l.cp-1250 CP1250"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in mk mk_MK ru ru_RU; do
+         echo "$l ISO-8859-5"
+         echo "$l.iso-8859-5 ISO-8859-5"
+         echo "$l.koi8-r KOI8-R"
+         echo "$l.cp-866 CP866"
+         echo "$l.cp-1251 CP1251"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in ar ar_SA; do
+         echo "$l ISO-8859-6"
+         echo "$l.iso-8859-6 ISO-8859-6"
+         echo "$l.cp-864 CP864"
+         #echo "$l.cp-868 CP868" # not a commonly used encoding
+         echo "$l.cp-1256 CP1256"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in el el_GR gr gr_GR; do
+         echo "$l ISO-8859-7"
+         echo "$l.iso-8859-7 ISO-8859-7"
+         echo "$l.cp-869 CP869"
+         echo "$l.cp-1253 CP1253"
+         echo "$l.cp-1253@euro CP1253"
+         echo "$l.utf-8 UTF-8"
+         echo "$l.utf-8@euro UTF-8"
+       done
+       for l in he he_IL iw iw_IL; do
+         echo "$l ISO-8859-8"
+         echo "$l.iso-8859-8 ISO-8859-8"
+         echo "$l.cp-862 CP862"
+         echo "$l.cp-1255 CP1255"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in tr tr_TR; do
+         echo "$l ISO-8859-9"
+         echo "$l.iso-8859-9 ISO-8859-9"
+         echo "$l.cp-857 CP857"
+         echo "$l.cp-1254 CP1254"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in lt lt_LT lv lv_LV; do
+         #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
+         echo "$l ISO-8859-13"
+       done
+       for l in ru_UA uk uk_UA; do
+         echo "$l KOI8-U"
+       done
+       for l in zh zh_CN; do
+         #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
+         echo "$l GB2312"
+       done
+       for l in ja ja_JP ja_JP.EUC; do
+         echo "$l EUC-JP"
+       done
+       for l in ko ko_KR; do
+         echo "$l EUC-KR"
+       done
+       for l in th th_TH; do
+         echo "$l TIS-620"
+       done
+       for l in fa fa_IR; do
+         #echo "$l ISIRI-3342" # a broken encoding
+         echo "$l.utf-8 UTF-8"
+       done
+       ;;
+    linux* | *-gnu*)
+       # With glibc-2.1 or newer, we don't need any canonicalization,
+       # because glibc has iconv and both glibc and libiconv support all
+       # GNU canonical names directly. Therefore, the Makefile does not
+       # need to install the alias file at all.
+       # The following applies only to glibc-2.0.x and older libcs.
+       echo "ISO_646.IRV:1983 ASCII"
+       ;;
+    aix*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-6 ISO-8859-6"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "IBM-850 CP850"
+       echo "IBM-856 CP856"
+       echo "IBM-921 ISO-8859-13"
+       echo "IBM-922 CP922"
+       echo "IBM-932 CP932"
+       echo "IBM-943 CP943"
+       echo "IBM-1046 CP1046"
+       echo "IBM-1124 CP1124"
+       echo "IBM-1129 CP1129"
+       echo "IBM-1252 CP1252"
+       echo "IBM-eucCN GB2312"
+       echo "IBM-eucJP EUC-JP"
+       echo "IBM-eucKR EUC-KR"
+       echo "IBM-eucTW EUC-TW"
+       echo "big5 BIG5"
+       echo "GBK GBK"
+       echo "TIS-620 TIS-620"
+       echo "UTF-8 UTF-8"
+       ;;
+    hpux*)
+       echo "iso88591 ISO-8859-1"
+       echo "iso88592 ISO-8859-2"
+       echo "iso88595 ISO-8859-5"
+       echo "iso88596 ISO-8859-6"
+       echo "iso88597 ISO-8859-7"
+       echo "iso88598 ISO-8859-8"
+       echo "iso88599 ISO-8859-9"
+       echo "iso885915 ISO-8859-15"
+       echo "roman8 HP-ROMAN8"
+       echo "arabic8 HP-ARABIC8"
+       echo "greek8 HP-GREEK8"
+       echo "hebrew8 HP-HEBREW8"
+       echo "turkish8 HP-TURKISH8"
+       echo "kana8 HP-KANA8"
+       echo "tis620 TIS-620"
+       echo "big5 BIG5"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "hp15CN GB2312"
+       #echo "ccdc ?" # what is this?
+       echo "SJIS SHIFT_JIS"
+       echo "utf8 UTF-8"
+       ;;
+    irix*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "eucCN GB2312"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       ;;
+    osf*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "cp850 CP850"
+       echo "big5 BIG5"
+       echo "dechanyu DEC-HANYU"
+       echo "dechanzi GB2312"
+       echo "deckanji DEC-KANJI"
+       echo "deckorean EUC-KR"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "GBK GBK"
+       echo "KSC5601 CP949"
+       echo "sdeckanji EUC-JP"
+       echo "SJIS SHIFT_JIS"
+       echo "TACTIS TIS-620"
+       echo "UTF-8 UTF-8"
+       ;;
+    solaris*)
+       echo "646 ASCII"
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-3 ISO-8859-3"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-6 ISO-8859-6"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "koi8-r KOI8-R"
+       echo "ansi-1251 CP1251"
+       echo "BIG5 BIG5"
+       echo "Big5-HKSCS BIG5-HKSCS"
+       echo "gb2312 GB2312"
+       echo "GBK GBK"
+       echo "GB18030 GB18030"
+       echo "cns11643 EUC-TW"
+       echo "5601 EUC-KR"
+       echo "ko_KR.johap92 JOHAB"
+       echo "eucJP EUC-JP"
+       echo "PCK SHIFT_JIS"
+       echo "TIS620.2533 TIS-620"
+       #echo "sun_eu_greek ?" # what is this?
+       echo "UTF-8 UTF-8"
+       ;;
+    freebsd* | os2*)
+       # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
+       # reuse FreeBSD's locale data for OS/2.
+       echo "C ASCII"
+       echo "US-ASCII ASCII"
+       for l in la_LN lt_LN; do
+         echo "$l.ASCII ASCII"
+       done
+       for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+                fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
+                lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
+         echo "$l.ISO_8859-1 ISO-8859-1"
+         echo "$l.DIS_8859-15 ISO-8859-15"
+       done
+       for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
+         echo "$l.ISO_8859-2 ISO-8859-2"
+       done
+       for l in la_LN lt_LT; do
+         echo "$l.ISO_8859-4 ISO-8859-4"
+       done
+       for l in ru_RU ru_SU; do
+         echo "$l.KOI8-R KOI8-R"
+         echo "$l.ISO_8859-5 ISO-8859-5"
+         echo "$l.CP866 CP866"
+       done
+       echo "uk_UA.KOI8-U KOI8-U"
+       echo "zh_TW.BIG5 BIG5"
+       echo "zh_TW.Big5 BIG5"
+       echo "zh_CN.EUC GB2312"
+       echo "ja_JP.EUC EUC-JP"
+       echo "ja_JP.SJIS SHIFT_JIS"
+       echo "ja_JP.Shift_JIS SHIFT_JIS"
+       echo "ko_KR.EUC EUC-KR"
+       ;;
+    netbsd*)
+       echo "646 ASCII"
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-13 ISO-8859-13"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "eucCN GB2312"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "BIG5 BIG5"
+       echo "SJIS SHIFT_JIS"
+       ;;
+    openbsd*)
+       echo "646 ASCII"
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-13 ISO-8859-13"
+       echo "ISO8859-15 ISO-8859-15"
+       ;;
+    darwin[56]*)
+       # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "C ASCII"
+       for l in en_AU en_CA en_GB en_US la_LN; do
+         echo "$l.US-ASCII ASCII"
+       done
+       for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+                fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
+                nl_NL no_NO pt_PT sv_SE; do
+         echo "$l ISO-8859-1"
+         echo "$l.ISO8859-1 ISO-8859-1"
+         echo "$l.ISO8859-15 ISO-8859-15"
+       done
+       for l in la_LN; do
+         echo "$l.ISO8859-1 ISO-8859-1"
+         echo "$l.ISO8859-15 ISO-8859-15"
+       done
+       for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
+         echo "$l.ISO8859-2 ISO-8859-2"
+       done
+       for l in la_LN lt_LT; do
+         echo "$l.ISO8859-4 ISO-8859-4"
+       done
+       for l in ru_RU; do
+         echo "$l.KOI8-R KOI8-R"
+         echo "$l.ISO8859-5 ISO-8859-5"
+         echo "$l.CP866 CP866"
+       done
+       for l in bg_BG; do
+         echo "$l.CP1251 CP1251"
+       done
+       echo "uk_UA.KOI8-U KOI8-U"
+       echo "zh_TW.BIG5 BIG5"
+       echo "zh_TW.Big5 BIG5"
+       echo "zh_CN.EUC GB2312"
+       echo "ja_JP.EUC EUC-JP"
+       echo "ja_JP.SJIS SHIFT_JIS"
+       echo "ko_KR.EUC EUC-KR"
+       ;;
+    darwin*)
+       # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
+       # useless:
+       # - It returns the empty string when LANG is set to a locale of the
+       #   form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
+       #   LC_CTYPE file.
+       # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
+       #   the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
+       # - The documentation says:
+       #     "... all code that calls BSD system routines should ensure
+       #      that the const *char parameters of these routines are in UTF-8
+       #      encoding. All BSD system functions expect their string
+       #      parameters to be in UTF-8 encoding and nothing else."
+       #   It also says
+       #     "An additional caveat is that string parameters for files,
+       #      paths, and other file-system entities must be in canonical
+       #      UTF-8. In a canonical UTF-8 Unicode string, all decomposable
+       #      characters are decomposed ..."
+       #   but this is not true: You can pass non-decomposed UTF-8 strings
+       #   to file system functions, and it is the OS which will convert
+       #   them to decomposed UTF-8 before accessing the file system.
+       # - The Apple Terminal application displays UTF-8 by default.
+       # - However, other applications are free to use different encodings:
+       #   - xterm uses ISO-8859-1 by default.
+       #   - TextEdit uses MacRoman by default.
+       # We prefer UTF-8 over decomposed UTF-8-MAC because one should
+       # minimize the use of decomposed Unicode. Unfortunately, through the
+       # Darwin file system, decomposed UTF-8 strings are leaked into user
+       # space nevertheless.
+       # Then there are also the locales with encodings other than US-ASCII
+       # and UTF-8. These locales can be occasionally useful to users (e.g.
+       # when grepping through ISO-8859-1 encoded text files), when all their
+       # file names are in US-ASCII.
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-13 ISO-8859-13"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "KOI8-R KOI8-R"
+       echo "KOI8-U KOI8-U"
+       echo "CP866 CP866"
+       echo "CP949 CP949"
+       echo "CP1131 CP1131"
+       echo "CP1251 CP1251"
+       echo "eucCN GB2312"
+       echo "GB2312 GB2312"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "Big5 BIG5"
+       echo "Big5HKSCS BIG5-HKSCS"
+       echo "GBK GBK"
+       echo "GB18030 GB18030"
+       echo "SJIS SHIFT_JIS"
+       echo "ARMSCII-8 ARMSCII-8"
+       echo "PT154 PT154"
+       #echo "ISCII-DEV ?"
+       echo "* UTF-8"
+       ;;
+    beos* | haiku*)
+       # BeOS and Haiku have a single locale, and it has UTF-8 encoding.
+       echo "* UTF-8"
+       ;;
+    msdosdjgpp*)
+       # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "#"
+       echo "# The encodings given here may not all be correct."
+       echo "# If you find that the encoding given for your language and"
+       echo "# country is not the one your DOS machine actually uses, just"
+       echo "# correct it in this file, and send a mail to"
+       echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
+       echo "# and Bruno Haible <bruno@clisp.org>."
+       echo "#"
+       echo "C ASCII"
+       # ISO-8859-1 languages
+       echo "ca CP850"
+       echo "ca_ES CP850"
+       echo "da CP865"    # not CP850 ??
+       echo "da_DK CP865" # not CP850 ??
+       echo "de CP850"
+       echo "de_AT CP850"
+       echo "de_CH CP850"
+       echo "de_DE CP850"
+       echo "en CP850"
+       echo "en_AU CP850" # not CP437 ??
+       echo "en_CA CP850"
+       echo "en_GB CP850"
+       echo "en_NZ CP437"
+       echo "en_US CP437"
+       echo "en_ZA CP850" # not CP437 ??
+       echo "es CP850"
+       echo "es_AR CP850"
+       echo "es_BO CP850"
+       echo "es_CL CP850"
+       echo "es_CO CP850"
+       echo "es_CR CP850"
+       echo "es_CU CP850"
+       echo "es_DO CP850"
+       echo "es_EC CP850"
+       echo "es_ES CP850"
+       echo "es_GT CP850"
+       echo "es_HN CP850"
+       echo "es_MX CP850"
+       echo "es_NI CP850"
+       echo "es_PA CP850"
+       echo "es_PY CP850"
+       echo "es_PE CP850"
+       echo "es_SV CP850"
+       echo "es_UY CP850"
+       echo "es_VE CP850"
+       echo "et CP850"
+       echo "et_EE CP850"
+       echo "eu CP850"
+       echo "eu_ES CP850"
+       echo "fi CP850"
+       echo "fi_FI CP850"
+       echo "fr CP850"
+       echo "fr_BE CP850"
+       echo "fr_CA CP850"
+       echo "fr_CH CP850"
+       echo "fr_FR CP850"
+       echo "ga CP850"
+       echo "ga_IE CP850"
+       echo "gd CP850"
+       echo "gd_GB CP850"
+       echo "gl CP850"
+       echo "gl_ES CP850"
+       echo "id CP850"    # not CP437 ??
+       echo "id_ID CP850" # not CP437 ??
+       echo "is CP861"    # not CP850 ??
+       echo "is_IS CP861" # not CP850 ??
+       echo "it CP850"
+       echo "it_CH CP850"
+       echo "it_IT CP850"
+       echo "lt CP775"
+       echo "lt_LT CP775"
+       echo "lv CP775"
+       echo "lv_LV CP775"
+       echo "nb CP865"    # not CP850 ??
+       echo "nb_NO CP865" # not CP850 ??
+       echo "nl CP850"
+       echo "nl_BE CP850"
+       echo "nl_NL CP850"
+       echo "nn CP865"    # not CP850 ??
+       echo "nn_NO CP865" # not CP850 ??
+       echo "no CP865"    # not CP850 ??
+       echo "no_NO CP865" # not CP850 ??
+       echo "pt CP850"
+       echo "pt_BR CP850"
+       echo "pt_PT CP850"
+       echo "sv CP850"
+       echo "sv_SE CP850"
+       # ISO-8859-2 languages
+       echo "cs CP852"
+       echo "cs_CZ CP852"
+       echo "hr CP852"
+       echo "hr_HR CP852"
+       echo "hu CP852"
+       echo "hu_HU CP852"
+       echo "pl CP852"
+       echo "pl_PL CP852"
+       echo "ro CP852"
+       echo "ro_RO CP852"
+       echo "sk CP852"
+       echo "sk_SK CP852"
+       echo "sl CP852"
+       echo "sl_SI CP852"
+       echo "sq CP852"
+       echo "sq_AL CP852"
+       echo "sr CP852"    # CP852 or CP866 or CP855 ??
+       echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
+       echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
+       # ISO-8859-3 languages
+       echo "mt CP850"
+       echo "mt_MT CP850"
+       # ISO-8859-5 languages
+       echo "be CP866"
+       echo "be_BE CP866"
+       echo "bg CP866"    # not CP855 ??
+       echo "bg_BG CP866" # not CP855 ??
+       echo "mk CP866"    # not CP855 ??
+       echo "mk_MK CP866" # not CP855 ??
+       echo "ru CP866"
+       echo "ru_RU CP866"
+       echo "uk CP1125"
+       echo "uk_UA CP1125"
+       # ISO-8859-6 languages
+       echo "ar CP864"
+       echo "ar_AE CP864"
+       echo "ar_DZ CP864"
+       echo "ar_EG CP864"
+       echo "ar_IQ CP864"
+       echo "ar_IR CP864"
+       echo "ar_JO CP864"
+       echo "ar_KW CP864"
+       echo "ar_MA CP864"
+       echo "ar_OM CP864"
+       echo "ar_QA CP864"
+       echo "ar_SA CP864"
+       echo "ar_SY CP864"
+       # ISO-8859-7 languages
+       echo "el CP869"
+       echo "el_GR CP869"
+       # ISO-8859-8 languages
+       echo "he CP862"
+       echo "he_IL CP862"
+       # ISO-8859-9 languages
+       echo "tr CP857"
+       echo "tr_TR CP857"
+       # Japanese
+       echo "ja CP932"
+       echo "ja_JP CP932"
+       # Chinese
+       echo "zh_CN GBK"
+       echo "zh_TW CP950" # not CP938 ??
+       # Korean
+       echo "kr CP949"    # not CP934 ??
+       echo "kr_KR CP949" # not CP934 ??
+       # Thai
+       echo "th CP874"
+       echo "th_TH CP874"
+       # Other
+       echo "eo CP850"
+       echo "eo_EO CP850"
+       ;;
+esac
diff --git a/lib/errno.in.h b/lib/errno.in.h
new file mode 100644 (file)
index 0000000..70c16b6
--- /dev/null
@@ -0,0 +1,160 @@
+/* A POSIX-like <errno.h>.
+
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_ERRNO_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
+
+#ifndef _GL_ERRNO_H
+#define _GL_ERRNO_H
+
+
+/* On native Windows platforms, many macros are not defined.  */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value.  */
+#  define EWOULDBLOCK     EAGAIN
+
+/* Values >= 100 seem safe to use.  */
+#  define ETXTBSY   100
+#  define GNULIB_defined_ETXTBSY 1
+
+/* These are intentionally the same values as the WSA* error numbers, defined
+   in <winsock2.h>.  */
+#  define EINPROGRESS     10036
+#  define EALREADY        10037
+#  define ENOTSOCK        10038
+#  define EDESTADDRREQ    10039
+#  define EMSGSIZE        10040
+#  define EPROTOTYPE      10041
+#  define ENOPROTOOPT     10042
+#  define EPROTONOSUPPORT 10043
+#  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
+#  define EOPNOTSUPP      10045
+#  define EPFNOSUPPORT    10046  /* not required by POSIX */
+#  define EAFNOSUPPORT    10047
+#  define EADDRINUSE      10048
+#  define EADDRNOTAVAIL   10049
+#  define ENETDOWN        10050
+#  define ENETUNREACH     10051
+#  define ENETRESET       10052
+#  define ECONNABORTED    10053
+#  define ECONNRESET      10054
+#  define ENOBUFS         10055
+#  define EISCONN         10056
+#  define ENOTCONN        10057
+#  define ESHUTDOWN       10058  /* not required by POSIX */
+#  define ETOOMANYREFS    10059  /* not required by POSIX */
+#  define ETIMEDOUT       10060
+#  define ECONNREFUSED    10061
+#  define ELOOP           10062
+#  define EHOSTDOWN       10064  /* not required by POSIX */
+#  define EHOSTUNREACH    10065
+#  define EPROCLIM        10067  /* not required by POSIX */
+#  define EUSERS          10068  /* not required by POSIX */
+#  define EDQUOT          10069
+#  define ESTALE          10070
+#  define EREMOTE         10071  /* not required by POSIX */
+#  define GNULIB_defined_ESOCK 1
+
+# endif
+
+
+/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
+   EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
+# if @EMULTIHOP_HIDDEN@
+#  define EMULTIHOP @EMULTIHOP_VALUE@
+#  define GNULIB_defined_EMULTIHOP 1
+# endif
+# if @ENOLINK_HIDDEN@
+#  define ENOLINK   @ENOLINK_VALUE@
+#  define GNULIB_defined_ENOLINK 1
+# endif
+# if @EOVERFLOW_HIDDEN@
+#  define EOVERFLOW @EOVERFLOW_VALUE@
+#  define GNULIB_defined_EOVERFLOW 1
+# endif
+
+
+/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
+   EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
+   Define them here.  Values >= 2000 seem safe to use: Solaris ESTALE = 151,
+   HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
+
+   Note: When one of these systems defines some of these macros some day,
+   binaries will have to be recompiled so that they recognizes the new
+   errno values from the system.  */
+
+# ifndef ENOMSG
+#  define ENOMSG    2000
+#  define GNULIB_defined_ENOMSG 1
+# endif
+
+# ifndef EIDRM
+#  define EIDRM     2001
+#  define GNULIB_defined_EIDRM 1
+# endif
+
+# ifndef ENOLINK
+#  define ENOLINK   2002
+#  define GNULIB_defined_ENOLINK 1
+# endif
+
+# ifndef EPROTO
+#  define EPROTO    2003
+#  define GNULIB_defined_EPROTO 1
+# endif
+
+# ifndef EMULTIHOP
+#  define EMULTIHOP 2004
+#  define GNULIB_defined_EMULTIHOP 1
+# endif
+
+# ifndef EBADMSG
+#  define EBADMSG   2005
+#  define GNULIB_defined_EBADMSG 1
+# endif
+
+# ifndef EOVERFLOW
+#  define EOVERFLOW 2006
+#  define GNULIB_defined_EOVERFLOW 1
+# endif
+
+# ifndef ENOTSUP
+#  define ENOTSUP   2007
+#  define GNULIB_defined_ENOTSUP 1
+# endif
+
+# ifndef ESTALE
+#  define ESTALE    2009
+#  define GNULIB_defined_ESTALE 1
+# endif
+
+# ifndef ECANCELED
+#  define ECANCELED 2008
+#  define GNULIB_defined_ECANCELED 1
+# endif
+
+
+#endif /* _GL_ERRNO_H */
+#endif /* _GL_ERRNO_H */
index 48ff48e14107400d81ceeb70072bd287d2f7c8e0..cf7c42fbfd6611ed4b8cef2256f3ca879c36eef3 100644 (file)
@@ -1,5 +1,5 @@
 /* An fseeko() function that, together with fflush(), is POSIX compliant.
 /* An fseeko() function that, together with fflush(), is POSIX compliant.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
 #endif
 
   /* These tests are based on fpurge.c.  */
 #endif
 
   /* These tests are based on fpurge.c.  */
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_read_end == fp->_IO_read_ptr
       && fp->_IO_write_ptr == fp->_IO_write_base
       && fp->_IO_save_base == NULL)
   if (fp->_IO_read_end == fp->_IO_read_ptr
       && fp->_IO_write_ptr == fp->_IO_write_base
       && fp->_IO_save_base == NULL)
@@ -82,11 +82,23 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
       && fp->_Rsave == NULL)
   if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
       && fp->_Rsave == NULL)
+#elif defined __MINT__              /* Atari FreeMiNT */
+  if (fp->__bufp == fp->__buffer
+      && fp->__get_limit == fp->__bufp
+      && fp->__put_limit == fp->__bufp
+      && !fp->__pushed_back)
 #else
   #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
 #endif
     {
 #else
   #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
 #endif
     {
-      off_t pos = lseek (fileno (fp), offset, whence);
+      /* We get here when an fflush() call immediately preceded this one.  We
+        know there are no buffers.
+        POSIX requires us to modify the file descriptor's position.
+        But we cannot position beyond end of file here.  */
+      off_t pos =
+       lseek (fileno (fp),
+              whence == SEEK_END && offset > 0 ? 0 : offset,
+              whence);
       if (pos == -1)
        {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
       if (pos == -1)
        {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
@@ -94,20 +106,25 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
 #endif
          return -1;
        }
 #endif
          return -1;
        }
-      else
-       {
-#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
-         fp_->_offset = pos;
-         fp_->_flags |= __SOFF;
-         fp_->_flags &= ~__SEOF;
+
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+      fp->_flags &= ~_IO_EOF_SEEN;
+#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+      fp_->_offset = pos;
+      fp_->_flags |= __SOFF;
+      fp_->_flags &= ~__SEOF;
 #elif defined __EMX__               /* emx+gcc */
 #elif defined __EMX__               /* emx+gcc */
-          fp->_flags &= ~_IOEOF;
+      fp->_flags &= ~_IOEOF;
 #elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
 #elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
-          fp->_flag &= ~_IOEOF;
+      fp->_flag &= ~_IOEOF;
+#elif defined __MINT__              /* Atari FreeMiNT */
+      fp->__offset = pos;
+      fp->__eof = 0;
 #endif
 #endif
-         return 0;
-       }
+      /* If we were not requested to position beyond end of file, we're
+        done.  */
+      if (!(whence == SEEK_END && offset > 0))
+       return 0;
     }
     }
-  else
-    return fseeko (fp, offset, whence);
+  return fseeko (fp, offset, whence);
 }
 }
index 3c519ccbf4cab7658e71b0ed10cf441ef4a82338..b74e5b5350055d63cbd667bdb3c7625ce88fca44 100644 (file)
@@ -1,6 +1,6 @@
 /* getdelim.c --- Implementation of replacement getdelim function.
 /* getdelim.c --- Implementation of replacement getdelim function.
-   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008 Free
-   Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007,
+   2008, 2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
 #include <stdio.h>
 
 #include <limits.h>
 #include <stdio.h>
 
 #include <limits.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <errno.h>
 
 #include <stdlib.h>
 #include <errno.h>
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
-#if !HAVE_FLOCKFILE
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+# define getc_maybe_unlocked(fp)       getc(fp)
+#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
 # undef flockfile
 # undef flockfile
-# define flockfile(x) ((void) 0)
-#endif
-#if !HAVE_FUNLOCKFILE
 # undef funlockfile
 # undef funlockfile
+# define flockfile(x) ((void) 0)
 # define funlockfile(x) ((void) 0)
 # define funlockfile(x) ((void) 0)
+# define getc_maybe_unlocked(fp)       getc(fp)
+#else
+# define getc_maybe_unlocked(fp)       getc_unlocked(fp)
 #endif
 
 /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
 #endif
 
 /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
@@ -79,7 +82,7 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
     {
       int i;
 
     {
       int i;
 
-      i = getc (fp);
+      i = getc_maybe_unlocked (fp);
       if (i == EOF)
        {
          result = -1;
       if (i == EOF)
        {
          result = -1;
index d6a3ecf4e709543b202652a300c9721286ad504a..ba115c472e72d7d74564b6016842f8f2ec4e79f2 100644 (file)
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006,2009
      Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
      Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -91,7 +91,7 @@ main (int argc, char **argv)
     {
       int this_option_optind = optind ? optind : 1;
       int option_index = 0;
     {
       int this_option_optind = optind ? optind : 1;
       int option_index = 0;
-      static struct option long_options[] =
+      static const struct option long_options[] =
       {
        {"add", 1, 0, 0},
        {"append", 0, 0, 0},
       {
        {"add", 1, 0, 0},
        {"append", 0, 0, 0},
index 763dd3c1470ad11df04d2ed89d8c574f9c30a88f..8cf2dca0ad722c667242e8c0d28221bc2487d092 100644 (file)
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    for invalid uses of the value returned from these functions.
    On pre-ANSI systems without 'const', the config.h file is supposed to
    contain "#define const".  */
    for invalid uses of the value returned from these functions.
    On pre-ANSI systems without 'const', the config.h file is supposed to
    contain "#define const".  */
+# undef gettext
 # define gettext(Msgid) ((const char *) (Msgid))
 # define gettext(Msgid) ((const char *) (Msgid))
+# undef dgettext
 # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
 # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
+# undef dcgettext
 # define dcgettext(Domainname, Msgid, Category) \
     ((void) (Category), dgettext (Domainname, Msgid))
 # define dcgettext(Domainname, Msgid, Category) \
     ((void) (Category), dgettext (Domainname, Msgid))
+# undef ngettext
 # define ngettext(Msgid1, Msgid2, N) \
     ((N) == 1 \
      ? ((void) (Msgid2), (const char *) (Msgid1)) \
      : ((void) (Msgid1), (const char *) (Msgid2)))
 # define ngettext(Msgid1, Msgid2, N) \
     ((N) == 1 \
      ? ((void) (Msgid2), (const char *) (Msgid1)) \
      : ((void) (Msgid1), (const char *) (Msgid2)))
+# undef dngettext
 # define dngettext(Domainname, Msgid1, Msgid2, N) \
     ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
 # define dngettext(Domainname, Msgid1, Msgid2, N) \
     ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
+# undef dcngettext
 # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
     ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
 # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
     ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
+# undef textdomain
 # define textdomain(Domainname) ((const char *) (Domainname))
 # define textdomain(Domainname) ((const char *) (Domainname))
+# undef bindtextdomain
 # define bindtextdomain(Domainname, Dirname) \
     ((void) (Domainname), (const char *) (Dirname))
 # define bindtextdomain(Domainname, Dirname) \
     ((void) (Domainname), (const char *) (Dirname))
+# undef bind_textdomain_codeset
 # define bind_textdomain_codeset(Domainname, Codeset) \
     ((void) (Domainname), (const char *) (Codeset))
 
 # define bind_textdomain_codeset(Domainname, Codeset) \
     ((void) (Domainname), (const char *) (Codeset))
 
diff --git a/lib/localcharset.c b/lib/localcharset.c
new file mode 100644 (file)
index 0000000..a7ca94c
--- /dev/null
@@ -0,0 +1,499 @@
+/* Determine a canonical name for the current locale's character encoding.
+
+   Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "localcharset.h"
+
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
+#endif
+
+#if defined _WIN32 || defined __WIN32__
+# define WIN32_NATIVE
+#endif
+
+#if defined __EMX__
+/* Assume EMX program runs on OS/2, even if compiled under DOS.  */
+# ifndef OS2
+#  define OS2
+# endif
+#endif
+
+#if !defined WIN32_NATIVE
+# if HAVE_LANGINFO_CODESET
+#  include <langinfo.h>
+# else
+#  if 0 /* see comment below */
+#   include <locale.h>
+#  endif
+# endif
+# ifdef __CYGWIN__
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+# endif
+#elif defined WIN32_NATIVE
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+#if defined OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+#if ENABLE_RELOCATABLE
+# include "relocatable.h"
+#else
+# define relocate(pathname) (pathname)
+#endif
+
+/* Get LIBDIR.  */
+#ifndef LIBDIR
+# include "configmake.h"
+#endif
+
+#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+  /* Win32, Cygwin, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#endif
+
+#ifndef DIRECTORY_SEPARATOR
+# define DIRECTORY_SEPARATOR '/'
+#endif
+
+#ifndef ISSLASH
+# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
+#endif
+
+#if HAVE_DECL_GETC_UNLOCKED
+# undef getc
+# define getc getc_unlocked
+#endif
+
+/* The following static variable is declared 'volatile' to avoid a
+   possible multithread problem in the function get_charset_aliases. If we
+   are running in a threaded environment, and if two threads initialize
+   'charset_aliases' simultaneously, both will produce the same value,
+   and everything will be ok if the two assignments to 'charset_aliases'
+   are atomic. But I don't know what will happen if the two assignments mix.  */
+#if __STDC__ != 1
+# define volatile /* empty */
+#endif
+/* Pointer to the contents of the charset.alias file, if it has already been
+   read, else NULL.  Its format is:
+   ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0'  */
+static const char * volatile charset_aliases;
+
+/* Return a pointer to the contents of the charset.alias file.  */
+static const char *
+get_charset_aliases (void)
+{
+  const char *cp;
+
+  cp = charset_aliases;
+  if (cp == NULL)
+    {
+#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
+      FILE *fp;
+      const char *dir;
+      const char *base = "charset.alias";
+      char *file_name;
+
+      /* Make it possible to override the charset.alias location.  This is
+        necessary for running the testsuite before "make install".  */
+      dir = getenv ("CHARSETALIASDIR");
+      if (dir == NULL || dir[0] == '\0')
+       dir = relocate (LIBDIR);
+
+      /* Concatenate dir and base into freshly allocated file_name.  */
+      {
+       size_t dir_len = strlen (dir);
+       size_t base_len = strlen (base);
+       int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
+       file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
+       if (file_name != NULL)
+         {
+           memcpy (file_name, dir, dir_len);
+           if (add_slash)
+             file_name[dir_len] = DIRECTORY_SEPARATOR;
+           memcpy (file_name + dir_len + add_slash, base, base_len + 1);
+         }
+      }
+
+      if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
+       /* Out of memory or file not found, treat it as empty.  */
+       cp = "";
+      else
+       {
+         /* Parse the file's contents.  */
+         char *res_ptr = NULL;
+         size_t res_size = 0;
+
+         for (;;)
+           {
+             int c;
+             char buf1[50+1];
+             char buf2[50+1];
+             size_t l1, l2;
+             char *old_res_ptr;
+
+             c = getc (fp);
+             if (c == EOF)
+               break;
+             if (c == '\n' || c == ' ' || c == '\t')
+               continue;
+             if (c == '#')
+               {
+                 /* Skip comment, to end of line.  */
+                 do
+                   c = getc (fp);
+                 while (!(c == EOF || c == '\n'));
+                 if (c == EOF)
+                   break;
+                 continue;
+               }
+             ungetc (c, fp);
+             if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
+               break;
+             l1 = strlen (buf1);
+             l2 = strlen (buf2);
+             old_res_ptr = res_ptr;
+             if (res_size == 0)
+               {
+                 res_size = l1 + 1 + l2 + 1;
+                 res_ptr = (char *) malloc (res_size + 1);
+               }
+             else
+               {
+                 res_size += l1 + 1 + l2 + 1;
+                 res_ptr = (char *) realloc (res_ptr, res_size + 1);
+               }
+             if (res_ptr == NULL)
+               {
+                 /* Out of memory. */
+                 res_size = 0;
+                 if (old_res_ptr != NULL)
+                   free (old_res_ptr);
+                 break;
+               }
+             strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
+             strcpy (res_ptr + res_size - (l2 + 1), buf2);
+           }
+         fclose (fp);
+         if (res_size == 0)
+           cp = "";
+         else
+           {
+             *(res_ptr + res_size) = '\0';
+             cp = res_ptr;
+           }
+       }
+
+      if (file_name != NULL)
+       free (file_name);
+
+#else
+
+# if defined DARWIN7
+      /* To avoid the trouble of installing a file that is shared by many
+        GNU packages -- many packaging systems have problems with this --,
+        simply inline the aliases here.  */
+      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
+          "ISO8859-2" "\0" "ISO-8859-2" "\0"
+          "ISO8859-4" "\0" "ISO-8859-4" "\0"
+          "ISO8859-5" "\0" "ISO-8859-5" "\0"
+          "ISO8859-7" "\0" "ISO-8859-7" "\0"
+          "ISO8859-9" "\0" "ISO-8859-9" "\0"
+          "ISO8859-13" "\0" "ISO-8859-13" "\0"
+          "ISO8859-15" "\0" "ISO-8859-15" "\0"
+          "KOI8-R" "\0" "KOI8-R" "\0"
+          "KOI8-U" "\0" "KOI8-U" "\0"
+          "CP866" "\0" "CP866" "\0"
+          "CP949" "\0" "CP949" "\0"
+          "CP1131" "\0" "CP1131" "\0"
+          "CP1251" "\0" "CP1251" "\0"
+          "eucCN" "\0" "GB2312" "\0"
+          "GB2312" "\0" "GB2312" "\0"
+          "eucJP" "\0" "EUC-JP" "\0"
+          "eucKR" "\0" "EUC-KR" "\0"
+          "Big5" "\0" "BIG5" "\0"
+          "Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
+          "GBK" "\0" "GBK" "\0"
+          "GB18030" "\0" "GB18030" "\0"
+          "SJIS" "\0" "SHIFT_JIS" "\0"
+          "ARMSCII-8" "\0" "ARMSCII-8" "\0"
+          "PT154" "\0" "PT154" "\0"
+        /*"ISCII-DEV" "\0" "?" "\0"*/
+          "*" "\0" "UTF-8" "\0";
+# endif
+
+# if defined VMS
+      /* To avoid the troubles of an extra file charset.alias_vms in the
+        sources of many GNU packages, simply inline the aliases here.  */
+      /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
+        "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
+        section 10.7 "Handling Different Character Sets".  */
+      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
+          "ISO8859-2" "\0" "ISO-8859-2" "\0"
+          "ISO8859-5" "\0" "ISO-8859-5" "\0"
+          "ISO8859-7" "\0" "ISO-8859-7" "\0"
+          "ISO8859-8" "\0" "ISO-8859-8" "\0"
+          "ISO8859-9" "\0" "ISO-8859-9" "\0"
+          /* Japanese */
+          "eucJP" "\0" "EUC-JP" "\0"
+          "SJIS" "\0" "SHIFT_JIS" "\0"
+          "DECKANJI" "\0" "DEC-KANJI" "\0"
+          "SDECKANJI" "\0" "EUC-JP" "\0"
+          /* Chinese */
+          "eucTW" "\0" "EUC-TW" "\0"
+          "DECHANYU" "\0" "DEC-HANYU" "\0"
+          "DECHANZI" "\0" "GB2312" "\0"
+          /* Korean */
+          "DECKOREAN" "\0" "EUC-KR" "\0";
+# endif
+
+# if defined WIN32_NATIVE || defined __CYGWIN__
+      /* To avoid the troubles of installing a separate file in the same
+        directory as the DLL and of retrieving the DLL's directory at
+        runtime, simply inline the aliases here.  */
+
+      cp = "CP936" "\0" "GBK" "\0"
+          "CP1361" "\0" "JOHAB" "\0"
+          "CP20127" "\0" "ASCII" "\0"
+          "CP20866" "\0" "KOI8-R" "\0"
+          "CP20936" "\0" "GB2312" "\0"
+          "CP21866" "\0" "KOI8-RU" "\0"
+          "CP28591" "\0" "ISO-8859-1" "\0"
+          "CP28592" "\0" "ISO-8859-2" "\0"
+          "CP28593" "\0" "ISO-8859-3" "\0"
+          "CP28594" "\0" "ISO-8859-4" "\0"
+          "CP28595" "\0" "ISO-8859-5" "\0"
+          "CP28596" "\0" "ISO-8859-6" "\0"
+          "CP28597" "\0" "ISO-8859-7" "\0"
+          "CP28598" "\0" "ISO-8859-8" "\0"
+          "CP28599" "\0" "ISO-8859-9" "\0"
+          "CP28605" "\0" "ISO-8859-15" "\0"
+          "CP38598" "\0" "ISO-8859-8" "\0"
+          "CP51932" "\0" "EUC-JP" "\0"
+          "CP51936" "\0" "GB2312" "\0"
+          "CP51949" "\0" "EUC-KR" "\0"
+          "CP51950" "\0" "EUC-TW" "\0"
+          "CP54936" "\0" "GB18030" "\0"
+          "CP65001" "\0" "UTF-8" "\0";
+# endif
+#endif
+
+      charset_aliases = cp;
+    }
+
+  return cp;
+}
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed in config.charset.
+   The result must not be freed; it is statically allocated.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+
+#ifdef STATIC
+STATIC
+#endif
+const char *
+locale_charset (void)
+{
+  const char *codeset;
+  const char *aliases;
+
+#if !(defined WIN32_NATIVE || defined OS2)
+
+# if HAVE_LANGINFO_CODESET
+
+  /* Most systems support nl_langinfo (CODESET) nowadays.  */
+  codeset = nl_langinfo (CODESET);
+
+#  ifdef __CYGWIN__
+  /* Cygwin 2006 does not have locales.  nl_langinfo (CODESET) always
+     returns "US-ASCII".  As long as this is not fixed, return the suffix
+     of the locale name from the environment variables (if present) or
+     the codepage as a number.  */
+  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
+    {
+      const char *locale;
+      static char buf[2 + 10 + 1];
+
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+      if (locale != NULL && locale[0] != '\0')
+       {
+         /* If the locale name contains an encoding after the dot, return
+            it.  */
+         const char *dot = strchr (locale, '.');
+
+         if (dot != NULL)
+           {
+             const char *modifier;
+
+             dot++;
+             /* Look for the possible @... trailer and remove it, if any.  */
+             modifier = strchr (dot, '@');
+             if (modifier == NULL)
+               return dot;
+             if (modifier - dot < sizeof (buf))
+               {
+                 memcpy (buf, dot, modifier - dot);
+                 buf [modifier - dot] = '\0';
+                 return buf;
+               }
+           }
+       }
+
+      /* Woe32 has a function returning the locale's codepage as a number.  */
+      sprintf (buf, "CP%u", GetACP ());
+      codeset = buf;
+    }
+#  endif
+
+# else
+
+  /* On old systems which lack it, use setlocale or getenv.  */
+  const char *locale = NULL;
+
+  /* But most old systems don't have a complete set of locales.  Some
+     (like SunOS 4 or DJGPP) have only the C locale.  Therefore we don't
+     use setlocale here; it would return "C" when it doesn't support the
+     locale name the user has set.  */
+#  if 0
+  locale = setlocale (LC_CTYPE, NULL);
+#  endif
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+    }
+
+  /* On some old systems, one used to set locale = "iso8859_1". On others,
+     you set it to "language_COUNTRY.charset". In any case, we resolve it
+     through the charset.alias file.  */
+  codeset = locale;
+
+# endif
+
+#elif defined WIN32_NATIVE
+
+  static char buf[2 + 10 + 1];
+
+  /* Woe32 has a function returning the locale's codepage as a number.  */
+  sprintf (buf, "CP%u", GetACP ());
+  codeset = buf;
+
+#elif defined OS2
+
+  const char *locale;
+  static char buf[2 + 10 + 1];
+  ULONG cp[3];
+  ULONG cplen;
+
+  /* Allow user to override the codeset, as set in the operating system,
+     with standard language environment variables.  */
+  locale = getenv ("LC_ALL");
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_CTYPE");
+      if (locale == NULL || locale[0] == '\0')
+       locale = getenv ("LANG");
+    }
+  if (locale != NULL && locale[0] != '\0')
+    {
+      /* If the locale name contains an encoding after the dot, return it.  */
+      const char *dot = strchr (locale, '.');
+
+      if (dot != NULL)
+       {
+         const char *modifier;
+
+         dot++;
+         /* Look for the possible @... trailer and remove it, if any.  */
+         modifier = strchr (dot, '@');
+         if (modifier == NULL)
+           return dot;
+         if (modifier - dot < sizeof (buf))
+           {
+             memcpy (buf, dot, modifier - dot);
+             buf [modifier - dot] = '\0';
+             return buf;
+           }
+       }
+
+      /* Resolve through the charset.alias file.  */
+      codeset = locale;
+    }
+  else
+    {
+      /* OS/2 has a function returning the locale's codepage as a number.  */
+      if (DosQueryCp (sizeof (cp), cp, &cplen))
+       codeset = "";
+      else
+       {
+         sprintf (buf, "CP%u", cp[0]);
+         codeset = buf;
+       }
+    }
+
+#endif
+
+  if (codeset == NULL)
+    /* The canonical name cannot be determined.  */
+    codeset = "";
+
+  /* Resolve alias. */
+  for (aliases = get_charset_aliases ();
+       *aliases != '\0';
+       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
+    if (strcmp (codeset, aliases) == 0
+       || (aliases[0] == '*' && aliases[1] == '\0'))
+      {
+       codeset = aliases + strlen (aliases) + 1;
+       break;
+      }
+
+  /* Don't return an empty string.  GNU libc and GNU libiconv interpret
+     the empty string as denoting "the locale's character encoding",
+     thus GNU libiconv would call this function a second time.  */
+  if (codeset[0] == '\0')
+    codeset = "ASCII";
+
+  return codeset;
+}
diff --git a/lib/localcharset.h b/lib/localcharset.h
new file mode 100644 (file)
index 0000000..b9a3013
--- /dev/null
@@ -0,0 +1,41 @@
+/* Determine a canonical name for the current locale's character encoding.
+   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   This file is part of the GNU CHARSET Library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _LOCALCHARSET_H
+#define _LOCALCHARSET_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed in config.charset.
+   The result must not be freed; it is statically allocated.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+extern const char * locale_charset (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LOCALCHARSET_H */
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
new file mode 100644 (file)
index 0000000..0fec5f1
--- /dev/null
@@ -0,0 +1,386 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 1999-2002, 2005-2009 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#if GNULIB_defined_mbstate_t
+/* Implement mbrtowc() on top of mbtowc().  */
+
+# include <errno.h>
+# include <stdlib.h>
+
+# include "localcharset.h"
+# include "streq.h"
+# include "verify.h"
+
+
+verify (sizeof (mbstate_t) >= 4);
+
+static char internal_state[4];
+
+size_t
+mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
+{
+  char *pstate = (char *)ps;
+
+  if (pstate == NULL)
+    pstate = internal_state;
+
+  if (s == NULL)
+    {
+      pwc = NULL;
+      s = "";
+      n = 1;
+    }
+
+  if (n == 0)
+    return (size_t)(-2);
+
+  /* Here n > 0.  */
+  {
+    size_t nstate = pstate[0];
+    char buf[4];
+    const char *p;
+    size_t m;
+
+    switch (nstate)
+      {
+      case 0:
+       p = s;
+       m = n;
+       break;
+      case 3:
+       buf[2] = pstate[3];
+       /*FALLTHROUGH*/
+      case 2:
+       buf[1] = pstate[2];
+       /*FALLTHROUGH*/
+      case 1:
+       buf[0] = pstate[1];
+       p = buf;
+       m = nstate;
+       buf[m++] = s[0];
+       if (n >= 2 && m < 4)
+         {
+           buf[m++] = s[1];
+           if (n >= 3 && m < 4)
+             buf[m++] = s[2];
+         }
+       break;
+      default:
+       errno = EINVAL;
+       return (size_t)(-1);
+      }
+
+    /* Here m > 0.  */
+
+# if __GLIBC__
+    /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
+    mbtowc (NULL, NULL, 0);
+# endif
+    {
+      int res = mbtowc (pwc, p, m);
+
+      if (res >= 0)
+       {
+         if (pwc != NULL && ((*pwc == 0) != (res == 0)))
+           abort ();
+         if (nstate >= (res > 0 ? res : 1))
+           abort ();
+         res -= nstate;
+         pstate[0] = 0;
+         return res;
+       }
+
+      /* mbtowc does not distinguish between invalid and incomplete multibyte
+        sequences.  But mbrtowc needs to make this distinction.
+        There are two possible approaches:
+          - Use iconv() and its return value.
+          - Use built-in knowledge about the possible encodings.
+        Given the low quality of implementation of iconv() on the systems that
+        lack mbrtowc(), we use the second approach.
+        The possible encodings are:
+          - 8-bit encodings,
+          - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
+          - UTF-8.
+        Use specialized code for each.  */
+      if (m >= 4 || m >= MB_CUR_MAX)
+       goto invalid;
+      /* Here MB_CUR_MAX > 1 and 0 < m < 4.  */
+      {
+       const char *encoding = locale_charset ();
+
+       if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+         {
+           /* Cf. unistr/u8-mblen.c.  */
+           unsigned char c = (unsigned char) p[0];
+
+           if (c >= 0xc2)
+             {
+               if (c < 0xe0)
+                 {
+                   if (m == 1)
+                     goto incomplete;
+                 }
+               else if (c < 0xf0)
+                 {
+                   if (m == 1)
+                     goto incomplete;
+                   if (m == 2)
+                     {
+                       unsigned char c2 = (unsigned char) p[1];
+
+                       if ((c2 ^ 0x80) < 0x40
+                           && (c >= 0xe1 || c2 >= 0xa0)
+                           && (c != 0xed || c2 < 0xa0))
+                         goto incomplete;
+                     }
+                 }
+               else if (c <= 0xf4)
+                 {
+                   if (m == 1)
+                     goto incomplete;
+                   else /* m == 2 || m == 3 */
+                     {
+                       unsigned char c2 = (unsigned char) p[1];
+
+                       if ((c2 ^ 0x80) < 0x40
+                           && (c >= 0xf1 || c2 >= 0x90)
+                           && (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
+                         {
+                           if (m == 2)
+                             goto incomplete;
+                           else /* m == 3 */
+                             {
+                               unsigned char c3 = (unsigned char) p[2];
+
+                               if ((c3 ^ 0x80) < 0x40)
+                                 goto incomplete;
+                             }
+                         }
+                     }
+                 }
+             }
+           goto invalid;
+         }
+
+       /* As a reference for this code, you can use the GNU libiconv
+          implementation.  Look for uses of the RET_TOOFEW macro.  */
+
+       if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
+         {
+           if (m == 1)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
+                 goto incomplete;
+             }
+           if (m == 2)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if (c == 0x8f)
+                 {
+                   unsigned char c2 = (unsigned char) p[1];
+
+                   if (c2 >= 0xa1 && c2 < 0xff)
+                     goto incomplete;
+                 }
+             }
+           goto invalid;
+         }
+       if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+           || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+           || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
+         {
+           if (m == 1)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if (c >= 0xa1 && c < 0xff)
+                 goto incomplete;
+             }
+           goto invalid;
+         }
+       if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
+         {
+           if (m == 1)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
+                 goto incomplete;
+             }
+           else /* m == 2 || m == 3 */
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if (c == 0x8e)
+                 goto incomplete;
+             }
+           goto invalid;
+         }
+       if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
+         {
+           if (m == 1)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
+                 goto incomplete;
+             }
+           else /* m == 2 || m == 3 */
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if (c >= 0x90 && c <= 0xe3)
+                 {
+                   unsigned char c2 = (unsigned char) p[1];
+
+                   if (c2 >= 0x30 && c2 <= 0x39)
+                     {
+                       if (m == 2)
+                         goto incomplete;
+                       else /* m == 3 */
+                         {
+                           unsigned char c3 = (unsigned char) p[2];
+
+                           if (c3 >= 0x81 && c3 <= 0xfe)
+                             goto incomplete;
+                         }
+                     }
+                 }
+             }
+           goto invalid;
+         }
+       if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
+         {
+           if (m == 1)
+             {
+               unsigned char c = (unsigned char) p[0];
+
+               if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
+                   || (c >= 0xf0 && c <= 0xf9))
+                 goto incomplete;
+             }
+           goto invalid;
+         }
+
+       /* An unknown multibyte encoding.  */
+       goto incomplete;
+      }
+
+     incomplete:
+      {
+       size_t k = nstate;
+       /* Here 0 <= k < m < 4.  */
+       pstate[++k] = s[0];
+       if (k < m)
+         {
+           pstate[++k] = s[1];
+           if (k < m)
+             pstate[++k] = s[2];
+         }
+       if (k != m)
+         abort ();
+      }
+      pstate[0] = m;
+      return (size_t)(-2);
+
+     invalid:
+      errno = EILSEQ;
+      /* The conversion state is undefined, says POSIX.  */
+      return (size_t)(-1);
+    }
+  }
+}
+
+#else
+/* Override the system's mbrtowc() function.  */
+
+# undef mbrtowc
+
+size_t
+rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
+{
+# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG
+  if (s == NULL)
+    {
+      pwc = NULL;
+      s = "";
+      n = 1;
+    }
+# endif
+
+# if MBRTOWC_RETVAL_BUG
+  {
+    static mbstate_t internal_state;
+
+    /* Override mbrtowc's internal state.  We can not call mbsinit() on the
+       hidden internal state, but we can call it on our variable.  */
+    if (ps == NULL)
+      ps = &internal_state;
+
+    if (!mbsinit (ps))
+      {
+       /* Parse the rest of the multibyte character byte for byte.  */
+       size_t count = 0;
+       for (; n > 0; s++, n--)
+         {
+           wchar_t wc;
+           size_t ret = mbrtowc (&wc, s, 1, ps);
+
+           if (ret == (size_t)(-1))
+             return (size_t)(-1);
+           count++;
+           if (ret != (size_t)(-2))
+             {
+               /* The multibyte character has been completed.  */
+               if (pwc != NULL)
+                 *pwc = wc;
+               return (wc == 0 ? 0 : count);
+             }
+         }
+       return (size_t)(-2);
+      }
+  }
+# endif
+
+# if MBRTOWC_NUL_RETVAL_BUG
+  {
+    wchar_t wc;
+    size_t ret = mbrtowc (&wc, s, n, ps);
+
+    if (ret != (size_t)(-1) && ret != (size_t)(-2))
+      {
+       if (pwc != NULL)
+         *pwc = wc;
+       if (wc == 0)
+         ret = 0;
+      }
+    return ret;
+  }
+# else
+  return mbrtowc (pwc, s, n, ps);
+# endif
+}
+
+#endif
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
new file mode 100644 (file)
index 0000000..81fed5a
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test for initial conversion state.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "verify.h"
+
+/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
+   and wcrtomb(), wcsrtombs().
+   We assume that
+     - sizeof (mbstate_t) >= 4,
+     - only stateless encodings are supported (such as UTF-8 and EUC-JP, but
+       not ISO-2022 variants),
+     - for each encoding, the number of bytes for a wide character is <= 4.
+       (This maximum is attained for UTF-8, GB18030, EUC-TW.)
+   We define the meaning of mbstate_t as follows:
+     - In mb -> wc direction, mbstate_t's first byte contains the number of
+       buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
+     - In wc -> mb direction, mbstate_t contains no information. In other
+       words, it is always in the initial state.  */
+
+verify (sizeof (mbstate_t) >= 4);
+
+int
+mbsinit (const mbstate_t *ps)
+{
+  const char *pstate = (const char *)ps;
+
+  return pstate[0] == 0;
+}
index 75fbc72f3d5174559161bdd35b9237d777dc9830..339bf34942854b0c59192058f24ec09576087275 100644 (file)
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
-#if !HAVE_MBRTOWC
-/* Disable multibyte processing entirely.  Since MB_CUR_MAX is 1, the
-   other macros are defined only for documentation and to satisfy C
-   syntax.  */
-# undef MB_CUR_MAX
-# define MB_CUR_MAX 1
-# undef mbstate_t
-# define mbstate_t int
-# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
-# define iswprint(wc) isprint ((unsigned char) (wc))
-# undef HAVE_MBSINIT
-#endif
-
-#if !defined mbsinit && !HAVE_MBSINIT
-# define mbsinit(ps) 1
-#endif
-
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
 #endif
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
 #endif
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
new file mode 100644 (file)
index 0000000..222d752
--- /dev/null
@@ -0,0 +1,30 @@
+# Add this package to a list of references stored in a text file.
+#
+#   Copyright (C) 2000 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 3, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by Bruno Haible <haible@clisp.cons.org>.
+#
+/^# Packages using this file: / {
+  s/# Packages using this file://
+  ta
+  :a
+  s/ @PACKAGE@ / @PACKAGE@ /
+  tb
+  s/ $/ @PACKAGE@ /
+  :b
+  s/^/# Packages using this file:/
+}
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
new file mode 100644 (file)
index 0000000..1bf073e
--- /dev/null
@@ -0,0 +1,25 @@
+# Remove this package from a list of references stored in a text file.
+#
+#   Copyright (C) 2000 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 3, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by Bruno Haible <haible@clisp.cons.org>.
+#
+/^# Packages using this file: / {
+  s/# Packages using this file://
+  s/ @PACKAGE@ / /
+  s/^/# Packages using this file:/
+}
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
new file mode 100644 (file)
index 0000000..53aa34a
--- /dev/null
@@ -0,0 +1,567 @@
+/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
+   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
+   This file is part of gnulib.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/*
+ * ISO C 99 <stdint.h> for platforms that lack it.
+ * <http://www.opengroup.org/susv3xbd/stdint.h.html>
+ */
+
+#ifndef _GL_STDINT_H
+
+/* When including a system file that in turn includes <inttypes.h>,
+   use the system <inttypes.h>, not our substitute.  This avoids
+   problems with (for example) VMS, whose <sys/bitypes.h> includes
+   <inttypes.h>.  */
+#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* Get those types that are already defined in other system include
+   files, so that we can "#define int8_t signed char" below without
+   worrying about a later system include file containing a "typedef
+   signed char int8_t;" that will get messed up by our macro.  Our
+   macros should all be consistent with the system versions, except
+   for the "fast" types and macros, which we recommend against using
+   in public interfaces due to compiler differences.  */
+
+#if @HAVE_STDINT_H@
+# if defined __sgi && ! defined __c99
+   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
+      with "This header file is to be used only for c99 mode compilations"
+      diagnostics.  */
+#  define __STDINT_H__
+# endif
+  /* Other systems may have an incomplete or buggy <stdint.h>.
+     Include it before <inttypes.h>, since any "#include <stdint.h>"
+     in <inttypes.h> would reinclude us, skipping our contents because
+     _GL_STDINT_H is defined.
+     The include_next requires a split double-inclusion guard.  */
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#endif
+
+#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+#define _GL_STDINT_H
+
+/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
+   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
+   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
+   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+   relies on the system <stdint.h> definitions, so include
+   <sys/types.h> after @NEXT_STDINT_H@.  */
+#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
+# include <sys/types.h>
+#endif
+
+/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
+#include <limits.h>
+
+#if @HAVE_INTTYPES_H@
+  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
+     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
+     <inttypes.h> also defines intptr_t and uintptr_t.  */
+# include <inttypes.h>
+#elif @HAVE_SYS_INTTYPES_H@
+  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
+     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
+# include <sys/inttypes.h>
+#endif
+
+#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
+  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
+     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
+     included by <sys/types.h>.  */
+# include <sys/bitypes.h>
+#endif
+
+#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* Minimum and maximum values for a integer type under the usual assumption.
+   Return an unspecified value if BITS == 0, adding a check to pacify
+   picky compilers.  */
+
+#define _STDINT_MIN(signed, bits, zero) \
+  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
+
+#define _STDINT_MAX(signed, bits, zero) \
+  ((signed) \
+   ? ~ _STDINT_MIN (signed, bits, zero) \
+   : /* The expression for the unsigned case.  The subtraction of (signed) \
+       is a nop in the unsigned case and avoids "signed integer overflow" \
+       warnings in the signed case.  */ \
+     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+
+/* 7.18.1.1. Exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+#undef int8_t
+#undef uint8_t
+typedef signed char gl_int8_t;
+typedef unsigned char gl_uint8_t;
+#define int8_t gl_int8_t
+#define uint8_t gl_uint8_t
+
+#undef int16_t
+#undef uint16_t
+typedef short int gl_int16_t;
+typedef unsigned short int gl_uint16_t;
+#define int16_t gl_int16_t
+#define uint16_t gl_uint16_t
+
+#undef int32_t
+#undef uint32_t
+typedef int gl_int32_t;
+typedef unsigned int gl_uint32_t;
+#define int32_t gl_int32_t
+#define uint32_t gl_uint32_t
+
+/* Do not undefine int64_t if gnulib is not being used with 64-bit
+   types, since otherwise it breaks platforms like Tandem/NSK.  */
+#if LONG_MAX >> 31 >> 31 == 1
+# undef int64_t
+typedef long int gl_int64_t;
+# define int64_t gl_int64_t
+# define GL_INT64_T
+#elif defined _MSC_VER
+# undef int64_t
+typedef __int64 gl_int64_t;
+# define int64_t gl_int64_t
+# define GL_INT64_T
+#elif @HAVE_LONG_LONG_INT@
+# undef int64_t
+typedef long long int gl_int64_t;
+# define int64_t gl_int64_t
+# define GL_INT64_T
+#endif
+
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# undef uint64_t
+typedef unsigned long int gl_uint64_t;
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+#elif defined _MSC_VER
+# undef uint64_t
+typedef unsigned __int64 gl_uint64_t;
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# undef uint64_t
+typedef unsigned long long int gl_uint64_t;
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+#endif
+
+/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
+#define _UINT8_T
+#define _UINT32_T
+#define _UINT64_T
+
+
+/* 7.18.1.2. Minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+#undef int_least8_t
+#undef uint_least8_t
+#undef int_least16_t
+#undef uint_least16_t
+#undef int_least32_t
+#undef uint_least32_t
+#undef int_least64_t
+#undef uint_least64_t
+#define int_least8_t int8_t
+#define uint_least8_t uint8_t
+#define int_least16_t int16_t
+#define uint_least16_t uint16_t
+#define int_least32_t int32_t
+#define uint_least32_t uint32_t
+#ifdef GL_INT64_T
+# define int_least64_t int64_t
+#endif
+#ifdef GL_UINT64_T
+# define uint_least64_t uint64_t
+#endif
+
+/* 7.18.1.3. Fastest minimum-width integer types */
+
+/* Note: Other <stdint.h> substitutes may define these types differently.
+   It is not recommended to use these types in public header files. */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  Assume that 'long int'
+   is fast enough for all narrower integers.  */
+
+#undef int_fast8_t
+#undef uint_fast8_t
+#undef int_fast16_t
+#undef uint_fast16_t
+#undef int_fast32_t
+#undef uint_fast32_t
+#undef int_fast64_t
+#undef uint_fast64_t
+typedef long int gl_int_fast8_t;
+typedef unsigned long int gl_uint_fast8_t;
+typedef long int gl_int_fast16_t;
+typedef unsigned long int gl_uint_fast16_t;
+typedef long int gl_int_fast32_t;
+typedef unsigned long int gl_uint_fast32_t;
+#define int_fast8_t gl_int_fast8_t
+#define uint_fast8_t gl_uint_fast8_t
+#define int_fast16_t gl_int_fast16_t
+#define uint_fast16_t gl_uint_fast16_t
+#define int_fast32_t gl_int_fast32_t
+#define uint_fast32_t gl_uint_fast32_t
+#ifdef GL_INT64_T
+# define int_fast64_t int64_t
+#endif
+#ifdef GL_UINT64_T
+# define uint_fast64_t uint64_t
+#endif
+
+/* 7.18.1.4. Integer types capable of holding object pointers */
+
+#undef intptr_t
+#undef uintptr_t
+typedef long int gl_intptr_t;
+typedef unsigned long int gl_uintptr_t;
+#define intptr_t gl_intptr_t
+#define uintptr_t gl_uintptr_t
+
+/* 7.18.1.5. Greatest-width integer types */
+
+/* Note: These types are compiler dependent. It may be unwise to use them in
+   public header files. */
+
+#undef intmax_t
+#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+typedef long long int gl_intmax_t;
+# define intmax_t gl_intmax_t
+#elif defined GL_INT64_T
+# define intmax_t int64_t
+#else
+typedef long int gl_intmax_t;
+# define intmax_t gl_intmax_t
+#endif
+
+#undef uintmax_t
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+typedef unsigned long long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
+#elif defined GL_UINT64_T
+# define uintmax_t uint64_t
+#else
+typedef unsigned long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
+#endif
+
+/* Verify that intmax_t and uintmax_t have the same size.  Too much code
+   breaks if this is not the case.  If this check fails, the reason is likely
+   to be found in the autoconf macros.  */
+typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
+
+/* 7.18.2. Limits of specified-width integer types */
+
+#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
+
+/* 7.18.2.1. Limits of exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+#undef INT8_MIN
+#undef INT8_MAX
+#undef UINT8_MAX
+#define INT8_MIN  (~ INT8_MAX)
+#define INT8_MAX  127
+#define UINT8_MAX  255
+
+#undef INT16_MIN
+#undef INT16_MAX
+#undef UINT16_MAX
+#define INT16_MIN  (~ INT16_MAX)
+#define INT16_MAX  32767
+#define UINT16_MAX  65535
+
+#undef INT32_MIN
+#undef INT32_MAX
+#undef UINT32_MAX
+#define INT32_MIN  (~ INT32_MAX)
+#define INT32_MAX  2147483647
+#define UINT32_MAX  4294967295U
+
+#undef INT64_MIN
+#undef INT64_MAX
+#ifdef GL_INT64_T
+/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
+   evaluates the latter incorrectly in preprocessor expressions.  */
+# define INT64_MIN  (- INTMAX_C (1) << 63)
+# define INT64_MAX  INTMAX_C (9223372036854775807)
+#endif
+
+#undef UINT64_MAX
+#ifdef GL_UINT64_T
+# define UINT64_MAX  UINTMAX_C (18446744073709551615)
+#endif
+
+/* 7.18.2.2. Limits of minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+#undef INT_LEAST8_MIN
+#undef INT_LEAST8_MAX
+#undef UINT_LEAST8_MAX
+#define INT_LEAST8_MIN  INT8_MIN
+#define INT_LEAST8_MAX  INT8_MAX
+#define UINT_LEAST8_MAX  UINT8_MAX
+
+#undef INT_LEAST16_MIN
+#undef INT_LEAST16_MAX
+#undef UINT_LEAST16_MAX
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST16_MAX  INT16_MAX
+#define UINT_LEAST16_MAX  UINT16_MAX
+
+#undef INT_LEAST32_MIN
+#undef INT_LEAST32_MAX
+#undef UINT_LEAST32_MAX
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST32_MAX  INT32_MAX
+#define UINT_LEAST32_MAX  UINT32_MAX
+
+#undef INT_LEAST64_MIN
+#undef INT_LEAST64_MAX
+#ifdef GL_INT64_T
+# define INT_LEAST64_MIN  INT64_MIN
+# define INT_LEAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_LEAST64_MAX
+#ifdef GL_UINT64_T
+# define UINT_LEAST64_MAX  UINT64_MAX
+#endif
+
+/* 7.18.2.3. Limits of fastest minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  */
+
+#undef INT_FAST8_MIN
+#undef INT_FAST8_MAX
+#undef UINT_FAST8_MAX
+#define INT_FAST8_MIN  LONG_MIN
+#define INT_FAST8_MAX  LONG_MAX
+#define UINT_FAST8_MAX  ULONG_MAX
+
+#undef INT_FAST16_MIN
+#undef INT_FAST16_MAX
+#undef UINT_FAST16_MAX
+#define INT_FAST16_MIN  LONG_MIN
+#define INT_FAST16_MAX  LONG_MAX
+#define UINT_FAST16_MAX  ULONG_MAX
+
+#undef INT_FAST32_MIN
+#undef INT_FAST32_MAX
+#undef UINT_FAST32_MAX
+#define INT_FAST32_MIN  LONG_MIN
+#define INT_FAST32_MAX  LONG_MAX
+#define UINT_FAST32_MAX  ULONG_MAX
+
+#undef INT_FAST64_MIN
+#undef INT_FAST64_MAX
+#ifdef GL_INT64_T
+# define INT_FAST64_MIN  INT64_MIN
+# define INT_FAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_FAST64_MAX
+#ifdef GL_UINT64_T
+# define UINT_FAST64_MAX  UINT64_MAX
+#endif
+
+/* 7.18.2.4. Limits of integer types capable of holding object pointers */
+
+#undef INTPTR_MIN
+#undef INTPTR_MAX
+#undef UINTPTR_MAX
+#define INTPTR_MIN  LONG_MIN
+#define INTPTR_MAX  LONG_MAX
+#define UINTPTR_MAX  ULONG_MAX
+
+/* 7.18.2.5. Limits of greatest-width integer types */
+
+#undef INTMAX_MIN
+#undef INTMAX_MAX
+#ifdef INT64_MAX
+# define INTMAX_MIN  INT64_MIN
+# define INTMAX_MAX  INT64_MAX
+#else
+# define INTMAX_MIN  INT32_MIN
+# define INTMAX_MAX  INT32_MAX
+#endif
+
+#undef UINTMAX_MAX
+#ifdef UINT64_MAX
+# define UINTMAX_MAX  UINT64_MAX
+#else
+# define UINTMAX_MAX  UINT32_MAX
+#endif
+
+/* 7.18.3. Limits of other integer types */
+
+/* ptrdiff_t limits */
+#undef PTRDIFF_MIN
+#undef PTRDIFF_MAX
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
+# else
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
+# endif
+#else
+# define PTRDIFF_MIN  \
+    _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+# define PTRDIFF_MAX  \
+    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#endif
+
+/* sig_atomic_t limits */
+#undef SIG_ATOMIC_MIN
+#undef SIG_ATOMIC_MAX
+#define SIG_ATOMIC_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               0@SIG_ATOMIC_T_SUFFIX@)
+#define SIG_ATOMIC_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               0@SIG_ATOMIC_T_SUFFIX@)
+
+
+/* size_t limit */
+#undef SIZE_MAX
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
+# else
+#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
+# endif
+#else
+# define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+#endif
+
+/* wchar_t limits */
+/* Get WCHAR_MIN, WCHAR_MAX.
+   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
+   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+   <stdint.h> and assumes its types are already defined.  */
+#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# include <wchar.h>
+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+#endif
+#undef WCHAR_MIN
+#undef WCHAR_MAX
+#define WCHAR_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+#define WCHAR_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+
+/* wint_t limits */
+#undef WINT_MIN
+#undef WINT_MAX
+#define WINT_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+#define WINT_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+
+#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
+
+/* 7.18.4. Macros for integer constants */
+
+#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
+
+/* 7.18.4.1. Macros for minimum-width integer constants */
+/* According to ISO C 99 Technical Corrigendum 1 */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
+
+#undef INT8_C
+#undef UINT8_C
+#define INT8_C(x) x
+#define UINT8_C(x) x
+
+#undef INT16_C
+#undef UINT16_C
+#define INT16_C(x) x
+#define UINT16_C(x) x
+
+#undef INT32_C
+#undef UINT32_C
+#define INT32_C(x) x
+#define UINT32_C(x) x ## U
+
+#undef INT64_C
+#undef UINT64_C
+#if LONG_MAX >> 31 >> 31 == 1
+# define INT64_C(x) x##L
+#elif defined _MSC_VER
+# define INT64_C(x) x##i64
+#elif @HAVE_LONG_LONG_INT@
+# define INT64_C(x) x##LL
+#endif
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# define UINT64_C(x) x##ULL
+#endif
+
+/* 7.18.4.2. Macros for greatest-width integer constants */
+
+#undef INTMAX_C
+#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# define INTMAX_C(x)   x##LL
+#elif defined GL_INT64_T
+# define INTMAX_C(x)   INT64_C(x)
+#else
+# define INTMAX_C(x)   x##L
+#endif
+
+#undef UINTMAX_C
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x)  x##ULL
+#elif defined GL_UINT64_T
+# define UINTMAX_C(x)  UINT64_C(x)
+#else
+# define UINTMAX_C(x)  x##UL
+#endif
+
+#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
+
+#endif /* _GL_STDINT_H */
+#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
index b9572b4f046bb398572ff8d2359b63445688fbb0..c803e88c97cd0f6f5bca3d41040422289c46d7f5 100644 (file)
@@ -35,7 +35,7 @@
                         struct { unsigned char *_base; int _size; } _ub; \
                         int _ur; \
                         unsigned char _ubuf[3]; \
                         struct { unsigned char *_base; int _size; } _ub; \
                         int _ur; \
                         unsigned char _ubuf[3]; \
-                        unsigned cahr _nbuf[1]; \
+                        unsigned char _nbuf[1]; \
                         struct { unsigned char *_base; int _size; } _lb; \
                         int _blksize; \
                         fpos_t _offset; \
                         struct { unsigned char *_base; int _size; } _lb; \
                         int _blksize; \
                         fpos_t _offset; \
@@ -60,7 +60,7 @@
     };
 #  define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
 # else                                         /* FreeBSD, DragonFly, MacOS X, Cygwin */
     };
 #  define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
 # else                                         /* FreeBSD, DragonFly, MacOS X, Cygwin */
-#  define fp_ub fp->_ub
+#  define fp_ub fp_->_ub
 # endif
 
 # define HASUB(fp) (fp_ub._base != NULL)
 # endif
 
 # define HASUB(fp) (fp_ub._base != NULL)
diff --git a/lib/stdio-write.c b/lib/stdio-write.c
new file mode 100644 (file)
index 0000000..f1d0fcb
--- /dev/null
@@ -0,0 +1,148 @@
+/* POSIX compatible FILE stream write function.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Replace these functions only if module 'sigpipe' is requested.  */
+#if GNULIB_SIGPIPE
+
+/* On native Windows platforms, SIGPIPE does not exist.  When write() is
+   called on a pipe with no readers, WriteFile() fails with error
+   GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
+   error EINVAL.  This write() function is at the basis of the function
+   which flushes the buffer of a FILE stream.  */
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+#  include <errno.h>
+#  include <signal.h>
+#  include <io.h>
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
+  if (ferror (stream))                                                       \
+    return (EXPRESSION);                                                     \
+  else                                                                       \
+    {                                                                        \
+      RETTYPE ret;                                                           \
+      SetLastError (0);                                                              \
+      ret = (EXPRESSION);                                                    \
+      if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
+       {                                                                     \
+         int fd = fileno (stream);                                           \
+         if (fd >= 0                                                         \
+             && 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;                                                  \
+           }                                                                 \
+       }                                                                     \
+      return ret;                                                            \
+    }
+
+#  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
+int
+printf (const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfprintf (stdout, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+#  if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
+int
+fprintf (FILE *stream, const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfprintf (stream, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */
+int
+vprintf (const char *format, va_list args)
+{
+  return vfprintf (stdout, format, args);
+}
+#  endif
+
+#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */
+int
+vfprintf (FILE *stream, const char *format, va_list args)
+#undef vfprintf
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
+}
+#  endif
+
+int
+putchar (int c)
+{
+  return fputc (c, stdout);
+}
+
+int
+fputc (int c, FILE *stream)
+#undef fputc
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
+}
+
+int
+fputs (const char *string, FILE *stream)
+#undef fputs
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
+}
+
+int
+puts (const char *string)
+#undef puts
+{
+  FILE *stream = stdout;
+  CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
+}
+
+size_t
+fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+#undef fwrite
+{
+  CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
+}
+
+# endif
+#endif
index 434fa8e7793a25de8879982c5b458cbc5704e886..0445c6f10735579b038c75494f6d5853a063d03a 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 #if defined __need_FILE || defined __need___FILE
 /* Special invocation convention inside glibc header files.  */
 
 #if defined __need_FILE || defined __need___FILE
 /* Special invocation convention inside glibc header files.  */
 
@@ -71,6 +75,10 @@ extern "C" {
 extern int fprintf (FILE *fp, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 2, 3)));
 # endif
 extern int fprintf (FILE *fp, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 2, 3)));
 # endif
+#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
 #elif defined GNULIB_POSIXCHECK
 # undef fprintf
 # define fprintf \
 #elif defined GNULIB_POSIXCHECK
 # undef fprintf
 # define fprintf \
@@ -86,6 +94,10 @@ extern int fprintf (FILE *fp, const char *format, ...)
 extern int vfprintf (FILE *fp, const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 2, 0)));
 # endif
 extern int vfprintf (FILE *fp, const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 2, 0)));
 # endif
+#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
 #elif defined GNULIB_POSIXCHECK
 # undef vfprintf
 # define vfprintf(s,f,a) \
 #elif defined GNULIB_POSIXCHECK
 # undef vfprintf
 # define vfprintf(s,f,a) \
@@ -102,6 +114,11 @@ extern int vfprintf (FILE *fp, const char *format, va_list args)
 extern int printf (const char *format, ...)
        __attribute__ ((__format__ (__printf__, 1, 2)));
 # endif
 extern int printf (const char *format, ...)
        __attribute__ ((__format__ (__printf__, 1, 2)));
 # endif
+#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+/* Don't break __attribute__((format(printf,M,N))).  */
+# define printf __printf__
+extern int printf (const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
 #elif defined GNULIB_POSIXCHECK
 # undef printf
 # define printf \
 #elif defined GNULIB_POSIXCHECK
 # undef printf
 # define printf \
@@ -124,6 +141,10 @@ extern int printf (const char *format, ...)
 extern int vprintf (const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 1, 0)));
 # endif
 extern int vprintf (const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 1, 0)));
 # endif
+#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 1, 0)));
 #elif defined GNULIB_POSIXCHECK
 # undef vprintf
 # define vprintf(f,a) \
 #elif defined GNULIB_POSIXCHECK
 # undef vprintf
 # define vprintf(f,a) \
@@ -195,6 +216,38 @@ extern int vsprintf (char *str, const char *format, va_list args)
      vsprintf (b, f, a))
 #endif
 
      vsprintf (b, f, a))
 #endif
 
+#if @GNULIB_DPRINTF@
+# if @REPLACE_DPRINTF@
+#  define dprintf rpl_dprintf
+# endif
+# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
+extern int dprintf (int fd, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dprintf
+# define dprintf(d,f,a) \
+    (GL_LINK_WARNING ("dprintf is unportable - " \
+                      "use gnulib module dprintf for portability"), \
+     dprintf (d, f, a))
+#endif
+
+#if @GNULIB_VDPRINTF@
+# if @REPLACE_VDPRINTF@
+#  define vdprintf rpl_vdprintf
+# endif
+# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
+extern int vdprintf (int fd, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vdprintf
+# define vdprintf(d,f,a) \
+    (GL_LINK_WARNING ("vdprintf is unportable - " \
+                      "use gnulib module vdprintf for portability"), \
+     vdprintf (d, f, a))
+#endif
+
 #if @GNULIB_VASPRINTF@
 # if @REPLACE_VASPRINTF@
 #  define asprintf rpl_asprintf
 #if @GNULIB_VASPRINTF@
 # if @REPLACE_VASPRINTF@
 #  define asprintf rpl_asprintf
@@ -212,8 +265,29 @@ extern int vsprintf (char *str, const char *format, va_list args)
 # endif
 #endif
 
 # endif
 #endif
 
+#if @GNULIB_OBSTACK_PRINTF@
+# if @REPLACE_OBSTACK_PRINTF@
+#  define obstack_printf rpl_osbtack_printf
+#  define obstack_vprintf rpl_obstack_vprintf
+# endif
+# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
+  struct obstack;
+  /* Grow an obstack with formatted output.  Return the number of
+     bytes added to OBS.  No trailing nul byte is added, and the
+     object should be closed with obstack_finish before use.  Upon
+     memory allocation error, call obstack_alloc_failed_handler.  Upon
+     other error, return -1.  */
+  extern int obstack_printf (struct obstack *obs, const char *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3)));
+  extern int obstack_vprintf (struct obstack *obs, const char *format,
+                             va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#endif
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
+#  undef fopen
 #  define fopen rpl_fopen
 extern FILE * fopen (const char *filename, const char *mode);
 # endif
 #  define fopen rpl_fopen
 extern FILE * fopen (const char *filename, const char *mode);
 # endif
@@ -227,6 +301,7 @@ extern FILE * fopen (const char *filename, const char *mode);
 
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
 
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
+#  undef freopen
 #  define freopen rpl_freopen
 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
 # endif
 #  define freopen rpl_freopen
 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
 # endif
@@ -332,6 +407,75 @@ extern long rpl_ftell (FILE *fp);
     fflush (f))
 #endif
 
     fflush (f))
 #endif
 
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+#  define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
+  /* Discard all pending buffered I/O data on STREAM.
+     STREAM must not be wide-character oriented.
+     Return 0 if successful.  Upon error, return -1 and set errno.  */
+  extern int fpurge (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# define fpurge(f) \
+   (GL_LINK_WARNING ("fpurge is not always present - " \
+                     "use gnulib module fpurge for portability"), \
+    fpurge (f))
+#endif
+
+#if @GNULIB_FCLOSE@
+# if @REPLACE_FCLOSE@
+#  define fclose rpl_fclose
+  /* Close STREAM and its underlying file descriptor.  */
+extern int fclose (FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fclose
+# define fclose(f) \
+   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
+                     "use gnulib module fclose for portable " \
+                     "POSIX compliance"), \
+    fclose (f))
+#endif
+
+#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputc
+# define fputc rpl_fputc
+extern int fputc (int c, FILE *stream);
+#endif
+
+#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putc
+# define putc rpl_fputc
+extern int putc (int c, FILE *stream);
+#endif
+
+#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putchar
+# define putchar rpl_putchar
+extern int putchar (int c);
+#endif
+
+#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputs
+# define fputs rpl_fputs
+extern int fputs (const char *string, FILE *stream);
+#endif
+
+#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef puts
+# define puts rpl_puts
+extern int puts (const char *string);
+#endif
+
+#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fwrite
+# define fwrite rpl_fwrite
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+#endif
+
 #if @GNULIB_GETDELIM@
 # if !@HAVE_DECL_GETDELIM@
 /* Read input, up to (and including) the next occurrence of DELIMITER, from
 #if @GNULIB_GETDELIM@
 # if !@HAVE_DECL_GETDELIM@
 /* Read input, up to (and including) the next occurrence of DELIMITER, from
@@ -373,6 +517,22 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
    getline (l, s, f))
 #endif
 
    getline (l, s, f))
 #endif
 
+#if @GNULIB_PERROR@
+# if @REPLACE_PERROR@
+#  define perror rpl_perror
+/* Print a message to standard error, describing the value of ERRNO,
+   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
+   and terminated with a newline.  */
+extern void perror (const char *string);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef perror
+# define perror(s) \
+    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
+                      "use gnulib module perror for portability"), \
+     perror (s))
+#endif
+
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif
index b0fb12fcbc9fbcb9d86e18c24a8a22172c916281..f99767f600f6c721671db6f74b5ce79c59c28d1a 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 #if defined __need_malloc_and_calloc
 /* Special invocation convention inside glibc header files.  */
 
 #if defined __need_malloc_and_calloc
 /* Special invocation convention inside glibc header files.  */
 
 #define _GL_STDLIB_H
 
 
 #define _GL_STDLIB_H
 
 
+/* Solaris declares getloadavg() in <sys/loadavg.h>.  */
+#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+# include <sys/loadavg.h>
+#endif
+
+/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
+   from <stdlib.h> if _REENTRANT is defined.  Include it always.  */
+#if @HAVE_RANDOM_H@
+# include <random.h>
+#endif
+
+#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
+# include <stdint.h>
+#endif
+
+#if !@HAVE_STRUCT_RANDOM_DATA@
+struct random_data
+{
+  int32_t *fptr;               /* Front pointer.  */
+  int32_t *rptr;               /* Rear pointer.  */
+  int32_t *state;              /* Array of state values.  */
+  int rand_type;               /* Type of random number generator.  */
+  int rand_deg;                        /* Degree of random number generator.  */
+  int rand_sep;                        /* Distance between front and rear.  */
+  int32_t *end_ptr;            /* Pointer behind state table.  */
+};
+#endif
+
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
@@ -99,6 +131,38 @@ extern void * calloc (size_t nmemb, size_t size);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_ATOLL@
+# if !@HAVE_ATOLL@
+/* Parse a signed decimal integer.
+   Returns the value of the integer.  Errors are not detected.  */
+extern long long atoll (const char *string);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef atoll
+# define atoll(s) \
+    (GL_LINK_WARNING ("atoll is unportable - " \
+                      "use gnulib module atoll for portability"), \
+     atoll (s))
+#endif
+
+
+#if @GNULIB_GETLOADAVG@
+# if !@HAVE_DECL_GETLOADAVG@
+/* Store max(NELEM,3) load average numbers in LOADAVG[].
+   The three numbers are the load average of the last 1 minute, the last 5
+   minutes, and the last 15 minutes, respectively.
+   LOADAVG is an array of NELEM numbers.  */
+extern int getloadavg (double loadavg[], int nelem);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getloadavg
+# define getloadavg(l,n) \
+    (GL_LINK_WARNING ("getloadavg is not portable - " \
+                      "use gnulib module getloadavg for portability"), \
+     getloadavg (l, n))
+#endif
+
+
 #if @GNULIB_GETSUBOPT@
 /* Assuming *OPTIONP is a comma separated list of elements of the form
    "token" or "token=value", getsubopt parses the first of these elements.
 #if @GNULIB_GETSUBOPT@
 /* Assuming *OPTIONP is a comma separated list of elements of the form
    "token" or "token=value", getsubopt parses the first of these elements.
@@ -176,6 +240,43 @@ extern int putenv (char *string);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_RANDOM_R@
+# if !@HAVE_RANDOM_R@
+
+#  ifndef RAND_MAX
+#   define RAND_MAX 2147483647
+#  endif
+
+int srandom_r (unsigned int seed, struct random_data *rand_state);
+int initstate_r (unsigned int seed, char *buf, size_t buf_size,
+                struct random_data *rand_state);
+int setstate_r (char *arg_state, struct random_data *rand_state);
+int random_r (struct random_data *buf, int32_t *result);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef random_r
+# define random_r(b,r)                           \
+    (GL_LINK_WARNING ("random_r is unportable - " \
+                      "use gnulib module random_r for portability"), \
+     random_r (b,r))
+# undef initstate_r
+# define initstate_r(s,b,sz,r)                      \
+    (GL_LINK_WARNING ("initstate_r is unportable - " \
+                      "use gnulib module random_r for portability"), \
+     initstate_r (s,b,sz,r))
+# undef srandom_r
+# define srandom_r(s,r)                                   \
+    (GL_LINK_WARNING ("srandom_r is unportable - " \
+                      "use gnulib module random_r for portability"), \
+     srandom_r (s,r))
+# undef setstate_r
+# define setstate_r(a,r)                                   \
+    (GL_LINK_WARNING ("setstate_r is unportable - " \
+                      "use gnulib module random_r for portability"), \
+     setstate_r (a,r))
+#endif
+
+
 #if @GNULIB_RPMATCH@
 # if !@HAVE_RPMATCH@
 /* Test a user response to a question.
 #if @GNULIB_RPMATCH@
 # if !@HAVE_RPMATCH@
 /* Test a user response to a question.
@@ -231,6 +332,48 @@ extern double strtod (const char *str, char **endp);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_STRTOLL@
+# if !@HAVE_STRTOLL@
+/* Parse a signed integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
+   to ERANGE.  */
+extern long long strtoll (const char *string, char **endptr, int base);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoll
+# define strtoll(s,e,b) \
+    (GL_LINK_WARNING ("strtoll is unportable - " \
+                      "use gnulib module strtoll for portability"), \
+     strtoll (s, e, b))
+#endif
+
+
+#if @GNULIB_STRTOULL@
+# if !@HAVE_STRTOULL@
+/* Parse an unsigned integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is ULLONG_MAX, and errno is set to
+   ERANGE.  */
+extern unsigned long long strtoull (const char *string, char **endptr, int base);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoull
+# define strtoull(s,e,b) \
+    (GL_LINK_WARNING ("strtoull is unportable - " \
+                      "use gnulib module strtoull for portability"), \
+     strtoull (s, e, b))
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/streq.h b/lib/streq.h
new file mode 100644 (file)
index 0000000..80df916
--- /dev/null
@@ -0,0 +1,176 @@
+/* Optimized string comparison.
+   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#ifndef _GL_STREQ_H
+#define _GL_STREQ_H
+
+#include <string.h>
+
+/* STREQ allows to optimize string comparison with a small literal string.
+     STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+   is semantically equivalent to
+     strcmp (s, "EUC-KR") == 0
+   just faster.  */
+
+/* Help GCC to generate good code for string comparisons with
+   immediate strings. */
+#if defined (__GNUC__) && defined (__OPTIMIZE__)
+
+static inline int
+streq9 (const char *s1, const char *s2)
+{
+  return strcmp (s1 + 9, s2 + 9) == 0;
+}
+
+static inline int
+streq8 (const char *s1, const char *s2, char s28)
+{
+  if (s1[8] == s28)
+    {
+      if (s28 == 0)
+        return 1;
+      else
+        return streq9 (s1, s2);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq7 (const char *s1, const char *s2, char s27, char s28)
+{
+  if (s1[7] == s27)
+    {
+      if (s27 == 0)
+        return 1;
+      else
+        return streq8 (s1, s2, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
+{
+  if (s1[6] == s26)
+    {
+      if (s26 == 0)
+        return 1;
+      else
+        return streq7 (s1, s2, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
+{
+  if (s1[5] == s25)
+    {
+      if (s25 == 0)
+        return 1;
+      else
+        return streq6 (s1, s2, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[4] == s24)
+    {
+      if (s24 == 0)
+        return 1;
+      else
+        return streq5 (s1, s2, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[3] == s23)
+    {
+      if (s23 == 0)
+        return 1;
+      else
+        return streq4 (s1, s2, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[2] == s22)
+    {
+      if (s22 == 0)
+        return 1;
+      else
+        return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[1] == s21)
+    {
+      if (s21 == 0)
+        return 1;
+      else
+        return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[0] == s20)
+    {
+      if (s20 == 0)
+        return 1;
+      else
+        return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
+
+#else
+
+#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  (strcmp (s1, s2) == 0)
+
+#endif
+
+#endif /* _GL_STREQ_H */
index 9fe437db78df8a661bb2f6709b8d943b102832cc..dfe6c25f2faf121c921ee941bb802b68a90ba972 100644 (file)
@@ -1,6 +1,6 @@
 /* strerror.c --- POSIX compatible system error routine
 
 /* strerror.c --- POSIX compatible system error routine
 
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #if REPLACE_STRERROR
 
 
 #if REPLACE_STRERROR
 
+# include <errno.h>
 # include <stdio.h>
 
 # include <stdio.h>
 
+# if GNULIB_defined_ESOCK /* native Windows platforms */
+#  if HAVE_WINSOCK2_H
+#   include <winsock2.h>
+#  endif
+# endif
+
 # include "intprops.h"
 
 # undef strerror
 # include "intprops.h"
 
 # undef strerror
 char *
 rpl_strerror (int n)
 {
 char *
 rpl_strerror (int n)
 {
-  char *result = strerror (n);
-
-  if (result == NULL || result[0] == '\0')
+  char const *msg = NULL;
+  /* These error messages are taken from glibc/sysdeps/gnu/errlist.c.  */
+  switch (n)
     {
     {
-      static char const fmt[] = "Unknown error (%d)";
-      static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)];
-      sprintf (mesg, fmt, n);
-      return mesg;
+# if GNULIB_defined_ETXTBSY
+    case ETXTBSY:
+      msg = "Text file busy";
+      break;
+# endif
+
+# if GNULIB_defined_ESOCK /* native Windows platforms */
+    /* EWOULDBLOCK is the same as EAGAIN.  */
+    case EINPROGRESS:
+      msg = "Operation now in progress";
+      break;
+    case EALREADY:
+      msg = "Operation already in progress";
+      break;
+    case ENOTSOCK:
+      msg = "Socket operation on non-socket";
+      break;
+    case EDESTADDRREQ:
+      msg = "Destination address required";
+      break;
+    case EMSGSIZE:
+      msg = "Message too long";
+      break;
+    case EPROTOTYPE:
+      msg = "Protocol wrong type for socket";
+      break;
+    case ENOPROTOOPT:
+      msg = "Protocol not available";
+      break;
+    case EPROTONOSUPPORT:
+      msg = "Protocol not supported";
+      break;
+    case ESOCKTNOSUPPORT:
+      msg = "Socket type not supported";
+      break;
+    case EOPNOTSUPP:
+      msg = "Operation not supported";
+      break;
+    case EPFNOSUPPORT:
+      msg = "Protocol family not supported";
+      break;
+    case EAFNOSUPPORT:
+      msg = "Address family not supported by protocol";
+      break;
+    case EADDRINUSE:
+      msg = "Address already in use";
+      break;
+    case EADDRNOTAVAIL:
+      msg = "Cannot assign requested address";
+      break;
+    case ENETDOWN:
+      msg = "Network is down";
+      break;
+    case ENETUNREACH:
+      msg = "Network is unreachable";
+      break;
+    case ENETRESET:
+      msg = "Network dropped connection on reset";
+      break;
+    case ECONNABORTED:
+      msg = "Software caused connection abort";
+      break;
+    case ECONNRESET:
+      msg = "Connection reset by peer";
+      break;
+    case ENOBUFS:
+      msg = "No buffer space available";
+      break;
+    case EISCONN:
+      msg = "Transport endpoint is already connected";
+      break;
+    case ENOTCONN:
+      msg = "Transport endpoint is not connected";
+      break;
+    case ESHUTDOWN:
+      msg = "Cannot send after transport endpoint shutdown";
+      break;
+    case ETOOMANYREFS:
+      msg = "Too many references: cannot splice";
+      break;
+    case ETIMEDOUT:
+      msg = "Connection timed out";
+      break;
+    case ECONNREFUSED:
+      msg = "Connection refused";
+      break;
+    case ELOOP:
+      msg = "Too many levels of symbolic links";
+      break;
+    case EHOSTDOWN:
+      msg = "Host is down";
+      break;
+    case EHOSTUNREACH:
+      msg = "No route to host";
+      break;
+    case EPROCLIM:
+      msg = "Too many processes";
+      break;
+    case EUSERS:
+      msg = "Too many users";
+      break;
+    case EDQUOT:
+      msg = "Disk quota exceeded";
+      break;
+    case ESTALE:
+      msg = "Stale NFS file handle";
+      break;
+    case EREMOTE:
+      msg = "Object is remote";
+      break;
+#  if HAVE_WINSOCK2_H
+    /* WSA_INVALID_HANDLE maps to EBADF */
+    /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
+    /* WSA_INVALID_PARAMETER maps to EINVAL */
+    case WSA_OPERATION_ABORTED:
+      msg = "Overlapped operation aborted";
+      break;
+    case WSA_IO_INCOMPLETE:
+      msg = "Overlapped I/O event object not in signaled state";
+      break;
+    case WSA_IO_PENDING:
+      msg = "Overlapped operations will complete later";
+      break;
+    /* WSAEINTR maps to EINTR */
+    /* WSAEBADF maps to EBADF */
+    /* WSAEACCES maps to EACCES */
+    /* WSAEFAULT maps to EFAULT */
+    /* WSAEINVAL maps to EINVAL */
+    /* WSAEMFILE maps to EMFILE */
+    /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
+    /* WSAEINPROGRESS is EINPROGRESS */
+    /* WSAEALREADY is EALREADY */
+    /* WSAENOTSOCK is ENOTSOCK */
+    /* WSAEDESTADDRREQ is EDESTADDRREQ */
+    /* WSAEMSGSIZE is EMSGSIZE */
+    /* WSAEPROTOTYPE is EPROTOTYPE */
+    /* WSAENOPROTOOPT is ENOPROTOOPT */
+    /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
+    /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
+    /* WSAEOPNOTSUPP is EOPNOTSUPP */
+    /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
+    /* WSAEAFNOSUPPORT is EAFNOSUPPORT */
+    /* WSAEADDRINUSE is EADDRINUSE */
+    /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
+    /* WSAENETDOWN is ENETDOWN */
+    /* WSAENETUNREACH is ENETUNREACH */
+    /* WSAENETRESET is ENETRESET */
+    /* WSAECONNABORTED is ECONNABORTED */
+    /* WSAECONNRESET is ECONNRESET */
+    /* WSAENOBUFS is ENOBUFS */
+    /* WSAEISCONN is EISCONN */
+    /* WSAENOTCONN is ENOTCONN */
+    /* WSAESHUTDOWN is ESHUTDOWN */
+    /* WSAETOOMANYREFS is ETOOMANYREFS */
+    /* WSAETIMEDOUT is ETIMEDOUT */
+    /* WSAECONNREFUSED is ECONNREFUSED */
+    /* WSAELOOP is ELOOP */
+    /* WSAENAMETOOLONG maps to ENAMETOOLONG */
+    /* WSAEHOSTDOWN is EHOSTDOWN */
+    /* WSAEHOSTUNREACH is EHOSTUNREACH */
+    /* WSAENOTEMPTY maps to ENOTEMPTY */
+    /* WSAEPROCLIM is EPROCLIM */
+    /* WSAEUSERS is EUSERS */
+    /* WSAEDQUOT is EDQUOT */
+    /* WSAESTALE is ESTALE */
+    /* WSAEREMOTE is EREMOTE */
+    case WSASYSNOTREADY:
+      msg = "Network subsystem is unavailable";
+      break;
+    case WSAVERNOTSUPPORTED:
+      msg = "Winsock.dll version out of range";
+      break;
+    case WSANOTINITIALISED:
+      msg = "Successful WSAStartup not yet performed";
+      break;
+    case WSAEDISCON:
+      msg = "Graceful shutdown in progress";
+      break;
+    case WSAENOMORE: case WSA_E_NO_MORE:
+      msg = "No more results";
+      break;
+    case WSAECANCELLED: case WSA_E_CANCELLED:
+      msg = "Call was canceled";
+      break;
+    case WSAEINVALIDPROCTABLE:
+      msg = "Procedure call table is invalid";
+      break;
+    case WSAEINVALIDPROVIDER:
+      msg = "Service provider is invalid";
+      break;
+    case WSAEPROVIDERFAILEDINIT:
+      msg = "Service provider failed to initialize";
+      break;
+    case WSASYSCALLFAILURE:
+      msg = "System call failure";
+      break;
+    case WSASERVICE_NOT_FOUND:
+      msg = "Service not found";
+      break;
+    case WSATYPE_NOT_FOUND:
+      msg = "Class type not found";
+      break;
+    case WSAEREFUSED:
+      msg = "Database query was refused";
+      break;
+    case WSAHOST_NOT_FOUND:
+      msg = "Host not found";
+      break;
+    case WSATRY_AGAIN:
+      msg = "Nonauthoritative host not found";
+      break;
+    case WSANO_RECOVERY:
+      msg = "Nonrecoverable error";
+      break;
+    case WSANO_DATA:
+      msg = "Valid name, no data record of requested type";
+      break;
+    /* WSA_QOS_* omitted */
+#  endif
+# endif
+
+# if GNULIB_defined_ENOMSG
+    case ENOMSG:
+      msg = "No message of desired type";
+      break;
+# endif
+
+# if GNULIB_defined_EIDRM
+    case EIDRM:
+      msg = "Identifier removed";
+      break;
+# endif
+
+# if GNULIB_defined_ENOLINK
+    case ENOLINK:
+      msg = "Link has been severed";
+      break;
+# endif
+
+# if GNULIB_defined_EPROTO
+    case EPROTO:
+      msg = "Protocol error";
+      break;
+# endif
+
+# if GNULIB_defined_EMULTIHOP
+    case EMULTIHOP:
+      msg = "Multihop attempted";
+      break;
+# endif
+
+# if GNULIB_defined_EBADMSG
+    case EBADMSG:
+      msg = "Bad message";
+      break;
+# endif
+
+# if GNULIB_defined_EOVERFLOW
+    case EOVERFLOW:
+      msg = "Value too large for defined data type";
+      break;
+# endif
+
+# if GNULIB_defined_ENOTSUP
+    case ENOTSUP:
+      msg = "Not supported";
+      break;
+# endif
+
+# if GNULIB_defined_ESTALE
+    case ESTALE:
+      msg = "Stale NFS file handle";
+      break;
+# endif
+
+# if GNULIB_defined_ECANCELED
+    case ECANCELED:
+      msg = "Operation canceled";
+      break;
+# endif
     }
 
     }
 
-  return result;
+  if (msg)
+    return (char *) msg;
+
+  {
+    char *result = strerror (n);
+
+    if (result == NULL || result[0] == '\0')
+      {
+       static char const fmt[] = "Unknown error (%d)";
+       static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
+       sprintf (msg_buf, fmt, n);
+       return msg_buf;
+      }
+
+    return result;
+  }
 }
 
 #endif
 }
 
 #endif
index 41e765cc2bb3bbd2d1572f84c7e1523796af299a..97da28fb7722cbcb3ce5d16fc2683207d59df0e8 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #ifndef _GL_STRING_H
 
 
 #ifndef _GL_STRING_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_STRING_H@
 
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_STRING_H@
 
@@ -45,6 +49,21 @@ extern "C" {
 #endif
 
 
 #endif
 
 
+/* Return the first instance of C within N bytes of S, or NULL.  */
+#if @GNULIB_MEMCHR@
+# if @REPLACE_MEMCHR@
+#  define memchr rpl_memchr
+extern void *memchr (void const *__s, int __c, size_t __n)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memchr
+# define memchr(s,c,n) \
+    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
+                      "use gnulib module memchr for portability" ), \
+     memchr (s, c, n))
+#endif
+
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
 #if @GNULIB_MEMMEM@
 # if @REPLACE_MEMMEM@
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
 #if @GNULIB_MEMMEM@
 # if @REPLACE_MEMMEM@
@@ -165,7 +184,11 @@ extern char *strchrnul (char const *__s, int __c_in)
 
 /* Duplicate S, returning an identical malloc'd string.  */
 #if @GNULIB_STRDUP@
 
 /* Duplicate S, returning an identical malloc'd string.  */
 #if @GNULIB_STRDUP@
-# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
+# if @REPLACE_STRDUP@
+#  undef strdup
+#  define strdup rpl_strdup
+# endif
+# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
 extern char *strdup (char const *__s);
 # endif
 #elif defined GNULIB_POSIXCHECK
 extern char *strdup (char const *__s);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -576,6 +599,18 @@ extern char *strsignal (int __sig);
      strsignal (a))
 #endif
 
      strsignal (a))
 #endif
 
+#if @GNULIB_STRVERSCMP@
+# if !@HAVE_STRVERSCMP@
+extern int strverscmp (const char *, const char *);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strverscmp
+# define strverscmp(a, b) \
+    (GL_LINK_WARNING ("strverscmp is unportable - " \
+                      "use gnulib module strverscmp for portability"), \
+     strverscmp (a, b))
+#endif
+
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index 17b29affdd25d306e55a68e22a7bbf17fdd7611a..fa8d84a3d9c1d2569e10175500489c55e0cc8f9c 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2004-2008 Free Software Foundation, Inc.
+   Copyright (C) 2003-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #ifndef _GL_UNISTD_H
 
 
 #ifndef _GL_UNISTD_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_UNISTD_H@
 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_UNISTD_H@
 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
 #ifndef _GL_UNISTD_H
 #define _GL_UNISTD_H
 
 #ifndef _GL_UNISTD_H
 #define _GL_UNISTD_H
 
-/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
+/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
 #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
 # include <stdio.h>
 #endif
 
 /* mingw fails to declare _exit in <unistd.h>.  */
 #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
 # include <stdio.h>
 #endif
 
 /* mingw fails to declare _exit in <unistd.h>.  */
+/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
 #include <stdlib.h>
 
 #include <stdlib.h>
 
+#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+/* Get ssize_t.  */
+# include <sys/types.h>
+#endif
+
+#if @GNULIB_GETHOSTNAME@
+/* Get all possible declarations of gethostname().  */
+# if @UNISTD_H_HAVE_WINSOCK2_H@
+#  include <winsock2.h>
+#  if !defined _GL_SYS_SOCKET_H
+#   undef socket
+#   define socket              socket_used_without_including_sys_socket_h
+#   undef connect
+#   define connect             connect_used_without_including_sys_socket_h
+#   undef accept
+#   define accept              accept_used_without_including_sys_socket_h
+#   undef bind
+#   define bind                        bind_used_without_including_sys_socket_h
+#   undef getpeername
+#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   undef getsockname
+#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   undef getsockopt
+#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   undef listen
+#   define listen              listen_used_without_including_sys_socket_h
+#   undef recv
+#   define recv                        recv_used_without_including_sys_socket_h
+#   undef send
+#   define send                        send_used_without_including_sys_socket_h
+#   undef recvfrom
+#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   undef sendto
+#   define sendto              sendto_used_without_including_sys_socket_h
+#   undef setsockopt
+#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   undef shutdown
+#   define shutdown            shutdown_used_without_including_sys_socket_h
+#  endif
+#  if !defined _GL_SYS_SELECT_H
+#   undef select
+#   define select              select_used_without_including_sys_select_h
+#  endif
+# endif
+#endif
+
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
+/* OS/2 EMX lacks these macros.  */
+#ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+#endif
+#ifndef STDOUT_FILENO
+# define STDOUT_FILENO 1
+#endif
+#ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+#endif
+
 /* Declare overridden functions.  */
 
 #ifdef __cplusplus
 /* Declare overridden functions.  */
 
 #ifdef __cplusplus
@@ -68,6 +130,25 @@ extern int chown (const char *file, uid_t uid, gid_t gid);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_CLOSE@
+# if @REPLACE_CLOSE@
+/* Automatically included by modules that need a replacement for close.  */
+#  undef close
+#  define close rpl_close
+extern int close (int);
+# endif
+#elif @UNISTD_H_HAVE_WINSOCK2_H@
+# undef close
+# define close close_used_without_requesting_gnulib_module_close
+#elif defined GNULIB_POSIXCHECK
+# undef close
+# define close(f) \
+    (GL_LINK_WARNING ("close does not portably work on sockets - " \
+                      "use gnulib module close for portability"), \
+     close (f))
+#endif
+
+
 #if @GNULIB_DUP2@
 # if !@HAVE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
 #if @GNULIB_DUP2@
 # if !@HAVE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
@@ -106,6 +187,21 @@ extern char **environ;
 #endif
 
 
 #endif
 
 
+#if @GNULIB_EUIDACCESS@
+# if !@HAVE_EUIDACCESS@
+/* Like access(), except that is uses the effective user id and group id of
+   the current process.  */
+extern int euidaccess (const char *filename, int mode);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef euidaccess
+# define euidaccess(f,m) \
+    (GL_LINK_WARNING ("euidaccess is unportable - " \
+                      "use gnulib module euidaccess for portability"), \
+     euidaccess (f, m))
+#endif
+
+
 #if @GNULIB_FCHDIR@
 # if @REPLACE_FCHDIR@
 
 #if @GNULIB_FCHDIR@
 # if @REPLACE_FCHDIR@
 
@@ -116,8 +212,6 @@ extern char **environ;
    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
 extern int fchdir (int /*fd*/);
 
    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
 extern int fchdir (int /*fd*/);
 
-#  define close rpl_close
-extern int close (int);
 #  define dup rpl_dup
 extern int dup (int);
 #  define dup2 rpl_dup2
 #  define dup rpl_dup
 extern int dup (int);
 #  define dup2 rpl_dup2
@@ -133,6 +227,23 @@ extern int dup2 (int, int);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_FSYNC@
+/* Synchronize changes to a file.
+   Return 0 if successful, otherwise -1 and errno set.
+   See POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/fsync.html>.  */
+# if !@HAVE_FSYNC@
+extern int fsync (int fd);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fsync
+# define fsync(fd) \
+    (GL_LINK_WARNING ("fsync is unportable - " \
+                      "use gnulib module fsync for portability"), \
+     fsync (fd))
+#endif
+
+
 #if @GNULIB_FTRUNCATE@
 # if !@HAVE_FTRUNCATE@
 /* Change the size of the file to which FD is opened to become equal to LENGTH.
 #if @GNULIB_FTRUNCATE@
 # if !@HAVE_FTRUNCATE@
 /* Change the size of the file to which FD is opened to become equal to LENGTH.
@@ -177,6 +288,70 @@ extern char * getcwd (char *buf, size_t size);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_GETDOMAINNAME@
+/* Return the NIS domain name of the machine.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
+
+   Put up to LEN bytes of the NIS domain name into NAME.
+   Null terminate it if the name is shorter than LEN.
+   If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
+# if !@HAVE_GETDOMAINNAME@
+extern int getdomainname(char *name, size_t len);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdomainname
+# define getdomainname(n,l) \
+    (GL_LINK_WARNING ("getdomainname is unportable - " \
+                      "use gnulib module getdomainname for portability"), \
+     getdomainname (n, l))
+#endif
+
+
+#if @GNULIB_GETDTABLESIZE@
+# if !@HAVE_GETDTABLESIZE@
+/* Return the maximum number of file descriptors in the current process.  */
+extern int getdtablesize (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdtablesize
+# define getdtablesize() \
+    (GL_LINK_WARNING ("getdtablesize is unportable - " \
+                      "use gnulib module getdtablesize for portability"), \
+     getdtablesize ())
+#endif
+
+
+#if @GNULIB_GETHOSTNAME@
+/* Return the standard host name of the machine.
+   WARNING! The host name may or may not be fully qualified.
+
+   Put up to LEN bytes of the host name into NAME.
+   Null terminate it if the name is shorter than LEN.
+   If the host name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
+# if @UNISTD_H_HAVE_WINSOCK2_H@
+#  undef gethostname
+#  define gethostname rpl_gethostname
+# endif
+# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
+extern int gethostname(char *name, size_t len);
+# endif
+#elif @UNISTD_H_HAVE_WINSOCK2_H@
+# undef gethostname
+# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
+#elif defined GNULIB_POSIXCHECK
+# undef gethostname
+# define gethostname(n,l) \
+    (GL_LINK_WARNING ("gethostname is unportable - " \
+                      "use gnulib module gethostname for portability"), \
+     gethostname (n, l))
+#endif
+
+
 #if @GNULIB_GETLOGIN_R@
 /* Copies the user's login name to NAME.
    The array pointed to by NAME has room for SIZE bytes.
 #if @GNULIB_GETLOGIN_R@
 /* Copies the user's login name to NAME.
    The array pointed to by NAME has room for SIZE bytes.
@@ -258,6 +433,36 @@ extern int getpagesize (void);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_GETUSERSHELL@
+# if !@HAVE_GETUSERSHELL@
+/* Return the next valid login shell on the system, or NULL when the end of
+   the list has been reached.  */
+extern char *getusershell (void);
+/* Rewind to pointer that is advanced at each getusershell() call.  */
+extern void setusershell (void);
+/* Free the pointer that is advanced at each getusershell() call and
+   associated resources.  */
+extern void endusershell (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getusershell
+# define getusershell() \
+    (GL_LINK_WARNING ("getusershell is unportable - " \
+                      "use gnulib module getusershell for portability"), \
+     getusershell ())
+# undef setusershell
+# define setusershell() \
+    (GL_LINK_WARNING ("setusershell is unportable - " \
+                      "use gnulib module getusershell for portability"), \
+     setusershell ())
+# undef endusershell
+# define endusershell() \
+    (GL_LINK_WARNING ("endusershell is unportable - " \
+                      "use gnulib module getusershell for portability"), \
+     endusershell ())
+#endif
+
+
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
@@ -277,6 +482,23 @@ extern int lchown (char const *file, uid_t owner, gid_t group);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_LINK@
+/* Create a new hard link for an existing file.
+   Return 0 if successful, otherwise -1 and errno set.
+   See POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/link.html>.  */
+# if !@HAVE_LINK@
+extern int link (const char *path1, const char *path2);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef link
+# define link(path1,path2) \
+    (GL_LINK_WARNING ("link is unportable - " \
+                      "use gnulib module link for portability"), \
+     link (path1, path2))
+#endif
+
+
 #if @GNULIB_LSEEK@
 # if @REPLACE_LSEEK@
 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
 #if @GNULIB_LSEEK@
 # if @REPLACE_LSEEK@
 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
@@ -331,6 +553,22 @@ extern unsigned int sleep (unsigned int n);
 #endif
 
 
 #endif
 
 
+#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+/* Write up to COUNT bytes starting at BUF to file descriptor FD.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/write.html>.  */
+# undef write
+# define write rpl_write
+extern ssize_t write (int fd, const void *buf, size_t count);
+#endif
+
+
+#ifdef FCHDIR_REPLACEMENT
+/* gnulib internal function.  */
+extern void _gl_unregister_fd (int fd);
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/verify.h b/lib/verify.h
new file mode 100644 (file)
index 0000000..fac53f6
--- /dev/null
@@ -0,0 +1,140 @@
+/* Compile-time assert-like macros.
+
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#ifndef VERIFY_H
+# define VERIFY_H 1
+
+/* 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.
+
+   There are two macros, since no single macro can be used in all
+   contexts in C.  verify_true (R) is for scalar contexts, including
+   integer constant expression contexts.  verify (R) is for declaration
+   contexts, e.g., the top level.
+
+   Symbols ending in "__" are private to this header.
+
+   The code below uses several ideas.
+
+   * The first step is ((R) ? 1 : -1).  Given an expression R, of
+     integral or boolean or floating-point type, this yields an
+     expression of integral type, whose value is later verified to be
+     constant and nonnegative.
+
+   * Next this expression W is wrapped in a type
+     struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
+     If W is negative, this yields a compile-time error.  No compiler can
+     deal with a bit-field of negative size.
+
+     One might think that an array size check would have the same
+     effect, that is, that the type struct { unsigned int dummy[W]; }
+     would work as well.  However, inside a function, some compilers
+     (such as C++ compilers and GNU C) allow local parameters and
+     variables inside array size expressions.  With these compilers,
+     an array size check would not properly diagnose this misuse of
+     the verify macro:
+
+       void function (int n) { verify (n < 0); }
+
+   * For the verify macro, the struct verify_type__ will need to
+     somehow be embedded into a declaration.  To be portable, this
+     declaration must declare an object, a constant, a function, or a
+     typedef name.  If the declared entity uses the type directly,
+     such as in
+
+       struct dummy {...};
+       typedef struct {...} dummy;
+       extern struct {...} *dummy;
+       extern void dummy (struct {...} *);
+       extern struct {...} *dummy (void);
+
+     two uses of the verify macro would yield colliding declarations
+     if the entity names are not disambiguated.  A workaround is to
+     attach the current line number to the entity name:
+
+       #define GL_CONCAT0(x, y) x##y
+       #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
+       extern struct {...} * GL_CONCAT(dummy,__LINE__);
+
+     But this has the problem that two invocations of verify from
+     within the same macro would collide, since the __LINE__ value
+     would be the same for both invocations.
+
+     A solution is to use the sizeof operator.  It yields a number,
+     getting rid of the identity of the type.  Declarations like
+
+       extern int dummy [sizeof (struct {...})];
+       extern void dummy (int [sizeof (struct {...})]);
+       extern int (*dummy (void)) [sizeof (struct {...})];
+
+     can be repeated.
+
+   * Should the implementation use a named struct or an unnamed struct?
+     Which of the following alternatives can be used?
+
+       extern int dummy [sizeof (struct {...})];
+       extern int dummy [sizeof (struct verify_type__ {...})];
+       extern void dummy (int [sizeof (struct {...})]);
+       extern void dummy (int [sizeof (struct verify_type__ {...})]);
+       extern int (*dummy (void)) [sizeof (struct {...})];
+       extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
+
+     In the second and sixth case, the struct type is exported to the
+     outer scope; two such declarations therefore collide.  GCC warns
+     about the first, third, and fourth cases.  So the only remaining
+     possibility is the fifth case:
+
+       extern int (*dummy (void)) [sizeof (struct {...})];
+
+   * 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, e.g.,:
+
+       #if 4 <= __GNUC__
+       # define verify(R) \
+          extern int (* verify_function__ (void)) \
+                     [__builtin_constant_p (R) && (R) ? 1 : -1]
+       #endif
+
+   * In C++, any struct definition inside sizeof is invalid.
+     Use a template type to work around the problem.  */
+
+
+/* Verify requirement R at compile-time, as an integer constant expression.
+   Return 1.  */
+
+# ifdef __cplusplus
+template <int w>
+  struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
+#  define verify_true(R) \
+     (!!sizeof (verify_type__<(R) ? 1 : -1>))
+# else
+#  define verify_true(R) \
+     (!!sizeof \
+      (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
+# endif
+
+/* Verify requirement R at compile-time, as a declaration without a
+   trailing ';'.  */
+
+# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
+
+#endif
index f7961679710cc09b258f8d32a2d9be08558ffbed..cc5baad3c07c8e624bf3d5b05a590ebd571a63c6 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
  * the declaration of wcwidth().
  */
 
  * the declaration of wcwidth().
  */
 
-#ifdef __need_mbstate_t
-/* Special invocation convention inside uClibc header files.  */
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+/* Special invocation convention:
+   - Inside uClibc header files.
+   - On HP-UX 11.00 we have a sequence of nested includes
+     <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
+     once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
+     and once directly.  In both situations 'wint_t' is not yet defined,
+     therefore we cannot provide the function overrides; instead include only
+     the system's <wchar.h>.
+   - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
+     the latter includes <wchar.h>.  But here, we have no way to detect whether
+     <wctype.h> is completely included or is still being included.  */
 
 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
 
 
 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
 
@@ -36,6 +50,8 @@
 
 #ifndef _GL_WCHAR_H
 
 
 #ifndef _GL_WCHAR_H
 
+#define _GL_ALREADY_INCLUDING_WCHAR_H
+
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -51,6 +67,8 @@
 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
 #endif
 
 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
 #endif
 
+#undef _GL_ALREADY_INCLUDING_WCHAR_H
+
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
@@ -61,6 +79,207 @@ extern "C" {
 #endif
 
 
 #endif
 
 
+/* Define wint_t.  (Also done in wctype.in.h.)  */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+# ifndef WEOF
+#  define WEOF -1
+# endif
+#endif
+
+
+/* Override mbstate_t if it is too small.
+   On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
+   implementing mbrtowc for encodings like UTF-8.  */
+#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+typedef int rpl_mbstate_t;
+# undef mbstate_t
+# define mbstate_t rpl_mbstate_t
+# define GNULIB_defined_mbstate_t 1
+#endif
+
+
+/* Convert a single-byte character to a wide character.  */
+#if @GNULIB_BTOWC@
+# if @REPLACE_BTOWC@
+#  undef btowc
+#  define btowc rpl_btowc
+# endif
+# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@
+extern wint_t btowc (int c);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef btowc
+# define btowc(c) \
+    (GL_LINK_WARNING ("btowc is unportable - " \
+                      "use gnulib module btowc for portability"), \
+     btowc (c))
+#endif
+
+
+/* Convert a wide character to a single-byte character.  */
+#if @GNULIB_WCTOB@
+# if @REPLACE_WCTOB@
+#  undef wctob
+#  define wctob rpl_wctob
+# endif
+# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@
+/* wctob is provided by gnulib, or wctob exists but is not declared.  */
+extern int wctob (wint_t wc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wctob
+# define wctob(w) \
+    (GL_LINK_WARNING ("wctob is unportable - " \
+                      "use gnulib module wctob for portability"), \
+     wctob (w))
+#endif
+
+
+/* Test whether *PS is in the initial state.  */
+#if @GNULIB_MBSINIT@
+# if @REPLACE_MBSINIT@
+#  undef mbsinit
+#  define mbsinit rpl_mbsinit
+# endif
+# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@
+extern int mbsinit (const mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsinit
+# define mbsinit(p) \
+    (GL_LINK_WARNING ("mbsinit is unportable - " \
+                      "use gnulib module mbsinit for portability"), \
+     mbsinit (p))
+#endif
+
+
+/* Convert a multibyte character to a wide character.  */
+#if @GNULIB_MBRTOWC@
+# if @REPLACE_MBRTOWC@
+#  undef mbrtowc
+#  define mbrtowc rpl_mbrtowc
+# endif
+# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@
+extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrtowc
+# define mbrtowc(w,s,n,p) \
+    (GL_LINK_WARNING ("mbrtowc is unportable - " \
+                      "use gnulib module mbrtowc for portability"), \
+     mbrtowc (w, s, n, p))
+#endif
+
+
+/* Recognize a multibyte character.  */
+#if @GNULIB_MBRLEN@
+# if @REPLACE_MBRLEN@
+#  undef mbrlen
+#  define mbrlen rpl_mbrlen
+# endif
+# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@
+extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrlen
+# define mbrlen(s,n,p) \
+    (GL_LINK_WARNING ("mbrlen is unportable - " \
+                      "use gnulib module mbrlen for portability"), \
+     mbrlen (s, n, p))
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSRTOWCS@
+# if @REPLACE_MBSRTOWCS@
+#  undef mbsrtowcs
+#  define mbsrtowcs rpl_mbsrtowcs
+# endif
+# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsrtowcs
+# define mbsrtowcs(d,s,l,p) \
+    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
+                      "use gnulib module mbsrtowcs for portability"), \
+     mbsrtowcs (d, s, l, p))
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSNRTOWCS@
+# if @REPLACE_MBSNRTOWCS@
+#  undef mbsnrtowcs
+#  define mbsnrtowcs rpl_mbsnrtowcs
+# endif
+# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsnrtowcs
+# define mbsnrtowcs(d,s,n,l,p) \
+    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
+                      "use gnulib module mbsnrtowcs for portability"), \
+     mbsnrtowcs (d, s, n, l, p))
+#endif
+
+
+/* Convert a wide character to a multibyte character.  */
+#if @GNULIB_WCRTOMB@
+# if @REPLACE_WCRTOMB@
+#  undef wcrtomb
+#  define wcrtomb rpl_wcrtomb
+# endif
+# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@
+extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcrtomb
+# define wcrtomb(s,w,p) \
+    (GL_LINK_WARNING ("wcrtomb is unportable - " \
+                      "use gnulib module wcrtomb for portability"), \
+     wcrtomb (s, w, p))
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSRTOMBS@
+# if @REPLACE_WCSRTOMBS@
+#  undef wcsrtombs
+#  define wcsrtombs rpl_wcsrtombs
+# endif
+# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsrtombs
+# define wcsrtombs(d,s,l,p) \
+    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
+                      "use gnulib module wcsrtombs for portability"), \
+     wcsrtombs (d, s, l, p))
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSNRTOMBS@
+# if @REPLACE_WCSNRTOMBS@
+#  undef wcsnrtombs
+#  define wcsnrtombs rpl_wcsnrtombs
+# endif
+# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsnrtombs
+# define wcsnrtombs(d,s,n,l,p) \
+    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
+                      "use gnulib module wcsnrtombs for portability"), \
+     wcsnrtombs (d, s, n, l, p))
+#endif
+
+
 /* Return the number of screen columns needed for WC.  */
 #if @GNULIB_WCWIDTH@
 # if @REPLACE_WCWIDTH@
 /* Return the number of screen columns needed for WC.  */
 #if @GNULIB_WCWIDTH@
 # if @REPLACE_WCWIDTH@
index 1bb5228c7ff86db52552d82df35fb71fc9917313..f008d8ffd6b1d53f877808fd8123330ddc4b237d 100644 (file)
 
 #ifndef _GL_WCTYPE_H
 
 
 #ifndef _GL_WCTYPE_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 #if @HAVE_WINT_T@
 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
    Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
 #if @HAVE_WINT_T@
 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
    Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
 #ifndef _GL_WCTYPE_H
 #define _GL_WCTYPE_H
 
 #ifndef _GL_WCTYPE_H
 #define _GL_WCTYPE_H
 
-#if @HAVE_WINT_T@
-typedef wint_t __wctype_wint_t;
-#else
-typedef int __wctype_wint_t;
+/* Define wint_t.  (Also done in wchar.in.h.)  */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+# ifndef WEOF
+#  define WEOF -1
+# endif
 #endif
 
 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
 #endif
 
 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
@@ -96,56 +102,56 @@ typedef int __wctype_wint_t;
 #  endif
 
 static inline int
 #  endif
 
 static inline int
-iswalnum (__wctype_wint_t wc)
+iswalnum (wint_t wc)
 {
   return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
 }
 
 static inline int
 {
   return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
 }
 
 static inline int
-iswalpha (__wctype_wint_t wc)
+iswalpha (wint_t wc)
 {
   return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
 }
 
 static inline int
 {
   return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
 }
 
 static inline int
-iswblank (__wctype_wint_t wc)
+iswblank (wint_t wc)
 {
   return wc == ' ' || wc == '\t';
 }
 
 static inline int
 {
   return wc == ' ' || wc == '\t';
 }
 
 static inline int
-iswcntrl (__wctype_wint_t wc)
+iswcntrl (wint_t wc)
 {
   return (wc & ~0x1f) == 0 || wc == 0x7f;
 }
 
 static inline int
 {
   return (wc & ~0x1f) == 0 || wc == 0x7f;
 }
 
 static inline int
-iswdigit (__wctype_wint_t wc)
+iswdigit (wint_t wc)
 {
   return wc >= '0' && wc <= '9';
 }
 
 static inline int
 {
   return wc >= '0' && wc <= '9';
 }
 
 static inline int
-iswgraph (__wctype_wint_t wc)
+iswgraph (wint_t wc)
 {
   return wc >= '!' && wc <= '~';
 }
 
 static inline int
 {
   return wc >= '!' && wc <= '~';
 }
 
 static inline int
-iswlower (__wctype_wint_t wc)
+iswlower (wint_t wc)
 {
   return wc >= 'a' && wc <= 'z';
 }
 
 static inline int
 {
   return wc >= 'a' && wc <= 'z';
 }
 
 static inline int
-iswprint (__wctype_wint_t wc)
+iswprint (wint_t wc)
 {
   return wc >= ' ' && wc <= '~';
 }
 
 static inline int
 {
   return wc >= ' ' && wc <= '~';
 }
 
 static inline int
-iswpunct (__wctype_wint_t wc)
+iswpunct (wint_t wc)
 {
   return (wc >= '!' && wc <= '~'
          && !((wc >= '0' && wc <= '9')
 {
   return (wc >= '!' && wc <= '~'
          && !((wc >= '0' && wc <= '9')
@@ -153,20 +159,20 @@ iswpunct (__wctype_wint_t wc)
 }
 
 static inline int
 }
 
 static inline int
-iswspace (__wctype_wint_t wc)
+iswspace (wint_t wc)
 {
   return (wc == ' ' || wc == '\t'
          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
 }
 
 static inline int
 {
   return (wc == ' ' || wc == '\t'
          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
 }
 
 static inline int
-iswupper (__wctype_wint_t wc)
+iswupper (wint_t wc)
 {
   return wc >= 'A' && wc <= 'Z';
 }
 
 static inline int
 {
   return wc >= 'A' && wc <= 'Z';
 }
 
 static inline int
-iswxdigit (__wctype_wint_t wc)
+iswxdigit (wint_t wc)
 {
   return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
 {
   return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
index 89ecf17ad0851dc47687ac3e323e6743a2f942b3..585fb4b1e860c27f5140d60c9847a0f8e8beab53 100644 (file)
@@ -1,7 +1,7 @@
 /* xmalloc.c -- malloc with out of memory checking
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
 /* xmalloc.c -- malloc with out of memory checking
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation,
+   1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008-2009 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
    Inc.
 
    This program is free software: you can redistribute it and/or modify
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
 /* 1 if calloc is known to be compatible with GNU calloc.  This
    matters if we are not also using the calloc module, which defines
    HAVE_CALLOC and supports the GNU API even on non-GNU platforms.  */
 /* 1 if calloc is known to be compatible with GNU calloc.  This
    matters if we are not also using the calloc module, which defines
    HAVE_CALLOC and supports the GNU API even on non-GNU platforms.  */
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
new file mode 100644 (file)
index 0000000..d4d04d1
--- /dev/null
@@ -0,0 +1,30 @@
+# 00gnulib.m4 serial 2
+dnl Copyright (C) 2009 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 This file must be named something that sorts before all other
+dnl gnulib-provided .m4 files.  It is needed until such time as we can
+dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics.
+
+# AC_DEFUN_ONCE([NAME], VALUE)
+# ----------------------------
+# Define NAME to expand to VALUE on the first use (whether by direct
+# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
+# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier.  This
+# definition is slower than the version in Autoconf 2.64, because it
+# can only use interfaces that existed since 2.59; but it achieves the
+# same effect.  Quoting is necessary to avoid confusing Automake.
+m4_version_prereq([2.63.263], [],
+[m4_define([AC][_DEFUN_ONCE],
+  [AC][_DEFUN([$1],
+    [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
+      [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
+[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
+
+# gl_00GNULIB
+# -----------
+# Witness macro that this file has been included.  Needed to force
+# Automake to include this file prior to all other gnulib .m4 files.
+AC_DEFUN([gl_00GNULIB])
index 95f54a6d48c08452ba0f2eaef811c72ce2748825..4b978e137cbe7c2d9f76baa6546764f6e2f7a0a6 100644 (file)
@@ -1,5 +1,5 @@
-# alloca.m4 serial 8
-dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc.
+# alloca.m4 serial 9
+dnl Copyright (C) 2002-2004, 2006, 2007, 2009 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 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.
@@ -26,7 +26,7 @@ AC_DEFUN([gl_FUNC_ALLOCA],
     ])
     if test $gl_cv_rpl_alloca = yes; then
       dnl OK, alloca can be implemented through a compiler built-in.
     ])
     if test $gl_cv_rpl_alloca = yes; then
       dnl OK, alloca can be implemented through a compiler built-in.
-      AC_DEFINE([HAVE_ALLOCA], 1,
+      AC_DEFINE([HAVE_ALLOCA], [1],
         [Define to 1 if you have 'alloca' after including <alloca.h>,
          a header that may be supplied by this distribution.])
       ALLOCA_H=alloca.h
         [Define to 1 if you have 'alloca' after including <alloca.h>,
          a header that may be supplied by this distribution.])
       ALLOCA_H=alloca.h
diff --git a/m4/codeset.m4 b/m4/codeset.m4
new file mode 100644 (file)
index 0000000..413217b
--- /dev/null
@@ -0,0 +1,21 @@
+# codeset.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 2000-2002, 2006, 2008, 2009 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.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+  AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
+    [AC_TRY_LINK([#include <langinfo.h>],
+      [char* cs = nl_langinfo(CODESET); return !cs;],
+      [am_cv_langinfo_codeset=yes],
+      [am_cv_langinfo_codeset=no])
+    ])
+  if test $am_cv_langinfo_codeset = yes; then
+    AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
+      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+  fi
+])
diff --git a/m4/eoverflow.m4 b/m4/eoverflow.m4
deleted file mode 100644 (file)
index 3bffd10..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# eoverflow.m4 serial 2
-dnl Copyright (C) 2004, 2006 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.
-
-# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
-# POSIX.  But some systems (like AIX 3) don't define it, and some systems
-# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
-
-# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
-# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
-# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
-#    value.
-
-AC_DEFUN([gl_EOVERFLOW],
-[
-  AC_REQUIRE([AC_PROG_CC])dnl
-
-  AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
-    AC_EGREP_CPP(yes,[
-#include <errno.h>
-#ifdef EOVERFLOW
-yes
-#endif
-      ], have_eoverflow=1)
-    if test -n "$have_eoverflow"; then
-      dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
-      ac_cv_decl_EOVERFLOW=yes
-    else
-      AC_EGREP_CPP(yes,[
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-#ifdef EOVERFLOW
-yes
-#endif
-        ], have_eoverflow=1)
-      if test -n "$have_eoverflow"; then
-        dnl EOVERFLOW exists but is hidden.
-        dnl Define it to the same value.
-        AC_COMPUTE_INT([ac_cv_decl_EOVERFLOW], [EOVERFLOW], [
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-/* The following two lines are a workaround against an autoconf-2.52 bug.  */
-#include <stdio.h>
-#include <stdlib.h>
-])
-      else
-        dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
-        dnl don't define it as EINVAL, because snprintf() callers want to
-        dnl distinguish EINVAL and EOVERFLOW.
-        ac_cv_decl_EOVERFLOW=E2BIG
-      fi
-    fi
-  ])
-  if test "$ac_cv_decl_EOVERFLOW" != yes; then
-    AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
-                       [Define as good substitute value for EOVERFLOW.])
-    EOVERFLOW="$ac_cv_decl_EOVERFLOW"
-    AC_SUBST(EOVERFLOW)
-  fi
-])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
-  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
new file mode 100644 (file)
index 0000000..4ce1ccb
--- /dev/null
@@ -0,0 +1,115 @@
+# errno_h.m4 serial 6
+dnl Copyright (C) 2004, 2006, 2008, 2009 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_ONCE([gl_HEADER_ERRNO_H],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
+    AC_EGREP_CPP([booboo],[
+#include <errno.h>
+#if !defined ENOMSG
+booboo
+#endif
+#if !defined EIDRM
+booboo
+#endif
+#if !defined ENOLINK
+booboo
+#endif
+#if !defined EPROTO
+booboo
+#endif
+#if !defined EMULTIHOP
+booboo
+#endif
+#if !defined EBADMSG
+booboo
+#endif
+#if !defined EOVERFLOW
+booboo
+#endif
+#if !defined ENOTSUP
+booboo
+#endif
+#if !defined ESTALE
+booboo
+#endif
+#if !defined ECANCELED
+booboo
+#endif
+      ],
+      [gl_cv_header_errno_h_complete=no],
+      [gl_cv_header_errno_h_complete=yes])
+  ])
+  if test $gl_cv_header_errno_h_complete = yes; then
+    ERRNO_H=''
+  else
+    gl_CHECK_NEXT_HEADERS([errno.h])
+    ERRNO_H='errno.h'
+  fi
+  AC_SUBST([ERRNO_H])
+  gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
+  gl_REPLACE_ERRNO_VALUE([ENOLINK])
+  gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
+])
+
+# Assuming $1 = EOVERFLOW.
+# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
+# POSIX.  But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
+# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
+# Check for the value of EOVERFLOW.
+# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
+AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
+[
+  if test -n "$ERRNO_H"; then
+    AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
+      AC_EGREP_CPP([yes],[
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+      ],
+      [gl_cv_header_errno_h_]$1[=yes],
+      [gl_cv_header_errno_h_]$1[=no])
+      if test $gl_cv_header_errno_h_]$1[ = no; then
+        AC_EGREP_CPP([yes],[
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+          ], [gl_cv_header_errno_h_]$1[=hidden])
+        if test $gl_cv_header_errno_h_]$1[ = hidden; then
+          dnl The macro exists but is hidden.
+          dnl Define it to the same value.
+          AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+/* The following two lines are a workaround against an autoconf-2.52 bug.  */
+#include <stdio.h>
+#include <stdlib.h>
+])
+        fi
+      fi
+    ])
+    case $gl_cv_header_errno_h_]$1[ in
+      yes | no)
+        ]$1[_HIDDEN=0; ]$1[_VALUE=
+        ;;
+      *)
+        ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
+        ;;
+    esac
+    AC_SUBST($1[_HIDDEN])
+    AC_SUBST($1[_VALUE])
+  fi
+])
+
+dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
+dnl Remove this when we can assume autoconf >= 2.61.
+m4_ifdef([AC_COMPUTE_INT], [], [
+  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
+])
index 917af9480549ed985f0d4a1e84b9e19a8f2a83ee..ba6d5e190f9f2df6ae1b080fc8f2d16490b5e3b2 100644 (file)
@@ -1,7 +1,7 @@
-# serial 5  -*- Autoconf -*-
+# serial 8  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2009 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.
 # 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_DEFINE.  The goal here is to define all known feature-enabling
 # macros, then, if reports of conflicts are made, disable macros that
 # cause problems on some platforms (such as __EXTENSIONS__).
 # AC_DEFINE.  The goal here is to define all known feature-enabling
 # macros, then, if reports of conflicts are made, disable macros that
 # cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
   AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
   if test "$MINIX" = yes; then
     AC_DEFINE([_POSIX_SOURCE], [1],
   AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
   if test "$MINIX" = yes; then
     AC_DEFINE([_POSIX_SOURCE], [1],
@@ -36,6 +38,16 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
       [Define to 1 if on MINIX.])
   fi
 
       [Define to 1 if on MINIX.])
   fi
 
+  dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
+  dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
+  dnl provided.
+  case "$host_os" in
+    hpux*)
+      AC_DEFINE([_XOPEN_SOURCE], [500],
+        [Define to 500 only on HP-UX.])
+      ;;
+  esac
+
   AH_VERBATIM([__EXTENSIONS__],
 [/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
   AH_VERBATIM([__EXTENSIONS__],
 [/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
@@ -78,5 +90,15 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
-AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-  [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
+AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
+[
+  dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
+  dnl gnulib does not need it. But if it gets required by third-party macros
+  dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
+  dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
+  dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
+  dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
index 18b96bef85d547dc5cbe6279bc6ff5a80ffeea6f..7760f8279bd9b8df7ab5982781f656068454d5e6 100644 (file)
@@ -31,4 +31,5 @@ AC_DEFUN([gl_FUNC_GETDELIM],
 AC_DEFUN([gl_PREREQ_GETDELIM],
 [
   AC_CHECK_FUNCS([flockfile funlockfile])
 AC_DEFUN([gl_PREREQ_GETDELIM],
 [
   AC_CHECK_FUNCS([flockfile funlockfile])
+  AC_CHECK_DECLS([getc_unlocked])
 ])
 ])
index 57625da5c9d7f5d6279ef8d2826c3ece3f3aa4b7..99933455f094b07d37d675e109de3b6483537f91 100644 (file)
@@ -1,7 +1,6 @@
-# getline.m4 serial 18
+# getline.m4 serial 19
 
 
-dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free
-dnl Software Foundation, Inc.
+dnl Copyright (C) 1998-2003, 2005-2007, 2009 Free Software Foundation, Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +9,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_PREREQ([2.59])
 
 dnl See if there's a working, system-supplied version of the getline function.
 AC_PREREQ([2.59])
 
 dnl See if there's a working, system-supplied version of the getline function.
-dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
+dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems
 dnl have a function by that name in -linet that doesn't have anything
 dnl to do with the function we need.
 AC_DEFUN([gl_FUNC_GETLINE],
 dnl have a function by that name in -linet that doesn't have anything
 dnl to do with the function we need.
 AC_DEFUN([gl_FUNC_GETLINE],
@@ -23,12 +22,12 @@ AC_DEFUN([gl_FUNC_GETLINE],
   AC_CHECK_DECLS_ONCE([getline])
 
   gl_getline_needs_run_time_check=no
   AC_CHECK_DECLS_ONCE([getline])
 
   gl_getline_needs_run_time_check=no
-  AC_CHECK_FUNC(getline,
+  AC_CHECK_FUNC([getline],
                dnl Found it in some library.  Verify that it works.
                gl_getline_needs_run_time_check=yes,
                am_cv_func_working_getline=no)
   if test $gl_getline_needs_run_time_check = yes; then
                dnl Found it in some library.  Verify that it works.
                gl_getline_needs_run_time_check=yes,
                am_cv_func_working_getline=no)
   if test $gl_getline_needs_run_time_check = yes; then
-    AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
+    AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
     AC_TRY_RUN([
 #    include <stdio.h>
     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
     AC_TRY_RUN([
 #    include <stdio.h>
index 54348ce7c7c06f6a8a884ad6c99593292b9f8505..3b55ee48ec8d3c9b46ae3a6d3f841ff57d3822a3 100644 (file)
@@ -1,5 +1,5 @@
-# getpass.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
+# getpass.m4 serial 11
+dnl Copyright (C) 2002-2003, 2005-2006, 2009 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 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.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
 # Provide a getpass() function if the system doesn't have it.
 AC_DEFUN([gl_FUNC_GETPASS],
 [
 # Provide a getpass() function if the system doesn't have it.
 AC_DEFUN([gl_FUNC_GETPASS],
 [
-  AC_REPLACE_FUNCS(getpass)
-  AC_CHECK_DECLS_ONCE(getpass)
+  AC_REPLACE_FUNCS([getpass])
+  AC_CHECK_DECLS_ONCE([getpass])
   if test $ac_cv_func_getpass = no; then
     gl_PREREQ_GETPASS
   fi
   if test $ac_cv_func_getpass = no; then
     gl_PREREQ_GETPASS
   fi
@@ -18,9 +18,9 @@ AC_DEFUN([gl_FUNC_GETPASS],
 # arbitrary length (not just 8 bytes as on HP-UX).
 AC_DEFUN([gl_FUNC_GETPASS_GNU],
 [
 # arbitrary length (not just 8 bytes as on HP-UX).
 AC_DEFUN([gl_FUNC_GETPASS_GNU],
 [
-  AC_CHECK_DECLS_ONCE(getpass)
+  AC_CHECK_DECLS_ONCE([getpass])
   dnl TODO: Detect when GNU getpass() is already found in glibc.
   dnl TODO: Detect when GNU getpass() is already found in glibc.
-  AC_LIBOBJ(getpass)
+  AC_LIBOBJ([getpass])
   gl_PREREQ_GETPASS
   dnl We must choose a different name for our function, since on ELF systems
   dnl an unusable getpass() in libc.so would override our getpass() if it is
   gl_PREREQ_GETPASS
   dnl We must choose a different name for our function, since on ELF systems
   dnl an unusable getpass() in libc.so would override our getpass() if it is
@@ -31,8 +31,8 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU],
 
 # Prerequisites of lib/getpass.c.
 AC_DEFUN([gl_PREREQ_GETPASS], [
 
 # Prerequisites of lib/getpass.c.
 AC_DEFUN([gl_PREREQ_GETPASS], [
-  AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h)
-  AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr)
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
+  AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
   AC_CHECK_DECLS([__fsetlocking],,,
     [#include <stdio.h>
      #if HAVE_STDIO_EXT_H
   AC_CHECK_DECLS([__fsetlocking],,,
     [#include <stdio.h>
      #if HAVE_STDIO_EXT_H
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
new file mode 100644 (file)
index 0000000..93fbf47
--- /dev/null
@@ -0,0 +1,30 @@
+# glibc21.m4 serial 4
+dnl Copyright (C) 2000-2002, 2004, 2008 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.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([gl_GLIBC21],
+  [
+    AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer],
+      [ac_cv_gnu_library_2_1],
+      [AC_EGREP_CPP([Lucky GNU user],
+       [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+  Lucky GNU user
+ #endif
+#endif
+       ],
+       [ac_cv_gnu_library_2_1=yes],
+       [ac_cv_gnu_library_2_1=no])
+      ]
+    )
+    AC_SUBST([GLIBC21])
+    GLIBC21="$ac_cv_gnu_library_2_1"
+  ]
+)
index 508da7f144ca71e09ec16fe97a0ed1f1f2cb136b..5959c3f34777ecf9f3e275a0822a6a35a0980941 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 
 
 # Specification in the form of a command-line invocation:
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
-gl_MODULES([alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg])
+gl_MODULES([
+  alloca
+  c-ctype
+  getopt
+  getpass-gnu
+  maintainer-makefile
+  quote
+  quotearg
+])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
index 34d91c728f0765ebfd801df3973604d15814c9d9..c8fda2033045d38975415f240bd9a72a14a2c949 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 5
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 11
+dnl Copyright (C) 2007-2009 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 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.
@@ -8,6 +8,7 @@ dnl with or without modifications, as long as this notice is preserved.
 # is expanded unconditionally through gnulib-tool magic.
 AC_DEFUN([gl_COMMON], [
   dnl Use AC_REQUIRE here, so that the code is expanded once only.
 # is expanded unconditionally through gnulib-tool magic.
 AC_DEFUN([gl_COMMON], [
   dnl Use AC_REQUIRE here, so that the code is expanded once only.
+  AC_REQUIRE([gl_00GNULIB])
   AC_REQUIRE([gl_COMMON_BODY])
 ])
 AC_DEFUN([gl_COMMON_BODY], [
   AC_REQUIRE([gl_COMMON_BODY])
 ])
 AC_DEFUN([gl_COMMON_BODY], [
@@ -21,6 +22,16 @@ AC_DEFUN([gl_COMMON_BODY], [
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
 # define __GNUC_STDC_INLINE__ 1
 #endif])
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
 # define __GNUC_STDC_INLINE__ 1
 #endif])
+  AH_VERBATIM([unused_parameter],
+[/* Define as a marker that can be attached to function parameter declarations
+   for parameters that are not used.  This helps to reduce warnings, such as
+   from GCC -Wunused-parameter.  */
+#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+#else
+# define _UNUSED_PARAMETER_
+#endif
+])
 ])
 
 # gl_MODULE_INDICATOR([modulename])
 ])
 
 # gl_MODULE_INDICATOR([modulename])
@@ -42,7 +53,7 @@ m4_ifndef([m4_foreach_w],
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
 m4_ifdef([AC_PROG_MKDIR_P], [], [
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
 m4_ifdef([AC_PROG_MKDIR_P], [], [
-  AC_DEFUN([AC_PROG_MKDIR_P],
+  AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
      AC_SUBST([MKDIR_P])])])
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
      AC_SUBST([MKDIR_P])])])
@@ -53,7 +64,7 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
 # works.
 # This definition can be removed once autoconf >= 2.62 can be assumed.
 AC_DEFUN([AC_C_RESTRICT],
 # works.
 # This definition can be removed once autoconf >= 2.62 can be assumed.
 AC_DEFUN([AC_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
+[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
   [ac_cv_c_restrict=no
    # The order here caters to the fact that C++ does not require restrict.
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
   [ac_cv_c_restrict=no
    # The order here caters to the fact that C++ does not require restrict.
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
@@ -89,3 +100,25 @@ AC_DEFUN([AC_C_RESTRICT],
    *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  esac
 ])
    *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  esac
 ])
+
+# gl_BIGENDIAN
+# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
+# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
+# macros invoke AC_C_BIGENDIAN with arguments.
+AC_DEFUN([gl_BIGENDIAN],
+[
+  AC_C_BIGENDIAN
+])
+
+# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
+# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
+# output a spurious "(cached)" mark in the midst of other configure output.
+# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
+# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
+AC_DEFUN([gl_CACHE_VAL_SILENT],
+[
+  saved_as_echo_n="$as_echo_n"
+  as_echo_n=':'
+  AC_CACHE_VAL([$1], [$2])
+  as_echo_n="$saved_as_echo_n"
+])
index 9fce2e41ad001784382746395638e25cf6944cbd..2989649d21be03257c676b44e2dbe8eb61de1c8d 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -44,8 +44,8 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([gl_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='lib'
   m4_pushdef([gl_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='lib'
-  gl_EOVERFLOW
   gl_FUNC_ALLOCA
   gl_FUNC_ALLOCA
+  gl_HEADER_ERRNO_H
   gl_ERROR
   m4_ifdef([AM_XGETTEXT_OPTION],
     [AM_XGETTEXT_OPTION([--flag=error:3:c-format])
   gl_ERROR
   m4_ifdef([AM_XGETTEXT_OPTION],
     [AM_XGETTEXT_OPTION([--flag=error:3:c-format])
@@ -72,13 +72,22 @@ AC_DEFUN([gl_INIT],
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
        [GNUmakefile=$GNUmakefile])])
   gl_INLINE
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
        [GNUmakefile=$GNUmakefile])])
   gl_INLINE
+  gl_LOCALCHARSET
+  LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
+  AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
   gl_FUNC_LSEEK
   gl_UNISTD_MODULE_INDICATOR([lseek])
   gl_FUNC_LSEEK
   gl_UNISTD_MODULE_INDICATOR([lseek])
+  gl_FUNC_MBRTOWC
+  gl_WCHAR_MODULE_INDICATOR([mbrtowc])
+  gl_FUNC_MBSINIT
+  gl_WCHAR_MODULE_INDICATOR([mbsinit])
+  gl_MULTIARCH
   gl_QUOTE
   gl_QUOTEARG
   gl_FUNC_REALLOC_POSIX
   gl_STDLIB_MODULE_INDICATOR([realloc-posix])
   AM_STDBOOL_H
   gl_QUOTE
   gl_QUOTEARG
   gl_FUNC_REALLOC_POSIX
   gl_STDLIB_MODULE_INDICATOR([realloc-posix])
   AM_STDBOOL_H
+  gl_STDINT_H
   gl_STDIO_H
   gl_STDLIB_H
   gl_FUNC_STRERROR
   gl_STDIO_H
   gl_STDLIB_H
   gl_FUNC_STRERROR
@@ -89,10 +98,10 @@ AC_DEFUN([gl_INIT],
   gl_WCTYPE_H
   gl_XALLOC
   m4_ifval(gl_LIBSOURCES_LIST, [
   gl_WCTYPE_H
   gl_XALLOC
   m4_ifval(gl_LIBSOURCES_LIST, [
-    m4_syscmd([test ! -d ]gl_LIBSOURCES_DIR[ ||
+    m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
       for gl_file in ]gl_LIBSOURCES_LIST[ ; do
       for gl_file in ]gl_LIBSOURCES_LIST[ ; do
-        if test ! -r ]gl_LIBSOURCES_DIR[/$gl_file ; then
-          echo "missing file ]gl_LIBSOURCES_DIR[/$gl_file" >&2
+        if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
+          echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
           exit 1
         fi
       done])dnl
           exit 1
         fi
       done])dnl
@@ -128,10 +137,10 @@ AC_DEFUN([gl_INIT],
   gl_COMMON
   gl_source_base='tests'
   m4_ifval(gltests_LIBSOURCES_LIST, [
   gl_COMMON
   gl_source_base='tests'
   m4_ifval(gltests_LIBSOURCES_LIST, [
-    m4_syscmd([test ! -d ]gltests_LIBSOURCES_DIR[ ||
+    m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
       for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
       for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
-        if test ! -r ]gltests_LIBSOURCES_DIR[/$gl_file ; then
-          echo "missing file ]gltests_LIBSOURCES_DIR[/$gl_file" >&2
+        if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
+          echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
           exit 1
         fi
       done])dnl
           exit 1
         fi
       done])dnl
@@ -221,10 +230,14 @@ AC_DEFUN([gltests_LIBSOURCES], [
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
   build-aux/link-warning.h
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
   build-aux/link-warning.h
+  build-aux/useless-if-before-free
+  build-aux/vc-list-files
   lib/alloca.c
   lib/alloca.in.h
   lib/c-ctype.c
   lib/c-ctype.h
   lib/alloca.c
   lib/alloca.in.h
   lib/c-ctype.c
   lib/c-ctype.h
+  lib/config.charset
+  lib/errno.in.h
   lib/error.c
   lib/error.h
   lib/exitfail.c
   lib/error.c
   lib/error.h
   lib/exitfail.c
@@ -240,26 +253,38 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/getpass.h
   lib/gettext.h
   lib/intprops.h
   lib/getpass.h
   lib/gettext.h
   lib/intprops.h
+  lib/localcharset.c
+  lib/localcharset.h
   lib/lseek.c
   lib/lseek.c
+  lib/mbrtowc.c
+  lib/mbsinit.c
   lib/quote.c
   lib/quote.h
   lib/quotearg.c
   lib/quotearg.h
   lib/realloc.c
   lib/quote.c
   lib/quote.h
   lib/quotearg.c
   lib/quotearg.h
   lib/realloc.c
+  lib/ref-add.sin
+  lib/ref-del.sin
   lib/stdbool.in.h
   lib/stdbool.in.h
+  lib/stdint.in.h
   lib/stdio-impl.h
   lib/stdio-impl.h
+  lib/stdio-write.c
   lib/stdio.in.h
   lib/stdlib.in.h
   lib/stdio.in.h
   lib/stdlib.in.h
+  lib/streq.h
   lib/strerror.c
   lib/string.in.h
   lib/unistd.in.h
   lib/strerror.c
   lib/string.in.h
   lib/unistd.in.h
+  lib/verify.h
   lib/wchar.in.h
   lib/wctype.in.h
   lib/xalloc-die.c
   lib/xalloc.h
   lib/xmalloc.c
   lib/wchar.in.h
   lib/wctype.in.h
   lib/xalloc-die.c
   lib/xalloc.h
   lib/xmalloc.c
+  m4/00gnulib.m4
   m4/alloca.m4
   m4/alloca.m4
-  m4/eoverflow.m4
+  m4/codeset.m4
+  m4/errno_h.m4
   m4/error.m4
   m4/exitfail.m4
   m4/extensions.m4
   m4/error.m4
   m4/exitfail.m4
   m4/extensions.m4
@@ -268,17 +293,26 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/getline.m4
   m4/getopt.m4
   m4/getpass.m4
   m4/getline.m4
   m4/getopt.m4
   m4/getpass.m4
+  m4/glibc21.m4
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/inline.m4
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/inline.m4
+  m4/localcharset.m4
+  m4/locale-fr.m4
+  m4/locale-ja.m4
+  m4/locale-zh.m4
+  m4/longlong.m4
   m4/lseek.m4
   m4/malloc.m4
   m4/mbrtowc.m4
   m4/lseek.m4
   m4/malloc.m4
   m4/mbrtowc.m4
+  m4/mbsinit.m4
   m4/mbstate_t.m4
   m4/mbstate_t.m4
+  m4/multiarch.m4
   m4/quote.m4
   m4/quotearg.m4
   m4/realloc.m4
   m4/stdbool.m4
   m4/quote.m4
   m4/quotearg.m4
   m4/realloc.m4
   m4/stdbool.m4
+  m4/stdint.m4
   m4/stdio_h.m4
   m4/stdlib_h.m4
   m4/strerror.m4
   m4/stdio_h.m4
   m4/stdlib_h.m4
   m4/strerror.m4
index ef59320316b9796903a2c4a46ed7b810508dc8c7..4438d488698b2e25a911a6741d8903cb9fd35ebf 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-tool.m4 serial 1
+# gnulib-tool.m4 serial 2
 dnl Copyright (C) 2004-2005 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 Copyright (C) 2004-2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,9 @@ dnl The following macros need not be invoked explicitly.
 dnl Invoking them does nothing except to declare default arguments
 dnl for "gnulib-tool --import".
 
 dnl Invoking them does nothing except to declare default arguments
 dnl for "gnulib-tool --import".
 
+dnl Usage: gl_LOCAL_DIR([DIR])
+AC_DEFUN([gl_LOCAL_DIR], [])
+
 dnl Usage: gl_MODULES([module1 module2 ...])
 AC_DEFUN([gl_MODULES], [])
 
 dnl Usage: gl_MODULES([module1 module2 ...])
 AC_DEFUN([gl_MODULES], [])
 
@@ -20,14 +23,35 @@ AC_DEFUN([gl_SOURCE_BASE], [])
 dnl Usage: gl_M4_BASE([DIR])
 AC_DEFUN([gl_M4_BASE], [])
 
 dnl Usage: gl_M4_BASE([DIR])
 AC_DEFUN([gl_M4_BASE], [])
 
+dnl Usage: gl_PO_BASE([DIR])
+AC_DEFUN([gl_PO_BASE], [])
+
+dnl Usage: gl_DOC_BASE([DIR])
+AC_DEFUN([gl_DOC_BASE], [])
+
+dnl Usage: gl_TESTS_BASE([DIR])
+AC_DEFUN([gl_TESTS_BASE], [])
+
+dnl Usage: gl_WITH_TESTS
+AC_DEFUN([gl_WITH_TESTS], [])
+
 dnl Usage: gl_LIB([LIBNAME])
 AC_DEFUN([gl_LIB], [])
 
 dnl Usage: gl_LIB([LIBNAME])
 AC_DEFUN([gl_LIB], [])
 
-dnl Usage: gl_LGPL
+dnl Usage: gl_LGPL or gl_LGPL([VERSION])
 AC_DEFUN([gl_LGPL], [])
 
 AC_DEFUN([gl_LGPL], [])
 
+dnl Usage: gl_MAKEFILE_NAME([FILENAME])
+AC_DEFUN([gl_MAKEFILE_NAME], [])
+
 dnl Usage: gl_LIBTOOL
 AC_DEFUN([gl_LIBTOOL], [])
 
 dnl Usage: gl_MACRO_PREFIX([PREFIX])
 AC_DEFUN([gl_MACRO_PREFIX], [])
 dnl Usage: gl_LIBTOOL
 AC_DEFUN([gl_LIBTOOL], [])
 
 dnl Usage: gl_MACRO_PREFIX([PREFIX])
 AC_DEFUN([gl_MACRO_PREFIX], [])
+
+dnl Usage: gl_PO_DOMAIN([DOMAIN])
+AC_DEFUN([gl_PO_DOMAIN], [])
+
+dnl Usage: gl_VC_FILES([BOOLEAN])
+AC_DEFUN([gl_VC_FILES], [])
index a842e2a23682bd0bea8a73ea22b58533c33ad97c..5e22ded936ccb558203f81709e7b8f2417fd532f 100644 (file)
@@ -1,19 +1,47 @@
-# include_next.m4 serial 6
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+# include_next.m4 serial 14
+dnl Copyright (C) 2006-2009 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 Paul Eggert and Derek Price.
 
 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 Paul Eggert and Derek Price.
 
+dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
+dnl
+dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
+dnl 'include' otherwise.
+dnl
+dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
+dnl supports it in the special case that it is the first include directive in
+dnl the given file, or to 'include' otherwise.
+dnl
+dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
+dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
+dnl '#pragma GCC system_header' has the same effect as if the file was found
+dnl through the include search path specified with '-isystem' options (as
+dnl opposed to the search path specified with '-I' options). Namely, gcc
+dnl does not warn about some things, and on some systems (Solaris and Interix)
+dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
+dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
+dnl of plain '__STDC__'.
+
 AC_DEFUN([gl_INCLUDE_NEXT],
 [
   AC_LANG_PREPROC_REQUIRE()
   AC_CACHE_CHECK([whether the preprocessor supports include_next],
     [gl_cv_have_include_next],
 AC_DEFUN([gl_INCLUDE_NEXT],
 [
   AC_LANG_PREPROC_REQUIRE()
   AC_CACHE_CHECK([whether the preprocessor supports include_next],
     [gl_cv_have_include_next],
-    [rm -rf conftestd1 conftestd2
-     mkdir conftestd1 conftestd2
-     cat <<EOF > conftestd1/conftest.h
+    [rm -rf conftestd1a conftestd1b conftestd2
+     mkdir conftestd1a conftestd1b conftestd2
+     dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
+     dnl AIX 6.1 support include_next when used as first preprocessor directive
+     dnl in a file, but not when preceded by another include directive. Check
+     dnl for this bug by including <stdio.h>.
+     dnl Additionally, with this same compiler, include_next is a no-op when
+     dnl used in a header file that was included by specifying its absolute
+     dnl file name. Despite these two bugs, include_next is used in the
+     dnl compiler's <math.h>. By virtue of the second bug, we need to use
+     dnl include_next as well in this case.
+     cat <<EOF > conftestd1a/conftest.h
 #define DEFINED_IN_CONFTESTD1
 #include_next <conftest.h>
 #ifdef DEFINED_IN_CONFTESTD2
 #define DEFINED_IN_CONFTESTD1
 #include_next <conftest.h>
 #ifdef DEFINED_IN_CONFTESTD2
@@ -21,6 +49,16 @@ int foo;
 #else
 #error "include_next doesn't work"
 #endif
 #else
 #error "include_next doesn't work"
 #endif
+EOF
+     cat <<EOF > conftestd1b/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include <stdio.h>
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
 EOF
      cat <<EOF > conftestd2/conftest.h
 #ifndef DEFINED_IN_CONFTESTD1
 EOF
      cat <<EOF > conftestd2/conftest.h
 #ifndef DEFINED_IN_CONFTESTD1
@@ -28,26 +66,37 @@ EOF
 #endif
 #define DEFINED_IN_CONFTESTD2
 EOF
 #endif
 #define DEFINED_IN_CONFTESTD2
 EOF
-     save_CPPFLAGS="$CPPFLAGS"
-     CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
+     gl_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
      AC_COMPILE_IFELSE([#include <conftest.h>],
        [gl_cv_have_include_next=yes],
      AC_COMPILE_IFELSE([#include <conftest.h>],
        [gl_cv_have_include_next=yes],
-       [gl_cv_have_include_next=no])
-     CPPFLAGS="$save_CPPFLAGS"
-     rm -rf conftestd1 conftestd2
+       [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
+        AC_COMPILE_IFELSE([#include <conftest.h>],
+          [gl_cv_have_include_next=buggy],
+          [gl_cv_have_include_next=no])
+       ])
+     CPPFLAGS="$gl_save_CPPFLAGS"
+     rm -rf conftestd1a conftestd1b conftestd2
     ])
     ])
+  PRAGMA_SYSTEM_HEADER=
   if test $gl_cv_have_include_next = yes; then
   if test $gl_cv_have_include_next = yes; then
-
-    dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it
-    dnl to use @INCLUDE_NEXT@ instead.
-    AC_DEFINE([HAVE_INCLUDE_NEXT], 1,
-             [Define if your compiler supports the #include_next directive.])
-
     INCLUDE_NEXT=include_next
     INCLUDE_NEXT=include_next
+    INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    if test -n "$GCC"; then
+      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
+    fi
   else
   else
-    INCLUDE_NEXT=include
+    if test $gl_cv_have_include_next = buggy; then
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    else
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
+    fi
   fi
   AC_SUBST([INCLUDE_NEXT])
   fi
   AC_SUBST([INCLUDE_NEXT])
+  AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
+  AC_SUBST([PRAGMA_SYSTEM_HEADER])
 ])
 
 # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
 ])
 
 # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
@@ -55,8 +104,14 @@ EOF
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
 #      #@INCLUDE_NEXT@ @NEXT_FOO_H@
 # That way, a header file with the following line:
 #      #@INCLUDE_NEXT@ @NEXT_FOO_H@
+# or
+#      #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
@@ -69,31 +124,43 @@ EOF
 AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 [
   AC_REQUIRE([gl_INCLUDE_NEXT])
 AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 [
   AC_REQUIRE([gl_INCLUDE_NEXT])
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_HEADERS_ONCE([$1])
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
   AC_CHECK_HEADERS_ONCE([$1])
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
-        m4_quote(m4_defn([gl_next_header])),
+        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+        m4_defn([gl_next_header]),
         [AS_VAR_PUSHDEF([gl_header_exists],
         [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
          if test AS_VAR_GET(gl_header_exists) = yes; then
            AC_LANG_CONFTEST(
              [AC_LANG_SOURCE(
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
               )])
          if test AS_VAR_GET(gl_header_exists) = yes; then
            AC_LANG_CONFTEST(
              [AC_LANG_SOURCE(
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
               )])
-           dnl eval is necessary to expand ac_cpp.
+           dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+           dnl that contain only a #include of other header files and no
+           dnl non-comment tokens of their own. This leads to a failure to
+           dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+           dnl and others. The workaround is to force preservation of comments
+           dnl through option -C. This ensures all necessary #line directives
+           dnl are present. GCC supports option -C as well.
+           case "$host_os" in
+             aix*) gl_absname_cpp="$ac_cpp -C" ;;
+             *)    gl_absname_cpp="$ac_cpp" ;;
+           esac
+           dnl eval is necessary to expand gl_absname_cpp.
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
            dnl so use subshell.
            AS_VAR_SET([gl_next_header],
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
            dnl so use subshell.
            AS_VAR_SET([gl_next_header],
-             ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
-                s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
+             ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
                 s#^/[^/]#//&#
                 p
                 q
                 s#^/[^/]#//&#
                 p
                 q
@@ -104,7 +171,17 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
-       AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+       AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
        [AS_VAR_GET([gl_next_header])])
        [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
+       [$gl_next_as_first_directive])
      AS_VAR_POPDEF([gl_next_header])])
 ])
      AS_VAR_POPDEF([gl_next_header])])
 ])
index a07076cd6b3beda72050f99ba50138c0fea2c324..cee51099f1c2e79261dfb835f3144ac3050800ae 100644 (file)
@@ -1,5 +1,5 @@
-# inline.m4 serial 3
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
+# inline.m4 serial 4
+dnl Copyright (C) 2006, 2009 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 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.
@@ -32,7 +32,7 @@ AC_DEFUN([gl_INLINE],
      fi
     ])
   if test $gl_cv_c_inline_effective = yes; then
      fi
     ])
   if test $gl_cv_c_inline_effective = yes; then
-    AC_DEFINE([HAVE_INLINE], 1,
+    AC_DEFINE([HAVE_INLINE], [1],
       [Define to 1 if the compiler supports one of the keywords
        'inline', '__inline__', '__inline' and effectively inlines
        functions marked as such.])
       [Define to 1 if the compiler supports one of the keywords
        'inline', '__inline__', '__inline' and effectively inlines
        functions marked as such.])
diff --git a/m4/localcharset.m4 b/m4/localcharset.m4
new file mode 100644 (file)
index 0000000..e960104
--- /dev/null
@@ -0,0 +1,16 @@
+# localcharset.m4 serial 6
+dnl Copyright (C) 2002, 2004, 2006, 2009 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_LOCALCHARSET],
+[
+  dnl Prerequisites of lib/localcharset.c.
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CHECK_DECLS_ONCE([getc_unlocked])
+
+  dnl Prerequisites of the lib/Makefile.am snippet.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_GLIBC21])
+])
diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4
new file mode 100644 (file)
index 0000000..653a5bc
--- /dev/null
@@ -0,0 +1,185 @@
+# locale-fr.m4 serial 11
+dnl Copyright (C) 2003, 2005-2009 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 Determine the name of a french locale with traditional encoding.
+AC_DEFUN([gt_LOCALE_FR],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([
+changequote(,)dnl
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main () {
+  /* Check whether the given locale name is recognized by the system.  */
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+#if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+#endif
+#ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+#endif
+  /* Check whether in the abbreviation of the second month, the second
+     character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only
+     one byte long. This excludes the UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
+  /* Check whether the decimal separator is a comma.
+     On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
+     are nl_langinfo(RADIXCHAR) are both ".".  */
+  if (localeconv () ->decimal_point[0] != ',') return 1;
+  return 0;
+}
+changequote([,])dnl
+      ])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+      # configure script would override the LC_ALL setting. Likewise for
+      # LC_CTYPE, which is also set at the beginning of the configure script.
+      # Test for the usual locale name.
+      if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+        gt_cv_locale_fr=fr_FR
+      else
+        # Test for the locale name with explicit encoding suffix.
+        if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+          gt_cv_locale_fr=fr_FR.ISO-8859-1
+        else
+          # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
+          if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr=fr_FR.ISO8859-1
+          else
+            # Test for the HP-UX locale name.
+            if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_fr=fr_FR.iso88591
+            else
+              # Test for the Solaris 7 locale name.
+              if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr=fr
+              else
+                # None found.
+                gt_cv_locale_fr=none
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_FR=$gt_cv_locale_fr
+  AC_SUBST([LOCALE_FR])
+])
+
+dnl Determine the name of a french locale with UTF-8 encoding.
+AC_DEFUN([gt_LOCALE_FR_UTF8],
+[
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([
+changequote(,)dnl
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main () {
+  /* On BeOS and Haiku, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  */
+#if !(defined __BEOS__ || defined __HAIKU__)
+  /* Check whether the given locale name is recognized by the system.  */
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+# if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+# endif
+# ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+# endif
+  /* Check whether in the abbreviation of the second month, the second
+     character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is
+     two bytes long, with UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%b", &t) < 4
+      || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v')
+    return 1;
+#endif
+  /* Check whether the decimal separator is a comma.
+     On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
+     are nl_langinfo(RADIXCHAR) are both ".".  */
+  if (localeconv () ->decimal_point[0] != ',') return 1;
+  return 0;
+}
+changequote([,])dnl
+      ])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+      # configure script would override the LC_ALL setting. Likewise for
+      # LC_CTYPE, which is also set at the beginning of the configure script.
+      # Test for the usual locale name.
+      if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+        gt_cv_locale_fr_utf8=fr_FR
+      else
+        # Test for the locale name with explicit encoding suffix.
+        if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+          gt_cv_locale_fr_utf8=fr_FR.UTF-8
+        else
+          # Test for the Solaris 7 locale name.
+          if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr_utf8=fr.UTF-8
+          else
+            # None found.
+            gt_cv_locale_fr_utf8=none
+          fi
+        fi
+      fi
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
+  AC_SUBST([LOCALE_FR_UTF8])
+])
diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4
new file mode 100644 (file)
index 0000000..9360576
--- /dev/null
@@ -0,0 +1,107 @@
+# locale-ja.m4 serial 7
+dnl Copyright (C) 2003, 2005-2009 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 Determine the name of a japanese locale with EUC-JP encoding.
+AC_DEFUN([gt_LOCALE_JA],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([
+changequote(,)dnl
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main ()
+{
+  const char *p;
+  /* Check whether the given locale name is recognized by the system.  */
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+#if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+#endif
+#ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+#endif
+  /* Check whether MB_CUR_MAX is > 1.  This excludes the dysfunctional locales
+     on Cygwin 1.5.x.  */
+  if (MB_CUR_MAX == 1)
+    return 1;
+  /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
+     This excludes the UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
+  for (p = buf; *p != '\0'; p++)
+    if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
+      return 1;
+  return 0;
+}
+changequote([,])dnl
+      ])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+      # configure script would override the LC_ALL setting. Likewise for
+      # LC_CTYPE, which is also set at the beginning of the configure script.
+      # Test for the AIX locale name.
+      if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+        gt_cv_locale_ja=ja_JP
+      else
+        # Test for the locale name with explicit encoding suffix.
+        if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+          gt_cv_locale_ja=ja_JP.EUC-JP
+        else
+          # Test for the HP-UX, OSF/1, NetBSD locale name.
+          if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_ja=ja_JP.eucJP
+          else
+            # Test for the IRIX, FreeBSD locale name.
+            if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_ja=ja_JP.EUC
+            else
+              # Test for the Solaris 7 locale name.
+              if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_ja=ja
+              else
+                # Special test for NetBSD 1.6.
+                if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
+                  gt_cv_locale_ja=ja_JP.eucJP
+                else
+                  # None found.
+                  gt_cv_locale_ja=none
+                fi
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_JA=$gt_cv_locale_ja
+  AC_SUBST([LOCALE_JA])
+])
diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4
new file mode 100644 (file)
index 0000000..36a5f1d
--- /dev/null
@@ -0,0 +1,92 @@
+# locale-zh.m4 serial 6
+dnl Copyright (C) 2003, 2005-2009 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 Determine the name of a chinese locale with GB18030 encoding.
+AC_DEFUN([gt_LOCALE_ZH_CN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([
+changequote(,)dnl
+#include <locale.h>
+#include <stdlib.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main ()
+{
+  const char *p;
+  /* Check whether the given locale name is recognized by the system.  */
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+#if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+#endif
+#ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+#endif
+  /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
+     This excludes the UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
+  for (p = buf; *p != '\0'; p++)
+    if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
+      return 1;
+  /* Check whether a typical GB18030 multibyte sequence is recognized as a
+     single wide character.  This excludes the GB2312 and GBK encodings.  */
+  if (mblen ("\203\062\332\066", 5) != 4)
+    return 1;
+  return 0;
+}
+changequote([,])dnl
+      ])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+      # configure script would override the LC_ALL setting. Likewise for
+      # LC_CTYPE, which is also set at the beginning of the configure script.
+      # Test for the locale name without encoding suffix.
+      if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+        gt_cv_locale_zh_CN=zh_CN
+      else
+        # Test for the locale name with explicit encoding suffix.
+        if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+          gt_cv_locale_zh_CN=zh_CN.GB18030
+        else
+          # None found.
+          gt_cv_locale_zh_CN=none
+        fi
+      fi
+    else
+      # If there was a link error, due to mblen(), the system is so old that
+      # it certainly doesn't have a chinese locale.
+      gt_cv_locale_zh_CN=none
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_ZH_CN=$gt_cv_locale_zh_CN
+  AC_SUBST([LOCALE_ZH_CN])
+])
diff --git a/m4/longlong.m4 b/m4/longlong.m4
new file mode 100644 (file)
index 0000000..eedc8d5
--- /dev/null
@@ -0,0 +1,106 @@
+# longlong.m4 serial 14
+dnl Copyright (C) 1999-2007, 2009 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 Paul Eggert.
+
+# Define HAVE_LONG_LONG_INT if 'long long int' works.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
+
+# Note: If the type 'long long int' exists but is only 32 bits large
+# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
+# defined. In this case you can treat 'long long int' like 'long int'.
+
+AC_DEFUN([AC_TYPE_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
+    [AC_LINK_IFELSE(
+       [_AC_TYPE_LONG_LONG_SNIPPET],
+       [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
+       dnl If cross compiling, assume the bug isn't important, since
+       dnl nobody cross compiles for this platform as far as we know.
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[@%:@include <limits.h>
+              @%:@ifndef LLONG_MAX
+              @%:@ define HALF \
+                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+              @%:@ define LLONG_MAX (HALF - 1 + HALF)
+              @%:@endif]],
+            [[long long int n = 1;
+              int i;
+              for (i = 0; ; i++)
+                {
+                  long long int m = n << i;
+                  if (m >> i != n)
+                    return 1;
+                  if (LLONG_MAX / 2 < m)
+                    break;
+                }
+              return 0;]])],
+         [ac_cv_type_long_long_int=yes],
+         [ac_cv_type_long_long_int=no],
+         [ac_cv_type_long_long_int=yes])],
+       [ac_cv_type_long_long_int=no])])
+  if test $ac_cv_type_long_long_int = yes; then
+    AC_DEFINE([HAVE_LONG_LONG_INT], [1],
+      [Define to 1 if the system has the type `long long int'.])
+  fi
+])
+
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
+
+# Note: If the type 'unsigned long long int' exists but is only 32 bits
+# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
+# will not be defined. In this case you can treat 'unsigned long long int'
+# like 'unsigned long int'.
+
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for unsigned long long int],
+    [ac_cv_type_unsigned_long_long_int],
+    [AC_LINK_IFELSE(
+       [_AC_TYPE_LONG_LONG_SNIPPET],
+       [ac_cv_type_unsigned_long_long_int=yes],
+       [ac_cv_type_unsigned_long_long_int=no])])
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
+      [Define to 1 if the system has the type `unsigned long long int'.])
+  fi
+])
+
+# Expands to a C program that can be used to test for simultaneous support
+# of 'long long' and 'unsigned long long'. We don't want to say that
+# 'long long' is available if 'unsigned long long' is not, or vice versa,
+# because too many programs rely on the symmetry between signed and unsigned
+# integer types (excluding 'bool').
+AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
+[
+  AC_LANG_PROGRAM(
+    [[/* For now, do not test the preprocessor; as of 2007 there are too many
+        implementations with broken preprocessors.  Perhaps this can
+        be revisited in 2012.  In the meantime, code should not expect
+        #if to work with literals wider than 32 bits.  */
+      /* Test literals.  */
+      long long int ll = 9223372036854775807ll;
+      long long int nll = -9223372036854775807LL;
+      unsigned long long int ull = 18446744073709551615ULL;
+      /* Test constant expressions.   */
+      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+                    ? 1 : -1)];
+      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+                    ? 1 : -1)];
+      int i = 63;]],
+    [[/* Test availability of runtime routines for shift and division.  */
+      long long int llmax = 9223372036854775807ll;
+      unsigned long long int ullmax = 18446744073709551615ull;
+      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+             | (llmax / ll) | (llmax % ll)
+             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+             | (ullmax / ull) | (ullmax % ull));]])
+])
index 764f2a9fa199c24dd959ca2d0be0238825498a73..807017166ba35812585f8e41667b8181f4f20afa 100644 (file)
@@ -1,5 +1,5 @@
-# malloc.m4 serial 8
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# malloc.m4 serial 9
+dnl Copyright (C) 2007, 2009 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 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.
@@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
   AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
   if test $gl_cv_func_malloc_posix = yes; then
     HAVE_MALLOC_POSIX=1
   AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
   if test $gl_cv_func_malloc_posix = yes; then
     HAVE_MALLOC_POSIX=1
-    AC_DEFINE([HAVE_MALLOC_POSIX], 1,
+    AC_DEFINE([HAVE_MALLOC_POSIX], [1],
       [Define if the 'malloc' function is POSIX compliant.])
   else
     AC_LIBOBJ([malloc])
       [Define if the 'malloc' function is POSIX compliant.])
   else
     AC_LIBOBJ([malloc])
index a3bd9114c39d739e810cf3704e9dc808af0c3ec7..2fddcc8a109ae0942bba20665c449fe7fd918a14 100644 (file)
-# mbrtowc.m4 serial 8
-dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
+# mbrtowc.m4 serial 16
+dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 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 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_MBRTOWC],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+  if test $REPLACE_MBSTATE_T = 1; then
+    REPLACE_MBRTOWC=1
+  fi
+  AC_CHECK_FUNCS_ONCE([mbrtowc])
+  if test $ac_cv_func_mbrtowc = no; then
+    HAVE_MBRTOWC=0
+  fi
+  if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then
+    gl_MBRTOWC_NULL_ARG
+    gl_MBRTOWC_RETVAL
+    gl_MBRTOWC_NUL_RETVAL
+    case "$gl_cv_func_mbrtowc_null_arg" in
+      *yes) ;;
+      *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1],
+           [Define if the mbrtowc function has the NULL string argument bug.])
+         REPLACE_MBRTOWC=1
+         ;;
+    esac
+    case "$gl_cv_func_mbrtowc_retval" in
+      *yes) ;;
+      *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
+           [Define if the mbrtowc function returns a wrong return value.])
+         REPLACE_MBRTOWC=1
+         ;;
+    esac
+    case "$gl_cv_func_mbrtowc_nul_retval" in
+      *yes) ;;
+      *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1],
+           [Define if the mbrtowc function does not return 0 for a NUL character.])
+         REPLACE_MBRTOWC=1
+         ;;
+    esac
+  fi
+  if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
+    gl_REPLACE_WCHAR_H
+    AC_LIBOBJ([mbrtowc])
+    gl_PREREQ_MBRTOWC
+  fi
+])
+
+dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
+dnl redefines the semantics of the given mbstate_t type.
+dnl Result is REPLACE_MBSTATE_T.
+dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to
+dnl avoid inconsistencies.
+
+AC_DEFUN([gl_MBSTATE_T_BROKEN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_CHECK_FUNCS_ONCE([mbsinit])
+  AC_CHECK_FUNCS_ONCE([mbrtowc])
+  if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then
+    gl_MBRTOWC_INCOMPLETE_STATE
+    gl_MBRTOWC_SANITYCHECK
+    REPLACE_MBSTATE_T=0
+    case "$gl_cv_func_mbrtowc_incomplete_state" in
+      *yes) ;;
+      *) REPLACE_MBSTATE_T=1 ;;
+    esac
+    case "$gl_cv_func_mbrtowc_sanitycheck" in
+      *yes) ;;
+      *) REPLACE_MBSTATE_T=1 ;;
+    esac
+  else
+    REPLACE_MBSTATE_T=1
+  fi
+  if test $REPLACE_MBSTATE_T = 1; then
+    gl_REPLACE_WCHAR_H
+  fi
+])
+
+dnl Test whether mbrtowc puts the state into non-initial state when parsing an
+dnl incomplete multibyte character.
+dnl Result is gl_cv_func_mbrtowc_incomplete_state.
+
+AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
+    [gl_cv_func_mbrtowc_incomplete_state],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+              # Guess no on AIX and OSF/1.
+        osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
+              # Guess yes otherwise.
+        *)    gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_JA != none; then
+        AC_TRY_RUN([
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        if (mbsinit (&state))
+          return 1;
+    }
+  return 0;
+}],
+          [gl_cv_func_mbrtowc_incomplete_state=yes],
+          [gl_cv_func_mbrtowc_incomplete_state=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc works not worse than mbtowc.
+dnl Result is gl_cv_func_mbrtowc_sanitycheck.
+
+AC_DEFUN([gl_MBRTOWC_SANITYCHECK],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc works as well as mbtowc],
+    [gl_cv_func_mbrtowc_sanitycheck],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                    # Guess no on Solaris 8.
+        solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;;
+                    # Guess yes otherwise.
+        *)          gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_ZH_CN != none; then
+        AC_TRY_RUN([
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This fails on Solaris 8:
+     mbrtowc returns 2, and sets wc to 0x00F0.
+     mbtowc returns 4 (correct) and sets wc to 0x5EDC.  */
+  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 3, 6, &state) != 4
+          && mbtowc (&wc, input + 3, 6) == 4)
+        return 1;
+    }
+  return 0;
+}],
+          [gl_cv_func_mbrtowc_sanitycheck=yes],
+          [gl_cv_func_mbrtowc_sanitycheck=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc supports a NULL string argument correctly.
+dnl Result is gl_cv_func_mbrtowc_null_arg.
+
+AC_DEFUN([gl_MBRTOWC_NULL_ARG],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
+    [gl_cv_func_mbrtowc_null_arg],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+              # Guess no on OSF/1.
+        osf*) gl_cv_func_mbrtowc_null_arg="guessing no" ;;
+              # Guess yes otherwise.
+        *)    gl_cv_func_mbrtowc_null_arg="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none; then
+        AC_TRY_RUN([
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc;
+      int ret;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      wc = (wchar_t) 0xBADFACE;
+      mbrtowc (&wc, NULL, 5, &state);
+      /* Check that wc was not modified.  */
+      if (wc != (wchar_t) 0xBADFACE)
+        return 1;
+    }
+  return 0;
+}], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc, when parsing the end of a multibyte character,
+dnl correctly returns the number of bytes that were needed to complete the
+dnl character (not the total number of bytes of the multibyte character).
+dnl Result is gl_cv_func_mbrtowc_retval.
+
+AC_DEFUN([gl_MBRTOWC_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc has a correct return value],
+    [gl_cv_func_mbrtowc_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                          # Guess no on HP-UX and Solaris.
+        hpux* | solaris*) gl_cv_func_mbrtowc_retval="guessing no" ;;
+                          # Guess yes otherwise.
+        *)                gl_cv_func_mbrtowc_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then
+        AC_TRY_RUN([
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This fails on Solaris.  */
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      char input[] = "B\303\274\303\237er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrtowc (&wc, input + 2, 5, &state) != 1)
+            return 1;
+        }
+    }
+  /* This fails on HP-UX 11.11.  */
+  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrtowc (&wc, input + 2, 5, &state) != 2)
+            return 1;
+        }
+    }
+  return 0;
+}],
+          [gl_cv_func_mbrtowc_retval=yes],
+          [gl_cv_func_mbrtowc_retval=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc, when parsing a NUL character, correctly returns 0.
+dnl Result is gl_cv_func_mbrtowc_nul_retval.
+
+AC_DEFUN([gl_MBRTOWC_NUL_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc returns 0 when parsing a NUL character],
+    [gl_cv_func_mbrtowc_nul_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                       # Guess no on Solaris 8 and 9.
+        solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;;
+                       # Guess yes otherwise.
+        *)             gl_cv_func_mbrtowc_nul_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_ZH_CN != none; then
+        AC_TRY_RUN([
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This fails on Solaris 8 and 9.  */
+  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "", 1, &state) != 0)
+        return 1;
+    }
+  return 0;
+}],
+          [gl_cv_func_mbrtowc_nul_retval=yes],
+          [gl_cv_func_mbrtowc_nul_retval=no],
+          [:])
+      fi
+    ])
+])
+
+# Prerequisites of lib/mbrtowc.c.
+AC_DEFUN([gl_PREREQ_MBRTOWC], [
+  :
+])
+
+
 dnl From Paul Eggert
 
 dnl From Paul Eggert
 
-dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
-dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
+dnl This override of an autoconf macro can be removed when autoconf 2.60 or
+dnl newer can be assumed everywhere.
 
 
-AC_DEFUN([gl_FUNC_MBRTOWC],
+m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.60]),[-1],[
+AC_DEFUN([AC_FUNC_MBRTOWC],
 [
   dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
 [
   dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
@@ -25,7 +376,8 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
        gl_cv_func_mbrtowc=yes,
        gl_cv_func_mbrtowc=no)])
   if test $gl_cv_func_mbrtowc = yes; then
        gl_cv_func_mbrtowc=yes,
        gl_cv_func_mbrtowc=no)])
   if test $gl_cv_func_mbrtowc = yes; then
-    AC_DEFINE([HAVE_MBRTOWC], 1,
+    AC_DEFINE([HAVE_MBRTOWC], [1],
       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
   fi
 ])
       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
   fi
 ])
+])
diff --git a/m4/mbsinit.m4 b/m4/mbsinit.m4
new file mode 100644 (file)
index 0000000..03b055c
--- /dev/null
@@ -0,0 +1,30 @@
+# mbsinit.m4 serial 3
+dnl Copyright (C) 2008 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_MBSINIT],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+  if test $REPLACE_MBSTATE_T = 1; then
+    REPLACE_MBSINIT=1
+  fi
+  AC_CHECK_FUNCS_ONCE([mbsinit])
+  if test $ac_cv_func_mbsinit = no; then
+    HAVE_MBSINIT=0
+  fi
+  if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
+    gl_REPLACE_WCHAR_H
+    AC_LIBOBJ([mbsinit])
+    gl_PREREQ_MBSINIT
+  fi
+])
+
+# Prerequisites of lib/mbsinit.c.
+AC_DEFUN([gl_PREREQ_MBSINIT], [
+  :
+])
index 0da32b6b48b84065765f741d6ae914b1fe24eea0..d4ec6f0fc7107449a362452387e0ed1963799ee4 100644 (file)
@@ -1,5 +1,5 @@
-# mbstate_t.m4 serial 10
-dnl Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
+# mbstate_t.m4 serial 12
+dnl Copyright (C) 2000-2002, 2008, 2009 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 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.
@@ -13,7 +13,10 @@ dnl with or without modifications, as long as this notice is preserved.
 # AC_TYPE_MBSTATE_T
 # -----------------
 AC_DEFUN([AC_TYPE_MBSTATE_T],
 # AC_TYPE_MBSTATE_T
 # -----------------
 AC_DEFUN([AC_TYPE_MBSTATE_T],
-  [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+[
+   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11
+
+   AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],
      [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
           [AC_INCLUDES_DEFAULT[
      [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
           [AC_INCLUDES_DEFAULT[
@@ -22,9 +25,10 @@ AC_DEFUN([AC_TYPE_MBSTATE_T],
        [ac_cv_type_mbstate_t=yes],
        [ac_cv_type_mbstate_t=no])])
    if test $ac_cv_type_mbstate_t = yes; then
        [ac_cv_type_mbstate_t=yes],
        [ac_cv_type_mbstate_t=no])])
    if test $ac_cv_type_mbstate_t = yes; then
-     AC_DEFINE([HAVE_MBSTATE_T], 1,
+     AC_DEFINE([HAVE_MBSTATE_T], [1],
               [Define to 1 if <wchar.h> declares mbstate_t.])
    else
               [Define to 1 if <wchar.h> declares mbstate_t.])
    else
-     AC_DEFINE([mbstate_t], int,
+     AC_DEFINE([mbstate_t], [int],
               [Define to a type if <wchar.h> does not define.])
               [Define to a type if <wchar.h> does not define.])
-   fi])
+   fi
+])
diff --git a/m4/multiarch.m4 b/m4/multiarch.m4
new file mode 100644 (file)
index 0000000..ec377ba
--- /dev/null
@@ -0,0 +1,65 @@
+# multiarch.m4 serial 5
+dnl Copyright (C) 2008, 2009 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.
+
+# Determine whether the compiler is or may be producing universal binaries.
+#
+# On MacOS X 10.5 and later systems, the user can create libraries and
+# executables that work on multiple system types--known as "fat" or
+# "universal" binaries--by specifying multiple '-arch' options to the
+# compiler but only a single '-arch' option to the preprocessor.  Like
+# this:
+#
+#     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CPP="gcc -E" CXXCPP="g++ -E"
+#
+# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the
+# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
+
+AC_DEFUN_ONCE([gl_MULTIARCH],
+[
+  dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
+  gl_cv_c_multiarch=no
+  AC_COMPILE_IFELSE(
+    [AC_LANG_SOURCE(
+      [[#ifndef __APPLE_CC__
+         not a universal capable compiler
+        #endif
+        typedef int dummy;
+      ]])],
+    [
+     dnl Check for potential -arch flags.  It is not universal unless
+     dnl there are at least two -arch flags with different values.
+     arch=
+     prev=
+     for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
+       if test -n "$prev"; then
+         case $word in
+           i?86 | x86_64 | ppc | ppc64)
+             if test -z "$arch" || test "$arch" = "$word"; then
+               arch="$word"
+             else
+               gl_cv_c_multiarch=yes
+             fi
+             ;;
+         esac
+         prev=
+       else
+         if test "x$word" = "x-arch"; then
+           prev=arch
+         fi
+       fi
+     done
+    ])
+  if test $gl_cv_c_multiarch = yes; then
+    AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1],
+      [Define if the compiler is building for multiple architectures of Apple platforms at once.])
+    APPLE_UNIVERSAL_BUILD=1
+  else
+    APPLE_UNIVERSAL_BUILD=0
+  fi
+  AC_SUBST([APPLE_UNIVERSAL_BUILD])
+])
index db635d05ffe9794430f0a3cc7998035a14c43ec7..eec9e686c0348ccc104f8d9b08ed3c17156a78c4 100644 (file)
@@ -1,5 +1,5 @@
-# quotearg.m4 serial 6
-dnl Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# quotearg.m4 serial 8
+dnl Copyright (C) 2002, 2004-2009 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 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.
@@ -7,9 +7,4 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_QUOTEARG],
 [
   AC_LIBOBJ([quotearg])
 AC_DEFUN([gl_QUOTEARG],
 [
   AC_LIBOBJ([quotearg])
-
-  dnl Prerequisites of lib/quotearg.c.
-  AC_CHECK_FUNCS_ONCE([mbsinit])
-  AC_TYPE_MBSTATE_T
-  gl_FUNC_MBRTOWC
 ])
 ])
index f9fd935dbbde98f57212b8786a6cfbc3cc2cbe18..5925796864e033cb4e0794c9e751378f513b97c5 100644 (file)
@@ -1,5 +1,5 @@
-# realloc.m4 serial 8
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# realloc.m4 serial 9
+dnl Copyright (C) 2007, 2009 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 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.
@@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
   AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
   if test $gl_cv_func_malloc_posix = yes; then
     HAVE_REALLOC_POSIX=1
   AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
   if test $gl_cv_func_malloc_posix = yes; then
     HAVE_REALLOC_POSIX=1
-    AC_DEFINE([HAVE_REALLOC_POSIX], 1,
+    AC_DEFINE([HAVE_REALLOC_POSIX], [1],
       [Define if the 'realloc' function is POSIX compliant.])
   else
     AC_LIBOBJ([realloc])
       [Define if the 'realloc' function is POSIX compliant.])
   else
     AC_LIBOBJ([realloc])
index 2204ecd98405be59e1a8ef52d6fbd464f61552f7..57c804a80ff7da006714ce54b11da37c58557faa 100644 (file)
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009 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 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.
@@ -111,5 +111,5 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
        [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
-     AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
+     AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
    fi])
    fi])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
new file mode 100644 (file)
index 0000000..a2e8bdd
--- /dev/null
@@ -0,0 +1,472 @@
+# stdint.m4 serial 34
+dnl Copyright (C) 2001-2009 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 Paul Eggert and Bruno Haible.
+dnl Test whether <stdint.h> is supported or must be substituted.
+
+AC_DEFUN([gl_STDINT_H],
+[
+  AC_PREREQ([2.59])dnl
+
+  dnl Check for long long int and unsigned long long int.
+  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+  if test $ac_cv_type_long_long_int = yes; then
+    HAVE_LONG_LONG_INT=1
+  else
+    HAVE_LONG_LONG_INT=0
+  fi
+  AC_SUBST([HAVE_LONG_LONG_INT])
+  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+    HAVE_UNSIGNED_LONG_LONG_INT=1
+  else
+    HAVE_UNSIGNED_LONG_LONG_INT=0
+  fi
+  AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
+
+  dnl Check for <inttypes.h>.
+  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
+  if test $ac_cv_header_inttypes_h = yes; then
+    HAVE_INTTYPES_H=1
+  else
+    HAVE_INTTYPES_H=0
+  fi
+  AC_SUBST([HAVE_INTTYPES_H])
+
+  dnl Check for <sys/types.h>.
+  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
+  if test $ac_cv_header_sys_types_h = yes; then
+    HAVE_SYS_TYPES_H=1
+  else
+    HAVE_SYS_TYPES_H=0
+  fi
+  AC_SUBST([HAVE_SYS_TYPES_H])
+
+  gl_CHECK_NEXT_HEADERS([stdint.h])
+  if test $ac_cv_header_stdint_h = yes; then
+    HAVE_STDINT_H=1
+  else
+    HAVE_STDINT_H=0
+  fi
+  AC_SUBST([HAVE_STDINT_H])
+
+  dnl Now see whether we need a substitute <stdint.h>.
+  if test $ac_cv_header_stdint_h = yes; then
+    AC_CACHE_CHECK([whether stdint.h conforms to C99],
+      [gl_cv_header_working_stdint_h],
+      [gl_cv_header_working_stdint_h=no
+       AC_COMPILE_IFELSE([
+         AC_LANG_PROGRAM([[
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
+#if !(defined WCHAR_MIN && defined WCHAR_MAX)
+#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
+#endif
+]
+gl_STDINT_INCLUDES
+[
+#ifdef INT8_MAX
+int8_t a1 = INT8_MAX;
+int8_t a1min = INT8_MIN;
+#endif
+#ifdef INT16_MAX
+int16_t a2 = INT16_MAX;
+int16_t a2min = INT16_MIN;
+#endif
+#ifdef INT32_MAX
+int32_t a3 = INT32_MAX;
+int32_t a3min = INT32_MIN;
+#endif
+#ifdef INT64_MAX
+int64_t a4 = INT64_MAX;
+int64_t a4min = INT64_MIN;
+#endif
+#ifdef UINT8_MAX
+uint8_t b1 = UINT8_MAX;
+#else
+typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
+#endif
+#ifdef UINT16_MAX
+uint16_t b2 = UINT16_MAX;
+#endif
+#ifdef UINT32_MAX
+uint32_t b3 = UINT32_MAX;
+#endif
+#ifdef UINT64_MAX
+uint64_t b4 = UINT64_MAX;
+#endif
+int_least8_t c1 = INT8_C (0x7f);
+int_least8_t c1max = INT_LEAST8_MAX;
+int_least8_t c1min = INT_LEAST8_MIN;
+int_least16_t c2 = INT16_C (0x7fff);
+int_least16_t c2max = INT_LEAST16_MAX;
+int_least16_t c2min = INT_LEAST16_MIN;
+int_least32_t c3 = INT32_C (0x7fffffff);
+int_least32_t c3max = INT_LEAST32_MAX;
+int_least32_t c3min = INT_LEAST32_MIN;
+int_least64_t c4 = INT64_C (0x7fffffffffffffff);
+int_least64_t c4max = INT_LEAST64_MAX;
+int_least64_t c4min = INT_LEAST64_MIN;
+uint_least8_t d1 = UINT8_C (0xff);
+uint_least8_t d1max = UINT_LEAST8_MAX;
+uint_least16_t d2 = UINT16_C (0xffff);
+uint_least16_t d2max = UINT_LEAST16_MAX;
+uint_least32_t d3 = UINT32_C (0xffffffff);
+uint_least32_t d3max = UINT_LEAST32_MAX;
+uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
+uint_least64_t d4max = UINT_LEAST64_MAX;
+int_fast8_t e1 = INT_FAST8_MAX;
+int_fast8_t e1min = INT_FAST8_MIN;
+int_fast16_t e2 = INT_FAST16_MAX;
+int_fast16_t e2min = INT_FAST16_MIN;
+int_fast32_t e3 = INT_FAST32_MAX;
+int_fast32_t e3min = INT_FAST32_MIN;
+int_fast64_t e4 = INT_FAST64_MAX;
+int_fast64_t e4min = INT_FAST64_MIN;
+uint_fast8_t f1 = UINT_FAST8_MAX;
+uint_fast16_t f2 = UINT_FAST16_MAX;
+uint_fast32_t f3 = UINT_FAST32_MAX;
+uint_fast64_t f4 = UINT_FAST64_MAX;
+#ifdef INTPTR_MAX
+intptr_t g = INTPTR_MAX;
+intptr_t gmin = INTPTR_MIN;
+#endif
+#ifdef UINTPTR_MAX
+uintptr_t h = UINTPTR_MAX;
+#endif
+intmax_t i = INTMAX_MAX;
+uintmax_t j = UINTMAX_MAX;
+
+#include <limits.h> /* for CHAR_BIT */
+#define TYPE_MINIMUM(t) \
+  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+#define TYPE_MAXIMUM(t) \
+  ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+struct s {
+  int check_PTRDIFF:
+      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
+      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
+      ? 1 : -1;
+  /* Detect bug in FreeBSD 6.0 / ia64.  */
+  int check_SIG_ATOMIC:
+      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
+      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
+      ? 1 : -1;
+  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
+  int check_WCHAR:
+      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
+      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
+      ? 1 : -1;
+  /* Detect bug in mingw.  */
+  int check_WINT:
+      WINT_MIN == TYPE_MINIMUM (wint_t)
+      && WINT_MAX == TYPE_MAXIMUM (wint_t)
+      ? 1 : -1;
+
+  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
+  int check_UINT8_C:
+        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
+  int check_UINT16_C:
+        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
+
+  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
+#ifdef UINT8_MAX
+  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
+#endif
+#ifdef UINT16_MAX
+  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
+#endif
+#ifdef UINT32_MAX
+  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
+#endif
+#ifdef UINT64_MAX
+  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
+#endif
+  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
+  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
+  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
+  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
+  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
+  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
+  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
+  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
+  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
+  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
+  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
+};
+         ]])],
+         [dnl Determine whether the various *_MIN, *_MAX macros are usable
+          dnl in preprocessor expression. We could do it by compiling a test
+          dnl program for each of these macros. It is faster to run a program
+          dnl that inspects the macro expansion.
+          dnl This detects a bug on HP-UX 11.23/ia64.
+          AC_RUN_IFELSE([
+            AC_LANG_PROGRAM([[
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+#include <stdio.h>
+#include <string.h>
+#define MVAL(macro) MVAL1(macro)
+#define MVAL1(expression) #expression
+static const char *macro_values[] =
+  {
+#ifdef INT8_MAX
+    MVAL (INT8_MAX),
+#endif
+#ifdef INT16_MAX
+    MVAL (INT16_MAX),
+#endif
+#ifdef INT32_MAX
+    MVAL (INT32_MAX),
+#endif
+#ifdef INT64_MAX
+    MVAL (INT64_MAX),
+#endif
+#ifdef UINT8_MAX
+    MVAL (UINT8_MAX),
+#endif
+#ifdef UINT16_MAX
+    MVAL (UINT16_MAX),
+#endif
+#ifdef UINT32_MAX
+    MVAL (UINT32_MAX),
+#endif
+#ifdef UINT64_MAX
+    MVAL (UINT64_MAX),
+#endif
+    NULL
+  };
+]], [[
+  const char **mv;
+  for (mv = macro_values; *mv != NULL; mv++)
+    {
+      const char *value = *mv;
+      /* Test whether it looks like a cast expression.  */
+      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
+          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
+          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
+          || strncmp (value, "((int)"/*)*/, 6) == 0
+          || strncmp (value, "((signed short)"/*)*/, 15) == 0
+          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
+        return 1;
+    }
+  return 0;
+]])],
+              [gl_cv_header_working_stdint_h=yes],
+              [],
+              [dnl When cross-compiling, assume it works.
+               gl_cv_header_working_stdint_h=yes
+              ])
+         ])
+      ])
+  fi
+  if test "$gl_cv_header_working_stdint_h" = yes; then
+    STDINT_H=
+  else
+    dnl Check for <sys/inttypes.h>, and for
+    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
+    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
+    if test $ac_cv_header_sys_inttypes_h = yes; then
+      HAVE_SYS_INTTYPES_H=1
+    else
+      HAVE_SYS_INTTYPES_H=0
+    fi
+    AC_SUBST([HAVE_SYS_INTTYPES_H])
+    if test $ac_cv_header_sys_bitypes_h = yes; then
+      HAVE_SYS_BITYPES_H=1
+    else
+      HAVE_SYS_BITYPES_H=0
+    fi
+    AC_SUBST([HAVE_SYS_BITYPES_H])
+
+    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+    dnl character support).
+    AC_CHECK_HEADERS_ONCE([wchar.h])
+
+    gl_STDINT_TYPE_PROPERTIES
+    STDINT_H=stdint.h
+  fi
+  AC_SUBST([STDINT_H])
+])
+
+dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
+dnl Determine the size of each of the given types in bits.
+AC_DEFUN([gl_STDINT_BITSIZEOF],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+       [Define to the number of bits in type ']gltype['.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
+      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
+         [$2
+#include <limits.h>], [result=unknown])
+       eval gl_cv_bitsizeof_${gltype}=\$result
+      ])
+    eval result=\$gl_cv_bitsizeof_${gltype}
+    if test $result = unknown; then
+      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
+      dnl do a syntax check even on unused #if conditions and give an error
+      dnl on valid C code like this:
+      dnl   #if 0
+      dnl   # if  > 32
+      dnl   # endif
+      dnl   #endif
+      result=0
+    fi
+    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
+    eval BITSIZEOF_${GLTYPE}=\$result
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+])
+
+dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
+dnl Determine the signedness of each of the given types.
+dnl Define HAVE_SIGNED_TYPE if type is signed.
+AC_DEFUN([gl_CHECK_TYPES_SIGNED],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+       [Define to 1 if ']gltype[' is a signed integer type.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([$2[
+            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
+         result=yes, result=no)
+       eval gl_cv_type_${gltype}_signed=\$result
+      ])
+    eval result=\$gl_cv_type_${gltype}_signed
+    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    if test "$result" = yes; then
+      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
+      eval HAVE_SIGNED_${GLTYPE}=1
+    else
+      eval HAVE_SIGNED_${GLTYPE}=0
+    fi
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+])
+
+dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
+dnl Determine the suffix to use for integer constants of the given types.
+dnl Define t_SUFFIX for each such type.
+AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
+       [Define to l, ll, u, ul, ull, etc., as suitable for
+        constants of type ']gltype['.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([for $gltype integer literal suffix],
+      [gl_cv_type_${gltype}_suffix],
+      [eval gl_cv_type_${gltype}_suffix=no
+       eval result=\$gl_cv_type_${gltype}_signed
+       if test "$result" = yes; then
+         glsufu=
+       else
+         glsufu=u
+       fi
+       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
+         case $glsuf in
+           '')  gltype1='int';;
+           l)  gltype1='long int';;
+           ll) gltype1='long long int';;
+           i64)        gltype1='__int64';;
+           u)  gltype1='unsigned int';;
+           ul) gltype1='unsigned long int';;
+           ull)        gltype1='unsigned long long int';;
+           ui64)gltype1='unsigned __int64';;
+         esac
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([$2[
+              extern $gltype foo;
+              extern $gltype1 foo;]])],
+           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
+         eval result=\$gl_cv_type_${gltype}_suffix
+         test "$result" != no && break
+       done])
+    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    eval result=\$gl_cv_type_${gltype}_suffix
+    test "$result" = no && result=
+    eval ${GLTYPE}_SUFFIX=\$result
+    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
+])
+
+dnl gl_STDINT_INCLUDES
+AC_DEFUN([gl_STDINT_INCLUDES],
+[[
+  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+     included before <wchar.h>.  */
+  #include <stddef.h>
+  #include <signal.h>
+  #if HAVE_WCHAR_H
+  # include <stdio.h>
+  # include <time.h>
+  # include <wchar.h>
+  #endif
+]])
+
+dnl gl_STDINT_TYPE_PROPERTIES
+dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
+dnl of interest to stdint.in.h.
+AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
+[
+  AC_REQUIRE([gl_MULTIARCH])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_cv_type_ptrdiff_t_signed=yes
+  gl_cv_type_size_t_signed=no
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+])
+
+dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
+dnl Remove this when we can assume autoconf >= 2.61.
+m4_ifdef([AC_COMPUTE_INT], [], [
+  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
+])
+
+# Hey Emacs!
+# Local Variables:
+# indent-tabs-mode: nil
+# End:
index fa262e359c304269ca78c289559f3e07aa5dca5c..fcbe68f6ba6af3ce982fb68c7e5ab66ae0703228 100644 (file)
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 10
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# stdio_h.m4 serial 16
+dnl Copyright (C) 2007-2009 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 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.
@@ -8,6 +8,28 @@ AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdio.h])
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdio.h])
+  dnl No need to create extra modules for these functions. Everyone who uses
+  dnl <stdio.h> likely needs them.
+  GNULIB_FPRINTF=1
+  GNULIB_PRINTF=1
+  GNULIB_VFPRINTF=1
+  GNULIB_VPRINTF=1
+  GNULIB_FPUTC=1
+  GNULIB_PUTC=1
+  GNULIB_PUTCHAR=1
+  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.
+  m4_ifdef([gl_SIGNAL_SIGPIPE], [
+    gl_SIGNAL_SIGPIPE
+    if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+      REPLACE_STDIO_WRITE_FUNCS=1
+      AC_LIBOBJ([stdio-write])
+    fi
+  ])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -19,49 +41,78 @@ AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
 
 AC_DEFUN([gl_STDIO_H_DEFAULTS],
 [
 
 AC_DEFUN([gl_STDIO_H_DEFAULTS],
 [
-  GNULIB_FPRINTF_POSIX=0;  AC_SUBST([GNULIB_FPRINTF_POSIX])
-  GNULIB_PRINTF_POSIX=0;   AC_SUBST([GNULIB_PRINTF_POSIX])
-  GNULIB_SNPRINTF=0;       AC_SUBST([GNULIB_SNPRINTF])
-  GNULIB_SPRINTF_POSIX=0;  AC_SUBST([GNULIB_SPRINTF_POSIX])
-  GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
-  GNULIB_VPRINTF_POSIX=0;  AC_SUBST([GNULIB_VPRINTF_POSIX])
-  GNULIB_VSNPRINTF=0;      AC_SUBST([GNULIB_VSNPRINTF])
-  GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
-  GNULIB_VASPRINTF=0;      AC_SUBST([GNULIB_VASPRINTF])
-  GNULIB_FOPEN=0;          AC_SUBST([GNULIB_FOPEN])
-  GNULIB_FREOPEN=0;        AC_SUBST([GNULIB_FREOPEN])
-  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_FFLUSH=0;         AC_SUBST([GNULIB_FFLUSH])
-  GNULIB_GETDELIM=0;       AC_SUBST([GNULIB_GETDELIM])
-  GNULIB_GETLINE=0;        AC_SUBST([GNULIB_GETLINE])
+  GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
+  GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
+  GNULIB_PRINTF=0;               AC_SUBST([GNULIB_PRINTF])
+  GNULIB_PRINTF_POSIX=0;         AC_SUBST([GNULIB_PRINTF_POSIX])
+  GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
+  GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
+  GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
+  GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
+  GNULIB_VPRINTF=0;              AC_SUBST([GNULIB_VPRINTF])
+  GNULIB_VPRINTF_POSIX=0;        AC_SUBST([GNULIB_VPRINTF_POSIX])
+  GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
+  GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
+  GNULIB_DPRINTF=0;              AC_SUBST([GNULIB_DPRINTF])
+  GNULIB_VDPRINTF=0;             AC_SUBST([GNULIB_VDPRINTF])
+  GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
+  GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
+  GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
+  GNULIB_FOPEN=0;                AC_SUBST([GNULIB_FOPEN])
+  GNULIB_FREOPEN=0;              AC_SUBST([GNULIB_FREOPEN])
+  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_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
+  GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
+  GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
+  GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
+  GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
+  GNULIB_PUTCHAR=0;              AC_SUBST([GNULIB_PUTCHAR])
+  GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
+  GNULIB_PUTS=0;                 AC_SUBST([GNULIB_PUTS])
+  GNULIB_FWRITE=0;               AC_SUBST([GNULIB_FWRITE])
+  GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
+  GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
+  GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
+  GNULIB_STDIO_H_SIGPIPE=0;      AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   dnl Assume proper GNU behavior unless another module says otherwise.
-  REPLACE_FPRINTF=0;       AC_SUBST([REPLACE_FPRINTF])
-  REPLACE_VFPRINTF=0;      AC_SUBST([REPLACE_VFPRINTF])
-  REPLACE_PRINTF=0;        AC_SUBST([REPLACE_PRINTF])
-  REPLACE_VPRINTF=0;       AC_SUBST([REPLACE_VPRINTF])
-  REPLACE_SNPRINTF=0;      AC_SUBST([REPLACE_SNPRINTF])
-  HAVE_DECL_SNPRINTF=1;    AC_SUBST([HAVE_DECL_SNPRINTF])
-  REPLACE_VSNPRINTF=0;     AC_SUBST([REPLACE_VSNPRINTF])
-  HAVE_DECL_VSNPRINTF=1;   AC_SUBST([HAVE_DECL_VSNPRINTF])
-  REPLACE_SPRINTF=0;       AC_SUBST([REPLACE_SPRINTF])
-  REPLACE_VSPRINTF=0;      AC_SUBST([REPLACE_VSPRINTF])
-  HAVE_VASPRINTF=1;        AC_SUBST([HAVE_VASPRINTF])
-  REPLACE_VASPRINTF=0;     AC_SUBST([REPLACE_VASPRINTF])
-  REPLACE_FOPEN=0;         AC_SUBST([REPLACE_FOPEN])
-  REPLACE_FREOPEN=0;       AC_SUBST([REPLACE_FREOPEN])
-  HAVE_FSEEKO=1;           AC_SUBST([HAVE_FSEEKO])
-  REPLACE_FSEEKO=0;        AC_SUBST([REPLACE_FSEEKO])
-  REPLACE_FSEEK=0;         AC_SUBST([REPLACE_FSEEK])
-  HAVE_FTELLO=1;           AC_SUBST([HAVE_FTELLO])
-  REPLACE_FTELLO=0;        AC_SUBST([REPLACE_FTELLO])
-  REPLACE_FTELL=0;         AC_SUBST([REPLACE_FTELL])
-  REPLACE_FFLUSH=0;        AC_SUBST([REPLACE_FFLUSH])
-  HAVE_DECL_GETDELIM=1;    AC_SUBST([HAVE_DECL_GETDELIM])
-  HAVE_DECL_GETLINE=1;     AC_SUBST([HAVE_DECL_GETLINE])
-  REPLACE_GETLINE=0;       AC_SUBST([REPLACE_GETLINE])
+  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
+  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
+  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
+  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
+  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
+  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
+  HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
+  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
+  HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
+  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
+  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
+  HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
+  REPLACE_DPRINTF=0;             AC_SUBST([REPLACE_DPRINTF])
+  HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
+  REPLACE_VDPRINTF=0;            AC_SUBST([REPLACE_VDPRINTF])
+  HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
+  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
+  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
+  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
+  REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
+  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
+  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
+  REPLACE_FSEEK=0;               AC_SUBST([REPLACE_FSEEK])
+  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
+  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
+  REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
+  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
+  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
+  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
+  REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
+  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
+  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
+  REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
+  REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
 ])
 
 dnl Code shared by fseeko and ftello.  Determine if large files are supported,
 ])
 
 dnl Code shared by fseeko and ftello.  Determine if large files are supported,
index 95e679f7971d8b33e40f4a6160cb3f2a8614cfb3..b295f16b2797a03bdd21abd9dbd0d25fc57c0ffa 100644 (file)
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 7
-dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 15
+dnl Copyright (C) 2007-2009 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 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.
@@ -8,6 +8,20 @@ AC_DEFUN([gl_STDLIB_H],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdlib.h])
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdlib.h])
+  AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT])
+  if test $ac_cv_header_random_h = yes; then
+    HAVE_RANDOM_H=1
+  else
+    HAVE_RANDOM_H=0
+  fi
+  AC_SUBST([HAVE_RANDOM_H])
+  AC_CHECK_TYPES([struct random_data],
+    [], [HAVE_STRUCT_RANDOM_DATA=0],
+    [[#include <stdlib.h>
+      #if HAVE_RANDOM_H
+      # include <random.h>
+      #endif
+    ]])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -22,26 +36,38 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
   GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
   GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
   GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
   GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
   GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
+  GNULIB_ATOLL=0;         AC_SUBST([GNULIB_ATOLL])
+  GNULIB_GETLOADAVG=0;    AC_SUBST([GNULIB_GETLOADAVG])
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
   GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
   GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
   GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
   GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
+  GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
   GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
   GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
   GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
   GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
+  GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
+  GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
   GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
   dnl Assume proper GNU behavior unless another module says otherwise.
   GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_CALLOC_POSIX=1;    AC_SUBST([HAVE_CALLOC_POSIX])
-  HAVE_GETSUBOPT=1;       AC_SUBST([HAVE_GETSUBOPT])
-  HAVE_MALLOC_POSIX=1;    AC_SUBST([HAVE_MALLOC_POSIX])
-  HAVE_MKDTEMP=1;         AC_SUBST([HAVE_MKDTEMP])
-  HAVE_REALLOC_POSIX=1;   AC_SUBST([HAVE_REALLOC_POSIX])
-  HAVE_RPMATCH=1;         AC_SUBST([HAVE_RPMATCH])
-  HAVE_SETENV=1;          AC_SUBST([HAVE_SETENV])
-  HAVE_STRTOD=1;          AC_SUBST([HAVE_STRTOD])
-  HAVE_UNSETENV=1;        AC_SUBST([HAVE_UNSETENV])
-  REPLACE_MKSTEMP=0;      AC_SUBST([REPLACE_MKSTEMP])
-  REPLACE_PUTENV=0;       AC_SUBST([REPLACE_PUTENV])
-  REPLACE_STRTOD=0;       AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;        AC_SUBST([VOID_UNSETENV])
+  HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
+  HAVE_CALLOC_POSIX=1;       AC_SUBST([HAVE_CALLOC_POSIX])
+  HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
+  HAVE_MALLOC_POSIX=1;       AC_SUBST([HAVE_MALLOC_POSIX])
+  HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
+  HAVE_REALLOC_POSIX=1;      AC_SUBST([HAVE_REALLOC_POSIX])
+  HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
+  HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
+  HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
+  HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
+  HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
+  HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
+  HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
+  HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
+  HAVE_UNSETENV=1;           AC_SUBST([HAVE_UNSETENV])
+  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
+  REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
+  REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
+  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
 ])
 ])
index 75d54621b1be315d0476c9f1651fc338964d281a..8c16ca9a879a5de8720a7651cf15ee5b22033adf 100644 (file)
@@ -1,4 +1,4 @@
-# strerror.m4 serial 8
+# strerror.m4 serial 9
 dnl Copyright (C) 2002, 2007-2008 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 Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_STRERROR],
 [
   AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
 AC_DEFUN([gl_FUNC_STRERROR],
 [
   AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
-  if test $gl_cv_func_working_strerror = no; then
+  if test $REPLACE_STRERROR = 1; then
     AC_LIBOBJ([strerror])
     AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
       [Define this to 1 if strerror is broken.])
     AC_LIBOBJ([strerror])
     AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
       [Define this to 1 if strerror is broken.])
@@ -18,25 +18,38 @@ AC_DEFUN([gl_FUNC_STRERROR],
 AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
 [
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
 AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
 [
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_CACHE_CHECK([for working strerror function],
-   [gl_cv_func_working_strerror],
-   [AC_RUN_IFELSE(
-      [AC_LANG_PROGRAM(
-        [[#include <string.h>
-        ]],
-        [[return !*strerror (-2);]])],
-      [gl_cv_func_working_strerror=yes],
-      [gl_cv_func_working_strerror=no],
-      [dnl Assume crossbuild works if it compiles.
-       AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <string.h>
-           ]],
-           [[return !*strerror (-2);]])],
-        [gl_cv_func_working_strerror=yes],
-        [gl_cv_func_working_strerror=no])])])
-  if test $gl_cv_func_working_strerror = no ; then
+  AC_REQUIRE([gl_HEADER_ERRNO_H])
+  if test -z "$ERRNO_H"; then
+    AC_CACHE_CHECK([for working strerror function],
+     [gl_cv_func_working_strerror],
+     [AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <string.h>
+           ]],
+           [[return !*strerror (-2);]])],
+        [gl_cv_func_working_strerror=yes],
+        [gl_cv_func_working_strerror=no],
+        [dnl Assume crossbuild works if it compiles.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <string.h>
+              ]],
+              [[return !*strerror (-2);]])],
+           [gl_cv_func_working_strerror=yes],
+           [gl_cv_func_working_strerror=no])
+      ])
+    ])
+    if test $gl_cv_func_working_strerror = no; then
+      dnl The system's strerror() fails to return a string for out-of-range
+      dnl integers. Replace it.
+      REPLACE_STRERROR=1
+    fi
+  else
+    dnl The system's strerror() cannot know about the new errno values we add
+    dnl to <errno.h>. Replace it.
     REPLACE_STRERROR=1
     REPLACE_STRERROR=1
+  fi
+  if test $REPLACE_STRERROR = 1; then
     gl_PREREQ_STRERROR
   fi
 ])
     gl_PREREQ_STRERROR
   fi
 ])
@@ -44,4 +57,12 @@ AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
 # Prerequisites of lib/strerror.c.
 AC_DEFUN([gl_PREREQ_STRERROR], [
   AC_CHECK_DECLS([strerror])
 # Prerequisites of lib/strerror.c.
 AC_DEFUN([gl_PREREQ_STRERROR], [
   AC_CHECK_DECLS([strerror])
+  AC_CHECK_HEADERS_ONCE([sys/socket.h])
+  if test $ac_cv_header_sys_socket_h != yes; then
+    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+    dnl the check for those headers unconditional; yet cygwin reports
+    dnl that the headers are present but cannot be compiled (since on
+    dnl cygwin, all socket information should come from sys/socket.h).
+    AC_CHECK_HEADERS([winsock2.h])
+  fi
 ])
 ])
index 7143690ebf695725b2f776a6d394e340704fc8c3..11f09c8b8ff35601a7ea61791cb0fc6857e5f9c0 100644 (file)
@@ -1,11 +1,11 @@
 # Configure a GNU-like replacement for <string.h>.
 
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2009 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.
 
 # 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.
 
-# serial 4
+# serial 7
 
 # Written by Paul Eggert.
 
 
 # Written by Paul Eggert.
 
@@ -32,6 +32,7 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR],
 
 AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
 [
 
 AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
 [
+  GNULIB_MEMCHR=0;      AC_SUBST([GNULIB_MEMCHR])
   GNULIB_MEMMEM=0;      AC_SUBST([GNULIB_MEMMEM])
   GNULIB_MEMPCPY=0;     AC_SUBST([GNULIB_MEMPCPY])
   GNULIB_MEMRCHR=0;     AC_SUBST([GNULIB_MEMRCHR])
   GNULIB_MEMMEM=0;      AC_SUBST([GNULIB_MEMMEM])
   GNULIB_MEMPCPY=0;     AC_SUBST([GNULIB_MEMPCPY])
   GNULIB_MEMRCHR=0;     AC_SUBST([GNULIB_MEMRCHR])
@@ -63,6 +64,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
+  GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
@@ -81,9 +83,12 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
   HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
   HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
   HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
   HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
   HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
-  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
-  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
+  HAVE_STRVERSCMP=1;           AC_SUBST([HAVE_STRVERSCMP])
+  REPLACE_MEMCHR=0;            AC_SUBST([REPLACE_MEMCHR])
   REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
   REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
-  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRDUP=0;            AC_SUBST([REPLACE_STRDUP])
   REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
   REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
+  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
 ])
 ])
index e8ccab16e837659cb30099432991a810bd7698cf..ff9a4ea0a59f3c43d7c06bbc973fa5918c7bf11c 100644 (file)
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 11
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+# unistd_h.m4 serial 17
+dnl Copyright (C) 2006-2009 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 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.
@@ -32,22 +32,39 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
 
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
 [
 
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
 [
-  GNULIB_CHOWN=0;         AC_SUBST([GNULIB_CHOWN])
-  GNULIB_DUP2=0;          AC_SUBST([GNULIB_DUP2])
-  GNULIB_ENVIRON=0;       AC_SUBST([GNULIB_ENVIRON])
-  GNULIB_FCHDIR=0;        AC_SUBST([GNULIB_FCHDIR])
-  GNULIB_FTRUNCATE=0;     AC_SUBST([GNULIB_FTRUNCATE])
-  GNULIB_GETCWD=0;        AC_SUBST([GNULIB_GETCWD])
-  GNULIB_GETLOGIN_R=0;    AC_SUBST([GNULIB_GETLOGIN_R])
-  GNULIB_GETPAGESIZE=0;   AC_SUBST([GNULIB_GETPAGESIZE])
-  GNULIB_LCHOWN=0;        AC_SUBST([GNULIB_LCHOWN])
-  GNULIB_LSEEK=0;         AC_SUBST([GNULIB_LSEEK])
-  GNULIB_READLINK=0;      AC_SUBST([GNULIB_READLINK])
-  GNULIB_SLEEP=0;         AC_SUBST([GNULIB_SLEEP])
+  GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
+  GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
+  GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
+  GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
+  GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
+  GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
+  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_GETHOSTNAME=0;      AC_SUBST([GNULIB_GETHOSTNAME])
+  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_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
+  GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
+  GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
+  GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
+  GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
+  HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
+  HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
+  HAVE_GETDOMAINNAME=1;   AC_SUBST([HAVE_GETDOMAINNAME])
+  HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
+  HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
+  HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
@@ -55,9 +72,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
+  REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
+  REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
+  UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
 ])
 ])
index 70b1248f8fcfce58a93260c6cfb8ea7bf93ded61..2e52a82acfb9a94e00ca1ef12729f3294995f64b 100644 (file)
@@ -1,13 +1,13 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2009 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 Written by Eric Blake.
 
 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 Written by Eric Blake.
 
-# wchar.m4 serial 4
+# wchar.m4 serial 23
 
 AC_DEFUN([gl_WCHAR_H],
 [
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -18,7 +18,16 @@ AC_DEFUN([gl_WCHAR_H],
 wchar_t w;]],
       [gl_cv_header_wchar_h_standalone=yes],
       [gl_cv_header_wchar_h_standalone=no])])
 wchar_t w;]],
       [gl_cv_header_wchar_h_standalone=yes],
       [gl_cv_header_wchar_h_standalone=no])])
-  if test $gl_cv_header_wchar_h_standalone != yes; then
+
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  if test $gt_cv_c_wint_t = yes; then
+    HAVE_WINT_T=1
+  else
+    HAVE_WINT_T=0
+  fi
+  AC_SUBST([HAVE_WINT_T])
+
+  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
     WCHAR_H=wchar.h
   fi
 
     WCHAR_H=wchar.h
   fi
 
@@ -36,6 +45,13 @@ wchar_t w;]],
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
+dnl Unconditionally enables the replacement of <wchar.h>.
+AC_DEFUN([gl_REPLACE_WCHAR_H],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  WCHAR_H=wchar.h
+])
+
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -45,10 +61,40 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
 [
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
 [
-  GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
+  GNULIB_BTOWC=0;      AC_SUBST([GNULIB_BTOWC])
+  GNULIB_WCTOB=0;      AC_SUBST([GNULIB_WCTOB])
+  GNULIB_MBSINIT=0;    AC_SUBST([GNULIB_MBSINIT])
+  GNULIB_MBRTOWC=0;    AC_SUBST([GNULIB_MBRTOWC])
+  GNULIB_MBRLEN=0;     AC_SUBST([GNULIB_MBRLEN])
+  GNULIB_MBSRTOWCS=0;  AC_SUBST([GNULIB_MBSRTOWCS])
+  GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
+  GNULIB_WCRTOMB=0;    AC_SUBST([GNULIB_WCRTOMB])
+  GNULIB_WCSRTOMBS=0;  AC_SUBST([GNULIB_WCSRTOMBS])
+  GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
+  GNULIB_WCWIDTH=0;    AC_SUBST([GNULIB_WCWIDTH])
   dnl Assume proper GNU behavior unless another module says otherwise.
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
-  REPLACE_WCWIDTH=0;   AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H=
-  AC_SUBST([WCHAR_H])
+  HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
+  HAVE_MBSINIT=1;       AC_SUBST([HAVE_MBSINIT])
+  HAVE_MBRTOWC=1;       AC_SUBST([HAVE_MBRTOWC])
+  HAVE_MBRLEN=1;        AC_SUBST([HAVE_MBRLEN])
+  HAVE_MBSRTOWCS=1;     AC_SUBST([HAVE_MBSRTOWCS])
+  HAVE_MBSNRTOWCS=1;    AC_SUBST([HAVE_MBSNRTOWCS])
+  HAVE_WCRTOMB=1;       AC_SUBST([HAVE_WCRTOMB])
+  HAVE_WCSRTOMBS=1;     AC_SUBST([HAVE_WCSRTOMBS])
+  HAVE_WCSNRTOMBS=1;    AC_SUBST([HAVE_WCSNRTOMBS])
+  HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
+  REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
+  REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
+  REPLACE_WCTOB=0;      AC_SUBST([REPLACE_WCTOB])
+  REPLACE_MBSINIT=0;    AC_SUBST([REPLACE_MBSINIT])
+  REPLACE_MBRTOWC=0;    AC_SUBST([REPLACE_MBRTOWC])
+  REPLACE_MBRLEN=0;     AC_SUBST([REPLACE_MBRLEN])
+  REPLACE_MBSRTOWCS=0;  AC_SUBST([REPLACE_MBSRTOWCS])
+  REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
+  REPLACE_WCRTOMB=0;    AC_SUBST([REPLACE_WCRTOMB])
+  REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
+  REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
+  REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
+  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
 ])
index af5ed936cc447baf325b9c2c1ea4fc9b0f620ee5..47a4363d79041b6481ed781bcbe798dc1b171ec9 100644 (file)
@@ -1,5 +1,5 @@
-# wint_t.m4 serial 2 (gettext-0.17)
-dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+# wint_t.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 2003, 2007-2009 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 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.
@@ -10,7 +10,7 @@ dnl Prerequisite: AC_PROG_CC
 
 AC_DEFUN([gt_TYPE_WINT_T],
 [
 
 AC_DEFUN([gt_TYPE_WINT_T],
 [
-  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
+  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
     [AC_TRY_COMPILE([
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
     [AC_TRY_COMPILE([
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
@@ -21,8 +21,8 @@ AC_DEFUN([gt_TYPE_WINT_T],
 #include <time.h>
 #include <wchar.h>
        wint_t foo = (wchar_t)'\0';], ,
 #include <time.h>
 #include <wchar.h>
        wint_t foo = (wchar_t)'\0';], ,
-       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
+       [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
   if test $gt_cv_c_wint_t = yes; then
   if test $gt_cv_c_wint_t = yes; then
-    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
+    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
   fi
 ])
   fi
 ])
index 4d74e19efc3de897c0c7a07e7df536c7af6e6eb9..ef828d1cb80a7ca5f22f6b38e374b399e16ab8fe 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -1,31 +1,28 @@
 # -*-Makefile-*-
 # -*-Makefile-*-
-# This Makefile fragment is intended to be useful by any GNU-like project.
-# This file originate from coreutils, CPPI, Bison, and Autoconf.
-
-# Copyright (C) 2001-2007 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License,
-# or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# This Makefile fragment tries to be general-purpose enough to be
+# used by many projects via the gnulib maintainer-makefile module.
 
 
-ME := maint.mk
+## Copyright (C) 2001-2009 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-# List of all C-like source code files that will be tested for
-# stylistic "errors".  You may want to define this to something
-# more complex in Makefile.cfg.
-C_SOURCES ?= $(shell find . -name '*.[chly]')
+# This is reported not to work with make-3.79.1
+# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+ME := maint.mk
 
 
-# Add some more files to check, typically set in Makefile.cfg.
-C_SOURCES += $(C_SOURCES_ADD)
+# Override this in cfg.mk if you use a non-standard build-aux directory.
+build_aux ?= $(srcdir)/build-aux
 
 # Do not save the original name or timestamp in the .tar.gz file.
 # Use --rsyncable if available.
 
 # Do not save the original name or timestamp in the .tar.gz file.
 # Use --rsyncable if available.
@@ -33,81 +30,731 @@ gzip_rsyncable := \
   $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 
   $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 
+# cfg.mk must define the gpg_key_ID used by this package.
+GIT = git
+VC = $(GIT)
+VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
+
+VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
+
+VC_LIST_EXCEPT = \
+  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; else grep -v ChangeLog; fi
+
+ifeq ($(origin prev_version_file), undefined)
+  prev_version_file = $(srcdir)/.prev-version
+endif
+
+PREV_VERSION := $(shell cat $(prev_version_file))
+VERSION_REGEXP = $(subst .,\.,$(VERSION))
+PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
+
+ifeq ($(VC),$(GIT))
+this-vc-tag = v$(VERSION)
+this-vc-tag-regexp = v$(VERSION_REGEXP)
+else
+tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
+tag-this-version = $(subst .,_,$(VERSION))
+this-vc-tag = $(tag-package)-$(tag-this-version)
+this-vc-tag-regexp = $(this-vc-tag)
+endif
+my_distdir = $(PACKAGE)-$(VERSION)
+
+# Old releases are stored here.
+release_archive_dir ?= ../release
+
 # Prevent programs like 'sort' from considering distinct strings to be equal.
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C
 
 # Prevent programs like 'sort' from considering distinct strings to be equal.
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C
 
-# Casting arguments to free is never necessary.
-sc_cast_of_argument_to_free:
-       @grep -nE '\<free *\( *\(' $(C_SOURCES) &&                      \
-         { echo '$(ME): don'\''t cast free argument' 1>&2;             \
+## --------------- ##
+## Sanity checks.  ##
+## --------------- ##
+
+# Collect the names of rules starting with `sc_'.
+syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
+                       $(srcdir)/$(ME) $(srcdir)/cfg.mk)
+.PHONY: $(syntax-check-rules)
+
+local-checks-available = \
+  $(syntax-check-rules)
+.PHONY: $(local-checks-available)
+
+# Arrange to print the name of each syntax-checking rule just before running it.
+$(syntax-check-rules): %: %.m
+$(patsubst %, %.m, $(syntax-check-rules)):
+       @echo $(patsubst sc_%.m, %, $@)
+
+local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
+
+syntax-check: $(local-check)
+#      @grep -nE '#  *include <(limits|std(def|arg|bool))\.h>'         \
+#          $$(find -type f -name '*.[chly]') &&                        \
+#        { echo '$(ME): found conditional include' 1>&2;               \
+#          exit 1; } || :
+
+#      grep -nE '^#  *include <(string|stdlib)\.h>'                    \
+#          $(srcdir)/{lib,src}/*.[chy] &&                              \
+#        { echo '$(ME): FIXME' 1>&2;                                   \
+#          exit 1; } || :
+# FIXME: don't allow `#include .strings\.h' anywhere
+
+# By default, _prohibit_regexp does not ignore case.
+export ignore_case =
+_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
+
+# There are many rules below that prohibit constructs in this package.
+# If the offending construct can be matched with a grep-E-style regexp,
+# use this macro.  The shell variables "re" and "msg" must be defined.
+define _prohibit_regexp
+  dummy=; : so we do not need a semicolon before each use;             \
+  test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
+  test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
+  grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) &&             \
+    { echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
+endef
+
+sc_avoid_if_before_free:
+       @$(build_aux)/useless-if-before-free                            \
+               $(useless_free_options)                                 \
+           $$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) &&   \
+         { echo '$(ME): found useless "if" before "free" above' 1>&2;  \
            exit 1; } || :
 
            exit 1; } || :
 
+sc_cast_of_argument_to_free:
+       @re='\<free *\( *\(' msg='don'\''t cast free argument'          \
+         $(_prohibit_regexp)
+
 sc_cast_of_x_alloc_return_value:
 sc_cast_of_x_alloc_return_value:
-       @grep -nE '\*\) *x(m|c|re)alloc\>' $(C_SOURCES) &&              \
-         { echo '$(ME): don'\''t cast x*alloc return value' 1>&2;      \
-           exit 1; } || :
+       @re='\*\) *x(m|c|re)alloc\>'                                    \
+       msg='don'\''t cast x*alloc return value'                        \
+         $(_prohibit_regexp)
 
 sc_cast_of_alloca_return_value:
 
 sc_cast_of_alloca_return_value:
-       @grep -nE '\*\) *alloca\>' $(C_SOURCES) &&                      \
-         { echo '$(ME): don'\''t cast alloca return value' 1>&2;       \
-           exit 1; } || :
+       @re='\*\) *alloca\>' msg='don'\''t cast alloca return value'    \
+         $(_prohibit_regexp)
 
 sc_space_tab:
 
 sc_space_tab:
-       @grep -n '[ ]   ' $(C_SOURCES) &&                               \
-         { echo '$(ME): found SPACE-TAB sequence; remove the SPACE'    \
-               1>&2; exit 1; } || :
+       @re='[ ]        ' msg='found SPACE-TAB sequence; remove the SPACE' \
+         $(_prohibit_regexp)
 
 
-# Don't use the old ato* functions in `real' code.
+# Don't use *scanf or the old ato* functions in `real' code.
 # They provide no error checking mechanism.
 # Instead, use strto* functions.
 sc_prohibit_atoi_atof:
 # They provide no error checking mechanism.
 # Instead, use strto* functions.
 sc_prohibit_atoi_atof:
-       @grep -nE '\<ato([filq]|ll)\>' $(C_SOURCES) &&                  \
-         { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
+       @re='\<([fs]?scanf|ato([filq]|ll)) *\('                         \
+       msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
+         $(_prohibit_regexp)
+
+# Use STREQ rather than comparing strcmp == 0, or != 0.
+sc_prohibit_strcmp:
+       @grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *=='           \
+           $$($(VC_LIST_EXCEPT))                                       \
+         | grep -vE ':# *define STREQ\(' &&                            \
+         { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
                1>&2; exit 1; } || :
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use `0' instead.
 sc_error_exit_success:
                1>&2; exit 1; } || :
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use `0' instead.
 sc_error_exit_success:
-       @grep -nF 'error (EXIT_SUCCESS,' $(C_SOURCES) &&                \
-         { echo '$(ME): found error (EXIT_SUCCESS' 1>&2;               \
+       @grep -nE 'error \(EXIT_SUCCESS,'                               \
+           $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') &&             \
+         { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
+
+# `FATAL:' should be fully upper-cased in error messages
+# `WARNING:' should be fully upper-cased, or fully lower-cased
+sc_error_message_warn_fatal:
+       @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT))               \
+           | grep -E '"Warning|"Fatal|"fatal' &&                       \
+         { echo '$(ME): use FATAL, WARNING or warning' 1>&2;           \
+           exit 1; } || :
+
+# Error messages should not start with a capital letter
+sc_error_message_uppercase:
+       @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT))               \
+           | grep -E '"[A-Z]'                                          \
+           | grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' &&           \
+         { echo '$(ME): found capitalized error message' 1>&2;         \
            exit 1; } || :
 
            exit 1; } || :
 
-# Stylistic, use #ifdef instead of #if
-sc_no_if_have_config_h:
-       @grep -n '^# *if HAVE_CONFIG_H' $(C_SOURCES) &&                 \
-         { echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef'    \
+# Error messages should not end with a period
+sc_error_message_period:
+       @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT))               \
+           | grep -E '[^."]\."' &&                                     \
+         { echo '$(ME): found error message ending in period' 1>&2;    \
+           exit 1; } || :
+
+sc_file_system:
+       @re=file''system ignore_case=1                                  \
+       msg='found use of "file''system"; spell it "file system"'       \
+         $(_prohibit_regexp)
+
+# Don't use cpp tests of this symbol.  All code assumes config.h is included.
+sc_prohibit_have_config_h:
+       @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) &&     \
+         { echo '$(ME): found use of HAVE''_CONFIG_H; remove'          \
                1>&2; exit 1; } || :
 
                1>&2; exit 1; } || :
 
+# Nearly all .c files must include <config.h>.  However, we also permit this
+# via inclusion of a package-specific header, if cfg.mk specified one.
+# config_h_header must be suitable for grep -E.
+config_h_header ?= <config\.h>
+sc_require_config_h:
+       @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then       \
+         grep -EL '^# *include $(config_h_header)'                     \
+               $$($(VC_LIST_EXCEPT) | grep '\.c$$')                    \
+             | grep . &&                                               \
+         { echo '$(ME): the above files do not include <config.h>'     \
+               1>&2; exit 1; } || :;                                   \
+       else :;                                                         \
+       fi
+
+# You must include <config.h> before including any other header file.
+# This can possibly be via a package-specific header, if given by cfg.mk.
+sc_require_config_h_first:
+       @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then       \
+         fail=0;                                                       \
+         for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do             \
+           grep '^# *include\>' $$i | sed 1q                           \
+               | grep -E '^# *include $(config_h_header)' > /dev/null  \
+             || { echo $$i; fail=1; };                                 \
+         done;                                                         \
+         test $$fail = 1 &&                                            \
+           { echo '$(ME): the above files include some other header'   \
+               'before <config.h>' 1>&2; exit 1; } || :;               \
+       else :;                                                         \
+       fi
+
+sc_prohibit_HAVE_MBRTOWC:
+       @re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
+         $(_prohibit_regexp)
+
+# To use this "command" macro, you must first define two shell variables:
+# h: the header, enclosed in <> or ""
+# re: a regular expression that matches IFF something provided by $h is used.
+define _header_without_use
+  h_esc=`echo "$$h"|sed 's/\./\\./g'`;                                 \
+  if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then             \
+    files=$$(grep -l '^# *include '"$$h_esc"                           \
+            $$($(VC_LIST_EXCEPT) | grep '\.c$$')) &&                   \
+    grep -LE "$$re" $$files | grep . &&                                        \
+      { echo "$(ME): the above files include $$h but don't use it"     \
+       1>&2; exit 1; } || :;                                           \
+  else :;                                                              \
+  fi
+endef
+
 # Prohibit the inclusion of assert.h without an actual use of assert.
 sc_prohibit_assert_without_use:
 # Prohibit the inclusion of assert.h without an actual use of assert.
 sc_prohibit_assert_without_use:
-       @files=$$(grep -l '# *include [<"]assert\.h[>"]' $(C_SOURCES)   \
-                       | grep '\.[cy]$$') &&                           \
-       grep -L '\<assert (' $$files                                    \
-           | grep . &&                                                 \
-         { echo "$(ME): the above files include <assert.h> but don't use it" \
-               1>&2; exit 1; } || :
+       @h='<assert.h>' re='\<assert *\(' $(_header_without_use)
+
+# Prohibit the inclusion of getopt.h without an actual use.
+sc_prohibit_getopt_without_use:
+       @h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
+
+# Don't include quotearg.h unless you use one of its functions.
+sc_prohibit_quotearg_without_use:
+       @h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
+
+# Don't include quote.h unless you use one of its functions.
+sc_prohibit_quote_without_use:
+       @h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_long_options_without_use:
+       @h='"long-options.h"' re='\<parse_long_options *\(' \
+         $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_inttostr_without_use:
+       @h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
+         $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_error_without_use:
+       @h='"error.h"' \
+       re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
+         $(_header_without_use)
+
+sc_prohibit_safe_read_without_use:
+       @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
+         $(_header_without_use)
+
+sc_prohibit_argmatch_without_use:
+       @h='"argmatch.h"' \
+       re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
+         $(_header_without_use)
+
+sc_prohibit_root_dev_ino_without_use:
+       @h='"root-dev-ino.h"' \
+       re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
+         $(_header_without_use)
+
+# Prohibit the inclusion of c-ctype.h without an actual use.
+ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
+|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
+sc_prohibit_c_ctype_without_use:
+       @h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
+
+_empty =
+_sp = $(_empty) $(_empty)
+# The following list was generated by running:
+# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
+#   | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
+_sig_functions = \
+  bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
+  sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
+  siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
+  sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
+_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
+# The following were extracted from "man signal.h" manually.
+_sig_types_and_consts =                                                        \
+  MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK          \
+  SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL           \
+  SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE   \
+  SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
+  sigstack sigval stack_t ucontext_t
+# generated via this:
+# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
+_sig_names =                                                           \
+  SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT     \
+  SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL      \
+  SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
+  SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR     \
+  SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS  \
+  SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1       \
+  SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW      \
+  SIGXCPU SIGXFSZ
+_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
+
+# Prohibit the inclusion of signal.h without an actual use.
+sc_prohibit_signal_without_use:
+       @h='<signal.h>'                                                 \
+       re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>'          \
+         $(_header_without_use)
 
 sc_obsolete_symbols:
 
 sc_obsolete_symbols:
-       @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' $(C_SOURCES) &&     \
-         { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY'       \
-               1>&2; exit 1; } || :
+       @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'                           \
+       msg='do not use HAVE''_FCNTL_H or O'_NDELAY                     \
+         $(_prohibit_regexp)
+
+# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
 
 
-# Each nonempty line must start with a year number, or a TAB.
+# Each nonempty ChangeLog line must start with a year number, or a TAB.
 sc_changelog:
 sc_changelog:
-       @grep -n '^[^12 ]' $$(find . -name ChangeLog) &&        \
+       @if $(VC_LIST_EXCEPT) | grep -l '^ChangeLog$$' >/dev/null; then \
+         grep -n '^[^12        ]'                                      \
+           $$($(VC_LIST_EXCEPT) | grep '^ChangeLog$$') &&              \
          { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2;  \
          { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2;  \
+           exit 1; } || :;                                             \
+       fi
+
+# Ensure that each .c file containing a "main" function also
+# calls set_program_name.
+sc_program_name:
+       @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then       \
+         files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
+         grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files         \
+             | grep . &&                                               \
+         { echo '$(ME): the above files do not call set_program_name'  \
+               1>&2; exit 1; } || :;                                   \
+       else :;                                                         \
+       fi
+
+# Require that the final line of each test-lib.sh-using test be this one:
+# Exit $fail
+# Note: this test requires GNU grep's --label= option.
+Exit_witness_file ?= tests/test-lib.sh
+Exit_base := $(notdir $(Exit_witness_file))
+sc_require_test_exit_idiom:
+       @if test -f $(srcdir)/$(Exit_witness_file); then                \
+         die=0;                                                        \
+         for i in $$(grep -l -F 'srcdir/$(Exit_base)'                  \
+               $$($(VC_LIST) tests)); do                               \
+           tail -n1 $$i | grep '^Exit .' > /dev/null                   \
+             && : || { die=1; echo $$i; }                              \
+         done;                                                         \
+         test $$die = 1 &&                                             \
+           { echo 1>&2 '$(ME): the final line in each of the above is not:'; \
+             echo 1>&2 'Exit something';                               \
+             exit 1; } || :;                                           \
+       fi
+
+sc_the_the:
+       @re='\<the ''the\>'                                             \
+       ignore_case=1 msg='found use of "the ''the";'                   \
+         $(_prohibit_regexp)
+
+sc_trailing_blank:
+       @re='[   ]$$'                                                   \
+       msg='found trailing blank(s)'                                   \
+         $(_prohibit_regexp)
+
+# Match lines like the following, but where there is only one space
+# between the options and the description:
+#   -D, --all-repeated[=delimit-method]  print all duplicate lines\n
+longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
+sc_two_space_separator_in_usage:
+       @grep -nE '^   *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$'         \
+           $$($(VC_LIST_EXCEPT)) &&                                    \
+         { echo "$(ME): help2man requires at least two spaces between"; \
+           echo "$(ME): an option and its description";                \
+               1>&2; exit 1; } || :
+
+# Look for diagnostics that aren't marked for translation.
+# This won't find any for which error's format string is on a separate line.
+sc_unmarked_diagnostics:
+       @grep -nE                                                       \
+           '\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT))       \
+         | grep -v '_''(' &&                                           \
+         { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
 
            exit 1; } || :
 
-# Collect the names of rules starting with `sc_'.
-syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(ME))
-.PHONY: $(syntax-check-rules)
+# Avoid useless parentheses like those in this example:
+# #if defined (SYMBOL) || defined (SYM2)
+sc_useless_cpp_parens:
+       @grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) &&         \
+         { echo '$(ME): found useless parentheses in cpp directive'    \
+               1>&2; exit 1; } || :
+
+# Require the latest GPL.
+sc_GPL_version:
+       @re='either ''version [^3]' msg='GPL vN, N!=3'                  \
+         $(_prohibit_regexp)
+
+cvs_keywords = \
+  Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
+
+sc_prohibit_cvs_keyword:
+       @re='\$$($(cvs_keywords))\$$'                                   \
+           msg='do not use CVS keyword expansion'                      \
+         $(_prohibit_regexp)
+
+# 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
+# even in comments, but for now it does the job with no false positives.
+sc_prohibit_stat_st_blocks:
+       @re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS'  \
+         $(_prohibit_regexp)
+
+# Make sure we don't define any S_IS* macros in src/*.c files.
+# They're already defined via gnulib's sys/stat.h replacement.
+sc_prohibit_S_IS_definition:
+       @re='^ *# *define  *S_IS'                                       \
+       msg='do not define S_IS* macros; include <sys/stat.h>'          \
+         $(_prohibit_regexp)
+
+# Each program that uses proper_name_utf8 must link with
+# one of the ICONV libraries.
+sc_proper_name_utf8_requires_ICONV:
+       @progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
+       if test "x$$progs" != x; then                                   \
+         fail=0;                                                       \
+         for p in $$progs; do                                          \
+           dir=$$(dirname "$$p");                                      \
+           base=$$(basename "$$p" .c);                                 \
+           grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
+             || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
+         done;                                                         \
+         test $$fail = 1 &&                                            \
+           { echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
+             exit 1; } || :;                                           \
+       fi
+
+# Warn about "c0nst struct Foo const foo[]",
+# but not about "char const *const foo" or "#define const const".
+sc_redundant_const:
+       @re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b'                \
+       msg='redundant "const" in declarations'                         \
+         $(_prohibit_regexp)
+
+sc_const_long_option:
+       @grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT))         \
+         | grep -Ev 'const struct option|struct option const' && {     \
+             echo 1>&2 '$(ME): add "const" to the above declarations'; \
+             exit 1; } || :
+
+NEWS_hash =                                                            \
+  $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p'             \
+       $(srcdir)/NEWS                                                  \
+     | grep -v '^Copyright .*Free Software'                            \
+     | md5sum -                                                                \
+     | sed 's/ .*//')
+
+# Ensure that we don't accidentally insert an entry into an old NEWS block.
+sc_immutable_NEWS:
+       @if test -f $(srcdir)/NEWS; then                                \
+         test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : ||              \
+           { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
+       fi
+
+# Update the hash stored above.  Do this after each release and
+# for any corrections to old entries.
+update-NEWS-hash: NEWS
+       perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
+         $(srcdir)/cfg.mk
+
+# 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.
+sc_makefile_check:
+       @perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/'        \
+         -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'    \
+           $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$')       \
+         && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
+
+news-date-check: NEWS
+       today=`date +%Y-%m-%d`;                                         \
+       if head $(srcdir)/NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
+           >/dev/null; then                                            \
+         :;                                                            \
+       else                                                            \
+         echo "version or today's date is not in NEWS" 1>&2;           \
+         exit 1;                                                       \
+       fi
+
+sc_makefile_TAB_only_indentation:
+       @grep -nE '^    [ ]{8}'                                         \
+           $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$')            \
+         && { echo '$(ME): found TAB-8-space indentation' 1>&2;        \
+              exit 1; } || :
+
+sc_m4_quote_check:
+       @grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]'              \
+           $$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$')   \
+         && { echo '$(ME): quote the first arg to AC_DEF*' 1>&2;       \
+              exit 1; } || :
+
+fix_po_file_diag = \
+'you have changed the set of files with translatable diagnostics;\n\
+apply the above patch\n'
+
+# Verify that all source files using _() are listed in po/POTFILES.in.
+po_file = 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              \
+           test -r $$file || continue;                                 \
+           case $$file in                                              \
+             *.?|*.??) ;;                                              \
+             *) continue;;                                             \
+           esac;                                                       \
+           case $$file in                                              \
+           *.[ch])                                                     \
+             base=`expr " $$file" : ' \(.*\)\..'`;                     \
+             { test -f $$base.l || test -f $$base.y; } && continue;;   \
+           esac;                                                       \
+           files="$$files $$file";                                     \
+         done;                                                         \
+         grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files          \
+           | 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;                                              \
+       fi
+
+# Sometimes it is useful to change the PATH environment variable
+# in Makefiles.  When doing so, it's better not to use the Unix-centric
+# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
+msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
+sc_makefile_path_separator_check:
+       @grep -nE 'PATH[=].*:'                                          \
+           $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$')            \
+         && { echo $(msg) 1>&2; exit 1; } || :
+
+# Check that `make alpha' will not fail at the end of the process.
+writable-files:
+       if test -d $(release_archive_dir); then :; else                 \
+         for file in $(distdir).tar.gz                                 \
+                     $(release_archive_dir)/$(distdir).tar.gz; do      \
+           test -e $$file || continue;                                 \
+           test -w $$file                                              \
+             || { echo ERROR: $$file is not writable; fail=1; };       \
+         done;                                                         \
+         test "$$fail" && exit 1 || : ;                                \
+       fi
+
+v_etc_file = lib/version-etc.c
+sample-test = tests/sample-test
+texi = doc/$(PACKAGE).texi
+# Make sure that the copyright date in $(v_etc_file) is up to date.
+# Do the same for the $(sample-test) and the main doc/.texi file.
+sc_copyright_check:
+       @if test -f $(v_etc_file); then                                 \
+         grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
+           >/dev/null                                                  \
+         || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
+              exit 1; };                                               \
+       fi
+       @if test -f $(sample-test); then                                \
+         grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test)     \
+           >/dev/null                                                  \
+         || { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
+              exit 1; };                                               \
+       fi
+       @if test -f $(texi); then                                       \
+         grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi)   \
+           >/dev/null                                                  \
+         || { echo 'out of date copyright in $(texi); update it' 1>&2; \
+              exit 1; };                                               \
+       fi
+
+vc-diff-check:
+       (unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
+       if test -s vc-diffs; then                               \
+         cat vc-diffs;                                         \
+         echo "Some files are locally modified:" 1>&2;         \
+         exit 1;                                               \
+       else                                                    \
+         rm vc-diffs;                                          \
+       fi
+
+cvs-check: vc-diff-check
+
+ALL_RECURSIVE_TARGETS += maintainer-distcheck
+maintainer-distcheck:
+       $(MAKE) distcheck
+       $(MAKE) taint-distcheck
+       $(MAKE) my-distcheck
+
+
+# Don't make a distribution if checks fail.
+# Also, make sure the NEWS file is up-to-date.
+ALL_RECURSIVE_TARGETS += vc-dist
+vc-dist: $(local-check) cvs-check maintainer-distcheck
+       XZ_OPT=-9ev $(MAKE) dist
+
+# Use this to make sure we don't run these programs when building
+# from a virgin tgz file, below.
+null_AM_MAKEFLAGS = \
+  ACLOCAL=false \
+  AUTOCONF=false \
+  AUTOMAKE=false \
+  AUTOHEADER=false \
+  MAKEINFO=false
+
+built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
+
+rel-files = $(DIST_ARCHIVES)
+
+gnulib_dir ?= $(srcdir)/gnulib
+gnulib-version = $$(cd $(gnulib_dir) && git describe)
+bootstrap-tools ?= autoconf,automake,gnulib
+
+announcement: NEWS ChangeLog $(rel-files)
+       @$(build_aux)/announce-gen                                      \
+           --release-type=$(RELEASE_TYPE)                              \
+           --package=$(PACKAGE)                                        \
+           --prev=$(PREV_VERSION)                                      \
+           --curr=$(VERSION)                                           \
+           --gpg-key-id=$(gpg_key_ID)                                  \
+           --news=NEWS                                                 \
+           --bootstrap-tools=$(bootstrap-tools)                        \
+           --gnulib-version=$(gnulib-version)                          \
+           --no-print-checksums                                        \
+           $(addprefix --url-dir=, $(url_dir_list))
+
+## ---------------- ##
+## Updating files.  ##
+## ---------------- ##
+
+ftp-gnu = ftp://ftp.gnu.org/gnu
+www-gnu = http://www.gnu.org
+
+emit_upload_commands:
+       @echo =====================================
+       @echo =====================================
+       @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
+       @echo "    --to $(gnu_rel_host):$(PACKAGE) \\"
+       @echo "  $(rel-files)"
+       @echo '# send the /tmp/announcement e-mail'
+       @echo =====================================
+       @echo =====================================
+
+noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
+define emit-commit-log
+  printf '%s\n' 'post-release administrivia' '' \
+    '* NEWS: Add header line for next release.' \
+    '* .prev-version: Record previous version.' \
+    '* cfg.mk (old_NEWS_hash): Auto-update.'
+endef
+
+.PHONY: no-submodule-changes
+no-submodule-changes:
+       if test -d $(srcdir)/.git; then                                 \
+         diff=$$(cd $(srcdir) && git submodule -q foreach              \
+                 git diff-index --name-only HEAD)                      \
+           || exit 1;                                                  \
+         case $$diff in '') ;;                                         \
+           *) echo '$(ME): submodule files are locally modified:';     \
+               echo "$$diff"; exit 1;; esac;                           \
+       else                                                            \
+         : ;                                                           \
+       fi
+
+.PHONY: alpha beta major
+ALL_RECURSIVE_TARGETS += alpha beta major
+alpha beta major: $(local-check) writable-files no-submodule-changes
+       test $@ = major                                         \
+         && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
+              || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
+         || :
+       $(MAKE) vc-dist
+       $(MAKE) news-date-check
+       $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
+       if test -d $(release_archive_dir); then                 \
+         ln $(rel-files) $(release_archive_dir);               \
+         chmod a-w $(rel-files);                               \
+       fi
+       $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
+       echo $(VERSION) > $(prev_version_file)
+       $(MAKE) update-NEWS-hash
+       perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
+       $(emit-commit-log) > .ci-msg
+       $(VC) commit -F .ci-msg -a
+
+.PHONY: web-manual
+web-manual:
+       @test -z "$(manual_title)" \
+         && { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
+       @cd '$(srcdir)/doc'; \
+         $(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
+            --email $(PACKAGE_BUGREPORT) $(PACKAGE) \
+           "$(PACKAGE_NAME) - $(manual_title)"
+       @echo " *** Upload the doc/manual directory to web-cvs."
+
+# Code Coverage
+
+init-coverage:
+       $(MAKE) $(AM_MAKEFLAGS) clean
+       lcov --directory . --zerocounters
+
+COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_OUT ?= doc/coverage
+
+build-coverage:
+       $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS)
+       $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
+       mkdir -p $(COVERAGE_OUT)
+       lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
+               --capture
+
+gen-coverage:
+       genhtml --output-directory $(COVERAGE_OUT) \
+               $(COVERAGE_OUT)/$(PACKAGE).info \
+               --highlight --frames --legend \
+               --title "$(PACKAGE_NAME)"
 
 
-syntax-check: $(syntax-check-rules)
+coverage: init-coverage build-coverage gen-coverage
 
 # Update gettext files.
 PACKAGE ?= $(shell basename $(PWD))
 
 # Update gettext files.
 PACKAGE ?= $(shell basename $(PWD))
-POURL = http://translationproject.org/latest/$(PACKAGE)/
+PO_DOMAIN ?= $(PACKAGE)
+POURL = http://translationproject.org/latest/$(PO_DOMAIN)/
 PODIR ?= po
 refresh-po:
        rm -f $(PODIR)/*.po && \
 PODIR ?= po
 refresh-po:
        rm -f $(PODIR)/*.po && \
@@ -115,7 +762,7 @@ refresh-po:
        wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
        echo 'en@boldquot' > $(PODIR)/LINGUAS && \
        echo 'en@quot' >> $(PODIR)/LINGUAS && \
        wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
        echo 'en@boldquot' > $(PODIR)/LINGUAS && \
        echo 'en@quot' >> $(PODIR)/LINGUAS && \
-       ls $(PODIR)/*.po | sed 's/.po//' | sed 's,$(PODIR)/,,' | sort >> $(PODIR)/LINGUAS
+       ls $(PODIR)/*.po | sed 's/\.po//' | sed 's,$(PODIR)/,,' | sort >> $(PODIR)/LINGUAS
 
 INDENT_SOURCES ?= $(C_SOURCES)
 .PHONY: indent
 
 INDENT_SOURCES ?= $(C_SOURCES)
 .PHONY: indent
index 8c87f94767886d1ef2db78c1b5c0cc7720be5a2e..f1001341e6fb27a55a3cad8b86fb53ad4dd7c224 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -9,10 +9,11 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=md5 crypto/md5
+# Reproduce by: gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=md5 crypto/md5
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
+SUBDIRS =
 noinst_HEADERS =
 noinst_LIBRARIES =
 noinst_LTLIBRARIES =
 noinst_HEADERS =
 noinst_LIBRARIES =
 noinst_LTLIBRARIES =
@@ -24,8 +25,10 @@ MOSTLYCLEANDIRS =
 CLEANFILES =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 CLEANFILES =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
+EXTRA_DIST += m4/gnulib-cache.m4
 
 AM_CPPFLAGS =
 
 AM_CPPFLAGS =
+AM_CFLAGS =
 
 noinst_LIBRARIES += libmd5.a
 
 
 noinst_LIBRARIES += libmd5.a
 
@@ -61,7 +64,8 @@ stdint.h: stdint.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
              -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
              -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
              -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
              -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
              -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -69,6 +73,7 @@ stdint.h: stdint.in.h
              -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
              -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
              -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
              -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
              -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
              -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
              -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
              -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
              -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
              -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
              -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
              -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
@@ -100,11 +105,44 @@ BUILT_SOURCES += $(WCHAR_H)
 wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
              -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+             -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
+             -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
+             -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
+             -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
+             -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
+             -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
+             -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
+             -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
+             -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
+             -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
+             -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
+             -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
+             -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
+             -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
+             -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
+             -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
+             -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
+             -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
+             -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
+             -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
+             -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
+             -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
+             -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
+             -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
+             -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
+             -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
+             -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
+             -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
+             -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
+             -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
+             -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
            < $(srcdir)/wchar.in.h; \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
            < $(srcdir)/wchar.in.h; \
diff --git a/md5/m4/00gnulib.m4 b/md5/m4/00gnulib.m4
new file mode 100644 (file)
index 0000000..d4d04d1
--- /dev/null
@@ -0,0 +1,30 @@
+# 00gnulib.m4 serial 2
+dnl Copyright (C) 2009 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 This file must be named something that sorts before all other
+dnl gnulib-provided .m4 files.  It is needed until such time as we can
+dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics.
+
+# AC_DEFUN_ONCE([NAME], VALUE)
+# ----------------------------
+# Define NAME to expand to VALUE on the first use (whether by direct
+# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
+# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier.  This
+# definition is slower than the version in Autoconf 2.64, because it
+# can only use interfaces that existed since 2.59; but it achieves the
+# same effect.  Quoting is necessary to avoid confusing Automake.
+m4_version_prereq([2.63.263], [],
+[m4_define([AC][_DEFUN_ONCE],
+  [AC][_DEFUN([$1],
+    [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
+      [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
+[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
+
+# gl_00GNULIB
+# -----------
+# Witness macro that this file has been included.  Needed to force
+# Automake to include this file prior to all other gnulib .m4 files.
+AC_DEFUN([gl_00GNULIB])
index a33aea475ae09fc39c883212abddf26b09854576..b0872afd2056ca1a83006fcfea18edcd6512f4bb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 
 
 # Specification in the form of a command-line invocation:
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=md5 crypto/md5
+#   gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=md5 crypto/md5
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
-gl_MODULES([crypto/md5])
+gl_MODULES([
+  crypto/md5
+])
 gl_AVOID([])
 gl_SOURCE_BASE([md5])
 gl_M4_BASE([md5/m4])
 gl_AVOID([])
 gl_SOURCE_BASE([md5])
 gl_M4_BASE([md5/m4])
index 3edfc120f81f9a135aeab6c15994b2327f414f1c..c8fda2033045d38975415f240bd9a72a14a2c949 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 11
+dnl Copyright (C) 2007-2009 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 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.
@@ -8,6 +8,7 @@ dnl with or without modifications, as long as this notice is preserved.
 # is expanded unconditionally through gnulib-tool magic.
 AC_DEFUN([gl_COMMON], [
   dnl Use AC_REQUIRE here, so that the code is expanded once only.
 # is expanded unconditionally through gnulib-tool magic.
 AC_DEFUN([gl_COMMON], [
   dnl Use AC_REQUIRE here, so that the code is expanded once only.
+  AC_REQUIRE([gl_00GNULIB])
   AC_REQUIRE([gl_COMMON_BODY])
 ])
 AC_DEFUN([gl_COMMON_BODY], [
   AC_REQUIRE([gl_COMMON_BODY])
 ])
 AC_DEFUN([gl_COMMON_BODY], [
@@ -21,6 +22,16 @@ AC_DEFUN([gl_COMMON_BODY], [
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
 # define __GNUC_STDC_INLINE__ 1
 #endif])
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
 # define __GNUC_STDC_INLINE__ 1
 #endif])
+  AH_VERBATIM([unused_parameter],
+[/* Define as a marker that can be attached to function parameter declarations
+   for parameters that are not used.  This helps to reduce warnings, such as
+   from GCC -Wunused-parameter.  */
+#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+#else
+# define _UNUSED_PARAMETER_
+#endif
+])
 ])
 
 # gl_MODULE_INDICATOR([modulename])
 ])
 
 # gl_MODULE_INDICATOR([modulename])
@@ -31,11 +42,18 @@ AC_DEFUN([gl_MODULE_INDICATOR],
     [Define to 1 when using the gnulib module ]$1[.])
 ])
 
     [Define to 1 when using the gnulib module ]$1[.])
 ])
 
+# m4_foreach_w
+# is a backport of autoconf-2.59c's m4_foreach_w.
+# Remove this macro when we can assume autoconf >= 2.60.
+m4_ifndef([m4_foreach_w],
+  [m4_define([m4_foreach_w],
+    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
+
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
 m4_ifdef([AC_PROG_MKDIR_P], [], [
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
 m4_ifdef([AC_PROG_MKDIR_P], [], [
-  AC_DEFUN([AC_PROG_MKDIR_P],
+  AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
      AC_SUBST([MKDIR_P])])])
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
      AC_SUBST([MKDIR_P])])])
@@ -46,7 +64,7 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
 # works.
 # This definition can be removed once autoconf >= 2.62 can be assumed.
 AC_DEFUN([AC_C_RESTRICT],
 # works.
 # This definition can be removed once autoconf >= 2.62 can be assumed.
 AC_DEFUN([AC_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
+[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
   [ac_cv_c_restrict=no
    # The order here caters to the fact that C++ does not require restrict.
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
   [ac_cv_c_restrict=no
    # The order here caters to the fact that C++ does not require restrict.
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
@@ -82,3 +100,25 @@ AC_DEFUN([AC_C_RESTRICT],
    *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  esac
 ])
    *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  esac
 ])
+
+# gl_BIGENDIAN
+# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
+# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
+# macros invoke AC_C_BIGENDIAN with arguments.
+AC_DEFUN([gl_BIGENDIAN],
+[
+  AC_C_BIGENDIAN
+])
+
+# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
+# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
+# output a spurious "(cached)" mark in the midst of other configure output.
+# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
+# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
+AC_DEFUN([gl_CACHE_VAL_SILENT],
+[
+  saved_as_echo_n="$as_echo_n"
+  as_echo_n=':'
+  AC_CACHE_VAL([$1], [$2])
+  as_echo_n="$saved_as_echo_n"
+])
index dd5050cde48c37405ceacaffd9092458f4eae7b0..24cf478a8aefeb0f995c24f8f1a87a1ede34ff4c 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2009 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -38,10 +38,27 @@ AC_DEFUN([md5_INIT],
   m4_pushdef([AC_LIBOBJ], m4_defn([md5_LIBOBJ]))
   m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5_REPLACE_FUNCS]))
   m4_pushdef([AC_LIBSOURCES], m4_defn([md5_LIBSOURCES]))
   m4_pushdef([AC_LIBOBJ], m4_defn([md5_LIBOBJ]))
   m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5_REPLACE_FUNCS]))
   m4_pushdef([AC_LIBSOURCES], m4_defn([md5_LIBSOURCES]))
+  m4_pushdef([md5_LIBSOURCES_LIST], [])
+  m4_pushdef([md5_LIBSOURCES_DIR], [])
+  gl_COMMON
   gl_source_base='md5'
   gl_MD5
   gl_source_base='md5'
   gl_MD5
+  gl_MULTIARCH
   gl_STDINT_H
   gl_WCHAR_H
   gl_STDINT_H
   gl_WCHAR_H
+  m4_ifval(md5_LIBSOURCES_LIST, [
+    m4_syscmd([test ! -d ]m4_defn([md5_LIBSOURCES_DIR])[ ||
+      for gl_file in ]md5_LIBSOURCES_LIST[ ; do
+        if test ! -r ]m4_defn([md5_LIBSOURCES_DIR])[/$gl_file ; then
+          echo "missing file ]m4_defn([md5_LIBSOURCES_DIR])[/$gl_file" >&2
+          exit 1
+        fi
+      done])dnl
+      m4_if(m4_sysval, [0], [],
+        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
+  ])
+  m4_popdef([md5_LIBSOURCES_DIR])
+  m4_popdef([md5_LIBSOURCES_LIST])
   m4_popdef([AC_LIBSOURCES])
   m4_popdef([AC_REPLACE_FUNCS])
   m4_popdef([AC_LIBOBJ])
   m4_popdef([AC_LIBSOURCES])
   m4_popdef([AC_REPLACE_FUNCS])
   m4_popdef([AC_LIBOBJ])
@@ -64,7 +81,23 @@ AC_DEFUN([md5_INIT],
   m4_pushdef([AC_LIBOBJ], m4_defn([md5tests_LIBOBJ]))
   m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5tests_REPLACE_FUNCS]))
   m4_pushdef([AC_LIBSOURCES], m4_defn([md5tests_LIBSOURCES]))
   m4_pushdef([AC_LIBOBJ], m4_defn([md5tests_LIBOBJ]))
   m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5tests_REPLACE_FUNCS]))
   m4_pushdef([AC_LIBSOURCES], m4_defn([md5tests_LIBSOURCES]))
+  m4_pushdef([md5tests_LIBSOURCES_LIST], [])
+  m4_pushdef([md5tests_LIBSOURCES_DIR], [])
+  gl_COMMON
   gl_source_base='tests'
   gl_source_base='tests'
+  m4_ifval(md5tests_LIBSOURCES_LIST, [
+    m4_syscmd([test ! -d ]m4_defn([md5tests_LIBSOURCES_DIR])[ ||
+      for gl_file in ]md5tests_LIBSOURCES_LIST[ ; do
+        if test ! -r ]m4_defn([md5tests_LIBSOURCES_DIR])[/$gl_file ; then
+          echo "missing file ]m4_defn([md5tests_LIBSOURCES_DIR])[/$gl_file" >&2
+          exit 1
+        fi
+      done])dnl
+      m4_if(m4_sysval, [0], [],
+        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
+  ])
+  m4_popdef([md5tests_LIBSOURCES_DIR])
+  m4_popdef([md5tests_LIBSOURCES_LIST])
   m4_popdef([AC_LIBSOURCES])
   m4_popdef([AC_REPLACE_FUNCS])
   m4_popdef([AC_LIBOBJ])
   m4_popdef([AC_LIBSOURCES])
   m4_popdef([AC_REPLACE_FUNCS])
   m4_popdef([AC_LIBOBJ])
@@ -95,13 +128,6 @@ AC_DEFUN([md5_LIBOBJ], [
   md5_LIBOBJS="$md5_LIBOBJS $1.$ac_objext"
 ])
 
   md5_LIBOBJS="$md5_LIBOBJS $1.$ac_objext"
 ])
 
-# m4_foreach_w is provided by autoconf-2.59c and later.
-# This definition is to accommodate developers using versions
-# of autoconf older than that.
-m4_ifndef([m4_foreach_w],
-  [m4_define([m4_foreach_w],
-    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
-
 # Like AC_REPLACE_FUNCS, except that the module name goes
 # into md5_LIBOBJS instead of into LIBOBJS.
 AC_DEFUN([md5_REPLACE_FUNCS], [
 # Like AC_REPLACE_FUNCS, except that the module name goes
 # into md5_LIBOBJS instead of into LIBOBJS.
 AC_DEFUN([md5_REPLACE_FUNCS], [
@@ -110,15 +136,14 @@ AC_DEFUN([md5_REPLACE_FUNCS], [
 ])
 
 # Like AC_LIBSOURCES, except the directory where the source file is
 ])
 
 # Like AC_LIBSOURCES, except the directory where the source file is
-# expected is derived from the gnulib-tool parametrization,
+# expected is derived from the gnulib-tool parameterization,
 # and alloca is special cased (for the alloca-opt module).
 # We could also entirely rely on EXTRA_lib..._SOURCES.
 AC_DEFUN([md5_LIBSOURCES], [
   m4_foreach([_gl_NAME], [$1], [
     m4_if(_gl_NAME, [alloca.c], [], [
 # and alloca is special cased (for the alloca-opt module).
 # We could also entirely rely on EXTRA_lib..._SOURCES.
 AC_DEFUN([md5_LIBSOURCES], [
   m4_foreach([_gl_NAME], [$1], [
     m4_if(_gl_NAME, [alloca.c], [], [
-      m4_syscmd([test -r md5/]_gl_NAME[ || test ! -d md5])dnl
-      m4_if(m4_sysval, [0], [],
-        [AC_FATAL([missing md5/]_gl_NAME)])
+      m4_define([md5_LIBSOURCES_DIR], [md5])
+      m4_append([md5_LIBSOURCES_LIST], _gl_NAME, [ ])
     ])
   ])
 ])
     ])
   ])
 ])
@@ -130,13 +155,6 @@ AC_DEFUN([md5tests_LIBOBJ], [
   md5tests_LIBOBJS="$md5tests_LIBOBJS $1.$ac_objext"
 ])
 
   md5tests_LIBOBJS="$md5tests_LIBOBJS $1.$ac_objext"
 ])
 
-# m4_foreach_w is provided by autoconf-2.59c and later.
-# This definition is to accommodate developers using versions
-# of autoconf older than that.
-m4_ifndef([m4_foreach_w],
-  [m4_define([m4_foreach_w],
-    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
-
 # Like AC_REPLACE_FUNCS, except that the module name goes
 # into md5tests_LIBOBJS instead of into LIBOBJS.
 AC_DEFUN([md5tests_REPLACE_FUNCS], [
 # Like AC_REPLACE_FUNCS, except that the module name goes
 # into md5tests_LIBOBJS instead of into LIBOBJS.
 AC_DEFUN([md5tests_REPLACE_FUNCS], [
@@ -145,15 +163,14 @@ AC_DEFUN([md5tests_REPLACE_FUNCS], [
 ])
 
 # Like AC_LIBSOURCES, except the directory where the source file is
 ])
 
 # Like AC_LIBSOURCES, except the directory where the source file is
-# expected is derived from the gnulib-tool parametrization,
+# expected is derived from the gnulib-tool parameterization,
 # and alloca is special cased (for the alloca-opt module).
 # We could also entirely rely on EXTRA_lib..._SOURCES.
 AC_DEFUN([md5tests_LIBSOURCES], [
   m4_foreach([_gl_NAME], [$1], [
     m4_if(_gl_NAME, [alloca.c], [], [
 # and alloca is special cased (for the alloca-opt module).
 # We could also entirely rely on EXTRA_lib..._SOURCES.
 AC_DEFUN([md5tests_LIBSOURCES], [
   m4_foreach([_gl_NAME], [$1], [
     m4_if(_gl_NAME, [alloca.c], [], [
-      m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl
-      m4_if(m4_sysval, [0], [],
-        [AC_FATAL([missing tests/]_gl_NAME)])
+      m4_define([md5tests_LIBSOURCES_DIR], [tests])
+      m4_append([md5tests_LIBSOURCES_LIST], _gl_NAME, [ ])
     ])
   ])
 ])
     ])
   ])
 ])
@@ -167,10 +184,13 @@ AC_DEFUN([md5_FILE_LIST], [
   lib/md5.h
   lib/stdint.in.h
   lib/wchar.in.h
   lib/md5.h
   lib/stdint.in.h
   lib/wchar.in.h
+  m4/00gnulib.m4
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/longlong.m4
   m4/md5.m4
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/longlong.m4
   m4/md5.m4
+  m4/multiarch.m4
   m4/stdint.m4
   m4/wchar.m4
   m4/stdint.m4
   m4/wchar.m4
+  m4/wint_t.m4
 ])
 ])
index ef59320316b9796903a2c4a46ed7b810508dc8c7..4438d488698b2e25a911a6741d8903cb9fd35ebf 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-tool.m4 serial 1
+# gnulib-tool.m4 serial 2
 dnl Copyright (C) 2004-2005 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 Copyright (C) 2004-2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,9 @@ dnl The following macros need not be invoked explicitly.
 dnl Invoking them does nothing except to declare default arguments
 dnl for "gnulib-tool --import".
 
 dnl Invoking them does nothing except to declare default arguments
 dnl for "gnulib-tool --import".
 
+dnl Usage: gl_LOCAL_DIR([DIR])
+AC_DEFUN([gl_LOCAL_DIR], [])
+
 dnl Usage: gl_MODULES([module1 module2 ...])
 AC_DEFUN([gl_MODULES], [])
 
 dnl Usage: gl_MODULES([module1 module2 ...])
 AC_DEFUN([gl_MODULES], [])
 
@@ -20,14 +23,35 @@ AC_DEFUN([gl_SOURCE_BASE], [])
 dnl Usage: gl_M4_BASE([DIR])
 AC_DEFUN([gl_M4_BASE], [])
 
 dnl Usage: gl_M4_BASE([DIR])
 AC_DEFUN([gl_M4_BASE], [])
 
+dnl Usage: gl_PO_BASE([DIR])
+AC_DEFUN([gl_PO_BASE], [])
+
+dnl Usage: gl_DOC_BASE([DIR])
+AC_DEFUN([gl_DOC_BASE], [])
+
+dnl Usage: gl_TESTS_BASE([DIR])
+AC_DEFUN([gl_TESTS_BASE], [])
+
+dnl Usage: gl_WITH_TESTS
+AC_DEFUN([gl_WITH_TESTS], [])
+
 dnl Usage: gl_LIB([LIBNAME])
 AC_DEFUN([gl_LIB], [])
 
 dnl Usage: gl_LIB([LIBNAME])
 AC_DEFUN([gl_LIB], [])
 
-dnl Usage: gl_LGPL
+dnl Usage: gl_LGPL or gl_LGPL([VERSION])
 AC_DEFUN([gl_LGPL], [])
 
 AC_DEFUN([gl_LGPL], [])
 
+dnl Usage: gl_MAKEFILE_NAME([FILENAME])
+AC_DEFUN([gl_MAKEFILE_NAME], [])
+
 dnl Usage: gl_LIBTOOL
 AC_DEFUN([gl_LIBTOOL], [])
 
 dnl Usage: gl_MACRO_PREFIX([PREFIX])
 AC_DEFUN([gl_MACRO_PREFIX], [])
 dnl Usage: gl_LIBTOOL
 AC_DEFUN([gl_LIBTOOL], [])
 
 dnl Usage: gl_MACRO_PREFIX([PREFIX])
 AC_DEFUN([gl_MACRO_PREFIX], [])
+
+dnl Usage: gl_PO_DOMAIN([DOMAIN])
+AC_DEFUN([gl_PO_DOMAIN], [])
+
+dnl Usage: gl_VC_FILES([BOOLEAN])
+AC_DEFUN([gl_VC_FILES], [])
index a842e2a23682bd0bea8a73ea22b58533c33ad97c..5e22ded936ccb558203f81709e7b8f2417fd532f 100644 (file)
@@ -1,19 +1,47 @@
-# include_next.m4 serial 6
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+# include_next.m4 serial 14
+dnl Copyright (C) 2006-2009 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 Paul Eggert and Derek Price.
 
 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 Paul Eggert and Derek Price.
 
+dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
+dnl
+dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
+dnl 'include' otherwise.
+dnl
+dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
+dnl supports it in the special case that it is the first include directive in
+dnl the given file, or to 'include' otherwise.
+dnl
+dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
+dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
+dnl '#pragma GCC system_header' has the same effect as if the file was found
+dnl through the include search path specified with '-isystem' options (as
+dnl opposed to the search path specified with '-I' options). Namely, gcc
+dnl does not warn about some things, and on some systems (Solaris and Interix)
+dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
+dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
+dnl of plain '__STDC__'.
+
 AC_DEFUN([gl_INCLUDE_NEXT],
 [
   AC_LANG_PREPROC_REQUIRE()
   AC_CACHE_CHECK([whether the preprocessor supports include_next],
     [gl_cv_have_include_next],
 AC_DEFUN([gl_INCLUDE_NEXT],
 [
   AC_LANG_PREPROC_REQUIRE()
   AC_CACHE_CHECK([whether the preprocessor supports include_next],
     [gl_cv_have_include_next],
-    [rm -rf conftestd1 conftestd2
-     mkdir conftestd1 conftestd2
-     cat <<EOF > conftestd1/conftest.h
+    [rm -rf conftestd1a conftestd1b conftestd2
+     mkdir conftestd1a conftestd1b conftestd2
+     dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
+     dnl AIX 6.1 support include_next when used as first preprocessor directive
+     dnl in a file, but not when preceded by another include directive. Check
+     dnl for this bug by including <stdio.h>.
+     dnl Additionally, with this same compiler, include_next is a no-op when
+     dnl used in a header file that was included by specifying its absolute
+     dnl file name. Despite these two bugs, include_next is used in the
+     dnl compiler's <math.h>. By virtue of the second bug, we need to use
+     dnl include_next as well in this case.
+     cat <<EOF > conftestd1a/conftest.h
 #define DEFINED_IN_CONFTESTD1
 #include_next <conftest.h>
 #ifdef DEFINED_IN_CONFTESTD2
 #define DEFINED_IN_CONFTESTD1
 #include_next <conftest.h>
 #ifdef DEFINED_IN_CONFTESTD2
@@ -21,6 +49,16 @@ int foo;
 #else
 #error "include_next doesn't work"
 #endif
 #else
 #error "include_next doesn't work"
 #endif
+EOF
+     cat <<EOF > conftestd1b/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include <stdio.h>
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
 EOF
      cat <<EOF > conftestd2/conftest.h
 #ifndef DEFINED_IN_CONFTESTD1
 EOF
      cat <<EOF > conftestd2/conftest.h
 #ifndef DEFINED_IN_CONFTESTD1
@@ -28,26 +66,37 @@ EOF
 #endif
 #define DEFINED_IN_CONFTESTD2
 EOF
 #endif
 #define DEFINED_IN_CONFTESTD2
 EOF
-     save_CPPFLAGS="$CPPFLAGS"
-     CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
+     gl_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
      AC_COMPILE_IFELSE([#include <conftest.h>],
        [gl_cv_have_include_next=yes],
      AC_COMPILE_IFELSE([#include <conftest.h>],
        [gl_cv_have_include_next=yes],
-       [gl_cv_have_include_next=no])
-     CPPFLAGS="$save_CPPFLAGS"
-     rm -rf conftestd1 conftestd2
+       [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
+        AC_COMPILE_IFELSE([#include <conftest.h>],
+          [gl_cv_have_include_next=buggy],
+          [gl_cv_have_include_next=no])
+       ])
+     CPPFLAGS="$gl_save_CPPFLAGS"
+     rm -rf conftestd1a conftestd1b conftestd2
     ])
     ])
+  PRAGMA_SYSTEM_HEADER=
   if test $gl_cv_have_include_next = yes; then
   if test $gl_cv_have_include_next = yes; then
-
-    dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it
-    dnl to use @INCLUDE_NEXT@ instead.
-    AC_DEFINE([HAVE_INCLUDE_NEXT], 1,
-             [Define if your compiler supports the #include_next directive.])
-
     INCLUDE_NEXT=include_next
     INCLUDE_NEXT=include_next
+    INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    if test -n "$GCC"; then
+      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
+    fi
   else
   else
-    INCLUDE_NEXT=include
+    if test $gl_cv_have_include_next = buggy; then
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    else
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
+    fi
   fi
   AC_SUBST([INCLUDE_NEXT])
   fi
   AC_SUBST([INCLUDE_NEXT])
+  AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
+  AC_SUBST([PRAGMA_SYSTEM_HEADER])
 ])
 
 # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
 ])
 
 # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
@@ -55,8 +104,14 @@ EOF
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
 #      #@INCLUDE_NEXT@ @NEXT_FOO_H@
 # That way, a header file with the following line:
 #      #@INCLUDE_NEXT@ @NEXT_FOO_H@
+# or
+#      #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
@@ -69,31 +124,43 @@ EOF
 AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 [
   AC_REQUIRE([gl_INCLUDE_NEXT])
 AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 [
   AC_REQUIRE([gl_INCLUDE_NEXT])
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_HEADERS_ONCE([$1])
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
   AC_CHECK_HEADERS_ONCE([$1])
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
-        m4_quote(m4_defn([gl_next_header])),
+        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+        m4_defn([gl_next_header]),
         [AS_VAR_PUSHDEF([gl_header_exists],
         [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
          if test AS_VAR_GET(gl_header_exists) = yes; then
            AC_LANG_CONFTEST(
              [AC_LANG_SOURCE(
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
               )])
          if test AS_VAR_GET(gl_header_exists) = yes; then
            AC_LANG_CONFTEST(
              [AC_LANG_SOURCE(
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
               )])
-           dnl eval is necessary to expand ac_cpp.
+           dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+           dnl that contain only a #include of other header files and no
+           dnl non-comment tokens of their own. This leads to a failure to
+           dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+           dnl and others. The workaround is to force preservation of comments
+           dnl through option -C. This ensures all necessary #line directives
+           dnl are present. GCC supports option -C as well.
+           case "$host_os" in
+             aix*) gl_absname_cpp="$ac_cpp -C" ;;
+             *)    gl_absname_cpp="$ac_cpp" ;;
+           esac
+           dnl eval is necessary to expand gl_absname_cpp.
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
            dnl so use subshell.
            AS_VAR_SET([gl_next_header],
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
            dnl so use subshell.
            AS_VAR_SET([gl_next_header],
-             ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
-                s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
+             ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
                 s#^/[^/]#//&#
                 p
                 q
                 s#^/[^/]#//&#
                 p
                 q
@@ -104,7 +171,17 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
-       AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+       AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
        [AS_VAR_GET([gl_next_header])])
        [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
+       [$gl_next_as_first_directive])
      AS_VAR_POPDEF([gl_next_header])])
 ])
      AS_VAR_POPDEF([gl_next_header])])
 ])
index 15bf9dacadb85b8802381eafddeb9fc6556c067d..eedc8d56826218e41849ce337e63964a968b7a1a 100644 (file)
@@ -1,5 +1,5 @@
-# longlong.m4 serial 13
-dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
+# longlong.m4 serial 14
+dnl Copyright (C) 1999-2007, 2009 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 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.
@@ -46,7 +46,7 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
-    AC_DEFINE([HAVE_LONG_LONG_INT], 1,
+    AC_DEFINE([HAVE_LONG_LONG_INT], [1],
       [Define to 1 if the system has the type `long long int'.])
   fi
 ])
       [Define to 1 if the system has the type `long long int'.])
   fi
 ])
@@ -69,7 +69,7 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
        [ac_cv_type_unsigned_long_long_int=yes],
        [ac_cv_type_unsigned_long_long_int=no])])
   if test $ac_cv_type_unsigned_long_long_int = yes; then
        [ac_cv_type_unsigned_long_long_int=yes],
        [ac_cv_type_unsigned_long_long_int=no])])
   if test $ac_cv_type_unsigned_long_long_int = yes; then
-    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
       [Define to 1 if the system has the type `unsigned long long int'.])
   fi
 ])
       [Define to 1 if the system has the type `unsigned long long int'.])
   fi
 ])
index e4d00f3fee949a65a451b1c5fa5b30193226ea4b..57b193fdf22bd6eb11e7edb1ac9d039efecd0aa5 100644 (file)
@@ -1,5 +1,5 @@
-# md5.m4 serial 10
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
+# md5.m4 serial 11
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009 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 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.
@@ -9,7 +9,7 @@ AC_DEFUN([gl_MD5],
   AC_LIBOBJ([md5])
 
   dnl Prerequisites of lib/md5.c.
   AC_LIBOBJ([md5])
 
   dnl Prerequisites of lib/md5.c.
-  AC_REQUIRE([AC_C_BIGENDIAN])
+  AC_REQUIRE([gl_BIGENDIAN])
   AC_REQUIRE([AC_C_INLINE])
   :
 ])
   AC_REQUIRE([AC_C_INLINE])
   :
 ])
diff --git a/md5/m4/multiarch.m4 b/md5/m4/multiarch.m4
new file mode 100644 (file)
index 0000000..ec377ba
--- /dev/null
@@ -0,0 +1,65 @@
+# multiarch.m4 serial 5
+dnl Copyright (C) 2008, 2009 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.
+
+# Determine whether the compiler is or may be producing universal binaries.
+#
+# On MacOS X 10.5 and later systems, the user can create libraries and
+# executables that work on multiple system types--known as "fat" or
+# "universal" binaries--by specifying multiple '-arch' options to the
+# compiler but only a single '-arch' option to the preprocessor.  Like
+# this:
+#
+#     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CPP="gcc -E" CXXCPP="g++ -E"
+#
+# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the
+# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
+
+AC_DEFUN_ONCE([gl_MULTIARCH],
+[
+  dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
+  gl_cv_c_multiarch=no
+  AC_COMPILE_IFELSE(
+    [AC_LANG_SOURCE(
+      [[#ifndef __APPLE_CC__
+         not a universal capable compiler
+        #endif
+        typedef int dummy;
+      ]])],
+    [
+     dnl Check for potential -arch flags.  It is not universal unless
+     dnl there are at least two -arch flags with different values.
+     arch=
+     prev=
+     for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
+       if test -n "$prev"; then
+         case $word in
+           i?86 | x86_64 | ppc | ppc64)
+             if test -z "$arch" || test "$arch" = "$word"; then
+               arch="$word"
+             else
+               gl_cv_c_multiarch=yes
+             fi
+             ;;
+         esac
+         prev=
+       else
+         if test "x$word" = "x-arch"; then
+           prev=arch
+         fi
+       fi
+     done
+    ])
+  if test $gl_cv_c_multiarch = yes; then
+    AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1],
+      [Define if the compiler is building for multiple architectures of Apple platforms at once.])
+    APPLE_UNIVERSAL_BUILD=1
+  else
+    APPLE_UNIVERSAL_BUILD=0
+  fi
+  AC_SUBST([APPLE_UNIVERSAL_BUILD])
+])
index 9b5001a52d6a5b76c62de46242f90aa8292eb892..a2e8bdd62814a97e7be2875fd8f3cbf3b4c4ba8f 100644 (file)
@@ -1,5 +1,5 @@
-# stdint.m4 serial 30
-dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
+# stdint.m4 serial 34
+dnl Copyright (C) 2001-2009 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 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.
@@ -9,7 +9,7 @@ dnl Test whether <stdint.h> is supported or must be substituted.
 
 AC_DEFUN([gl_STDINT_H],
 [
 
 AC_DEFUN([gl_STDINT_H],
 [
-  AC_PREREQ(2.59)dnl
+  AC_PREREQ([2.59])dnl
 
   dnl Check for long long int and unsigned long long int.
   AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
 
   dnl Check for long long int and unsigned long long int.
   AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
@@ -201,7 +201,75 @@ struct s {
   int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
 };
          ]])],
   int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
 };
          ]])],
-         [gl_cv_header_working_stdint_h=yes])])
+         [dnl Determine whether the various *_MIN, *_MAX macros are usable
+          dnl in preprocessor expression. We could do it by compiling a test
+          dnl program for each of these macros. It is faster to run a program
+          dnl that inspects the macro expansion.
+          dnl This detects a bug on HP-UX 11.23/ia64.
+          AC_RUN_IFELSE([
+            AC_LANG_PROGRAM([[
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+#include <stdio.h>
+#include <string.h>
+#define MVAL(macro) MVAL1(macro)
+#define MVAL1(expression) #expression
+static const char *macro_values[] =
+  {
+#ifdef INT8_MAX
+    MVAL (INT8_MAX),
+#endif
+#ifdef INT16_MAX
+    MVAL (INT16_MAX),
+#endif
+#ifdef INT32_MAX
+    MVAL (INT32_MAX),
+#endif
+#ifdef INT64_MAX
+    MVAL (INT64_MAX),
+#endif
+#ifdef UINT8_MAX
+    MVAL (UINT8_MAX),
+#endif
+#ifdef UINT16_MAX
+    MVAL (UINT16_MAX),
+#endif
+#ifdef UINT32_MAX
+    MVAL (UINT32_MAX),
+#endif
+#ifdef UINT64_MAX
+    MVAL (UINT64_MAX),
+#endif
+    NULL
+  };
+]], [[
+  const char **mv;
+  for (mv = macro_values; *mv != NULL; mv++)
+    {
+      const char *value = *mv;
+      /* Test whether it looks like a cast expression.  */
+      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
+          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
+          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
+          || strncmp (value, "((int)"/*)*/, 6) == 0
+          || strncmp (value, "((signed short)"/*)*/, 15) == 0
+          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
+        return 1;
+    }
+  return 0;
+]])],
+              [gl_cv_header_working_stdint_h=yes],
+              [],
+              [dnl When cross-compiling, assume it works.
+               gl_cv_header_working_stdint_h=yes
+              ])
+         ])
+      ])
   fi
   if test "$gl_cv_header_working_stdint_h" = yes; then
     STDINT_H=
   fi
   if test "$gl_cv_header_working_stdint_h" = yes; then
     STDINT_H=
@@ -229,7 +297,7 @@ struct s {
     gl_STDINT_TYPE_PROPERTIES
     STDINT_H=stdint.h
   fi
     gl_STDINT_TYPE_PROPERTIES
     STDINT_H=stdint.h
   fi
-  AC_SUBST(STDINT_H)
+  AC_SUBST([STDINT_H])
 ])
 
 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
 ])
 
 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
@@ -292,7 +360,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
     eval result=\$gl_cv_type_${gltype}_signed
     GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
     if test "$result" = yes; then
     eval result=\$gl_cv_type_${gltype}_signed
     GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
     if test "$result" = yes; then
-      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
+      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
       eval HAVE_SIGNED_${GLTYPE}=1
     else
       eval HAVE_SIGNED_${GLTYPE}=0
       eval HAVE_SIGNED_${GLTYPE}=1
     else
       eval HAVE_SIGNED_${GLTYPE}=0
@@ -337,9 +405,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM([$2
+           [AC_LANG_PROGRAM([$2[
               extern $gltype foo;
               extern $gltype foo;
-              extern $gltype1 foo;])],
+              extern $gltype1 foo;]])],
            [eval gl_cv_type_${gltype}_suffix=\$glsuf])
          eval result=\$gl_cv_type_${gltype}_suffix
          test "$result" != no && break
            [eval gl_cv_type_${gltype}_suffix=\$glsuf])
          eval result=\$gl_cv_type_${gltype}_suffix
          test "$result" != no && break
@@ -348,7 +416,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
     eval result=\$gl_cv_type_${gltype}_suffix
     test "$result" = no && result=
     eval ${GLTYPE}_SUFFIX=\$result
     eval result=\$gl_cv_type_${gltype}_suffix
     test "$result" = no && result=
     eval ${GLTYPE}_SUFFIX=\$result
-    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
+    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
   done
   m4_foreach_w([gltype], [$1],
     [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
   done
   m4_foreach_w([gltype], [$1],
     [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
@@ -373,13 +441,22 @@ dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
 dnl of interest to stdint.in.h.
 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
 [
 dnl of interest to stdint.in.h.
 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
 [
-  gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
+  AC_REQUIRE([gl_MULTIARCH])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
     [gl_STDINT_INCLUDES])
   gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
     [gl_STDINT_INCLUDES])
   gl_cv_type_ptrdiff_t_signed=yes
   gl_cv_type_size_t_signed=no
     [gl_STDINT_INCLUDES])
   gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
     [gl_STDINT_INCLUDES])
   gl_cv_type_ptrdiff_t_signed=yes
   gl_cv_type_size_t_signed=no
-  gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
     [gl_STDINT_INCLUDES])
 ])
 
     [gl_STDINT_INCLUDES])
 ])
 
index 70b1248f8fcfce58a93260c6cfb8ea7bf93ded61..2e52a82acfb9a94e00ca1ef12729f3294995f64b 100644 (file)
@@ -1,13 +1,13 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2009 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 Written by Eric Blake.
 
 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 Written by Eric Blake.
 
-# wchar.m4 serial 4
+# wchar.m4 serial 23
 
 AC_DEFUN([gl_WCHAR_H],
 [
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -18,7 +18,16 @@ AC_DEFUN([gl_WCHAR_H],
 wchar_t w;]],
       [gl_cv_header_wchar_h_standalone=yes],
       [gl_cv_header_wchar_h_standalone=no])])
 wchar_t w;]],
       [gl_cv_header_wchar_h_standalone=yes],
       [gl_cv_header_wchar_h_standalone=no])])
-  if test $gl_cv_header_wchar_h_standalone != yes; then
+
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  if test $gt_cv_c_wint_t = yes; then
+    HAVE_WINT_T=1
+  else
+    HAVE_WINT_T=0
+  fi
+  AC_SUBST([HAVE_WINT_T])
+
+  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
     WCHAR_H=wchar.h
   fi
 
     WCHAR_H=wchar.h
   fi
 
@@ -36,6 +45,13 @@ wchar_t w;]],
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
+dnl Unconditionally enables the replacement of <wchar.h>.
+AC_DEFUN([gl_REPLACE_WCHAR_H],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  WCHAR_H=wchar.h
+])
+
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -45,10 +61,40 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
 [
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
 [
-  GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
+  GNULIB_BTOWC=0;      AC_SUBST([GNULIB_BTOWC])
+  GNULIB_WCTOB=0;      AC_SUBST([GNULIB_WCTOB])
+  GNULIB_MBSINIT=0;    AC_SUBST([GNULIB_MBSINIT])
+  GNULIB_MBRTOWC=0;    AC_SUBST([GNULIB_MBRTOWC])
+  GNULIB_MBRLEN=0;     AC_SUBST([GNULIB_MBRLEN])
+  GNULIB_MBSRTOWCS=0;  AC_SUBST([GNULIB_MBSRTOWCS])
+  GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
+  GNULIB_WCRTOMB=0;    AC_SUBST([GNULIB_WCRTOMB])
+  GNULIB_WCSRTOMBS=0;  AC_SUBST([GNULIB_WCSRTOMBS])
+  GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
+  GNULIB_WCWIDTH=0;    AC_SUBST([GNULIB_WCWIDTH])
   dnl Assume proper GNU behavior unless another module says otherwise.
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
-  REPLACE_WCWIDTH=0;   AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H=
-  AC_SUBST([WCHAR_H])
+  HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
+  HAVE_MBSINIT=1;       AC_SUBST([HAVE_MBSINIT])
+  HAVE_MBRTOWC=1;       AC_SUBST([HAVE_MBRTOWC])
+  HAVE_MBRLEN=1;        AC_SUBST([HAVE_MBRLEN])
+  HAVE_MBSRTOWCS=1;     AC_SUBST([HAVE_MBSRTOWCS])
+  HAVE_MBSNRTOWCS=1;    AC_SUBST([HAVE_MBSNRTOWCS])
+  HAVE_WCRTOMB=1;       AC_SUBST([HAVE_WCRTOMB])
+  HAVE_WCSRTOMBS=1;     AC_SUBST([HAVE_WCSRTOMBS])
+  HAVE_WCSNRTOMBS=1;    AC_SUBST([HAVE_WCSNRTOMBS])
+  HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
+  REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
+  REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
+  REPLACE_WCTOB=0;      AC_SUBST([REPLACE_WCTOB])
+  REPLACE_MBSINIT=0;    AC_SUBST([REPLACE_MBSINIT])
+  REPLACE_MBRTOWC=0;    AC_SUBST([REPLACE_MBRTOWC])
+  REPLACE_MBRLEN=0;     AC_SUBST([REPLACE_MBRLEN])
+  REPLACE_MBSRTOWCS=0;  AC_SUBST([REPLACE_MBSRTOWCS])
+  REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
+  REPLACE_WCRTOMB=0;    AC_SUBST([REPLACE_WCRTOMB])
+  REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
+  REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
+  REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
+  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
 ])
diff --git a/md5/m4/wint_t.m4 b/md5/m4/wint_t.m4
new file mode 100644 (file)
index 0000000..47a4363
--- /dev/null
@@ -0,0 +1,28 @@
+# wint_t.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 2003, 2007-2009 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 Test whether <wchar.h> has the 'wint_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WINT_T],
+[
+  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
+    [AC_TRY_COMPILE([
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
+   before <wchar.h>.  */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+       wint_t foo = (wchar_t)'\0';], ,
+       [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
+  if test $gt_cv_c_wint_t = yes; then
+    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
+  fi
+])
index 67baceb67937a66ac7f528a0b29a602908546fee..53aa34a870e4fe38b329d2a5fc578ea1d7dcb14b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
@@ -49,6 +49,9 @@
      in <inttypes.h> would reinclude us, skipping our contents because
      _GL_STDINT_H is defined.
      The include_next requires a split double-inclusion guard.  */
      in <inttypes.h> would reinclude us, skipping our contents because
      _GL_STDINT_H is defined.
      The include_next requires a split double-inclusion guard.  */
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #endif
 
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #endif
 
 # include <sys/bitypes.h>
 #endif
 
 # include <sys/bitypes.h>
 #endif
 
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
-/* Get WCHAR_MIN, WCHAR_MAX.  */
-# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
-#  include <wchar.h>
-# endif
-
-#endif
-
 #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
 /* Minimum and maximum values for a integer type under the usual assumption.
 #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
 /* Minimum and maximum values for a integer type under the usual assumption.
 
 #undef int8_t
 #undef uint8_t
 
 #undef int8_t
 #undef uint8_t
-#define int8_t signed char
-#define uint8_t unsigned char
+typedef signed char gl_int8_t;
+typedef unsigned char gl_uint8_t;
+#define int8_t gl_int8_t
+#define uint8_t gl_uint8_t
 
 #undef int16_t
 #undef uint16_t
 
 #undef int16_t
 #undef uint16_t
-#define int16_t short int
-#define uint16_t unsigned short int
+typedef short int gl_int16_t;
+typedef unsigned short int gl_uint16_t;
+#define int16_t gl_int16_t
+#define uint16_t gl_uint16_t
 
 #undef int32_t
 #undef uint32_t
 
 #undef int32_t
 #undef uint32_t
-#define int32_t int
-#define uint32_t unsigned int
+typedef int gl_int32_t;
+typedef unsigned int gl_uint32_t;
+#define int32_t gl_int32_t
+#define uint32_t gl_uint32_t
 
 /* Do not undefine int64_t if gnulib is not being used with 64-bit
    types, since otherwise it breaks platforms like Tandem/NSK.  */
 #if LONG_MAX >> 31 >> 31 == 1
 # undef int64_t
 
 /* Do not undefine int64_t if gnulib is not being used with 64-bit
    types, since otherwise it breaks platforms like Tandem/NSK.  */
 #if LONG_MAX >> 31 >> 31 == 1
 # undef int64_t
-# define int64_t long int
+typedef long int gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #elif defined _MSC_VER
 # undef int64_t
 # define GL_INT64_T
 #elif defined _MSC_VER
 # undef int64_t
-# define int64_t __int64
+typedef __int64 gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #elif @HAVE_LONG_LONG_INT@
 # undef int64_t
 # define GL_INT64_T
 #elif @HAVE_LONG_LONG_INT@
 # undef int64_t
-# define int64_t long long int
+typedef long long int gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #endif
 
 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
 # undef uint64_t
 # define GL_INT64_T
 #endif
 
 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
 # undef uint64_t
-# define uint64_t unsigned long int
+typedef unsigned long int gl_uint64_t;
+# define uint64_t gl_uint64_t
 # define GL_UINT64_T
 #elif defined _MSC_VER
 # undef uint64_t
 # define GL_UINT64_T
 #elif defined _MSC_VER
 # undef uint64_t
-# define uint64_t unsigned __int64
+typedef unsigned __int64 gl_uint64_t;
+# define uint64_t gl_uint64_t
 # define GL_UINT64_T
 #elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # undef uint64_t
 # define GL_UINT64_T
 #elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # undef uint64_t
-# define uint64_t unsigned long long int
+typedef unsigned long long int gl_uint64_t;
+# define uint64_t gl_uint64_t
 # define GL_UINT64_T
 #endif
 
 # define GL_UINT64_T
 #endif
 
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
-#define int_fast8_t long int
-#define uint_fast8_t unsigned int_fast8_t
-#define int_fast16_t long int
-#define uint_fast16_t unsigned int_fast16_t
-#define int_fast32_t long int
-#define uint_fast32_t unsigned int_fast32_t
+typedef long int gl_int_fast8_t;
+typedef unsigned long int gl_uint_fast8_t;
+typedef long int gl_int_fast16_t;
+typedef unsigned long int gl_uint_fast16_t;
+typedef long int gl_int_fast32_t;
+typedef unsigned long int gl_uint_fast32_t;
+#define int_fast8_t gl_int_fast8_t
+#define uint_fast8_t gl_uint_fast8_t
+#define int_fast16_t gl_int_fast16_t
+#define uint_fast16_t gl_uint_fast16_t
+#define int_fast32_t gl_int_fast32_t
+#define uint_fast32_t gl_uint_fast32_t
 #ifdef GL_INT64_T
 # define int_fast64_t int64_t
 #endif
 #ifdef GL_INT64_T
 # define int_fast64_t int64_t
 #endif
 
 #undef intptr_t
 #undef uintptr_t
 
 #undef intptr_t
 #undef uintptr_t
-#define intptr_t long int
-#define uintptr_t unsigned long int
+typedef long int gl_intptr_t;
+typedef unsigned long int gl_uintptr_t;
+#define intptr_t gl_intptr_t
+#define uintptr_t gl_uintptr_t
 
 /* 7.18.1.5. Greatest-width integer types */
 
 
 /* 7.18.1.5. Greatest-width integer types */
 
 
 #undef intmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 
 #undef intmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define intmax_t long long int
+typedef long long int gl_intmax_t;
+# define intmax_t gl_intmax_t
 #elif defined GL_INT64_T
 # define intmax_t int64_t
 #else
 #elif defined GL_INT64_T
 # define intmax_t int64_t
 #else
-# define intmax_t long int
+typedef long int gl_intmax_t;
+# define intmax_t gl_intmax_t
 #endif
 
 #undef uintmax_t
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 #endif
 
 #undef uintmax_t
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define uintmax_t unsigned long long int
+typedef unsigned long long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
 #elif defined GL_UINT64_T
 # define uintmax_t uint64_t
 #else
 #elif defined GL_UINT64_T
 # define uintmax_t uint64_t
 #else
-# define uintmax_t unsigned long int
+typedef unsigned long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
 #endif
 
 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
 #endif
 
 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
@@ -416,10 +434,20 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
 /* ptrdiff_t limits */
 #undef PTRDIFF_MIN
 #undef PTRDIFF_MAX
 /* ptrdiff_t limits */
 #undef PTRDIFF_MIN
 #undef PTRDIFF_MAX
-#define PTRDIFF_MIN  \
-   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-#define PTRDIFF_MAX  \
-   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
+# else
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
+# endif
+#else
+# define PTRDIFF_MIN  \
+    _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+# define PTRDIFF_MAX  \
+    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#endif
 
 /* sig_atomic_t limits */
 #undef SIG_ATOMIC_MIN
 
 /* sig_atomic_t limits */
 #undef SIG_ATOMIC_MIN
@@ -434,9 +462,26 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
 
 /* size_t limit */
 #undef SIZE_MAX
 
 /* size_t limit */
 #undef SIZE_MAX
-#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
+# else
+#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
+# endif
+#else
+# define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+#endif
 
 /* wchar_t limits */
 
 /* wchar_t limits */
+/* Get WCHAR_MIN, WCHAR_MAX.
+   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
+   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+   <stdint.h> and assumes its types are already defined.  */
+#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# include <wchar.h>
+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+#endif
 #undef WCHAR_MIN
 #undef WCHAR_MAX
 #define WCHAR_MIN  \
 #undef WCHAR_MIN
 #undef WCHAR_MAX
 #define WCHAR_MIN  \
index 8dfead20ea2992d0c11a868422cea35a8d8538cd..cc5baad3c07c8e624bf3d5b05a590ebd571a63c6 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
  * the declaration of wcwidth().
  */
 
  * the declaration of wcwidth().
  */
 
-#ifdef __need_mbstate_t
-/* Special invocation convention inside glibc header files.  */
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+/* Special invocation convention:
+   - Inside uClibc header files.
+   - On HP-UX 11.00 we have a sequence of nested includes
+     <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
+     once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
+     and once directly.  In both situations 'wint_t' is not yet defined,
+     therefore we cannot provide the function overrides; instead include only
+     the system's <wchar.h>.
+   - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
+     the latter includes <wchar.h>.  But here, we have no way to detect whether
+     <wctype.h> is completely included or is still being included.  */
 
 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
 
 
 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
 
@@ -36,6 +50,8 @@
 
 #ifndef _GL_WCHAR_H
 
 
 #ifndef _GL_WCHAR_H
 
+#define _GL_ALREADY_INCLUDING_WCHAR_H
+
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -51,6 +67,8 @@
 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
 #endif
 
 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
 #endif
 
+#undef _GL_ALREADY_INCLUDING_WCHAR_H
+
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
@@ -61,6 +79,207 @@ extern "C" {
 #endif
 
 
 #endif
 
 
+/* Define wint_t.  (Also done in wctype.in.h.)  */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+# ifndef WEOF
+#  define WEOF -1
+# endif
+#endif
+
+
+/* Override mbstate_t if it is too small.
+   On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
+   implementing mbrtowc for encodings like UTF-8.  */
+#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+typedef int rpl_mbstate_t;
+# undef mbstate_t
+# define mbstate_t rpl_mbstate_t
+# define GNULIB_defined_mbstate_t 1
+#endif
+
+
+/* Convert a single-byte character to a wide character.  */
+#if @GNULIB_BTOWC@
+# if @REPLACE_BTOWC@
+#  undef btowc
+#  define btowc rpl_btowc
+# endif
+# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@
+extern wint_t btowc (int c);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef btowc
+# define btowc(c) \
+    (GL_LINK_WARNING ("btowc is unportable - " \
+                      "use gnulib module btowc for portability"), \
+     btowc (c))
+#endif
+
+
+/* Convert a wide character to a single-byte character.  */
+#if @GNULIB_WCTOB@
+# if @REPLACE_WCTOB@
+#  undef wctob
+#  define wctob rpl_wctob
+# endif
+# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@
+/* wctob is provided by gnulib, or wctob exists but is not declared.  */
+extern int wctob (wint_t wc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wctob
+# define wctob(w) \
+    (GL_LINK_WARNING ("wctob is unportable - " \
+                      "use gnulib module wctob for portability"), \
+     wctob (w))
+#endif
+
+
+/* Test whether *PS is in the initial state.  */
+#if @GNULIB_MBSINIT@
+# if @REPLACE_MBSINIT@
+#  undef mbsinit
+#  define mbsinit rpl_mbsinit
+# endif
+# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@
+extern int mbsinit (const mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsinit
+# define mbsinit(p) \
+    (GL_LINK_WARNING ("mbsinit is unportable - " \
+                      "use gnulib module mbsinit for portability"), \
+     mbsinit (p))
+#endif
+
+
+/* Convert a multibyte character to a wide character.  */
+#if @GNULIB_MBRTOWC@
+# if @REPLACE_MBRTOWC@
+#  undef mbrtowc
+#  define mbrtowc rpl_mbrtowc
+# endif
+# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@
+extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrtowc
+# define mbrtowc(w,s,n,p) \
+    (GL_LINK_WARNING ("mbrtowc is unportable - " \
+                      "use gnulib module mbrtowc for portability"), \
+     mbrtowc (w, s, n, p))
+#endif
+
+
+/* Recognize a multibyte character.  */
+#if @GNULIB_MBRLEN@
+# if @REPLACE_MBRLEN@
+#  undef mbrlen
+#  define mbrlen rpl_mbrlen
+# endif
+# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@
+extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrlen
+# define mbrlen(s,n,p) \
+    (GL_LINK_WARNING ("mbrlen is unportable - " \
+                      "use gnulib module mbrlen for portability"), \
+     mbrlen (s, n, p))
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSRTOWCS@
+# if @REPLACE_MBSRTOWCS@
+#  undef mbsrtowcs
+#  define mbsrtowcs rpl_mbsrtowcs
+# endif
+# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsrtowcs
+# define mbsrtowcs(d,s,l,p) \
+    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
+                      "use gnulib module mbsrtowcs for portability"), \
+     mbsrtowcs (d, s, l, p))
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSNRTOWCS@
+# if @REPLACE_MBSNRTOWCS@
+#  undef mbsnrtowcs
+#  define mbsnrtowcs rpl_mbsnrtowcs
+# endif
+# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsnrtowcs
+# define mbsnrtowcs(d,s,n,l,p) \
+    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
+                      "use gnulib module mbsnrtowcs for portability"), \
+     mbsnrtowcs (d, s, n, l, p))
+#endif
+
+
+/* Convert a wide character to a multibyte character.  */
+#if @GNULIB_WCRTOMB@
+# if @REPLACE_WCRTOMB@
+#  undef wcrtomb
+#  define wcrtomb rpl_wcrtomb
+# endif
+# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@
+extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcrtomb
+# define wcrtomb(s,w,p) \
+    (GL_LINK_WARNING ("wcrtomb is unportable - " \
+                      "use gnulib module wcrtomb for portability"), \
+     wcrtomb (s, w, p))
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSRTOMBS@
+# if @REPLACE_WCSRTOMBS@
+#  undef wcsrtombs
+#  define wcsrtombs rpl_wcsrtombs
+# endif
+# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsrtombs
+# define wcsrtombs(d,s,l,p) \
+    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
+                      "use gnulib module wcsrtombs for portability"), \
+     wcsrtombs (d, s, l, p))
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSNRTOMBS@
+# if @REPLACE_WCSNRTOMBS@
+#  undef wcsnrtombs
+#  define wcsnrtombs rpl_wcsnrtombs
+# endif
+# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsnrtombs
+# define wcsnrtombs(d,s,n,l,p) \
+    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
+                      "use gnulib module wcsnrtombs for portability"), \
+     wcsnrtombs (d, s, n, l, p))
+#endif
+
+
 /* Return the number of screen columns needed for WC.  */
 #if @GNULIB_WCWIDTH@
 # if @REPLACE_WCWIDTH@
 /* Return the number of screen columns needed for WC.  */
 #if @GNULIB_WCWIDTH@
 # if @REPLACE_WCWIDTH@
diff --git a/useless-if-before-free b/useless-if-before-free
new file mode 100755 (executable)
index 0000000..abcdef2
--- /dev/null
@@ -0,0 +1,206 @@
+#!/usr/bin/perl -T
+# Detect instances of "if (p) free (p);".
+# Likewise for "if (p != NULL) free (p);".  And with braces.
+# Also detect "if (NULL != p) free (p);".
+# And with 0 in place of NULL.
+
+my $VERSION = '2009-04-16 15:57'; # 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
+# do its job.  Otherwise, update this string manually.
+
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Written by Jim Meyering
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+(my $ME = $0) =~ s|.*/||;
+
+# use File::Coda; # http://meyering.net/code/Coda/
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
+sub usage ($)
+{
+  my ($exit_code) = @_;
+  my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
+  if ($exit_code != 0)
+    {
+      print $STREAM "Try `$ME --help' for more information.\n";
+    }
+  else
+    {
+      print $STREAM <<EOF;
+Usage: $ME [OPTIONS] FILE...
+
+Detect any instance in FILE of a useless "if" test before a free call, e.g.,
+"if (p) free (p);".  Any such test may be safely removed without affecting
+the semantics of the C code in FILE.  Use --name=FOO --name=BAR to also
+detect free-like functions named FOO and BAR.
+
+OPTIONS:
+
+   --list       print only the name of each matching FILE (\0-terminated)
+   --name=N     add name N to the list of \`free\'-like functions to detect;
+                  may be repeated
+
+   --help       display this help and exit
+   --version    output version information and exit
+
+Exit status:
+
+  0   one or more matches
+  1   no match
+  2   an error
+
+EXAMPLE:
+
+For example, this command prints all removable "if" tests before "free"
+and "kfree" calls in the linux kernel sources:
+
+    git ls-files -z |xargs -0 $ME --name=kfree
+
+EOF
+    }
+  exit $exit_code;
+}
+
+sub is_NULL ($)
+{
+  my ($expr) = @_;
+  return ($expr eq 'NULL' || $expr eq '0');
+}
+
+{
+  sub EXIT_MATCH {0}
+  sub EXIT_NO_MATCH {1}
+  sub EXIT_ERROR {2}
+  my $err = EXIT_NO_MATCH;
+
+  my $list;
+  my @name = qw(free);
+  GetOptions
+    (
+     help => sub { usage 0 },
+     version => sub { print "$ME version $VERSION\n"; exit },
+     list => \$list,
+     'name=s@' => \@name,
+    ) or usage 1;
+
+  # Make sure we have the right number of non-option arguments.
+  # Always tell the user why we fail.
+  @ARGV < 1
+    and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
+
+  my $or = join '|', @name;
+  my $regexp = qr/(?:$or)/;
+
+  # Set the input record separator.
+  # Note: this makes it impractical to print line numbers.
+  $/ = '"';
+
+  my $found_match = 0;
+ FILE:
+  foreach my $file (@ARGV)
+    {
+      open FH, '<', $file
+        or (warn "$ME: can't open `$file' for reading: $!\n"),
+          $err = EXIT_ERROR, next;
+      while (defined (my $line = <FH>))
+        {
+          while ($line =~
+              /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
+              #  1          2                  3
+               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
+                \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
+            {
+              my $all = $1;
+              my ($lhs, $rhs) = ($2, $3);
+              my ($free_opnd, $braced_free_opnd) = ($4, $5);
+              my $non_NULL;
+              if (!defined $rhs) { $non_NULL = $lhs }
+              elsif (is_NULL $rhs) { $non_NULL = $lhs }
+              elsif (is_NULL $lhs) { $non_NULL = $rhs }
+              else { next }
+
+              # Compare the non-NULL part of the "if" expression and the
+              # free'd expression, without regard to white space.
+              $non_NULL =~ tr/ \t//d;
+              my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
+              $e2 =~ tr/ \t//d;
+              if ($non_NULL eq $e2)
+                {
+                  $found_match = 1;
+                  $list
+                    and (print "$file\0"), next FILE;
+                  print "$file: $all\n";
+                }
+            }
+        }
+    }
+  continue
+    {
+      close FH;
+    }
+
+  $found_match && $err == EXIT_NO_MATCH
+    and $err = EXIT_MATCH;
+
+  exit $err;
+}
+
+my $foo = <<'EOF';
+# The above is to *find* them.
+# This adjusts them, removing the unnecessary "if (p)" part.
+
+# FIXME: do something like this as an option (doesn't do braces):
+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'
+
+# Use the following to remove redundant uses of kfree inside braces.
+# Note that -0777 puts perl in slurp-whole-file mode;
+# but we have plenty of memory, these days...
+free=kfree
+git grep -l -z "$free *(" \
+  | xargs -0 useless-if-before-free -l --name="$free" \
+  | xargs -0 perl -0777 -pi -e \
+     's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
+
+Be careful that the result of the above transformation is valid.
+If the matched string is followed by "else", then obviously, it won't be.
+
+When modifying files, refuse to process anything other than a regular file.
+EOF
+
+## Local Variables:
+## indent-tabs-mode: nil
+## eval: (add-hook 'write-file-hooks 'time-stamp)
+## time-stamp-start: "my $VERSION = '"
+## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-time-zone: "UTC"
+## time-stamp-end: "'; # UTC"
+## End:
diff --git a/vc-list-files b/vc-list-files
new file mode 100755 (executable)
index 0000000..9376e3d
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/sh
+# List version-controlled file names.
+
+# Print a version string.
+scriptversion=2009-04-25.13; # UTC
+
+# Copyright (C) 2006-2009 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# List the specified version-controlled files.
+# With no argument, list them all.  With a single DIRECTORY argument,
+# list the version-controlled files in that directory.
+
+# If there's an argument, it must be a single, "."-relative directory name.
+# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
+
+postprocess=
+case $1 in
+  --help) cat <<EOF
+Usage: $0 [-C SRCDIR] [DIR]
+
+Output a list of version-controlled files in DIR (default .), relative to
+SRCDIR (default .).  SRCDIR must be the top directory of a checkout.
+
+Options:
+  --help     print this help, then exit
+  --version  print version number, then exit
+  -C SRCDIR  change directory to SRCDIR before generating list
+
+Report bugs and patches to <bug-gnulib@gnu.org>.
+EOF
+    exit ;;
+
+  --version)
+    year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
+    cat <<EOF
+vc-list-files $scriptversion
+Copyright (C) $year Free Software Foundation, Inc,
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+    exit ;;
+
+  -C)
+    test "$2" = . || postprocess="| sed 's|^|$2/|'"
+    cd "$2" || exit 1
+    shift; shift ;;
+esac
+
+dir=
+case $# in
+  0) ;;
+  1) dir=$1 ;;
+  *) echo "$0: too many arguments" 1>&2
+     echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
+esac
+
+test "x$dir" = x && dir=.
+
+if test -d .git; then
+  test "x$dir" = x. \
+    && dir= sed_esc= \
+    || dir="$dir/" sed_esc=`echo "$dir"|sed 's,\([\\/]\),\\\\\1,g'`
+  # Ignore git symlinks - either they point into the tree, in which case
+  # we don't need to visit the target twice, or they point somewhere
+  # else (often into a submodule), in which case the content does not
+  # belong to this package.
+  eval exec git ls-tree -r 'HEAD:"$dir"' \
+    \| sed -n '"s/^100[^       ]*./$sed_esc/p"' $postprocess
+elif test -d .hg; then
+  eval exec hg locate '"$dir/*"' $postprocess
+elif test -d .bzr; then
+  test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+  eval exec bzr ls --versioned '"$dir"' $postprocess
+elif test -d CVS; then
+  test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+  if test -x build-aux/cvsu; then
+    eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
+  elif (cvsu --help) >/dev/null 2>&1; then
+    eval cvsu --find --types=AFGM '"$dir"' $postprocess
+  else
+    eval awk -F/ \''{                  \
+       if (!$1 && $3 !~ /^-/) {        \
+         f=FILENAME;                   \
+         if (f ~ /CVS\/Entries$/)      \
+           f = substr(f, 1, length(f)-11); \
+         print f $2;                   \
+       }}'\''                          \
+      `find "$dir" -name Entries -print` /dev/null' $postprocess
+  fi
+else
+  echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
+  exit 1
+fi
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End: