1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Use Gnulib's `nproc'.

This updates Gnulib to v0.0-4496-g6491120.

* m4/gnulib-cache.m4: Add `nproc'.
This commit is contained in:
Ludovic Courtès 2010-12-07 21:43:04 +01:00
parent cb26e97a88
commit 0f00f2c33a
90 changed files with 2524 additions and 680 deletions

1
.gitignore vendored
View file

@ -137,3 +137,4 @@ INSTALL
/lib/unitypes.h /lib/unitypes.h
/lib/c++defs.h /lib/c++defs.h
/.sc-start-* /.sc-start-*
/lib/math.h

View file

@ -57,7 +57,7 @@ _have-git-version-gen := \
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes) $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) 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 stable,$(MAKECMDGOALS)))
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS))) _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
ifneq (,$(_is-dist-target)$(_is-install-target)) ifneq (,$(_is-dist-target)$(_is-install-target))
_curr-ver := $(shell cd $(srcdir) \ _curr-ver := $(shell cd $(srcdir) \

View file

@ -2,10 +2,9 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is # gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details. # mentioned in maintain.texi. See the help message below for usage details.
scriptversion=2010-07-26.16 scriptversion=2010-11-27.07
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Copyright 2003-2010 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -22,6 +21,13 @@ scriptversion=2010-07-26.16
# #
# Original author: Mohit Agarwal. # Original author: Mohit Agarwal.
# Send bug reports and any other correspondence to bug-texinfo@gnu.org. # Send bug reports and any other correspondence to bug-texinfo@gnu.org.
#
# The latest version of this script, and the companion template, is
# available from Texinfo CVS:
# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs.sh
# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs_template
#
# An up-to-date copy is also maintained in Gnulib (gnu.org/software/gnulib).
prog=`basename "$0"` prog=`basename "$0"`
srcdir=`pwd` srcdir=`pwd`
@ -177,8 +183,8 @@ if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
fi fi
case $outdir in case $outdir in
/*) dotdot_outdir="$outdir";; /*) abs_outdir=$outdir;;
*) dotdot_outdir="../$outdir";; *) abs_outdir=$srcdir/$outdir;;
esac esac
echo Generating output formats for $srcfile echo Generating output formats for $srcfile
@ -186,9 +192,9 @@ echo Generating output formats for $srcfile
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\"" cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\""
echo "Generating info files... ($cmd)" echo "Generating info files... ($cmd)"
eval "$cmd" eval "$cmd"
mkdir -p $outdir/ mkdir -p "$outdir/"
tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info* tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz` info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
# do not mv the info files, there's no point in having them available # do not mv the info files, there's no point in having them available
# separately on the web. # separately on the web.
@ -201,26 +207,26 @@ echo Generating postscript...
${DVIPS} $PACKAGE -o ${DVIPS} $PACKAGE -o
gzip -f -9 $PACKAGE.ps gzip -f -9 $PACKAGE.ps
ps_gz_size=`calcsize $PACKAGE.ps.gz` ps_gz_size=`calcsize $PACKAGE.ps.gz`
mv $PACKAGE.ps.gz $outdir/ mv $PACKAGE.ps.gz "$outdir/"
# compress/finish dvi: # compress/finish dvi:
gzip -f -9 $PACKAGE.dvi gzip -f -9 $PACKAGE.dvi
dvi_gz_size=`calcsize $PACKAGE.dvi.gz` dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
mv $PACKAGE.dvi.gz $outdir/ mv $PACKAGE.dvi.gz "$outdir/"
cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\"" cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\""
echo "Generating pdf ... ($cmd)" echo "Generating pdf ... ($cmd)"
eval "$cmd" eval "$cmd"
pdf_size=`calcsize $PACKAGE.pdf` pdf_size=`calcsize $PACKAGE.pdf`
mv $PACKAGE.pdf $outdir/ mv $PACKAGE.pdf "$outdir/"
cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\"" cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\""
echo "Generating ASCII... ($cmd)" echo "Generating ASCII... ($cmd)"
eval "$cmd" eval "$cmd"
ascii_size=`calcsize $PACKAGE.txt` ascii_size=`calcsize $PACKAGE.txt`
gzip -f -9 -c $PACKAGE.txt >$outdir/$PACKAGE.txt.gz gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz` ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
mv $PACKAGE.txt $outdir/ mv $PACKAGE.txt "$outdir/"
html_split() html_split()
{ {
@ -232,12 +238,12 @@ html_split()
( (
cd ${split_html_dir} || exit 1 cd ${split_html_dir} || exit 1
ln -sf ${PACKAGE}.html index.html ln -sf ${PACKAGE}.html index.html
tar -czf $dotdot_outdir/${PACKAGE}.html_$1.tar.gz -- *.html tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
) )
eval html_$1_tgz_size=`calcsize $outdir/${PACKAGE}.html_$1.tar.gz` eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
rm -f $outdir/html_$1/*.html rm -f "$outdir"/html_$1/*.html
mkdir -p $outdir/html_$1/ mkdir -p "$outdir/html_$1/"
mv ${split_html_dir}/*.html $outdir/html_$1/ mv ${split_html_dir}/*.html "$outdir/html_$1/"
rmdir ${split_html_dir} rmdir ${split_html_dir}
} }
@ -248,9 +254,9 @@ if test -z "$use_texi2html"; then
rm -rf $PACKAGE.html # in case a directory is left over rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd" eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html` html_mono_size=`calcsize $PACKAGE.html`
gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
mv $PACKAGE.html $outdir/ mv $PACKAGE.html "$outdir/"
cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $htmlarg \"$srcfile\"" cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $htmlarg \"$srcfile\""
echo "Generating html by node... ($cmd)" echo "Generating html by node... ($cmd)"
@ -258,12 +264,12 @@ if test -z "$use_texi2html"; then
split_html_dir=$PACKAGE.html split_html_dir=$PACKAGE.html
( (
cd ${split_html_dir} || exit 1 cd ${split_html_dir} || exit 1
tar -czf $dotdot_outdir/${PACKAGE}.html_node.tar.gz -- *.html tar -czf "$abs_outdir/${PACKAGE}.html_node.tar.gz" -- *.html
) )
html_node_tgz_size=`calcsize $outdir/${PACKAGE}.html_node.tar.gz` html_node_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node.tar.gz"`
rm -f $outdir/html_node/*.html rm -f "$outdir"/html_node/*.html
mkdir -p $outdir/html_node/ mkdir -p "$outdir/html_node/"
mv ${split_html_dir}/*.html $outdir/html_node/ mv ${split_html_dir}/*.html "$outdir/html_node/"
rmdir ${split_html_dir} rmdir ${split_html_dir}
else else
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\"" cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\""
@ -271,9 +277,9 @@ else
rm -rf $PACKAGE.html # in case a directory is left over rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd" eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html` html_mono_size=`calcsize $PACKAGE.html`
gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
mv $PACKAGE.html $outdir/ mv $PACKAGE.html "$outdir/"
html_split node html_split node
html_split chapter html_split chapter
@ -282,51 +288,54 @@ fi
echo Making .tar.gz for sources... echo Making .tar.gz for sources...
d=`dirname $srcfile` d=`dirname $srcfile`
srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true (
tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles cd "$d"
texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz` srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
)
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
if test -n "$docbook"; then if test -n "$docbook"; then
cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml"
echo "Generating docbook XML... ($cmd)" echo "Generating docbook XML... ($cmd)"
eval "$cmd" eval "$cmd"
docbook_xml_size=`calcsize $PACKAGE-db.xml` docbook_xml_size=`calcsize $PACKAGE-db.xml`
gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
docbook_xml_gz_size=`calcsize $outdir/$PACKAGE-db.xml.gz` docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
mv $PACKAGE-db.xml $outdir/ mv $PACKAGE-db.xml "$outdir/"
cmd="${DOCBOOK2HTML} -o $split_html_db_dir ${outdir}/$PACKAGE-db.xml" cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook HTML... ($cmd)" echo "Generating docbook HTML... ($cmd)"
eval "$cmd" eval "$cmd"
split_html_db_dir=html_node_db split_html_db_dir=html_node_db
( (
cd ${split_html_db_dir} || exit 1 cd ${split_html_db_dir} || exit 1
tar -czf $dotdot_outdir/${PACKAGE}.html_node_db.tar.gz -- *.html tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
) )
html_node_db_tgz_size=`calcsize $outdir/${PACKAGE}.html_node_db.tar.gz` html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
rm -f $outdir/html_node_db/*.html rm -f "$outdir"/html_node_db/*.html
mkdir -p $outdir/html_node_db mkdir -p "$outdir/html_node_db"
mv ${split_html_db_dir}/*.html $outdir/html_node_db/ mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
rmdir ${split_html_db_dir} rmdir ${split_html_db_dir}
cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml" cmd="${DOCBOOK2TXT} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook ASCII... ($cmd)" echo "Generating docbook ASCII... ($cmd)"
eval "$cmd" eval "$cmd"
docbook_ascii_size=`calcsize $PACKAGE-db.txt` docbook_ascii_size=`calcsize $PACKAGE-db.txt`
mv $PACKAGE-db.txt $outdir/ mv $PACKAGE-db.txt "$outdir/"
cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml" cmd="${DOCBOOK2PS} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook PS... ($cmd)" echo "Generating docbook PS... ($cmd)"
eval "$cmd" eval "$cmd"
gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz gzip -f -9 -c $PACKAGE-db.ps >"$outdir/$PACKAGE-db.ps.gz"
docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz` docbook_ps_gz_size=`calcsize "$outdir/$PACKAGE-db.ps.gz"`
mv $PACKAGE-db.ps $outdir/ mv $PACKAGE-db.ps "$outdir/"
cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml" cmd="${DOCBOOK2PDF} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook PDF... ($cmd)" echo "Generating docbook PDF... ($cmd)"
eval "$cmd" eval "$cmd"
docbook_pdf_size=`calcsize $PACKAGE-db.pdf` docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
mv $PACKAGE-db.pdf $outdir/ mv $PACKAGE-db.pdf "$outdir/"
fi fi
echo "Writing index file..." echo "Writing index file..."
@ -363,7 +372,7 @@ sed \
-e "s,%%SCRIPTURL%%,$scripturl,g" \ -e "s,%%SCRIPTURL%%,$scripturl,g" \
-e "s!%%SCRIPTNAME%%!$prog!g" \ -e "s!%%SCRIPTNAME%%!$prog!g" \
-e "$CONDS" \ -e "$CONDS" \
$GENDOCS_TEMPLATE_DIR/gendocs_template >$outdir/index.html $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
echo "Done, see $outdir/ subdirectory for new files." echo "Done, see $outdir/ subdirectory for new files."

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Print a version string. # Print a version string.
scriptversion=2010-06-14.19; # UTC scriptversion=2010-10-13.20; # UTC
# Copyright (C) 2007-2010 Free Software Foundation, Inc. # Copyright (C) 2007-2010 Free Software Foundation, Inc.
# #
@ -98,7 +98,10 @@ fi
if test -n "$v" if test -n "$v"
then then
: # use $v : # use $v
elif test -d .git \ # Otherwise, if there is at least one git commit involving the working
# directory, and "git describe" output looks sensible, use that to
# derive a version string.
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
&& v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
|| git describe --abbrev=4 HEAD 2>/dev/null` \ || git describe --abbrev=4 HEAD 2>/dev/null` \
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \

View file

@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program. # the same distribution terms as the rest of that program.
# #
# Generated by gnulib-tool. # Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile nproc putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@ -36,6 +36,19 @@ libgnu_la_LIBADD = $(gl_LTLIBOBJS)
libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
EXTRA_libgnu_la_SOURCES = EXTRA_libgnu_la_SOURCES =
libgnu_la_LDFLAGS = $(AM_LDFLAGS) libgnu_la_LDFLAGS = $(AM_LDFLAGS)
libgnu_la_LDFLAGS += -no-undefined
libgnu_la_LDFLAGS += $(GETADDRINFO_LIB)
libgnu_la_LDFLAGS += $(HOSTENT_LIB)
libgnu_la_LDFLAGS += $(INET_NTOP_LIB)
libgnu_la_LDFLAGS += $(INET_PTON_LIB)
libgnu_la_LDFLAGS += $(ISNAND_LIBM)
libgnu_la_LDFLAGS += $(ISNANF_LIBM)
libgnu_la_LDFLAGS += $(ISNANL_LIBM)
libgnu_la_LDFLAGS += $(LIBSOCKET)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
libgnu_la_LDFLAGS += $(LTLIBUNISTRING)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
## begin gnulib module alignof ## begin gnulib module alignof
@ -105,6 +118,8 @@ arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
@ -193,6 +208,14 @@ EXTRA_libgnu_la_SOURCES += canonicalize-lgpl.c
## end gnulib module canonicalize-lgpl ## end gnulib module canonicalize-lgpl
## begin gnulib module close-hook
libgnu_la_SOURCES += close-hook.c
EXTRA_DIST += close-hook.h
## end gnulib module close-hook
## begin gnulib module configmake ## begin gnulib module configmake
# Retrieve values of the variables through 'configure' followed by # Retrieve values of the variables through 'configure' followed by
@ -274,6 +297,7 @@ errno.h: errno.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
-e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
-e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
@ -301,6 +325,7 @@ float.h: float.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
< $(srcdir)/float.in.h; \ < $(srcdir)/float.in.h; \
} > $@-t && \ } > $@-t && \
@ -416,7 +441,9 @@ iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \ -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \
-e 's|@''GNULIB_ICONV''@|$(GNULIB_ICONV)|g' \
-e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \ -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \
-e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
-e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
@ -626,6 +653,7 @@ locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
-e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
-e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
@ -686,6 +714,7 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
-e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \ -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
-e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \ -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
@ -828,6 +857,7 @@ netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \ -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \ -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
-e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \ -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
@ -859,6 +889,7 @@ netinet/in.h: netinet_in.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
-e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
< $(srcdir)/netinet_in.in.h; \ < $(srcdir)/netinet_in.in.h; \
@ -871,6 +902,14 @@ EXTRA_DIST += netinet_in.in.h
## end gnulib module netinet_in ## end gnulib module netinet_in
## begin gnulib module nproc
libgnu_la_SOURCES += nproc.c
EXTRA_DIST += nproc.h
## end gnulib module nproc
## begin gnulib module pathmax ## begin gnulib module pathmax
@ -929,6 +968,14 @@ EXTRA_libgnu_la_SOURCES += snprintf.c
## end gnulib module snprintf ## end gnulib module snprintf
## begin gnulib module sockets
libgnu_la_SOURCES += sockets.h sockets.c
EXTRA_DIST += w32sock.h
## end gnulib module sockets
## begin gnulib module stat ## begin gnulib module stat
@ -956,6 +1003,7 @@ stdarg.h: stdarg.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
< $(srcdir)/stdarg.in.h; \ < $(srcdir)/stdarg.in.h; \
} > $@-t && \ } > $@-t && \
@ -995,6 +1043,7 @@ stddef.h: stddef.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
@ -1019,6 +1068,7 @@ stdint.h: stdint.in.h
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_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_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@ -1060,6 +1110,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
-e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
@ -1170,6 +1221,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
-e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
-e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
@ -1194,6 +1246,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
-e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
-e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
-e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
@ -1289,6 +1342,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
-e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
-e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
@ -1322,6 +1376,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
-e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
-e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
-e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \
-e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
< $(srcdir)/string.in.h | \ < $(srcdir)/string.in.h | \
@ -1341,6 +1396,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
-e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
-e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
-e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
@ -1350,6 +1406,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
-e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
-e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
-e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
@ -1379,6 +1436,7 @@ strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
@ -1406,6 +1464,7 @@ sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
sed -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \ sed -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \ -e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
-e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \ -e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
-e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \ -e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
@ -1432,6 +1491,7 @@ sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
@ -1453,6 +1513,7 @@ sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
-e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY''@|$(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)|g' \
-e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \ -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
-e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \ -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@ -1480,6 +1541,7 @@ sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
@ -1537,6 +1599,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \ -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
-e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \ -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
@ -1587,6 +1650,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
@ -1638,7 +1702,6 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
-e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|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_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
-e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
-e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
@ -1659,6 +1722,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
-e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
-e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
-e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
-e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
@ -1670,6 +1734,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
@ -1877,6 +1942,8 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { 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|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''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_BTOWC''@|$(GNULIB_BTOWC)|g' \

View file

@ -21,6 +21,11 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if @HAVE_FEATURES_H@
# include <features.h> /* for __GLIBC__ */
#endif
/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
under MinGW. under MinGW.

91
lib/close-hook.c Normal file
View file

@ -0,0 +1,91 @@
/* Hook for making the close() function extensible.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "close-hook.h"
#include <stdlib.h>
#include <unistd.h>
#undef close
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
#if WINDOWS_SOCKETS
/* The first and last link in the doubly linked list.
Initially the list is empty. */
static struct close_hook anchor = { &anchor, &anchor, NULL };
int
execute_close_hooks (int fd, const struct close_hook *remaining_list)
{
if (remaining_list == &anchor)
/* End of list reached. */
return close (fd);
else
return remaining_list->private_fn (fd, remaining_list->private_next);
}
int
execute_all_close_hooks (int fd)
{
return execute_close_hooks (fd, anchor.private_next);
}
void
register_close_hook (close_hook_fn hook, struct close_hook *link)
{
if (link->private_next == NULL && link->private_prev == NULL)
{
/* Add the link to the doubly linked list. */
link->private_next = anchor.private_next;
link->private_prev = &anchor;
link->private_fn = hook;
anchor.private_next->private_prev = link;
anchor.private_next = link;
}
else
{
/* The link is already in use. */
if (link->private_fn != hook)
abort ();
}
}
void
unregister_close_hook (struct close_hook *link)
{
struct close_hook *next = link->private_next;
struct close_hook *prev = link->private_prev;
if (next != NULL && prev != NULL)
{
/* The link is in use. Remove it from the doubly linked list. */
prev->private_next = next;
next->private_prev = prev;
/* Clear the link, to mark it unused. */
link->private_next = NULL;
link->private_prev = NULL;
link->private_fn = NULL;
}
}
#endif

72
lib/close-hook.h Normal file
View file

@ -0,0 +1,72 @@
/* Hook for making the close() function extensible.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef CLOSE_HOOK_H
#define CLOSE_HOOK_H
#ifdef __cplusplus
extern "C" {
#endif
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
#if WINDOWS_SOCKETS
/* An element of the list of close hooks.
The fields of this structure are considered private. */
struct close_hook
{
/* Doubly linked list. */
struct close_hook *private_next;
struct close_hook *private_prev;
/* Function that treats the types of FD that it knows about and calls
execute_close_hooks (FD, REMAINING_LIST) as a fallback. */
int (*private_fn) (int fd, const struct close_hook *remaining_list);
};
/* This type of function closes FD, applying special knowledge for the FD
types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
for the other FD types. */
typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
/* Execute the close hooks in REMAINING_LIST.
Return 0 or -1, like close() would do. */
extern int execute_close_hooks (int fd, const struct close_hook *remaining_list);
/* Execute all close hooks.
Return 0 or -1, like close() would do. */
extern int execute_all_close_hooks (int fd);
/* Add a function to the list of close hooks.
The LINK variable points to a piece of memory which is guaranteed to be
accessible until the corresponding call to unregister_close_hook. */
extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
/* Removes a function from the list of close hooks. */
extern void unregister_close_hook (struct close_hook *link);
#endif
#ifdef __cplusplus
}
#endif
#endif /* CLOSE_HOOK_H */

View file

@ -21,6 +21,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ #@INCLUDE_NEXT@ @NEXT_ERRNO_H@
@ -98,6 +99,7 @@
/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, /* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
Likewise, on NonStop Kernel, EDQUOT is not defined.
Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
@ -150,6 +152,11 @@
# define GNULIB_defined_ESTALE 1 # define GNULIB_defined_ESTALE 1
# endif # endif
# ifndef EDQUOT
# define EDQUOT 2010
# define GNULIB_defined_EDQUOT 1
# endif
# ifndef ECANCELED # ifndef ECANCELED
# define ECANCELED 2008 # define ECANCELED 2008
# define GNULIB_defined_ECANCELED 1 # define GNULIB_defined_ECANCELED 1

View file

@ -141,8 +141,8 @@
#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) #define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
/* Verify that SIZEOF_FLT <= sizeof (float) etc. */ /* Verify that SIZEOF_FLT <= sizeof (float) etc. */
typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1]; typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1];
typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1]; typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1];
typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1]; typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1];
#endif /* _FLOATPLUS_H */ #endif /* _FLOATPLUS_H */

View file

@ -20,6 +20,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ #@INCLUDE_NEXT@ @NEXT_FLOAT_H@

View file

@ -59,6 +59,9 @@
# define WIN32_NATIVE # define WIN32_NATIVE
#endif #endif
/* gl_sockets_startup */
#include "sockets.h"
#ifdef WIN32_NATIVE #ifdef WIN32_NATIVE
typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*, typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
const struct addrinfo*, const struct addrinfo*,
@ -101,6 +104,8 @@ use_win32_p (void)
return 0; return 0;
} }
gl_sockets_startup (SOCKETS_1_1);
return 1; return 1;
} }
#endif #endif

View file

@ -54,7 +54,7 @@
it now, to make later inclusions of <libintl.h> a NOP. */ it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib> # include <cstdlib>
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h> # include <libintl.h>
# endif # endif
#endif #endif

View file

@ -21,6 +21,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ICONV_H@ #@INCLUDE_NEXT@ @NEXT_ICONV_H@
@ -35,22 +36,24 @@
/* The definition of _GL_WARN_ON_USE is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */
#if @REPLACE_ICONV_OPEN@ #if @GNULIB_ICONV@
# if @REPLACE_ICONV_OPEN@
/* An iconv_open wrapper that supports the IANA standardized encoding names /* An iconv_open wrapper that supports the IANA standardized encoding names
("ISO-8859-1" etc.) as far as possible. */ ("ISO-8859-1" etc.) as far as possible. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv_open rpl_iconv_open # define iconv_open rpl_iconv_open
# endif # endif
_GL_FUNCDECL_RPL (iconv_open, iconv_t, _GL_FUNCDECL_RPL (iconv_open, iconv_t,
(const char *tocode, const char *fromcode) (const char *tocode, const char *fromcode)
_GL_ARG_NONNULL ((1, 2))); _GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (iconv_open, iconv_t, _GL_CXXALIAS_RPL (iconv_open, iconv_t,
(const char *tocode, const char *fromcode)); (const char *tocode, const char *fromcode));
#else # else
_GL_CXXALIAS_SYS (iconv_open, iconv_t, _GL_CXXALIAS_SYS (iconv_open, iconv_t,
(const char *tocode, const char *fromcode)); (const char *tocode, const char *fromcode));
#endif # endif
_GL_CXXALIASWARN (iconv_open); _GL_CXXALIASWARN (iconv_open);
#endif
#if @REPLACE_ICONV_UTF@ #if @REPLACE_ICONV_UTF@
/* Special constants for supporting UTF-{16,32}{BE,LE} encodings. /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
@ -65,10 +68,11 @@ _GL_CXXALIASWARN (iconv_open);
# define _ICONV_UTF32LE_UTF8 (iconv_t)(-168) # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
#endif #endif
#if @REPLACE_ICONV@ #if @GNULIB_ICONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if @REPLACE_ICONV@
# define iconv rpl_iconv # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# endif # define iconv rpl_iconv
# endif
_GL_FUNCDECL_RPL (iconv, size_t, _GL_FUNCDECL_RPL (iconv, size_t,
(iconv_t cd, (iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft, @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
@ -77,24 +81,30 @@ _GL_CXXALIAS_RPL (iconv, size_t,
(iconv_t cd, (iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft, @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)); char **outbuf, size_t *outbytesleft));
#else # else
_GL_CXXALIAS_SYS (iconv, size_t, _GL_CXXALIAS_SYS (iconv, size_t,
(iconv_t cd, (iconv_t cd,
@ICONV_CONST@ char **inbuf, size_t *inbytesleft, @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)); char **outbuf, size_t *outbytesleft));
#endif
_GL_CXXALIASWARN (iconv);
#if @REPLACE_ICONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv_close rpl_iconv_close
# endif # endif
_GL_CXXALIASWARN (iconv);
# ifndef ICONV_CONST
# define ICONV_CONST @ICONV_CONST@
# endif
#endif
#if @GNULIB_ICONV@
# if @REPLACE_ICONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define iconv_close rpl_iconv_close
# endif
_GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd)); _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
_GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd)); _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
#else # else
_GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd)); _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
#endif # endif
_GL_CXXALIASWARN (iconv_close); _GL_CXXALIASWARN (iconv_close);
#endif
#endif /* _GL_ICONV_H */ #endif /* _GL_ICONV_H */

View file

@ -49,7 +49,7 @@
* WARNING: Don't even consider trying to compile this on a system where * WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/ */
typedef int verify_int_size[2 * sizeof (int) - 7]; typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size); static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
#if HAVE_IPV6 #if HAVE_IPV6

View file

@ -117,8 +117,9 @@ FUNC (DOUBLE x)
# else # else
/* Be careful to not do any floating-point operation on x, such as x == x, /* Be careful to not do any floating-point operation on x, such as x == x,
because x may be a signaling NaN. */ because x may be a signaling NaN. */
# if defined __SUNPRO_C || defined __DECC || (defined __sgi && !defined __GNUC__) # if defined __TINYC__ || defined __SUNPRO_C || defined __DECC \
/* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't || (defined __sgi && !defined __GNUC__) || defined __ICC
/* The Sun C 5.0, Intel ICC 10.0, and Compaq (ex-DEC) 6.4 compilers don't
recognize the initializers as constant expressions. The latter compiler recognize the initializers as constant expressions. The latter compiler
also fails when constant-folding 0.0 / 0.0 even when constant-folding is also fails when constant-folding 0.0 / 0.0 even when constant-folding is
not required. The SGI MIPSpro C compiler complains about "floating-point not required. The SGI MIPSpro C compiler complains about "floating-point

View file

@ -19,6 +19,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ #@INCLUDE_NEXT@ @NEXT_LOCALE_H@

View file

@ -21,6 +21,8 @@
/* Specification. */ /* Specification. */
#include "malloca.h" #include "malloca.h"
#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */ /* Use the system functions, not the gnulib overrides in this file. */
#undef malloc #undef malloc
@ -53,8 +55,7 @@ struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
#define HEADER_SIZE \ #define HEADER_SIZE \
(((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
/* Verify that HEADER_SIZE == sizeof (struct header). */ verify (HEADER_SIZE == sizeof (struct header));
typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
/* We make the hash table quite big, so that during lookups the probability /* We make the hash table quite big, so that during lookups the probability
of empty hash buckets is quite high. There is no need to make the hash of empty hash buckets is quite high. There is no need to make the hash
table resizable, because when the hash table gets filled so much that the table resizable, because when the hash table gets filled so much that the

View file

@ -20,6 +20,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@ #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
@ -609,7 +610,8 @@ _GL_EXTERN_C int isnanf (float x);
This function is a gnulib extension, unlike isnan() which applied only This function is a gnulib extension, unlike isnan() which applied only
to 'double' numbers earlier but now is a type-generic macro. */ to 'double' numbers earlier but now is a type-generic macro. */
# if @HAVE_ISNAND@ # if @HAVE_ISNAND@
/* The original <math.h> included above provides a declaration of isnan macro. */ /* The original <math.h> included above provides a declaration of isnan
macro. */
# if __GNUC__ >= 4 # if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */ /* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnand # undef isnand
@ -629,7 +631,8 @@ _GL_EXTERN_C int isnand (double x);
#if @GNULIB_ISNANL@ #if @GNULIB_ISNANL@
/* Test for NaN for 'long double' numbers. */ /* Test for NaN for 'long double' numbers. */
# if @HAVE_ISNANL@ # if @HAVE_ISNANL@
/* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */ /* The original <math.h> included above provides a declaration of isnan
macro or (older) isnanl function. */
# if __GNUC__ >= 4 # if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */ /* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanl # undef isnanl
@ -701,11 +704,13 @@ _GL_EXTERN_C int gl_signbitf (float arg);
_GL_EXTERN_C int gl_signbitd (double arg); _GL_EXTERN_C int gl_signbitd (double arg);
_GL_EXTERN_C int gl_signbitl (long double arg); _GL_EXTERN_C int gl_signbitl (long double arg);
# if __GNUC__ >= 2 && !__STRICT_ANSI__ # if __GNUC__ >= 2 && !__STRICT_ANSI__
# define _GL_NUM_UINT_WORDS(type) \
((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
# define gl_signbitf_OPTIMIZED_MACRO # define gl_signbitf_OPTIMIZED_MACRO
# define gl_signbitf(arg) \ # define gl_signbitf(arg) \
({ union { float _value; \ ({ union { float _value; \
unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \
} _m; \ } _m; \
_m._value = (arg); \ _m._value = (arg); \
(_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
@ -714,8 +719,8 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
# define gl_signbitd_OPTIMIZED_MACRO # define gl_signbitd_OPTIMIZED_MACRO
# define gl_signbitd(arg) \ # define gl_signbitd(arg) \
({ union { double _value; \ ({ union { double _value; \
unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \
} _m; \ } _m; \
_m._value = (arg); \ _m._value = (arg); \
(_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
@ -725,10 +730,10 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
# define gl_signbitl_OPTIMIZED_MACRO # define gl_signbitl_OPTIMIZED_MACRO
# define gl_signbitl(arg) \ # define gl_signbitl(arg) \
({ union { long double _value; \ ({ union { long double _value; \
unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
} _m; \ } _m; \
_m._value = (arg); \ _m._value = (arg); \
(_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
}) })
# endif # endif
# endif # endif

View file

@ -91,7 +91,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
/* Here m > 0. */ /* Here m > 0. */
# if __GLIBC__ # if __GLIBC__ || defined __UCLIBC__
/* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
mbtowc (NULL, NULL, 0); mbtowc (NULL, NULL, 0);
# endif # endif

View file

@ -25,6 +25,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if @HAVE_NETDB_H@ #if @HAVE_NETDB_H@

View file

@ -20,6 +20,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if @HAVE_NETINET_IN_H@ #if @HAVE_NETINET_IN_H@

358
lib/nproc.c Normal file
View file

@ -0,0 +1,358 @@
/* Detect the number of processors.
Copyright (C) 2009-2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Glen Lenker and Bruno Haible. */
#include <config.h>
#include "nproc.h"
#include <stdlib.h>
#include <unistd.h>
#if HAVE_PTHREAD_GETAFFINITY_NP && 0
# include <pthread.h>
# include <sched.h>
#endif
#if HAVE_SCHED_GETAFFINITY_LIKE_GLIBC || HAVE_SCHED_GETAFFINITY_NP
# include <sched.h>
#endif
#include <sys/types.h>
#if HAVE_SYS_PSTAT_H
# include <sys/pstat.h>
#endif
#if HAVE_SYS_SYSMP_H
# include <sys/sysmp.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#include "c-ctype.h"
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
/* Return the number of processors available to the current process, based
on a modern system call that returns the "affinity" between the current
process and each CPU. Return 0 if unknown or if such a system call does
not exist. */
static unsigned long
num_processors_via_affinity_mask (void)
{
/* glibc >= 2.3.3 with NPTL and NetBSD 5 have pthread_getaffinity_np,
but with different APIs. Also it requires linking with -lpthread.
Therefore this code is not enabled.
glibc >= 2.3.4 has sched_getaffinity whereas NetBSD 5 has
sched_getaffinity_np. */
#if HAVE_PTHREAD_GETAFFINITY_NP && defined __GLIBC__ && 0
{
cpu_set_t set;
if (pthread_getaffinity_np (pthread_self (), sizeof (set), &set) == 0)
{
unsigned long count;
# ifdef CPU_COUNT
/* glibc >= 2.6 has the CPU_COUNT macro. */
count = CPU_COUNT (&set);
# else
size_t i;
count = 0;
for (i = 0; i < CPU_SETSIZE; i++)
if (CPU_ISSET (i, &set))
count++;
# endif
if (count > 0)
return count;
}
}
#elif HAVE_PTHREAD_GETAFFINITY_NP && defined __NetBSD__ && 0
{
cpuset_t *set;
set = cpuset_create ();
if (set != NULL)
{
unsigned long count = 0;
if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
== 0)
{
cpuid_t i;
for (i = 0;; i++)
{
int ret = cpuset_isset (i, set);
if (ret < 0)
break;
if (ret > 0)
count++;
}
}
cpuset_destroy (set);
if (count > 0)
return count;
}
}
#elif HAVE_SCHED_GETAFFINITY_LIKE_GLIBC /* glibc >= 2.3.4 */
{
cpu_set_t set;
if (sched_getaffinity (0, sizeof (set), &set) == 0)
{
unsigned long count;
# ifdef CPU_COUNT
/* glibc >= 2.6 has the CPU_COUNT macro. */
count = CPU_COUNT (&set);
# else
size_t i;
count = 0;
for (i = 0; i < CPU_SETSIZE; i++)
if (CPU_ISSET (i, &set))
count++;
# endif
if (count > 0)
return count;
}
}
#elif HAVE_SCHED_GETAFFINITY_NP /* NetBSD >= 5 */
{
cpuset_t *set;
set = cpuset_create ();
if (set != NULL)
{
unsigned long count = 0;
if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
{
cpuid_t i;
for (i = 0;; i++)
{
int ret = cpuset_isset (i, set);
if (ret < 0)
break;
if (ret > 0)
count++;
}
}
cpuset_destroy (set);
if (count > 0)
return count;
}
}
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
{ /* This works on native Windows platforms. */
DWORD_PTR process_mask;
DWORD_PTR system_mask;
if (GetProcessAffinityMask (GetCurrentProcess (),
&process_mask, &system_mask))
{
DWORD_PTR mask = process_mask;
unsigned long count = 0;
for (; mask != 0; mask = mask >> 1)
if (mask & 1)
count++;
if (count > 0)
return count;
}
}
#endif
return 0;
}
unsigned long int
num_processors (enum nproc_query query)
{
if (query == NPROC_CURRENT_OVERRIDABLE)
{
/* Test the environment variable OMP_NUM_THREADS, recognized also by all
programs that are based on OpenMP. The OpenMP spec says that the
value assigned to the environment variable "may have leading and
trailing white space". */
const char *envvalue = getenv ("OMP_NUM_THREADS");
if (envvalue != NULL)
{
while (*envvalue != '\0' && c_isspace (*envvalue))
envvalue++;
/* Convert it from decimal to 'unsigned long'. */
if (c_isdigit (*envvalue))
{
char *endptr = NULL;
unsigned long int value = strtoul (envvalue, &endptr, 10);
if (endptr != NULL)
{
while (*endptr != '\0' && c_isspace (*endptr))
endptr++;
if (*endptr == '\0')
return (value > 0 ? value : 1);
}
}
}
query = NPROC_CURRENT;
}
/* Here query is one of NPROC_ALL, NPROC_CURRENT. */
/* On systems with a modern affinity mask system call, we have
sysconf (_SC_NPROCESSORS_CONF)
>= sysconf (_SC_NPROCESSORS_ONLN)
>= num_processors_via_affinity_mask ()
The first number is the number of CPUs configured in the system.
The second number is the number of CPUs available to the scheduler.
The third number is the number of CPUs available to the current process.
Note! On Linux systems with glibc, the first and second number come from
the /sys and /proc file systems (see
glibc/sysdeps/unix/sysv/linux/getsysstats.c).
In some situations these file systems are not mounted, and the sysconf
call returns 1, which does not reflect the reality. */
if (query == NPROC_CURRENT)
{
/* Try the modern affinity mask system call. */
{
unsigned long nprocs = num_processors_via_affinity_mask ();
if (nprocs > 0)
return nprocs;
}
#if defined _SC_NPROCESSORS_ONLN
{ /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_ONLN);
if (nprocs > 0)
return nprocs;
}
#endif
}
else /* query == NPROC_ALL */
{
#if defined _SC_NPROCESSORS_CONF
{ /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_CONF);
# if __GLIBC__ >= 2 && defined __linux__
/* On Linux systems with glibc, this information comes from the /sys and
/proc file systems (see glibc/sysdeps/unix/sysv/linux/getsysstats.c).
In some situations these file systems are not mounted, and the
sysconf call returns 1. But we wish to guarantee that
num_processors (NPROC_ALL) >= num_processors (NPROC_CURRENT). */
if (nprocs == 1)
{
unsigned long nprocs_current = num_processors_via_affinity_mask ();
if (nprocs_current > 0)
nprocs = nprocs_current;
}
# endif
if (nprocs > 0)
return nprocs;
}
#endif
}
#if HAVE_PSTAT_GETDYNAMIC
{ /* This works on HP-UX. */
struct pst_dynamic psd;
if (pstat_getdynamic (&psd, sizeof psd, 1, 0) >= 0)
{
/* The field psd_proc_cnt contains the number of active processors.
In newer releases of HP-UX 11, the field psd_max_proc_cnt includes
deactivated processors. */
if (query == NPROC_CURRENT)
{
if (psd.psd_proc_cnt > 0)
return psd.psd_proc_cnt;
}
else
{
if (psd.psd_max_proc_cnt > 0)
return psd.psd_max_proc_cnt;
}
}
}
#endif
#if HAVE_SYSMP && defined MP_NAPROCS && defined MP_NPROCS
{ /* This works on IRIX. */
/* MP_NPROCS yields the number of installed processors.
MP_NAPROCS yields the number of processors available to unprivileged
processes. */
int nprocs =
sysmp (query == NPROC_CURRENT && getpid () != 0
? MP_NAPROCS
: MP_NPROCS);
if (nprocs > 0)
return nprocs;
}
#endif
/* Finally, as fallback, use the APIs that don't distinguish between
NPROC_CURRENT and NPROC_ALL. */
#if HAVE_SYSCTL && defined HW_NCPU
{ /* This works on MacOS X, FreeBSD, NetBSD, OpenBSD. */
int nprocs;
size_t len = sizeof (nprocs);
static int mib[2] = { CTL_HW, HW_NCPU };
if (sysctl (mib, ARRAY_SIZE (mib), &nprocs, &len, NULL, 0) == 0
&& len == sizeof (nprocs)
&& 0 < nprocs)
return nprocs;
}
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
{ /* This works on native Windows platforms. */
SYSTEM_INFO system_info;
GetSystemInfo (&system_info);
if (0 < system_info.dwNumberOfProcessors)
return system_info.dwNumberOfProcessors;
}
#endif
return 1;
}

47
lib/nproc.h Normal file
View file

@ -0,0 +1,47 @@
/* Detect the number of processors.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Glen Lenker and Bruno Haible. */
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
#endif
/* A "processor" in this context means a thread execution unit, that is either
- an execution core in a (possibly multi-core) chip, in a (possibly multi-
chip) module, in a single computer, or
- a thread execution unit inside a core
(hyper-threading, see <http://en.wikipedia.org/wiki/Hyper-threading>).
Which of the two definitions is used, is unspecified. */
enum nproc_query
{
NPROC_ALL, /* total number of processors */
NPROC_CURRENT, /* processors available to the current process */
NPROC_CURRENT_OVERRIDABLE /* likewise, but overridable through the
OMP_NUM_THREADS environment variable */
};
/* Return the total number of processors. The result is guaranteed to
be at least 1. */
extern unsigned long int num_processors (enum nproc_query query);
#ifdef __cplusplus
}
#endif /* C++ */

View file

@ -206,6 +206,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
dp->flags |= FLAG_ZERO; dp->flags |= FLAG_ZERO;
cp++; cp++;
} }
#if __GLIBC__ >= 2 && !defined __UCLIBC__
else if (*cp == 'I')
{
dp->flags |= FLAG_LOCALIZED;
cp++;
}
#endif
else else
break; break;
} }

View file

@ -23,6 +23,10 @@
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
STATIC Set to 'static' to declare the function static. */ STATIC Set to 'static' to declare the function static. */
#if HAVE_FEATURES_H
# include <features.h> /* for __GLIBC__, __UCLIBC__ */
#endif
#include "printf-args.h" #include "printf-args.h"
@ -33,6 +37,9 @@
#define FLAG_SPACE 8 /* space flag */ #define FLAG_SPACE 8 /* space flag */
#define FLAG_ALT 16 /* # flag */ #define FLAG_ALT 16 /* # flag */
#define FLAG_ZERO 32 #define FLAG_ZERO 32
#if __GLIBC__ >= 2 && !defined __UCLIBC__
# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */
#endif
/* arg_index value indicating that no argument is consumed. */ /* arg_index value indicating that no argument is consumed. */
#define ARG_NONE (~(size_t)0) #define ARG_NONE (~(size_t)0)

118
lib/sockets.c Normal file
View file

@ -0,0 +1,118 @@
/* sockets.c --- wrappers for Windows socket functions
Copyright (C) 2008-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Simon Josefsson */
#include <config.h>
/* Specification. */
#include "sockets.h"
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
# include <sys/socket.h>
# include "close-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
# include "w32sock.h"
static int
close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
{
SOCKET sock;
WSANETWORKEVENTS ev;
/* Test whether fd refers to a socket. */
sock = FD_TO_SOCKET (fd);
ev.lNetworkEvents = 0xDEADBEEF;
WSAEnumNetworkEvents (sock, NULL, &ev);
if (ev.lNetworkEvents != 0xDEADBEEF)
{
/* fd refers to a socket. */
/* FIXME: other applications, like squid, use an undocumented
_free_osfhnd free function. But this is not enough: The 'osfile'
flags for fd also needs to be cleared, but it is hard to access it.
Instead, here we just close twice the file descriptor. */
if (closesocket (sock))
{
set_winsock_errno ();
return -1;
}
else
{
/* This call frees the file descriptor and does a
CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
_close (fd);
return 0;
}
}
else
/* Some other type of file descriptor. */
return execute_close_hooks (fd, remaining_list);
}
static struct close_hook close_sockets_hook;
static int initialized_sockets_version /* = 0 */;
#endif /* WINDOWS_SOCKETS */
int
gl_sockets_startup (int version _GL_UNUSED)
{
#if WINDOWS_SOCKETS
if (version > initialized_sockets_version)
{
WSADATA data;
int err;
err = WSAStartup (version, &data);
if (err != 0)
return 1;
if (data.wVersion < version)
return 2;
if (initialized_sockets_version == 0)
register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
initialized_sockets_version = version;
}
#endif
return 0;
}
int
gl_sockets_cleanup (void)
{
#if WINDOWS_SOCKETS
int err;
initialized_sockets_version = 0;
unregister_close_hook (&close_sockets_hook);
err = WSACleanup ();
if (err != 0)
return 1;
#endif
return 0;
}

51
lib/sockets.h Normal file
View file

@ -0,0 +1,51 @@
/* sockets.h - wrappers for Windows socket functions
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Simon Josefsson */
#ifndef SOCKETS_H
# define SOCKETS_H 1
#define SOCKETS_1_0 0x100 /* don't use - does not work on Windows XP */
#define SOCKETS_1_1 0x101
#define SOCKETS_2_0 0x200 /* don't use - does not work on Windows XP */
#define SOCKETS_2_1 0x201
#define SOCKETS_2_2 0x202
int gl_sockets_startup (int version);
int gl_sockets_cleanup (void);
/* This function is useful it you create a socket using gnulib's
Winsock wrappers but needs to pass on the socket handle to some
other library that only accepts sockets. */
#if WINDOWS_SOCKETS
#include <sys/socket.h>
static inline SOCKET
gl_fd_to_handle (int fd)
{
return _get_osfhandle (fd);
}
#else
#define gl_fd_to_handle(x) (x)
#endif /* WINDOWS_SOCKETS */
#endif /* SOCKETS_H */

View file

@ -20,6 +20,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDARG_H@ #@INCLUDE_NEXT@ @NEXT_STDARG_H@

View file

@ -26,6 +26,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined __need_wchar_t || defined __need_size_t \ #if defined __need_wchar_t || defined __need_size_t \
|| defined __need_ptrdiff_t || defined __need_NULL \ || defined __need_ptrdiff_t || defined __need_NULL \

View file

@ -26,6 +26,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* When including a system file that in turn includes <inttypes.h>, /* When including a system file that in turn includes <inttypes.h>,
use the system <inttypes.h>, not our substitute. This avoids use the system <inttypes.h>, not our substitute. This avoids
@ -133,40 +134,53 @@ typedef unsigned int gl_uint32_t;
#define int32_t gl_int32_t #define int32_t gl_int32_t
#define uint32_t gl_uint32_t #define uint32_t gl_uint32_t
/* If the system defines INT64_MAX, assume int64_t works. That way,
if the underlying platform defines int64_t to be a 64-bit long long
int, the code below won't mistakenly define it to be a 64-bit long
int, which would mess up C++ name mangling. */
#if INT64_MAX
# define GL_INT64_T
#else
/* Do not undefine int64_t if gnulib is not being used with 64-bit /* Do not undefine int64_t if gnulib is not being used with 64-bit
types, since otherwise it breaks platforms like Tandem/NSK. */ types, since otherwise it breaks platforms like Tandem/NSK. */
#if LONG_MAX >> 31 >> 31 == 1 # if LONG_MAX >> 31 >> 31 == 1
# undef int64_t # undef int64_t
typedef long int gl_int64_t; typedef long int gl_int64_t;
# define int64_t gl_int64_t # define int64_t gl_int64_t
# define GL_INT64_T # define GL_INT64_T
#elif defined _MSC_VER # elif defined _MSC_VER
# undef int64_t # undef int64_t
typedef __int64 gl_int64_t; typedef __int64 gl_int64_t;
# define int64_t gl_int64_t # define int64_t gl_int64_t
# define GL_INT64_T # define GL_INT64_T
#elif @HAVE_LONG_LONG_INT@ # elif @HAVE_LONG_LONG_INT@
# undef int64_t # undef int64_t
typedef long long int gl_int64_t; typedef long long int gl_int64_t;
# define int64_t gl_int64_t # define int64_t gl_int64_t
# define GL_INT64_T # define GL_INT64_T
# endif
#endif #endif
#if ULONG_MAX >> 31 >> 31 >> 1 == 1 #if UINT64_MAX
# undef uint64_t # define GL_UINT64_T
#else
# if ULONG_MAX >> 31 >> 31 >> 1 == 1
# undef uint64_t
typedef unsigned long int gl_uint64_t; typedef unsigned long int gl_uint64_t;
# define uint64_t gl_uint64_t # define uint64_t gl_uint64_t
# define GL_UINT64_T # define GL_UINT64_T
#elif defined _MSC_VER # elif defined _MSC_VER
# undef uint64_t # undef uint64_t
typedef unsigned __int64 gl_uint64_t; typedef unsigned __int64 gl_uint64_t;
# define uint64_t gl_uint64_t # define uint64_t gl_uint64_t
# define GL_UINT64_T # define GL_UINT64_T
#elif @HAVE_UNSIGNED_LONG_LONG_INT@ # elif @HAVE_UNSIGNED_LONG_LONG_INT@
# undef uint64_t # undef uint64_t
typedef unsigned long long int gl_uint64_t; typedef unsigned long long int gl_uint64_t;
# define uint64_t gl_uint64_t # define uint64_t gl_uint64_t
# define GL_UINT64_T # define GL_UINT64_T
# endif
#endif #endif
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
@ -278,7 +292,8 @@ typedef unsigned long int gl_uintmax_t;
/* Verify that intmax_t and uintmax_t have the same size. Too much code /* 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 breaks if this is not the case. If this check fails, the reason is likely
to be found in the autoconf macros. */ to be found in the autoconf macros. */
typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1]; typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
? 1 : -1];
/* 7.18.2. Limits of specified-width integer types */ /* 7.18.2. Limits of specified-width integer types */
@ -310,17 +325,14 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
#define INT32_MAX 2147483647 #define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U #define UINT32_MAX 4294967295U
#undef INT64_MIN #if defined GL_INT64_T && ! defined INT64_MAX
#undef INT64_MAX
#ifdef GL_INT64_T
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
evaluates the latter incorrectly in preprocessor expressions. */ evaluates the latter incorrectly in preprocessor expressions. */
# define INT64_MIN (- INTMAX_C (1) << 63) # define INT64_MIN (- INTMAX_C (1) << 63)
# define INT64_MAX INTMAX_C (9223372036854775807) # define INT64_MAX INTMAX_C (9223372036854775807)
#endif #endif
#undef UINT64_MAX #if defined GL_UINT64_T && ! defined UINT64_MAX
#ifdef GL_UINT64_T
# define UINT64_MAX UINTMAX_C (18446744073709551615) # define UINT64_MAX UINTMAX_C (18446744073709551615)
#endif #endif
@ -475,8 +487,9 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
/* wchar_t limits */ /* wchar_t limits */
/* Get WCHAR_MIN, WCHAR_MAX. /* 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 This include is not on the top, above, because on OSF/1 4.0 we have a
includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes 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. */ <stdint.h> and assumes its types are already defined. */
#if ! (defined WCHAR_MIN && defined WCHAR_MAX) #if ! (defined WCHAR_MIN && defined WCHAR_MAX)
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H

View file

@ -19,6 +19,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined __need_FILE || defined __need___FILE #if defined __need_FILE || defined __need___FILE
/* Special invocation convention inside glibc header files. */ /* Special invocation convention inside glibc header files. */
@ -56,6 +57,13 @@
# endif # endif
#endif #endif
/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
&& ! defined __GLIBC__
# include <unistd.h>
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -265,7 +273,8 @@ _GL_CXXALIASWARN (freopen);
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef freopen # undef freopen
/* Assume freopen is always declared. */ /* Assume freopen is always declared. */
_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - " _GL_WARN_ON_USE (freopen,
"freopen on Win32 platforms is not POSIX compatible - "
"use gnulib module freopen for portability"); "use gnulib module freopen for portability");
#endif #endif

View file

@ -18,6 +18,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined __need_malloc_and_calloc #if defined __need_malloc_and_calloc
/* Special invocation convention inside glibc header files. */ /* Special invocation convention inside glibc header files. */
@ -38,6 +39,11 @@
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
# include <sys/wait.h>
#endif
/* Solaris declares getloadavg() in <sys/loadavg.h>. */ /* Solaris declares getloadavg() in <sys/loadavg.h>. */
#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
# include <sys/loadavg.h> # include <sys/loadavg.h>
@ -55,6 +61,9 @@
#endif #endif
#if !@HAVE_STRUCT_RANDOM_DATA@ #if !@HAVE_STRUCT_RANDOM_DATA@
/* Define 'struct random_data'.
But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
# if !GNULIB_defined_struct_random_data
struct random_data struct random_data
{ {
int32_t *fptr; /* Front pointer. */ int32_t *fptr; /* Front pointer. */
@ -65,6 +74,8 @@ struct random_data
int rand_sep; /* Distance between front and rear. */ int rand_sep; /* Distance between front and rear. */
int32_t *end_ptr; /* Pointer behind state table. */ int32_t *end_ptr; /* Pointer behind state table. */
}; };
# define GNULIB_defined_struct_random_data 1
# endif
#endif #endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) #if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
@ -172,7 +183,8 @@ _GL_CXXALIASWARN (canonicalize_file_name);
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef canonicalize_file_name # undef canonicalize_file_name
# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " _GL_WARN_ON_USE (canonicalize_file_name,
"canonicalize_file_name is unportable - "
"use gnulib module canonicalize-lgpl for portability"); "use gnulib module canonicalize-lgpl for portability");
# endif # endif
#endif #endif
@ -675,7 +687,7 @@ _GL_CXXALIASWARN (unlockpt);
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef unlockpt # undef unlockpt
# if HAVE_RAW_DECL_UNLOCKPT # if HAVE_RAW_DECL_UNLOCKPT
_GL_WARN_ON_USE (ptsname, "unlockpt is not portable - " _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
"use gnulib module unlockpt for portability"); "use gnulib module unlockpt for portability");
# endif # endif
#endif #endif

View file

@ -52,7 +52,8 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp)
iconv_t cd2; iconv_t cd2;
/* Avoid glibc-2.1 bug with EUC-KR. */ /* Avoid glibc-2.1 bug with EUC-KR. */
# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
&& !defined _LIBICONV_VERSION
if (c_strcasecmp (from_codeset, "EUC-KR") == 0 if (c_strcasecmp (from_codeset, "EUC-KR") == 0
|| c_strcasecmp (to_codeset, "EUC-KR") == 0) || c_strcasecmp (to_codeset, "EUC-KR") == 0)
{ {
@ -79,7 +80,9 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp)
} }
if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \
&& !defined __UCLIBC__) \
|| _LIBICONV_VERSION >= 0x0105
|| c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0
# endif # endif
) )
@ -136,7 +139,7 @@ iconveh_close (const iconveh_t *cd)
/* iconv_carefully is like iconv, except that it stops as soon as it encounters /* iconv_carefully is like iconv, except that it stops as soon as it encounters
a conversion error, and it returns in *INCREMENTED a boolean telling whether a conversion error, and it returns in *INCREMENTED a boolean telling whether
it has incremented the input pointers past the error location. */ it has incremented the input pointers past the error location. */
# if !defined _LIBICONV_VERSION && !defined __GLIBC__ # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert. /* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather Only GNU libiconv and GNU libc are known to prefer to fail rather
@ -244,7 +247,7 @@ iconv_carefully_1 (iconv_t cd,
*inbuf = inptr; *inbuf = inptr;
*inbytesleft = inptr_end - inptr; *inbytesleft = inptr_end - inptr;
# if !defined _LIBICONV_VERSION && !defined __GLIBC__ # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert. /* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather Only GNU libiconv and GNU libc are known to prefer to fail rather
@ -403,7 +406,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \ # if defined _LIBICONV_VERSION \
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
/* Set to the initial state. */ /* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL); iconv (cd, NULL, NULL, NULL, NULL);
# endif # endif
@ -531,7 +535,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state back to the initial state. /* Now get the conversion state back to the initial state.
But avoid glibc-2.1 bug and Solaris 2.7 bug. */ But avoid glibc-2.1 bug and Solaris 2.7 bug. */
#if defined _LIBICONV_VERSION \ #if defined _LIBICONV_VERSION \
|| !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
for (;;) for (;;)
{ {
char *outptr = result + length; char *outptr = result + length;
@ -606,7 +611,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \ # if defined _LIBICONV_VERSION \
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
/* Set to the initial state. */ /* Set to the initial state. */
if (cd1 != (iconv_t)(-1)) if (cd1 != (iconv_t)(-1))
iconv (cd1, NULL, NULL, NULL, NULL); iconv (cd1, NULL, NULL, NULL, NULL);
@ -658,7 +664,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state of CD1 back to the initial state. /* Now get the conversion state of CD1 back to the initial state.
But avoid glibc-2.1 bug and Solaris 2.7 bug. */ But avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \ # if defined _LIBICONV_VERSION \
|| !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
if (cd1 != (iconv_t)(-1)) if (cd1 != (iconv_t)(-1))
res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size); res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size);
else else
@ -740,7 +747,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state of CD1 back to the initial /* Now get the conversion state of CD1 back to the initial
state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \ # if defined _LIBICONV_VERSION \
|| !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
|| defined __sun)
if (cd2 != (iconv_t)(-1)) if (cd2 != (iconv_t)(-1))
res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size); res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size);
else else
@ -883,7 +891,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
} }
length = out2ptr - result; length = out2ptr - result;
} }
# if !defined _LIBICONV_VERSION && !defined __GLIBC__ # if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert. /* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot NetBSD iconv() inserts a question mark if it cannot
convert. convert.

View file

@ -33,7 +33,7 @@ extern "C" {
#if HAVE_ICONV #if HAVE_ICONV
/* An conversion descriptor for use by the iconveh functions. */ /* A conversion descriptor for use by the iconveh functions. */
typedef struct typedef struct
{ {
/* Conversion descriptor from FROM_CODESET to TO_CODESET, or (iconv_t)(-1) /* Conversion descriptor from FROM_CODESET to TO_CODESET, or (iconv_t)(-1)

View file

@ -21,6 +21,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@ #@INCLUDE_NEXT@ @NEXT_STRING_H@
@ -49,6 +50,12 @@
# define _GL_ATTRIBUTE_PURE /* empty */ # define _GL_ATTRIBUTE_PURE /* empty */
#endif #endif
/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
&& ! defined __GLIBC__
# include <unistd.h>
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -80,7 +87,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr,
void *, (void const *__s, int __c, size_t __n), void *, (void const *__s, int __c, size_t __n),
void const *, (void const *__s, int __c, size_t __n)); void const *, (void const *__s, int __c, size_t __n));
# endif # endif
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
_GL_CXXALIASWARN1 (memchr, void const *, _GL_CXXALIASWARN1 (memchr, void const *,
@ -165,7 +172,7 @@ _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
_GL_CXXALIAS_SYS_CAST2 (memrchr, _GL_CXXALIAS_SYS_CAST2 (memrchr,
void *, (void const *, int, size_t), void *, (void const *, int, size_t),
void const *, (void const *, int, size_t)); void const *, (void const *, int, size_t));
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
@ -195,7 +202,7 @@ _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
_GL_CXXALIAS_SYS_CAST2 (rawmemchr, _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
void *, (void const *__s, int __c_in), void *, (void const *__s, int __c_in),
void const *, (void const *__s, int __c_in)); void const *, (void const *__s, int __c_in));
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
@ -286,7 +293,7 @@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
_GL_CXXALIAS_SYS_CAST2 (strchrnul, _GL_CXXALIAS_SYS_CAST2 (strchrnul,
char *, (char const *__s, int __c_in), char *, (char const *__s, int __c_in),
char const *, (char const *__s, int __c_in)); char const *, (char const *__s, int __c_in));
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
@ -432,7 +439,7 @@ _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
_GL_CXXALIAS_SYS_CAST2 (strpbrk, _GL_CXXALIAS_SYS_CAST2 (strpbrk,
char *, (char const *__s, char const *__accept), char *, (char const *__s, char const *__accept),
const char *, (char const *__s, char const *__accept)); const char *, (char const *__s, char const *__accept));
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
_GL_CXXALIASWARN1 (strpbrk, char const *, _GL_CXXALIASWARN1 (strpbrk, char const *,
@ -534,7 +541,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr,
char *, (const char *haystack, const char *needle), char *, (const char *haystack, const char *needle),
const char *, (const char *haystack, const char *needle)); const char *, (const char *haystack, const char *needle));
# endif # endif
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
_GL_CXXALIASWARN1 (strstr, const char *, _GL_CXXALIASWARN1 (strstr, const char *,
@ -583,7 +590,7 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr,
char *, (const char *haystack, const char *needle), char *, (const char *haystack, const char *needle),
const char *, (const char *haystack, const char *needle)); const char *, (const char *haystack, const char *needle));
# endif # endif
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
_GL_CXXALIASWARN1 (strcasestr, const char *, _GL_CXXALIASWARN1 (strcasestr, const char *,
@ -895,6 +902,35 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
"use gnulib module strerror to guarantee non-NULL result"); "use gnulib module strerror to guarantee non-NULL result");
#endif #endif
/* Map any int, typically from errno, into an error message. Multithread-safe.
Uses the POSIX declaration, not the glibc declaration. */
#if @GNULIB_STRERROR_R@
# if @REPLACE_STRERROR_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef strerror_r
# define strerror_r rpl_strerror_r
# endif
_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
# else
# if !@HAVE_DECL_STRERROR_R@
_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
# endif
# if @HAVE_DECL_STRERROR_R@
_GL_CXXALIASWARN (strerror_r);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strerror_r
# if HAVE_RAW_DECL_STRERROR_R
_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
"use gnulib module strerror_r-posix for portability");
# endif
#endif
#if @GNULIB_STRSIGNAL@ #if @GNULIB_STRSIGNAL@
# if @REPLACE_STRSIGNAL@ # if @REPLACE_STRSIGNAL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)

View file

@ -21,6 +21,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRINGS_H@ #@INCLUDE_NEXT@ @NEXT_STRINGS_H@

View file

@ -23,6 +23,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_FILE_H@ #if @HAVE_SYS_FILE_H@

View file

@ -26,6 +26,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
/* Special invocation convention: /* Special invocation convention:
@ -69,7 +70,14 @@
typedef unsigned short sa_family_t; typedef unsigned short sa_family_t;
#endif #endif
#if !@HAVE_STRUCT_SOCKADDR_STORAGE@ #if @HAVE_STRUCT_SOCKADDR_STORAGE@
/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
# if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
# ifndef ss_family
# define ss_family __ss_family
# endif
# endif
#else
# include <alignof.h> # include <alignof.h>
/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
@ -122,8 +130,8 @@ struct sockaddr_storage
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000 code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is box was not able to run the code, for example. The situation is
slightly confusing because: slightly confusing because
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp <http://msdn.microsoft.com/en-us/library/ms738520>
suggests that getaddrinfo should be available on all Windows suggests that getaddrinfo should be available on all Windows
releases. */ releases. */

View file

@ -24,6 +24,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined __need_system_sys_stat_h #if defined __need_system_sys_stat_h
/* Special invocation convention. */ /* Special invocation convention. */
@ -594,7 +595,8 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
# else /* !_LARGE_FILES */ # else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st) # define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */ # endif /* !_LARGE_FILES */
_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2)); _GL_EXTERN_C int stat (const char *name, struct stat *buf)
_GL_ARG_NONNULL ((1, 2));
# endif # endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef stat # undef stat

View file

@ -19,6 +19,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* Don't get in the way of glibc when it includes time.h merely to /* Don't get in the way of glibc when it includes time.h merely to
declare a few standard symbols, rather than to declare all the declare a few standard symbols, rather than to declare all the
@ -83,6 +84,15 @@ struct timespec
# endif # endif
# endif # endif
/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
time_t to be an integer type, even though C99 permits floating
point. We don't know of any implementation that uses floating
point, and it is much easier to write code that doesn't have to
worry about that corner case, so we force the issue. */
struct __time_t_must_be_integral {
unsigned int __floating_time_t_unsupported : (time_t) 1;
};
/* Sleep for at least RQTP seconds unless interrupted, If interrupted, /* Sleep for at least RQTP seconds unless interrupted, If interrupted,
return -1 and store the remaining time into RMTP. See return -1 and store the remaining time into RMTP. See
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */ <http://www.opengroup.org/susv3xsh/nanosleep.html>. */

View file

@ -18,6 +18,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
/* Special invocation convention: /* Special invocation convention:
- On mingw, several headers, including <winsock2.h>, include <unistd.h>, - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
@ -60,14 +61,16 @@
/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */ /* But avoid namespace pollution on glibc systems. */
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
|| (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
&& defined __CYGWIN__)) \
&& ! defined __GLIBC__ && ! defined __GLIBC__
# include <stdio.h> # include <stdio.h>
#endif #endif
/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */ /* But avoid namespace pollution on glibc systems. */
#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
&& ! defined __GLIBC__
# include <fcntl.h> # include <fcntl.h>
#endif #endif
@ -85,6 +88,13 @@
# include <io.h> # include <io.h>
#endif #endif
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
#if @GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__) \
&& !defined __GLIBC__
# include <netdb.h>
#endif
#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
/* Get ssize_t. */ /* Get ssize_t. */
@ -548,13 +558,21 @@ _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
Null terminate it if the name is shorter than LEN. 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. 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. */ Return 0 if successful, otherwise set errno and return -1. */
# if !@HAVE_GETDOMAINNAME@ # if @REPLACE_GETDOMAINNAME@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef getdomainname
# define getdomainname rpl_getdomainname
# endif
_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
# else
# if !@HAVE_DECL_GETDOMAINNAME@
_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
# endif # endif
/* Need to cast, because on MacOS X 10.5 systems, the second parameter is
int len. */
_GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len));
_GL_CXXALIASWARN (getdomainname); _GL_CXXALIASWARN (getdomainname);
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef getdomainname # undef getdomainname

View file

@ -134,7 +134,7 @@ extern int
/* The variants with _safe suffix are safe, even if the library is compiled /* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */ without --enable-safety. */
#ifdef GNULIB_UNISTR_U8_MBTOUC_UNSAFE #if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n); u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
@ -157,7 +157,7 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U16_MBTOUC_UNSAFE #if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n); u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
@ -180,7 +180,7 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U32_MBTOUC_UNSAFE #if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n); u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
@ -205,7 +205,7 @@ u32_mbtouc_unsafe (ucs4_t *puc,
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U8_MBTOUC #if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n); u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
@ -228,7 +228,7 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U16_MBTOUC #if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n); u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
@ -251,7 +251,7 @@ u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U32_MBTOUC #if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n); u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
@ -279,17 +279,17 @@ u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
/* Similar to u*_mbtouc(), except that the return value gives more details /* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */ about the failure, similar to mbrtowc(). */
#ifdef GNULIB_UNISTR_U8_MBTOUCR #if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n); u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif #endif
#ifdef GNULIB_UNISTR_U16_MBTOUCR #if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n); u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif #endif
#ifdef GNULIB_UNISTR_U32_MBTOUCR #if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n); u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif #endif
@ -300,7 +300,7 @@ extern int
/* Similar to wctomb(), except that s must not be NULL, and the argument n /* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */ must be specified. */
#ifdef GNULIB_UNISTR_U8_UCTOMB #if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */ /* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n); u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
@ -322,7 +322,7 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U16_UCTOMB #if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */ /* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n); u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
@ -344,7 +344,7 @@ u16_uctomb (uint16_t *s, ucs4_t uc, int n)
# endif # endif
#endif #endif
#ifdef GNULIB_UNISTR_U32_UCTOMB #if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE # if !HAVE_INLINE
extern int extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n); u32_uctomb (uint32_t *s, ucs4_t uc, int n);
@ -559,8 +559,15 @@ extern uint32_t *
/* Compare S1 and S2. */ /* Compare S1 and S2. */
/* Similar to strcmp(), wcscmp(). */ /* Similar to strcmp(), wcscmp(). */
#ifdef __sun
/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */
extern int
u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2);
# define u8_strcmp u8_strcmp_gnu
#else
extern int extern int
u8_strcmp (const uint8_t *s1, const uint8_t *s2); u8_strcmp (const uint8_t *s1, const uint8_t *s2);
#endif
extern int extern int
u16_strcmp (const uint16_t *s1, const uint16_t *s2); u16_strcmp (const uint16_t *s1, const uint16_t *s2);
extern int extern int

View file

@ -45,21 +45,32 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; return 1;
} }
} }
else if (c < 0xf0) else if (c < 0xf0)
{ {
if (n >= 3) if (n >= 3)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
{ {
*puc = ((unsigned int) (c & 0x0f) << 12) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 6) {
| (unsigned int) (s[2] ^ 0x80); if ((c >= 0xe1 || s[1] >= 0xa0)
return 3; && (c != 0xed || s[1] < 0xa0))
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -67,26 +78,45 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else
return 2;
} }
} }
else if (c < 0xf8) else if (c < 0xf8)
{ {
if (n >= 4) if (n >= 4)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{ {
*puc = ((unsigned int) (c & 0x07) << 18) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 12) {
| ((unsigned int) (s[2] ^ 0x80) << 6) if ((s[3] ^ 0x80) < 0x40)
| (unsigned int) (s[3] ^ 0x80); {
return 4; if ((c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
| ((unsigned int) (s[2] ^ 0x80) << 6)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -94,7 +124,12 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else if (n == 2 || (s[2] ^ 0x80) >= 0x40)
return 2;
else
return 3;
} }
} }
#if 0 #if 0
@ -102,16 +137,37 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
if (n >= 5) if (n >= 5)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
{ {
*puc = ((unsigned int) (c & 0x03) << 24) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 18) {
| ((unsigned int) (s[2] ^ 0x80) << 12) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 6) {
| (unsigned int) (s[4] ^ 0x80); if ((s[4] ^ 0x80) < 0x40)
return 5; {
if (c >= 0xf9 || s[1] >= 0x88)
{
*puc = ((unsigned int) (c & 0x03) << 24)
| ((unsigned int) (s[1] ^ 0x80) << 18)
| ((unsigned int) (s[2] ^ 0x80) << 12)
| ((unsigned int) (s[3] ^ 0x80) << 6)
| (unsigned int) (s[4] ^ 0x80);
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -126,18 +182,44 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
if (n >= 6) if (n >= 6)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (s[5] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
{ {
*puc = ((unsigned int) (c & 0x01) << 30) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 24) {
| ((unsigned int) (s[2] ^ 0x80) << 18) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 12) {
| ((unsigned int) (s[4] ^ 0x80) << 6) if ((s[4] ^ 0x80) < 0x40)
| (unsigned int) (s[5] ^ 0x80); {
return 6; if ((s[5] ^ 0x80) < 0x40)
{
if (c >= 0xfd || s[1] >= 0x84)
{
*puc = ((unsigned int) (c & 0x01) << 30)
| ((unsigned int) (s[1] ^ 0x80) << 24)
| ((unsigned int) (s[2] ^ 0x80) << 18)
| ((unsigned int) (s[3] ^ 0x80) << 12)
| ((unsigned int) (s[4] ^ 0x80) << 6)
| (unsigned int) (s[5] ^ 0x80);
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }

View file

@ -41,13 +41,15 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
| (unsigned int) (s[1] ^ 0x80); | (unsigned int) (s[1] ^ 0x80);
return 2; return 2;
} }
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; return 1;
} }
} }
else if (c < 0xf0) else if (c < 0xf0)
@ -55,23 +57,39 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 3) if (n >= 3)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
#endif
{ {
*puc = ((unsigned int) (c & 0x0f) << 12) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 6) {
| (unsigned int) (s[2] ^ 0x80); if ((c >= 0xe1 || s[1] >= 0xa0)
return 3; && (c != 0xed || s[1] < 0xa0))
#endif
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else
return 2;
} }
} }
else if (c < 0xf8) else if (c < 0xf8)
@ -79,28 +97,51 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 4) if (n >= 4)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
#endif
{ {
*puc = ((unsigned int) (c & 0x07) << 18) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 12) {
| ((unsigned int) (s[2] ^ 0x80) << 6) if ((s[3] ^ 0x80) < 0x40)
| (unsigned int) (s[3] ^ 0x80); {
return 4; if ((c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
#endif
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
| ((unsigned int) (s[2] ^ 0x80) << 6)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else if (n == 2 || (s[2] ^ 0x80) >= 0x40)
return 2;
else
return 3;
} }
} }
#if 0 #if 0
@ -109,19 +150,42 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 5) if (n >= 5)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
#endif
{ {
*puc = ((unsigned int) (c & 0x03) << 24) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 18) {
| ((unsigned int) (s[2] ^ 0x80) << 12) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 6) {
| (unsigned int) (s[4] ^ 0x80); if ((s[4] ^ 0x80) < 0x40)
return 5; {
if (c >= 0xf9 || s[1] >= 0x88)
#endif
{
*puc = ((unsigned int) (c & 0x03) << 24)
| ((unsigned int) (s[1] ^ 0x80) << 18)
| ((unsigned int) (s[2] ^ 0x80) << 12)
| ((unsigned int) (s[3] ^ 0x80) << 6)
| (unsigned int) (s[4] ^ 0x80);
return 5;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
@ -135,21 +199,49 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 6) if (n >= 6)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (s[5] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
#endif
{ {
*puc = ((unsigned int) (c & 0x01) << 30) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 24) {
| ((unsigned int) (s[2] ^ 0x80) << 18) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 12) {
| ((unsigned int) (s[4] ^ 0x80) << 6) if ((s[4] ^ 0x80) < 0x40)
| (unsigned int) (s[5] ^ 0x80); {
return 6; if ((s[5] ^ 0x80) < 0x40)
{
if (c >= 0xfd || s[1] >= 0x84)
#endif
{
*puc = ((unsigned int) (c & 0x01) << 30)
| ((unsigned int) (s[1] ^ 0x80) << 24)
| ((unsigned int) (s[2] ^ 0x80) << 18)
| ((unsigned int) (s[3] ^ 0x80) << 12)
| ((unsigned int) (s[4] ^ 0x80) << 6)
| (unsigned int) (s[5] ^ 0x80);
return 6;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {

View file

@ -52,13 +52,15 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
| (unsigned int) (s[1] ^ 0x80); | (unsigned int) (s[1] ^ 0x80);
return 2; return 2;
} }
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; return 1;
} }
} }
else if (c < 0xf0) else if (c < 0xf0)
@ -66,23 +68,39 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 3) if (n >= 3)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
#endif
{ {
*puc = ((unsigned int) (c & 0x0f) << 12) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 6) {
| (unsigned int) (s[2] ^ 0x80); if ((c >= 0xe1 || s[1] >= 0xa0)
return 3; && (c != 0xed || s[1] < 0xa0))
#endif
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else
return 2;
} }
} }
else if (c < 0xf8) else if (c < 0xf8)
@ -90,28 +108,51 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 4) if (n >= 4)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
#endif
{ {
*puc = ((unsigned int) (c & 0x07) << 18) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 12) {
| ((unsigned int) (s[2] ^ 0x80) << 6) if ((s[3] ^ 0x80) < 0x40)
| (unsigned int) (s[3] ^ 0x80); {
return 4; if ((c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
#endif
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
| ((unsigned int) (s[2] ^ 0x80) << 6)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else if (n == 2 || (s[2] ^ 0x80) >= 0x40)
return 2;
else
return 3;
} }
} }
#if 0 #if 0
@ -120,19 +161,42 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 5) if (n >= 5)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
#endif
{ {
*puc = ((unsigned int) (c & 0x03) << 24) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 18) {
| ((unsigned int) (s[2] ^ 0x80) << 12) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 6) {
| (unsigned int) (s[4] ^ 0x80); if ((s[4] ^ 0x80) < 0x40)
return 5; {
if (c >= 0xf9 || s[1] >= 0x88)
#endif
{
*puc = ((unsigned int) (c & 0x03) << 24)
| ((unsigned int) (s[1] ^ 0x80) << 18)
| ((unsigned int) (s[2] ^ 0x80) << 12)
| ((unsigned int) (s[3] ^ 0x80) << 6)
| (unsigned int) (s[4] ^ 0x80);
return 5;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {
@ -146,21 +210,49 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
if (n >= 6) if (n >= 6)
{ {
#if CONFIG_UNICODE_SAFETY #if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (s[5] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
#endif
{ {
*puc = ((unsigned int) (c & 0x01) << 30) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 24) {
| ((unsigned int) (s[2] ^ 0x80) << 18) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 12) {
| ((unsigned int) (s[4] ^ 0x80) << 6) if ((s[4] ^ 0x80) < 0x40)
| (unsigned int) (s[5] ^ 0x80); {
return 6; if ((s[5] ^ 0x80) < 0x40)
{
if (c >= 0xfd || s[1] >= 0x84)
#endif
{
*puc = ((unsigned int) (c & 0x01) << 30)
| ((unsigned int) (s[1] ^ 0x80) << 24)
| ((unsigned int) (s[2] ^ 0x80) << 18)
| ((unsigned int) (s[3] ^ 0x80) << 12)
| ((unsigned int) (s[4] ^ 0x80) << 6)
| (unsigned int) (s[5] ^ 0x80);
return 6;
}
#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
#endif
} }
else else
{ {

View file

@ -55,21 +55,32 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; return 1;
} }
} }
else if (c < 0xf0) else if (c < 0xf0)
{ {
if (n >= 3) if (n >= 3)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
{ {
*puc = ((unsigned int) (c & 0x0f) << 12) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 6) {
| (unsigned int) (s[2] ^ 0x80); if ((c >= 0xe1 || s[1] >= 0xa0)
return 3; && (c != 0xed || s[1] < 0xa0))
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -77,26 +88,45 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else
return 2;
} }
} }
else if (c < 0xf8) else if (c < 0xf8)
{ {
if (n >= 4) if (n >= 4)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{ {
*puc = ((unsigned int) (c & 0x07) << 18) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 12) {
| ((unsigned int) (s[2] ^ 0x80) << 6) if ((s[3] ^ 0x80) < 0x40)
| (unsigned int) (s[3] ^ 0x80); {
return 4; if ((c >= 0xf1 || s[1] >= 0x90)
#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
#endif
)
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
| ((unsigned int) (s[2] ^ 0x80) << 6)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -104,7 +134,12 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
/* incomplete multibyte character */ /* incomplete multibyte character */
*puc = 0xfffd; *puc = 0xfffd;
return n; if (n == 1 || (s[1] ^ 0x80) >= 0x40)
return 1;
else if (n == 2 || (s[2] ^ 0x80) >= 0x40)
return 2;
else
return 3;
} }
} }
#if 0 #if 0
@ -112,16 +147,37 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
if (n >= 5) if (n >= 5)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (c >= 0xf9 || s[1] >= 0x88))
{ {
*puc = ((unsigned int) (c & 0x03) << 24) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 18) {
| ((unsigned int) (s[2] ^ 0x80) << 12) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 6) {
| (unsigned int) (s[4] ^ 0x80); if ((s[4] ^ 0x80) < 0x40)
return 5; {
if (c >= 0xf9 || s[1] >= 0x88)
{
*puc = ((unsigned int) (c & 0x03) << 24)
| ((unsigned int) (s[1] ^ 0x80) << 18)
| ((unsigned int) (s[2] ^ 0x80) << 12)
| ((unsigned int) (s[3] ^ 0x80) << 6)
| (unsigned int) (s[4] ^ 0x80);
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }
@ -136,18 +192,44 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
{ {
if (n >= 6) if (n >= 6)
{ {
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 if ((s[1] ^ 0x80) < 0x40)
&& (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
&& (s[5] ^ 0x80) < 0x40
&& (c >= 0xfd || s[1] >= 0x84))
{ {
*puc = ((unsigned int) (c & 0x01) << 30) if ((s[2] ^ 0x80) < 0x40)
| ((unsigned int) (s[1] ^ 0x80) << 24) {
| ((unsigned int) (s[2] ^ 0x80) << 18) if ((s[3] ^ 0x80) < 0x40)
| ((unsigned int) (s[3] ^ 0x80) << 12) {
| ((unsigned int) (s[4] ^ 0x80) << 6) if ((s[4] ^ 0x80) < 0x40)
| (unsigned int) (s[5] ^ 0x80); {
return 6; if ((s[5] ^ 0x80) < 0x40)
{
if (c >= 0xfd || s[1] >= 0x84)
{
*puc = ((unsigned int) (c & 0x01) << 30)
| ((unsigned int) (s[1] ^ 0x80) << 24)
| ((unsigned int) (s[2] ^ 0x80) << 18)
| ((unsigned int) (s[3] ^ 0x80) << 12)
| ((unsigned int) (s[4] ^ 0x80) << 6)
| (unsigned int) (s[5] ^ 0x80);
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 6;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 5;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
}
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
}
/* invalid multibyte character */
return 2;
} }
/* invalid multibyte character */ /* invalid multibyte character */
} }

View file

@ -23,7 +23,7 @@
const uint8_t * const uint8_t *
u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start) u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start)
{ {
/* Keep in sync with unistr.h and utf8-ucs4.c. */ /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */
if (s != start) if (s != start)
{ {
uint8_t c_1 = s[-1]; uint8_t c_1 = s[-1];

View file

@ -88,6 +88,8 @@
/* Checked size_t computations. */ /* Checked size_t computations. */
#include "xsize.h" #include "xsize.h"
#include "verify.h"
#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h> # include <math.h>
# include "float+.h" # include "float+.h"
@ -277,7 +279,7 @@ decimal_point_char (void)
multithread-safe on glibc systems and MacOS X systems, but is not required multithread-safe on glibc systems and MacOS X systems, but is not required
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
localeconv() is rarely multithread-safe. */ localeconv() is rarely multithread-safe. */
# if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__)) # if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
point = nl_langinfo (RADIXCHAR); point = nl_langinfo (RADIXCHAR);
# elif 1 # elif 1
char pointbuf[5]; char pointbuf[5];
@ -322,11 +324,11 @@ is_infinite_or_zerol (long double x)
typedef unsigned int mp_limb_t; typedef unsigned int mp_limb_t;
# define GMP_LIMB_BITS 32 # define GMP_LIMB_BITS 32
typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1]; verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
typedef unsigned long long mp_twolimb_t; typedef unsigned long long mp_twolimb_t;
# define GMP_TWOLIMB_BITS 64 # define GMP_TWOLIMB_BITS 64
typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1]; verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
/* Representation of a bignum >= 0. */ /* Representation of a bignum >= 0. */
typedef struct typedef struct
@ -2621,7 +2623,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t characters; size_t characters;
# if !DCHAR_IS_TCHAR # if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */ /* This code assumes that TCHAR_T is 'char'. */
typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1]; verify (sizeof (TCHAR_T) == 1);
TCHAR_T *tmpsrc; TCHAR_T *tmpsrc;
DCHAR_T *tmpdst; DCHAR_T *tmpdst;
size_t tmpdst_len; size_t tmpdst_len;
@ -4597,6 +4599,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
TCHAR_T *fbp; TCHAR_T *fbp;
unsigned int prefix_count; unsigned int prefix_count;
int prefixes[2] IF_LINT (= { 0 }); int prefixes[2] IF_LINT (= { 0 });
int orig_errno;
#if !USE_SNPRINTF #if !USE_SNPRINTF
size_t tmp_length; size_t tmp_length;
TCHAR_T tmpbuf[700]; TCHAR_T tmpbuf[700];
@ -4751,6 +4754,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
*fbp++ = ' '; *fbp++ = ' ';
if (flags & FLAG_ALT) if (flags & FLAG_ALT)
*fbp++ = '#'; *fbp++ = '#';
#if __GLIBC__ >= 2 && !defined __UCLIBC__
if (flags & FLAG_LOCALIZED)
*fbp++ = 'I';
#endif
if (!pad_ourselves) if (!pad_ourselves)
{ {
if (flags & FLAG_ZERO) if (flags & FLAG_ZERO)
@ -4834,14 +4841,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif #endif
*fbp = dp->conversion; *fbp = dp->conversion;
#if USE_SNPRINTF #if USE_SNPRINTF
# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) # if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%'; fbp[1] = '%';
fbp[2] = 'n'; fbp[2] = 'n';
fbp[3] = '\0'; fbp[3] = '\0';
# else # else
/* On glibc2 systems from glibc >= 2.3 - probably also older /* On glibc2 systems from glibc >= 2.3 - probably also older
ones - we know that snprintf's returns value conforms to ones - we know that snprintf's return value conforms to
ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and
gl_SNPRINTF_TRUNCATION_C99 pass.
Therefore we can avoid using %n in this situation. Therefore we can avoid using %n in this situation.
On glibc2 systems from 2004-10-18 or newer, the use of %n On glibc2 systems from 2004-10-18 or newer, the use of %n
in format strings in writable memory may crash the program in format strings in writable memory may crash the program
@ -4900,6 +4908,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
*(TCHAR_T *) (result + length) = '\0'; *(TCHAR_T *) (result + length) = '\0';
#endif #endif
orig_errno = errno;
for (;;) for (;;)
{ {
int count = -1; int count = -1;
@ -5284,8 +5294,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
DCHAR_T *tmpdst; DCHAR_T *tmpdst;
size_t tmpdst_len; size_t tmpdst_len;
/* This code assumes that TCHAR_T is 'char'. */ /* This code assumes that TCHAR_T is 'char'. */
typedef int TCHAR_T_verify verify (sizeof (TCHAR_T) == 1);
[2 * (sizeof (TCHAR_T) == 1) - 1];
# if USE_SNPRINTF # if USE_SNPRINTF
tmpsrc = (TCHAR_T *) (result + length); tmpsrc = (TCHAR_T *) (result + length);
# else # else
@ -5498,6 +5507,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
length += count; length += count;
break; break;
} }
errno = orig_errno;
#undef pad_ourselves #undef pad_ourselves
#undef prec_ourselves #undef prec_ourselves
} }

61
lib/w32sock.h Normal file
View file

@ -0,0 +1,61 @@
/* w32sock.h --- internal auxilliary functions for Windows socket functions
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paolo Bonzini */
#include <errno.h>
/* Get O_RDWR and O_BINARY. */
#include <fcntl.h>
/* Get _get_osfhandle() and _open_osfhandle(). */
#include <io.h>
#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
static inline void
set_winsock_errno (void)
{
int err = WSAGetLastError ();
/* Map some WSAE* errors to the runtime library's error codes. */
switch (err)
{
case WSA_INVALID_HANDLE:
errno = EBADF;
break;
case WSA_NOT_ENOUGH_MEMORY:
errno = ENOMEM;
break;
case WSA_INVALID_PARAMETER:
errno = EINVAL;
break;
case WSAEWOULDBLOCK:
errno = EWOULDBLOCK;
break;
case WSAENAMETOOLONG:
errno = ENAMETOOLONG;
break;
case WSAENOTEMPTY:
errno = ENOTEMPTY;
break;
default:
errno = (err > 10000 && err < 10025) ? err - 10000 : err;
break;
}
}

View file

@ -29,6 +29,7 @@
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
#endif #endif
@PRAGMA_COLUMNS@
#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H #if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
/* Special invocation convention: /* Special invocation convention:
@ -52,6 +53,10 @@
#define _GL_ALREADY_INCLUDING_WCHAR_H #define _GL_ALREADY_INCLUDING_WCHAR_H
#if @HAVE_FEATURES_H@
# include <features.h> /* for __GLIBC__ */
#endif
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>. <wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be

View file

@ -1,4 +1,4 @@
# alloca.m4 serial 9 # alloca.m4 serial 10
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation,
dnl Inc. dnl Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_ALLOCA], AC_DEFUN([gl_FUNC_ALLOCA],
[ [
dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
AC_REQUIRE([AC_PROG_CPP])
AC_REQUIRE([AC_PROG_EGREP])
AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_FUNC_ALLOCA])
if test $ac_cv_func_alloca_works = no; then if test $ac_cv_func_alloca_works = no; then
gl_PREREQ_ALLOCA gl_PREREQ_ALLOCA

View file

@ -1,5 +1,5 @@
# arpa_inet_h.m4 serial 8 # arpa_inet_h.m4 serial 10
dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -22,11 +22,13 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
gl_CHECK_NEXT_HEADERS([arpa/inet.h]) gl_CHECK_NEXT_HEADERS([arpa/inet.h])
AC_REQUIRE([gl_FEATURES_H])
dnl Check for declarations of anything we want to poison if the dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[ gl_WARN_ON_USE_PREPARE([[
/* On some systems, this header is not self-consistent. */ /* On some systems, this header is not self-consistent. */
#ifndef __GLIBC__ #if !(defined __GLIBC__ || defined __UCLIBC__)
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#include <arpa/inet.h> #include <arpa/inet.h>

View file

@ -1,4 +1,4 @@
# canonicalize.m4 serial 16 # canonicalize.m4 serial 17
dnl Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc. dnl Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
@ -65,10 +65,23 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#include <stdlib.h> #include <stdlib.h>
]], [[ ]], [[
char *name1 = realpath ("conftest.a", NULL); int result = 0;
char *name2 = realpath ("conftest.b/../conftest.a", NULL); {
char *name3 = realpath ("conftest.a/", NULL); char *name = realpath ("conftest.a", NULL);
return !(name1 && *name1 == '/' && !name2 && !name3); if (!(name && *name == '/'))
result |= 1;
}
{
char *name = realpath ("conftest.b/../conftest.a", NULL);
if (name != NULL)
result |= 2;
}
{
char *name = realpath ("conftest.a/", NULL);
if (name != NULL)
result |= 4;
}
return result;
]]) ]])
], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no], ], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no],
[gl_cv_func_realpath_works="guessing no"]) [gl_cv_func_realpath_works="guessing no"])

View file

@ -1,4 +1,4 @@
# duplocale.m4 serial 4 # duplocale.m4 serial 5
dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -31,16 +31,19 @@ int main ()
}]])], }]])],
[gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=yes],
[gl_cv_func_duplocale_works=no], [gl_cv_func_duplocale_works=no],
[dnl Guess it works except on glibc < 2.12 and AIX. [dnl Guess it works except on glibc < 2.12, uClibc, and AIX.
case "$host_os" in case "$host_os" in
aix*) gl_cv_func_duplocale_works="guessing no";; aix*) gl_cv_func_duplocale_works="guessing no";;
*-gnu*) *-gnu*)
AC_EGREP_CPP([Unlucky GNU user], [ AC_EGREP_CPP([Unlucky], [
#include <features.h> #include <features.h>
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12) #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
Unlucky GNU user Unlucky GNU user
#endif #endif
#endif
#ifdef __UCLIBC__
Unlucky user
#endif #endif
], ],
[gl_cv_func_duplocale_works="guessing no"], [gl_cv_func_duplocale_works="guessing no"],

View file

@ -1,5 +1,5 @@
# errno_h.m4 serial 6 # errno_h.m4 serial 7
dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. dnl Copyright (C) 2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -37,6 +37,9 @@ booboo
#if !defined ESTALE #if !defined ESTALE
booboo booboo
#endif #endif
#if !defined EDQUOT
booboo
#endif
#if !defined ECANCELED #if !defined ECANCELED
booboo booboo
#endif #endif

View file

@ -1,4 +1,4 @@
# fcntl-o.m4 serial 2 # fcntl-o.m4 serial 3
dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -37,34 +37,61 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
}; };
]], ]],
[[ [[
int status = !constants; int result = !constants;
{ {
static char const sym[] = "conftest.sym"; static char const sym[] = "conftest.sym";
if (symlink (".", sym) != 0 if (symlink (".", sym) != 0)
|| close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) result |= 2;
status |= 32; else
{
int fd = open (sym, O_RDONLY | O_NOFOLLOW);
if (fd >= 0)
{
close (fd);
result |= 4;
}
}
unlink (sym); unlink (sym);
} }
{ {
static char const file[] = "confdefs.h"; static char const file[] = "confdefs.h";
int fd = open (file, O_RDONLY | O_NOATIME); int fd = open (file, O_RDONLY | O_NOATIME);
char c; if (fd < 0)
struct stat st0, st1; result |= 8;
if (fd < 0 else
|| fstat (fd, &st0) != 0 {
|| sleep (1) != 0 struct stat st0;
|| read (fd, &c, 1) != 1 if (fstat (fd, &st0) != 0)
|| close (fd) != 0 result |= 16;
|| stat (file, &st1) != 0 else
|| st0.st_atime != st1.st_atime) {
status |= 64; char c;
sleep (1);
if (read (fd, &c, 1) != 1)
result |= 24;
else
{
if (close (fd) != 0)
result |= 32;
else
{
struct stat st1;
if (stat (file, &st1) != 0)
result |= 40;
else
if (st0.st_atime != st1.st_atime)
result |= 64;
}
}
}
}
} }
return status;]])], return result;]])],
[gl_cv_header_working_fcntl_h=yes], [gl_cv_header_working_fcntl_h=yes],
[case $? in #( [case $? in #(
32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
*) gl_cv_header_working_fcntl_h='no';; *) gl_cv_header_working_fcntl_h='no';;
esac], esac],
[gl_cv_header_working_fcntl_h=cross-compiling])]) [gl_cv_header_working_fcntl_h=cross-compiling])])

View file

@ -1,4 +1,4 @@
# float_h.m4 serial 3 # float_h.m4 serial 4
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H],
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
FLOAT_H= FLOAT_H=
case "$host_os" in case "$host_os" in
beos* | openbsd*) beos* | openbsd* | mirbsd*)
FLOAT_H=float.h FLOAT_H=float.h
gl_CHECK_NEXT_HEADERS([float.h]) gl_CHECK_NEXT_HEADERS([float.h])
;; ;;

View file

@ -1,23 +1,26 @@
# glibc21.m4 serial 4 # glibc21.m4 serial 5
dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. dnl Copyright (C) 2000-2002, 2004, 2008, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
# Test for the GNU C Library, version 2.1 or newer. # Test for the GNU C Library, version 2.1 or newer, or uClibc.
# From Bruno Haible. # From Bruno Haible.
AC_DEFUN([gl_GLIBC21], AC_DEFUN([gl_GLIBC21],
[ [
AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc],
[ac_cv_gnu_library_2_1], [ac_cv_gnu_library_2_1],
[AC_EGREP_CPP([Lucky GNU user], [AC_EGREP_CPP([Lucky],
[ [
#include <features.h> #include <features.h>
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
Lucky GNU user Lucky GNU user
#endif #endif
#endif
#ifdef __UCLIBC__
Lucky user
#endif #endif
], ],
[ac_cv_gnu_library_2_1=yes], [ac_cv_gnu_library_2_1=yes],

View file

@ -15,7 +15,7 @@
# 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 --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings # gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile nproc putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations: # Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([]) gl_LOCAL_DIR([])
@ -51,6 +51,7 @@ gl_MODULES([
libunistring libunistring
locale locale
maintainer-makefile maintainer-makefile
nproc
putenv putenv
stat-time stat-time
stdlib stdlib

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 20 # gnulib-common.m4 serial 21
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -102,6 +102,19 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
[Define to 1 when the gnulib module $1 should be tested.]) [Define to 1 when the gnulib module $1 should be tested.])
]) ])
# Test whether <features.h> exists.
# Set HAVE_FEATURES_H.
AC_DEFUN([gl_FEATURES_H],
[
AC_CHECK_HEADERS_ONCE([features.h])
if test $ac_cv_header_features_h = yes; then
HAVE_FEATURES_H=1
else
HAVE_FEATURES_H=0
fi
AC_SUBST([HAVE_FEATURES_H])
])
# m4_foreach_w # m4_foreach_w
# is a backport of autoconf-2.59c's m4_foreach_w. # is a backport of autoconf-2.59c's m4_foreach_w.
# Remove this macro when we can assume autoconf >= 2.60. # Remove this macro when we can assume autoconf >= 2.60.

View file

@ -40,6 +40,7 @@ AC_DEFUN([gl_EARLY],
# Code from module c-strcase: # Code from module c-strcase:
# Code from module c-strcaseeq: # Code from module c-strcaseeq:
# Code from module canonicalize-lgpl: # Code from module canonicalize-lgpl:
# Code from module close-hook:
# Code from module configmake: # Code from module configmake:
# Code from module duplocale: # Code from module duplocale:
# Code from module environ: # Code from module environ:
@ -94,6 +95,7 @@ AC_DEFUN([gl_EARLY],
# Code from module multiarch: # Code from module multiarch:
# Code from module netdb: # Code from module netdb:
# Code from module netinet_in: # Code from module netinet_in:
# Code from module nproc:
# Code from module pathmax: # Code from module pathmax:
# Code from module putenv: # Code from module putenv:
# Code from module readlink: # Code from module readlink:
@ -102,6 +104,8 @@ AC_DEFUN([gl_EARLY],
# Code from module servent: # Code from module servent:
# Code from module size_max: # Code from module size_max:
# Code from module snprintf: # Code from module snprintf:
# Code from module socketlib:
# Code from module sockets:
# Code from module socklen: # Code from module socklen:
# Code from module ssize_t: # Code from module ssize_t:
# Code from module stat: # Code from module stat:
@ -185,6 +189,7 @@ AC_DEFUN([gl_INIT],
gl_MODULE_INDICATOR([canonicalize-lgpl]) gl_MODULE_INDICATOR([canonicalize-lgpl])
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name]) gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
gl_STDLIB_MODULE_INDICATOR([realpath]) gl_STDLIB_MODULE_INDICATOR([realpath])
# Code from module close-hook:
# Code from module configmake: # Code from module configmake:
# Code from module duplocale: # Code from module duplocale:
gl_FUNC_DUPLOCALE gl_FUNC_DUPLOCALE
@ -233,6 +238,7 @@ AC_DEFUN([gl_INIT],
gl_HOSTENT gl_HOSTENT
# Code from module iconv: # Code from module iconv:
AM_ICONV AM_ICONV
gl_ICONV_MODULE_INDICATOR([iconv])
# Code from module iconv-h: # Code from module iconv-h:
gl_ICONV_H gl_ICONV_H
# Code from module iconv_open: # Code from module iconv_open:
@ -307,6 +313,8 @@ AC_DEFUN([gl_INIT],
# Code from module netinet_in: # Code from module netinet_in:
gl_HEADER_NETINET_IN gl_HEADER_NETINET_IN
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
# Code from module nproc:
gl_NPROC
# Code from module pathmax: # Code from module pathmax:
gl_PATHMAX gl_PATHMAX
# Code from module putenv: # Code from module putenv:
@ -326,6 +334,10 @@ AC_DEFUN([gl_INIT],
# Code from module snprintf: # Code from module snprintf:
gl_FUNC_SNPRINTF gl_FUNC_SNPRINTF
gl_STDIO_MODULE_INDICATOR([snprintf]) gl_STDIO_MODULE_INDICATOR([snprintf])
# Code from module socketlib:
gl_SOCKETLIB
# Code from module sockets:
gl_SOCKETS
# Code from module socklen: # Code from module socklen:
gl_TYPE_SOCKLEN_T gl_TYPE_SOCKLEN_T
# Code from module ssize_t: # Code from module ssize_t:
@ -382,10 +394,10 @@ AC_DEFUN([gl_INIT],
gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h]) gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h])
# Code from module unistr/u8-mbtouc: # Code from module unistr/u8-mbtouc:
gl_MODULE_INDICATOR([unistr/u8-mbtouc]) gl_MODULE_INDICATOR([unistr/u8-mbtouc])
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtouc]) gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc])
# Code from module unistr/u8-mbtouc-unsafe: # Code from module unistr/u8-mbtouc-unsafe:
gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe]) gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe])
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtouc-unsafe]) gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc-unsafe])
# Code from module unistr/u8-mbtoucr: # Code from module unistr/u8-mbtoucr:
gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) gl_MODULE_INDICATOR([unistr/u8-mbtoucr])
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr])
@ -580,6 +592,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/c-strcaseeq.h lib/c-strcaseeq.h
lib/c-strncasecmp.c lib/c-strncasecmp.c
lib/canonicalize-lgpl.c lib/canonicalize-lgpl.c
lib/close-hook.c
lib/close-hook.h
lib/config.charset lib/config.charset
lib/duplocale.c lib/duplocale.c
lib/errno.in.h lib/errno.in.h
@ -627,6 +641,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/memchr.valgrind lib/memchr.valgrind
lib/netdb.in.h lib/netdb.in.h
lib/netinet_in.in.h lib/netinet_in.in.h
lib/nproc.c
lib/nproc.h
lib/pathmax.h lib/pathmax.h
lib/printf-args.c lib/printf-args.c
lib/printf-args.h lib/printf-args.h
@ -642,6 +658,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/safe-write.h lib/safe-write.h
lib/size_max.h lib/size_max.h
lib/snprintf.c lib/snprintf.c
lib/sockets.c
lib/sockets.h
lib/stat-time.h lib/stat-time.h
lib/stat.c lib/stat.c
lib/stdarg.in.h lib/stdarg.in.h
@ -683,6 +701,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/version-etc.c lib/version-etc.c
lib/version-etc.h lib/version-etc.h
lib/vsnprintf.c lib/vsnprintf.c
lib/w32sock.h
lib/wchar.in.h lib/wchar.in.h
lib/write.c lib/write.c
lib/xsize.h lib/xsize.h
@ -754,6 +773,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/multiarch.m4 m4/multiarch.m4
m4/netdb_h.m4 m4/netdb_h.m4
m4/netinet_in_h.m4 m4/netinet_in_h.m4
m4/nproc.m4
m4/pathmax.m4 m4/pathmax.m4
m4/printf.m4 m4/printf.m4
m4/putenv.m4 m4/putenv.m4
@ -763,6 +783,8 @@ AC_DEFUN([gl_FILE_LIST], [
m4/servent.m4 m4/servent.m4
m4/size_max.m4 m4/size_max.m4
m4/snprintf.m4 m4/snprintf.m4
m4/socketlib.m4
m4/sockets.m4
m4/socklen.m4 m4/socklen.m4
m4/sockpfaf.m4 m4/sockpfaf.m4
m4/ssize_t.m4 m4/ssize_t.m4

View file

@ -1,4 +1,4 @@
# iconv.m4 serial 15 (gettext-0.18.2) # iconv.m4 serial 17 (gettext-0.18.2)
dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -78,6 +78,7 @@ AC_DEFUN([AM_ICONV_LINK],
#include <string.h> #include <string.h>
int main () int main ()
{ {
int result = 0;
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */ returns. */
{ {
@ -94,7 +95,8 @@ int main ()
(char **) &inptr, &inbytesleft, (char **) &inptr, &inbytesleft,
&outptr, &outbytesleft); &outptr, &outbytesleft);
if (res == 0) if (res == 0)
return 1; result |= 1;
iconv_close (cd_utf8_to_88591);
} }
} }
/* Test against Solaris 10 bug: Failures are not distinguishable from /* Test against Solaris 10 bug: Failures are not distinguishable from
@ -113,7 +115,8 @@ int main ()
(char **) &inptr, &inbytesleft, (char **) &inptr, &inbytesleft,
&outptr, &outbytesleft); &outptr, &outbytesleft);
if (res == 0) if (res == 0)
return 1; result |= 2;
iconv_close (cd_ascii_to_88591);
} }
} }
/* Test against AIX 6.1..7.1 bug: Buffer overrun. */ /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
@ -131,7 +134,8 @@ int main ()
(char **) &inptr, &inbytesleft, (char **) &inptr, &inbytesleft,
&outptr, &outbytesleft); &outptr, &outbytesleft);
if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
return 1; result |= 4;
iconv_close (cd_88591_to_utf8);
} }
} }
#if 0 /* This bug could be worked around by the caller. */ #if 0 /* This bug could be worked around by the caller. */
@ -150,7 +154,8 @@ int main ()
(char **) &inptr, &inbytesleft, (char **) &inptr, &inbytesleft,
&outptr, &outbytesleft); &outptr, &outbytesleft);
if ((int)res > 0) if ((int)res > 0)
return 1; result |= 8;
iconv_close (cd_88591_to_utf8);
} }
} }
#endif #endif
@ -164,8 +169,8 @@ int main ()
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */ /* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1; result |= 16;
return 0; return result;
}]])], }]])],
[am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=yes],
[am_cv_func_iconv_works=no], [am_cv_func_iconv_works=no],
@ -252,5 +257,12 @@ size_t iconv();
$am_cv_proto_iconv]) $am_cv_proto_iconv])
AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
[Define as const if the declaration of iconv() needs const.]) [Define as const if the declaration of iconv() needs const.])
dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
m4_ifdef([gl_ICONV_H_DEFAULTS],
[AC_REQUIRE([gl_ICONV_H_DEFAULTS])
if test -n "$am_cv_proto_iconv_arg1"; then
ICONV_CONST="const"
fi
])
fi fi
]) ])

View file

@ -1,4 +1,4 @@
# iconv_h.m4 serial 6 # iconv_h.m4 serial 7
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -29,7 +29,9 @@ AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
AC_DEFUN([gl_ICONV_H_DEFAULTS], AC_DEFUN([gl_ICONV_H_DEFAULTS],
[ [
GNULIB_ICONV=0; AC_SUBST([GNULIB_ICONV])
dnl Assume proper GNU behavior unless another module says otherwise. dnl Assume proper GNU behavior unless another module says otherwise.
ICONV_CONST=; AC_SUBST([ICONV_CONST])
REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV]) REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV])
REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN]) REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF]) REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF])

View file

@ -1,4 +1,4 @@
# iconv_open.m4 serial 8 # iconv_open.m4 serial 11
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -16,7 +16,7 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
dnl We know that GNU libiconv and GNU libc do. dnl We know that GNU libiconv and GNU libc do.
AC_EGREP_CPP([gnu_iconv], [ AC_EGREP_CPP([gnu_iconv], [
#include <iconv.h> #include <iconv.h>
#if defined _LIBICONV_VERSION || defined __GLIBC__ #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__)
gnu_iconv gnu_iconv
#endif #endif
], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no]) ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no])
@ -52,12 +52,6 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_ICONV_H_DEFAULTS]) AC_REQUIRE([gl_ICONV_H_DEFAULTS])
if test "$am_cv_func_iconv" = yes; then if test "$am_cv_func_iconv" = yes; then
if test -n "$am_cv_proto_iconv_arg1"; then
ICONV_CONST="const"
else
ICONV_CONST=
fi
AC_SUBST([ICONV_CONST])
AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}], AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}],
[gl_cv_func_iconv_supports_utf], [gl_cv_func_iconv_supports_utf],
[ [
@ -70,9 +64,9 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define ASSERT(expr) if (!(expr)) return 1;
int main () int main ()
{ {
int result = 0;
/* Test conversion from UTF-8 to UTF-16BE with no errors. */ /* Test conversion from UTF-8 to UTF-16BE with no errors. */
{ {
static const char input[] = static const char input[] =
@ -80,25 +74,33 @@ int main ()
static const char expected[] = static const char expected[] =
"\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]"; "\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
iconv_t cd; iconv_t cd;
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
cd = iconv_open ("UTF-16BE", "UTF-8"); cd = iconv_open ("UTF-16BE", "UTF-8");
ASSERT (cd != (iconv_t)(-1)); if (cd == (iconv_t)(-1))
inptr = input; result |= 1;
inbytesleft = sizeof (input) - 1; else
outptr = buf; {
outbytesleft = sizeof (buf); char buf[100];
res = iconv (cd, const char *inptr;
(ICONV_CONST char **) &inptr, &inbytesleft, size_t inbytesleft;
&outptr, &outbytesleft); char *outptr;
ASSERT (res == 0 && inbytesleft == 0); size_t outbytesleft;
ASSERT (outptr == buf + (sizeof (expected) - 1)); size_t res;
ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); inptr = input;
ASSERT (iconv_close (cd) == 0); inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 1;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 1;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 1;
else if (!(iconv_close (cd) == 0))
result |= 1;
}
} }
/* Test conversion from UTF-8 to UTF-16LE with no errors. */ /* Test conversion from UTF-8 to UTF-16LE with no errors. */
{ {
@ -107,25 +109,33 @@ int main ()
static const char expected[] = static const char expected[] =
"J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000"; "J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000";
iconv_t cd; iconv_t cd;
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
cd = iconv_open ("UTF-16LE", "UTF-8"); cd = iconv_open ("UTF-16LE", "UTF-8");
ASSERT (cd != (iconv_t)(-1)); if (cd == (iconv_t)(-1))
inptr = input; result |= 2;
inbytesleft = sizeof (input) - 1; else
outptr = buf; {
outbytesleft = sizeof (buf); char buf[100];
res = iconv (cd, const char *inptr;
(ICONV_CONST char **) &inptr, &inbytesleft, size_t inbytesleft;
&outptr, &outbytesleft); char *outptr;
ASSERT (res == 0 && inbytesleft == 0); size_t outbytesleft;
ASSERT (outptr == buf + (sizeof (expected) - 1)); size_t res;
ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); inptr = input;
ASSERT (iconv_close (cd) == 0); inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 2;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 2;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 2;
else if (!(iconv_close (cd) == 0))
result |= 2;
}
} }
/* Test conversion from UTF-8 to UTF-32BE with no errors. */ /* Test conversion from UTF-8 to UTF-32BE with no errors. */
{ {
@ -134,25 +144,33 @@ int main ()
static const char expected[] = static const char expected[] =
"\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]"; "\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]";
iconv_t cd; iconv_t cd;
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
cd = iconv_open ("UTF-32BE", "UTF-8"); cd = iconv_open ("UTF-32BE", "UTF-8");
ASSERT (cd != (iconv_t)(-1)); if (cd == (iconv_t)(-1))
inptr = input; result |= 4;
inbytesleft = sizeof (input) - 1; else
outptr = buf; {
outbytesleft = sizeof (buf); char buf[100];
res = iconv (cd, const char *inptr;
(ICONV_CONST char **) &inptr, &inbytesleft, size_t inbytesleft;
&outptr, &outbytesleft); char *outptr;
ASSERT (res == 0 && inbytesleft == 0); size_t outbytesleft;
ASSERT (outptr == buf + (sizeof (expected) - 1)); size_t res;
ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); inptr = input;
ASSERT (iconv_close (cd) == 0); inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 4;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 4;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 4;
else if (!(iconv_close (cd) == 0))
result |= 4;
}
} }
/* Test conversion from UTF-8 to UTF-32LE with no errors. */ /* Test conversion from UTF-8 to UTF-32LE with no errors. */
{ {
@ -161,25 +179,33 @@ int main ()
static const char expected[] = static const char expected[] =
"J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000"; "J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000";
iconv_t cd; iconv_t cd;
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
cd = iconv_open ("UTF-32LE", "UTF-8"); cd = iconv_open ("UTF-32LE", "UTF-8");
ASSERT (cd != (iconv_t)(-1)); if (cd == (iconv_t)(-1))
inptr = input; result |= 8;
inbytesleft = sizeof (input) - 1; else
outptr = buf; {
outbytesleft = sizeof (buf); char buf[100];
res = iconv (cd, const char *inptr;
(ICONV_CONST char **) &inptr, &inbytesleft, size_t inbytesleft;
&outptr, &outbytesleft); char *outptr;
ASSERT (res == 0 && inbytesleft == 0); size_t outbytesleft;
ASSERT (outptr == buf + (sizeof (expected) - 1)); size_t res;
ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); inptr = input;
ASSERT (iconv_close (cd) == 0); inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 8;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 8;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 8;
else if ((iconv_close (cd) == 0))
result |= 8;
}
} }
/* Test conversion from UTF-16BE to UTF-8 with no errors. /* Test conversion from UTF-16BE to UTF-8 with no errors.
This test fails on NetBSD 3.0. */ This test fails on NetBSD 3.0. */
@ -189,27 +215,35 @@ int main ()
static const char expected[] = static const char expected[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]"; "Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
iconv_t cd; iconv_t cd;
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
cd = iconv_open ("UTF-8", "UTF-16BE"); cd = iconv_open ("UTF-8", "UTF-16BE");
ASSERT (cd != (iconv_t)(-1)); if (cd == (iconv_t)(-1))
inptr = input; result |= 16;
inbytesleft = sizeof (input) - 1; else
outptr = buf; {
outbytesleft = sizeof (buf); char buf[100];
res = iconv (cd, const char *inptr;
(ICONV_CONST char **) &inptr, &inbytesleft, size_t inbytesleft;
&outptr, &outbytesleft); char *outptr;
ASSERT (res == 0 && inbytesleft == 0); size_t outbytesleft;
ASSERT (outptr == buf + (sizeof (expected) - 1)); size_t res;
ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); inptr = input;
ASSERT (iconv_close (cd) == 0); inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 16;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 16;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 16;
else if (!(iconv_close (cd) == 0))
result |= 16;
}
} }
return 0; return result;
}]])], }]])],
[gl_cv_func_iconv_supports_utf=yes], [gl_cv_func_iconv_supports_utf=yes],
[gl_cv_func_iconv_supports_utf=no], [gl_cv_func_iconv_supports_utf=no],

View file

@ -1,4 +1,4 @@
# include_next.m4 serial 15 # include_next.m4 serial 16
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -24,6 +24,13 @@ 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 __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 effect; we are therefore careful to use 'defined __STDC__' or '1' instead
dnl of plain '__STDC__'. dnl of plain '__STDC__'.
dnl
dnl PRAGMA_COLUMNS can be used in files that override system header files, so
dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
dnl has the effect of truncating the lines of that file and all files that it
dnl includes to 80 columns) and the gnulib file has lines longer than 80
dnl columns.
AC_DEFUN([gl_INCLUDE_NEXT], AC_DEFUN([gl_INCLUDE_NEXT],
[ [
@ -98,6 +105,24 @@ dnl We intentionally avoid using AC_LANG_SOURCE here.
AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT])
AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
AC_SUBST([PRAGMA_SYSTEM_HEADER]) AC_SUBST([PRAGMA_SYSTEM_HEADER])
AC_CACHE_CHECK([whether system header files limit the line length],
[gl_cv_pragma_columns],
[dnl HP NonStop systems, which define __TANDEM, have this misfeature.
AC_EGREP_CPP([choke me],
[
#ifdef __TANDEM
choke me
#endif
],
[gl_cv_pragma_columns=yes],
[gl_cv_pragma_columns=no])
])
if test $gl_cv_pragma_columns = yes; then
PRAGMA_COLUMNS="#pragma COLUMNS 10000"
else
PRAGMA_COLUMNS=
fi
AC_SUBST([PRAGMA_COLUMNS])
]) ])
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)

View file

@ -1,4 +1,4 @@
# isnanf.m4 serial 11 # isnanf.m4 serial 12
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -150,13 +150,13 @@ NaN ()
typedef union { unsigned int word[NWORDS]; float value; } memory_float; typedef union { unsigned int word[NWORDS]; float value; } memory_float;
int main() int main()
{ {
memory_float m; int result = 0;
if (isnanf (1.0f / 0.0f)) if (isnanf (1.0f / 0.0f))
return 1; result |= 1;
if (!isnanf (NaN ())) if (!isnanf (NaN ()))
return 1; result |= 2;
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT #if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
/* The isnanf function should be immune against changes in the sign bit and /* The isnanf function should be immune against changes in the sign bit and
@ -164,16 +164,18 @@ int main()
a sign bit or a mantissa bit. */ a sign bit or a mantissa bit. */
if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0)
{ {
memory_float m;
m.value = NaN (); m.value = NaN ();
/* Set the bits below the exponent to 01111...111. */ /* Set the bits below the exponent to 01111...111. */
m.word[0] &= -1U << FLT_EXPBIT0_BIT; m.word[0] &= -1U << FLT_EXPBIT0_BIT;
m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1;
if (!isnanf (m.value)) if (!isnanf (m.value))
return 1; result |= 4;
} }
#endif #endif
return 0; return result;
}]])], }]])],
[gl_cv_func_isnanf_works=yes], [gl_cv_func_isnanf_works=yes],
[gl_cv_func_isnanf_works=no], [gl_cv_func_isnanf_works=no],

View file

@ -1,4 +1,4 @@
# isnanl.m4 serial 13 # isnanl.m4 serial 14
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -151,22 +151,26 @@ static long double NaNl ()
#endif #endif
int main () int main ()
{ {
memory_long_double m; int result = 0;
unsigned int i;
if (!isnanl (NaNl ())) if (!isnanl (NaNl ()))
return 1; result |= 1;
/* The isnanl function should be immune against changes in the sign bit and {
in the mantissa bits. The xor operation twiddles a bit that can only be memory_long_double m;
a sign bit or a mantissa bit (since the exponent never extends to unsigned int i;
bit 31). */
m.value = NaNl (); /* The isnanl function should be immune against changes in the sign bit and
m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); in the mantissa bits. The xor operation twiddles a bit that can only be
for (i = 0; i < NWORDS; i++) a sign bit or a mantissa bit (since the exponent never extends to
m.word[i] |= 1; bit 31). */
if (!isnanl (m.value)) m.value = NaNl ();
return 1; m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
for (i = 0; i < NWORDS; i++)
m.word[i] |= 1;
if (!isnanl (m.value))
result |= 1;
}
#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
/* Representation of an 80-bit 'long double' as an initializer for a sequence /* Representation of an 80-bit 'long double' as an initializer for a sequence
@ -185,14 +189,14 @@ int main ()
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 2;
} }
{ {
/* Signalling NaN. */ /* Signalling NaN. */
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 2;
} }
/* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities,
Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in
@ -205,35 +209,35 @@ int main ()
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 4;
} }
{ /* Pseudo-Infinity. */ { /* Pseudo-Infinity. */
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 8;
} }
{ /* Pseudo-Zero. */ { /* Pseudo-Zero. */
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 16;
} }
{ /* Unnormalized number. */ { /* Unnormalized number. */
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 32;
} }
{ /* Pseudo-Denormal. */ { /* Pseudo-Denormal. */
static memory_long_double x = static memory_long_double x =
{ LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
if (!isnanl (x.value)) if (!isnanl (x.value))
return 1; result |= 64;
} }
#endif #endif
return 0; return result;
}]])], }]])],
[gl_cv_func_isnanl_works=yes], [gl_cv_func_isnanl_works=yes],
[gl_cv_func_isnanl_works=no], [gl_cv_func_isnanl_works=no],

View file

@ -1,4 +1,4 @@
# locale-fr.m4 serial 11 # locale-fr.m4 serial 12
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -31,11 +31,14 @@ int main () {
is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 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() On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation, succeeds but then nl_langinfo(CODESET) is "646". In this situation,
some unit tests fail. */ some unit tests fail.
On MirBSD 10, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET #if HAVE_LANGINFO_CODESET
{ {
const char *cs = nl_langinfo (CODESET); const char *cs = nl_langinfo (CODESET);
if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
|| strcmp (cs, "UTF-8") == 0)
return 1; return 1;
} }
#endif #endif

View file

@ -1,4 +1,4 @@
# locale-ja.m4 serial 7 # locale-ja.m4 serial 8
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -33,11 +33,14 @@ int main ()
is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 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() On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation, succeeds but then nl_langinfo(CODESET) is "646". In this situation,
some unit tests fail. */ some unit tests fail.
On MirBSD 10, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET #if HAVE_LANGINFO_CODESET
{ {
const char *cs = nl_langinfo (CODESET); const char *cs = nl_langinfo (CODESET);
if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
|| strcmp (cs, "UTF-8") == 0)
return 1; return 1;
} }
#endif #endif
@ -52,7 +55,7 @@ int main ()
if (MB_CUR_MAX == 1) if (MB_CUR_MAX == 1)
return 1; return 1;
/* Check whether in a month name, no byte in the range 0x80..0x9F occurs. /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
This excludes the UTF-8 encoding. */ This excludes the UTF-8 encoding (except on MirBSD). */
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
for (p = buf; *p != '\0'; p++) for (p = buf; *p != '\0'; p++)

View file

@ -1,4 +1,4 @@
# locale-zh.m4 serial 6 # locale-zh.m4 serial 7
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -34,11 +34,14 @@ int main ()
is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 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() On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation, succeeds but then nl_langinfo(CODESET) is "646". In this situation,
some unit tests fail. */ some unit tests fail.
On MirBSD 10, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET #if HAVE_LANGINFO_CODESET
{ {
const char *cs = nl_langinfo (CODESET); const char *cs = nl_langinfo (CODESET);
if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
|| strcmp (cs, "UTF-8") == 0)
return 1; return 1;
} }
#endif #endif
@ -49,7 +52,7 @@ int main ()
if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
#endif #endif
/* Check whether in a month name, no byte in the range 0x80..0x9F occurs. /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
This excludes the UTF-8 encoding. */ This excludes the UTF-8 encoding (except on MirBSD). */
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
for (p = buf; *p != '\0'; p++) for (p = buf; *p != '\0'; p++)

View file

@ -1,4 +1,4 @@
# serial 20 # serial 21
# Copyright (C) 1997-2001, 2003-2010 Free Software Foundation, Inc. # Copyright (C) 1997-2001, 2003-2010 Free Software Foundation, Inc.
# #
@ -26,3 +26,44 @@ AC_DEFUN([gl_FUNC_LSTAT],
HAVE_LSTAT=0 HAVE_LSTAT=0
fi fi
]) ])
# Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer
# maintained in Autoconf.
AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
[
AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
[ac_cv_func_lstat_dereferences_slashed_symlink],
[rm -f conftest.sym conftest.file
echo >conftest.file
if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT],
[[struct stat sbuf;
/* Linux will dereference the symlink and fail, as required by
POSIX. That is better in the sense that it means we will not
have to compile and use the lstat wrapper. */
return lstat ("conftest.sym/", &sbuf) == 0;
]])],
[ac_cv_func_lstat_dereferences_slashed_symlink=yes],
[ac_cv_func_lstat_dereferences_slashed_symlink=no],
[# When cross-compiling, be pessimistic so we will end up using the
# replacement version of lstat that checks for trailing slashes and
# calls lstat a second time when necessary.
ac_cv_func_lstat_dereferences_slashed_symlink=no
])
else
# If the 'ln -s' command failed, then we probably don't even
# have an lstat function.
ac_cv_func_lstat_dereferences_slashed_symlink=no
fi
rm -f conftest.sym conftest.file
])
test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
[Define to 1 if `lstat' dereferences a symlink specified
with a trailing slash.])
if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
AC_LIBOBJ([lstat])
fi
])

View file

@ -1,4 +1,4 @@
# mbrlen.m4 serial 3 # mbrlen.m4 serial 4
dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -110,6 +110,7 @@ changequote([,])dnl
#include <wchar.h> #include <wchar.h>
int main () int main ()
{ {
int result = 0;
/* This fails on Solaris. */ /* This fails on Solaris. */
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{ {
@ -121,7 +122,7 @@ int main ()
{ {
input[1] = '\0'; input[1] = '\0';
if (mbrlen (input + 2, 5, &state) != 1) if (mbrlen (input + 2, 5, &state) != 1)
return 1; result |= 1;
} }
} }
/* This fails on HP-UX 11.11. */ /* This fails on HP-UX 11.11. */
@ -135,10 +136,10 @@ int main ()
{ {
input[1] = '\0'; input[1] = '\0';
if (mbrlen (input + 2, 5, &state) != 2) if (mbrlen (input + 2, 5, &state) != 2)
return 1; result |= 2;
} }
} }
return 0; return result;
}]])], }]])],
[gl_cv_func_mbrlen_retval=yes], [gl_cv_func_mbrlen_retval=yes],
[gl_cv_func_mbrlen_retval=no], [gl_cv_func_mbrlen_retval=no],

View file

@ -1,4 +1,4 @@
# mbrtowc.m4 serial 18 # mbrtowc.m4 serial 19
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation,
dnl Inc. dnl Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
@ -271,6 +271,7 @@ changequote([,])dnl
#include <wchar.h> #include <wchar.h>
int main () int main ()
{ {
int result = 0;
/* This fails on Solaris. */ /* This fails on Solaris. */
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{ {
@ -283,7 +284,7 @@ int main ()
{ {
input[1] = '\0'; input[1] = '\0';
if (mbrtowc (&wc, input + 2, 5, &state) != 1) if (mbrtowc (&wc, input + 2, 5, &state) != 1)
return 1; result |= 1;
} }
} }
/* This fails on HP-UX 11.11. */ /* This fails on HP-UX 11.11. */
@ -298,10 +299,10 @@ int main ()
{ {
input[1] = '\0'; input[1] = '\0';
if (mbrtowc (&wc, input + 2, 5, &state) != 2) if (mbrtowc (&wc, input + 2, 5, &state) != 2)
return 1; result |= 2;
} }
} }
return 0; return result;
}]])], }]])],
[gl_cv_func_mbrtowc_retval=yes], [gl_cv_func_mbrtowc_retval=yes],
[gl_cv_func_mbrtowc_retval=no], [gl_cv_func_mbrtowc_retval=no],

View file

@ -1,4 +1,4 @@
# memchr.m4 serial 8 # memchr.m4 serial 10
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -35,6 +35,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
# endif # endif
#endif #endif
]], [[ ]], [[
int result = 0;
char *fence = NULL; char *fence = NULL;
#if HAVE_SYS_MMAN_H && HAVE_MPROTECT #if HAVE_SYS_MMAN_H && HAVE_MPROTECT
# if HAVE_MAP_ANONYMOUS # if HAVE_MAP_ANONYMOUS
@ -58,12 +59,14 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
if (fence) if (fence)
{ {
if (memchr (fence, 0, 0)) if (memchr (fence, 0, 0))
return 1; result |= 1;
strcpy (fence - 9, "12345678"); strcpy (fence - 9, "12345678");
if (memchr (fence - 9, 0, 79) != fence - 1) if (memchr (fence - 9, 0, 79) != fence - 1)
return 2; result |= 2;
if (memchr (fence - 1, 0, 3) != fence - 1)
result |= 4;
} }
return 0; return result;
]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
[dnl Be pessimistic for now. [dnl Be pessimistic for now.
gl_cv_func_memchr_works="guessing no"])]) gl_cv_func_memchr_works="guessing no"])])

View file

@ -1,4 +1,4 @@
# mmap-anon.m4 serial 8 # mmap-anon.m4 serial 9
dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -15,10 +15,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_MMAP_ANON], AC_DEFUN([gl_FUNC_MMAP_ANON],
[ [
dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
AC_REQUIRE([AC_PROG_CPP])
AC_REQUIRE([AC_PROG_EGREP])
dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])

53
m4/nproc.m4 Normal file
View file

@ -0,0 +1,53 @@
# nproc.m4 serial 4
dnl Copyright (C) 2009, 2010 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_NPROC],
[
gl_PREREQ_NPROC
])
# Prerequisites of lib/nproc.c.
AC_DEFUN([gl_PREREQ_NPROC],
[
dnl Persuade glibc <sched.h> to declare CPU_SETSIZE, CPU_ISSET etc.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/param.h],,,
[AC_INCLUDES_DEFAULT])
dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
AC_CHECK_HEADERS([sys/sysctl.h],,,
[AC_INCLUDES_DEFAULT
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
AC_CHECK_FUNCS([sched_getaffinity sched_getaffinity_np \
pstat_getdynamic sysmp sysctl])
dnl Test whether sched_getaffinity has the expected declaration.
dnl glibc 2.3.[0-2]:
dnl int sched_getaffinity (pid_t, unsigned int, unsigned long int *);
dnl glibc 2.3.3:
dnl int sched_getaffinity (pid_t, cpu_set_t *);
dnl glibc >= 2.3.4:
dnl int sched_getaffinity (pid_t, size_t, cpu_set_t *);
if test $ac_cv_func_sched_getaffinity = yes; then
AC_CACHE_CHECK([for glibc compatible sched_getaffinity],
[gl_cv_func_sched_getaffinity3],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sched.h>]],
[[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
[gl_cv_func_sched_getaffinity3=yes],
[gl_cv_func_sched_getaffinity3=no])
])
if test $gl_cv_func_sched_getaffinity3 = yes; then
AC_DEFINE([HAVE_SCHED_GETAFFINITY_LIKE_GLIBC], [1],
[Define to 1 if sched_getaffinity has a glibc compatible declaration.])
fi
fi
])

View file

@ -1,4 +1,4 @@
# printf.m4 serial 35 # printf.m4 serial 40
dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -32,25 +32,26 @@ AC_DEFUN([gl_PRINTF_SIZES_C99],
static char buf[100]; static char buf[100];
int main () int main ()
{ {
int result = 0;
#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
|| strcmp (buf, "12345671 33") != 0) || strcmp (buf, "12345671 33") != 0)
return 1; result |= 1;
#endif #endif
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
|| strcmp (buf, "12345672 33") != 0) || strcmp (buf, "12345672 33") != 0)
return 1; result |= 2;
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
|| strcmp (buf, "12345673 33") != 0) || strcmp (buf, "12345673 33") != 0)
return 1; result |= 4;
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
|| strcmp (buf, "1.5 33") != 0) || strcmp (buf, "1.5 33") != 0)
return 1; result |= 8;
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=yes],
[gl_cv_func_printf_sizes_c99=no], [gl_cv_func_printf_sizes_c99=no],
@ -102,19 +103,20 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
static char buf[10000]; static char buf[10000];
int main () int main ()
{ {
int result = 0;
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
|| strcmp (buf, "1.750000 33") != 0) || strcmp (buf, "1.750000 33") != 0)
return 1; result |= 1;
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
|| strcmp (buf, "1.750000e+00 33") != 0) || strcmp (buf, "1.750000e+00 33") != 0)
return 1; result |= 2;
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
|| strcmp (buf, "1.75 33") != 0) || strcmp (buf, "1.75 33") != 0)
return 1; result |= 4;
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=yes],
[gl_cv_func_printf_long_double=no], [gl_cv_func_printf_long_double=no],
@ -175,39 +177,40 @@ static char buf[10000];
static double zero = 0.0; static double zero = 0.0;
int main () int main ()
{ {
int result = 0;
if (sprintf (buf, "%f", 1.0 / 0.0) < 0 if (sprintf (buf, "%f", 1.0 / 0.0) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%f", -1.0 / 0.0) < 0 if (sprintf (buf, "%f", -1.0 / 0.0) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%f", zero / zero) < 0 if (sprintf (buf, "%f", zero / zero) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
if (sprintf (buf, "%e", 1.0 / 0.0) < 0 if (sprintf (buf, "%e", 1.0 / 0.0) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 4;
if (sprintf (buf, "%e", -1.0 / 0.0) < 0 if (sprintf (buf, "%e", -1.0 / 0.0) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 4;
if (sprintf (buf, "%e", zero / zero) < 0 if (sprintf (buf, "%e", zero / zero) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 8;
if (sprintf (buf, "%g", 1.0 / 0.0) < 0 if (sprintf (buf, "%g", 1.0 / 0.0) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 16;
if (sprintf (buf, "%g", -1.0 / 0.0) < 0 if (sprintf (buf, "%g", -1.0 / 0.0) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 16;
if (sprintf (buf, "%g", zero / zero) < 0 if (sprintf (buf, "%g", zero / zero) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 32;
/* This test fails on HP-UX 10.20. */ /* This test fails on HP-UX 10.20. */
if (have_minus_zero ()) if (have_minus_zero ())
if (sprintf (buf, "%g", - zero) < 0 if (sprintf (buf, "%g", - zero) < 0
|| strcmp (buf, "-0") != 0) || strcmp (buf, "-0") != 0)
return 1; result |= 64;
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=yes],
[gl_cv_func_printf_infinite=no], [gl_cv_func_printf_infinite=no],
@ -289,34 +292,35 @@ static char buf[10000];
static long double zeroL = 0.0L; static long double zeroL = 0.0L;
int main () int main ()
{ {
int result = 0;
nocrash_init(); nocrash_init();
if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 1;
if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Le", zeroL / zeroL) < 0 if (sprintf (buf, "%Le", zeroL / zeroL) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 1;
if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
return 1; result |= 1;
if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 1;
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) #if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
/* Representation of an 80-bit 'long double' as an initializer for a sequence /* Representation of an 80-bit 'long double' as an initializer for a sequence
of 'unsigned int' words. */ of 'unsigned int' words. */
@ -335,13 +339,13 @@ int main ()
{ LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
} }
{ {
/* Signalling NaN. */ /* Signalling NaN. */
@ -349,81 +353,81 @@ int main ()
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 2;
} }
{ /* Pseudo-NaN. */ { /* Pseudo-NaN. */
static union { unsigned int word[4]; long double value; } x = static union { unsigned int word[4]; long double value; } x =
{ LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 4;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 4;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 4;
} }
{ /* Pseudo-Infinity. */ { /* Pseudo-Infinity. */
static union { unsigned int word[4]; long double value; } x = static union { unsigned int word[4]; long double value; } x =
{ LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 8;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 8;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 8;
} }
{ /* Pseudo-Zero. */ { /* Pseudo-Zero. */
static union { unsigned int word[4]; long double value; } x = static union { unsigned int word[4]; long double value; } x =
{ LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 16;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 16;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 16;
} }
{ /* Unnormalized number. */ { /* Unnormalized number. */
static union { unsigned int word[4]; long double value; } x = static union { unsigned int word[4]; long double value; } x =
{ LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 32;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 32;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 32;
} }
{ /* Pseudo-Denormal. */ { /* Pseudo-Denormal. */
static union { unsigned int word[4]; long double value; } x = static union { unsigned int word[4]; long double value; } x =
{ LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
if (sprintf (buf, "%Lf", x.value) < 0 if (sprintf (buf, "%Lf", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 64;
if (sprintf (buf, "%Le", x.value) < 0 if (sprintf (buf, "%Le", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 64;
if (sprintf (buf, "%Lg", x.value) < 0 if (sprintf (buf, "%Lg", x.value) < 0
|| !strisnan (buf, 0, strlen (buf))) || !strisnan (buf, 0, strlen (buf)))
return 1; result |= 64;
} }
#endif #endif
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_infinite_long_double=yes], [gl_cv_func_printf_infinite_long_double=yes],
[gl_cv_func_printf_infinite_long_double=no], [gl_cv_func_printf_infinite_long_double=no],
@ -439,16 +443,9 @@ changequote(,)dnl
# Guess yes on FreeBSD >= 6. # Guess yes on FreeBSD >= 6.
freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on MacOS X >= 10.3.
darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";;
darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on HP-UX >= 11. # Guess yes on HP-UX >= 11.
hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on NetBSD >= 3.
netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
gl_cv_func_printf_infinite_long_double="guessing no";;
netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# If we don't know, assume the worst. # If we don't know, assume the worst.
*) gl_cv_func_printf_infinite_long_double="guessing no";; *) gl_cv_func_printf_infinite_long_double="guessing no";;
esac esac
@ -483,37 +480,38 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
static char buf[100]; static char buf[100];
int main () int main ()
{ {
int result = 0;
if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
|| (strcmp (buf, "0x1.922p+1 33") != 0 || (strcmp (buf, "0x1.922p+1 33") != 0
&& strcmp (buf, "0x3.244p+0 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0
&& strcmp (buf, "0x6.488p-1 33") != 0 && strcmp (buf, "0x6.488p-1 33") != 0
&& strcmp (buf, "0xc.91p-2 33") != 0)) && strcmp (buf, "0xc.91p-2 33") != 0))
return 1; result |= 1;
if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
|| (strcmp (buf, "-0X1.922P+1 33") != 0 || (strcmp (buf, "-0X1.922P+1 33") != 0
&& strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X3.244P+0 33") != 0
&& strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0
&& strcmp (buf, "-0XC.91P-2 33") != 0)) && strcmp (buf, "-0XC.91P-2 33") != 0))
return 1; result |= 2;
/* This catches a FreeBSD 6.1 bug: it doesn't round. */ /* This catches a FreeBSD 6.1 bug: it doesn't round. */
if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
|| (strcmp (buf, "0x1.83p+0 33") != 0 || (strcmp (buf, "0x1.83p+0 33") != 0
&& strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0
&& strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0
&& strcmp (buf, "0xc.14p-3 33") != 0)) && strcmp (buf, "0xc.14p-3 33") != 0))
return 1; result |= 4;
/* This catches a FreeBSD 6.1 bug. See /* This catches a FreeBSD 6.1 bug. See
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
|| buf[0] == '0') || buf[0] == '0')
return 1; result |= 8;
/* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */
if (sprintf (buf, "%.1a", 1.999) < 0 if (sprintf (buf, "%.1a", 1.999) < 0
|| (strcmp (buf, "0x1.0p+1") != 0 || (strcmp (buf, "0x1.0p+1") != 0
&& strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x2.0p+0") != 0
&& strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x4.0p-1") != 0
&& strcmp (buf, "0x8.0p-2") != 0)) && strcmp (buf, "0x8.0p-2") != 0))
return 1; result |= 16;
/* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a
glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
if (sprintf (buf, "%.1La", 1.999L) < 0 if (sprintf (buf, "%.1La", 1.999L) < 0
@ -521,8 +519,8 @@ int main ()
&& strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x2.0p+0") != 0
&& strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x4.0p-1") != 0
&& strcmp (buf, "0x8.0p-2") != 0)) && strcmp (buf, "0x8.0p-2") != 0))
return 1; result |= 32;
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=yes],
[gl_cv_func_printf_directive_a=no], [gl_cv_func_printf_directive_a=no],
@ -533,7 +531,7 @@ int main ()
AC_EGREP_CPP([BZ2908], [ AC_EGREP_CPP([BZ2908], [
#include <features.h> #include <features.h>
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__
BZ2908 BZ2908
#endif #endif
#endif #endif
@ -566,17 +564,18 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
static char buf[100]; static char buf[100];
int main () int main ()
{ {
int result = 0;
if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
|| strcmp (buf, "1234567.000000 33") != 0) || strcmp (buf, "1234567.000000 33") != 0)
return 1; result |= 1;
if (sprintf (buf, "%F", 1.0 / 0.0) < 0 if (sprintf (buf, "%F", 1.0 / 0.0) < 0
|| (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
return 1; result |= 2;
/* This catches a Cygwin 1.5.x bug. */ /* This catches a Cygwin 1.5.x bug. */
if (sprintf (buf, "%.F", 1234.0) < 0 if (sprintf (buf, "%.F", 1234.0) < 0
|| strcmp (buf, "1234") != 0) || strcmp (buf, "1234") != 0)
return 1; result |= 4;
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=yes],
[gl_cv_func_printf_directive_f=no], [gl_cv_func_printf_directive_f=no],
@ -671,6 +670,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
#include <string.h> #include <string.h>
int main () int main ()
{ {
int result = 0;
char buf[100]; char buf[100];
/* Test whether %ls works at all. /* Test whether %ls works at all.
This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on
@ -680,7 +680,7 @@ int main ()
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%ls", wstring) < 0 if (sprintf (buf, "%ls", wstring) < 0
|| strcmp (buf, "abc") != 0) || strcmp (buf, "abc") != 0)
return 1; result |= 1;
} }
/* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an
assertion failure inside libc), but not on OpenBSD 4.0. */ assertion failure inside libc), but not on OpenBSD 4.0. */
@ -689,7 +689,7 @@ int main ()
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%ls", wstring) < 0 if (sprintf (buf, "%ls", wstring) < 0
|| strcmp (buf, "a") != 0) || strcmp (buf, "a") != 0)
return 1; result |= 2;
} }
/* Test whether precisions in %ls are supported as specified in ISO C 99 /* Test whether precisions in %ls are supported as specified in ISO C 99
section 7.19.6.1: section 7.19.6.1:
@ -704,9 +704,9 @@ int main ()
buf[0] = '\0'; buf[0] = '\0';
if (sprintf (buf, "%.2ls", wstring) < 0 if (sprintf (buf, "%.2ls", wstring) < 0
|| strcmp (buf, "ab") != 0) || strcmp (buf, "ab") != 0)
return 1; result |= 8;
} }
return 0; return result;
}]])], }]])],
[gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=yes],
[gl_cv_func_printf_directive_ls=no], [gl_cv_func_printf_directive_ls=no],
@ -889,8 +889,9 @@ changequote([,])dnl
dnl Test whether the *printf family of functions supports large precisions. dnl Test whether the *printf family of functions supports large precisions.
dnl On mingw, precisions larger than 512 are treated like 512, in integer, dnl On mingw, precisions larger than 512 are treated like 512, in integer,
dnl floating-point or pointer output. On BeOS, precisions larger than 1044 dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
dnl crash the program. dnl than 510 in floating-point output crash the program. On BeOS, precisions
dnl larger than 1044 crash the program.
dnl Result is gl_cv_func_printf_precision. dnl Result is gl_cv_func_printf_precision.
AC_DEFUN([gl_PRINTF_PRECISION], AC_DEFUN([gl_PRINTF_PRECISION],
@ -907,20 +908,24 @@ AC_DEFUN([gl_PRINTF_PRECISION],
static char buf[5000]; static char buf[5000];
int main () int main ()
{ {
int result = 0;
#ifdef __BEOS__ #ifdef __BEOS__
/* On BeOS, this would crash and show a dialog box. Avoid the crash. */ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */
return 1; return 1;
#endif #endif
if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
return 1; result |= 1;
return 0; if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
result |= 2;
return result;
}]])], }]])],
[gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=yes],
[gl_cv_func_printf_precision=no], [gl_cv_func_printf_precision=no],
[ [
changequote(,)dnl changequote(,)dnl
case "$host_os" in case "$host_os" in
# Guess no only on native Win32 and BeOS systems. # Guess no only on Solaris, native Win32, and BeOS systems.
solaris*) gl_cv_func_printf_precision="guessing no" ;;
mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
beos*) gl_cv_func_printf_precision="guessing no" ;; beos*) gl_cv_func_printf_precision="guessing no" ;;
*) gl_cv_func_printf_precision="guessing yes" ;; *) gl_cv_func_printf_precision="guessing yes" ;;
@ -1439,12 +1444,14 @@ dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
dnl MacOS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
dnl Solaris 10 . . # # # . . # . . . # . . . . . . . . dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . .
dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . .
dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . . dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . .
@ -1455,6 +1462,7 @@ dnl HP-UX 10.20 # . # . # # . ? . . # # . . .
dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
dnl Haiku . . . # # # . # . . . . . ? . . . . . . dnl Haiku . . . # # # . # . . . . . ? . . . . . .

View file

@ -1,4 +1,4 @@
# putenv.m4 serial 16 # putenv.m4 serial 17
dnl Copyright (C) 2002-2010 Free Software Foundation, Inc. dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -21,11 +21,11 @@ AC_DEFUN([gl_FUNC_PUTENV],
/* Try to remove it. */ /* Try to remove it. */
if (putenv ("CONFTEST_putenv")) if (putenv ("CONFTEST_putenv"))
return 1; return 2;
/* Make sure it was deleted. */ /* Make sure it was deleted. */
if (getenv ("CONFTEST_putenv") != 0) if (getenv ("CONFTEST_putenv") != 0)
return 1; return 3;
return 0; return 0;
]])], ]])],

86
m4/socketlib.m4 Normal file
View file

@ -0,0 +1,86 @@
# socketlib.m4 serial 1
dnl Copyright (C) 2008-2010 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 gl_SOCKETLIB
dnl Determines the library to use for socket functions.
dnl Sets and AC_SUBSTs LIBSOCKET.
AC_DEFUN([gl_SOCKETLIB],
[
gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
LIBSOCKET=
if test $HAVE_WINSOCK2_H = 1; then
dnl Native Windows API (not Cygwin).
AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
[gl_cv_func_wsastartup], [
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif]], [[
WORD wVersionRequested = MAKEWORD(1, 1);
WSADATA wsaData;
int err = WSAStartup(wVersionRequested, &wsaData);
WSACleanup ();]])],
gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
LIBS="$gl_save_LIBS"
])
if test "$gl_cv_func_wsastartup" = "yes"; then
AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
LIBSOCKET='-lws2_32'
fi
else
dnl Unix API.
dnl Solaris has most socket functions in libsocket.
dnl Haiku has most socket functions in libnetwork.
dnl BeOS has most socket functions in libnet.
AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
gl_cv_lib_socket=
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
#ifdef __cplusplus
"C"
#endif
char setsockopt();]], [[setsockopt();]])],
[],
[gl_save_LIBS="$LIBS"
LIBS="$gl_save_LIBS -lsocket"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
#ifdef __cplusplus
"C"
#endif
char setsockopt();]], [[setsockopt();]])],
[gl_cv_lib_socket="-lsocket"])
if test -z "$gl_cv_lib_socket"; then
LIBS="$gl_save_LIBS -lnetwork"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
#ifdef __cplusplus
"C"
#endif
char setsockopt();]], [[setsockopt();]])],
[gl_cv_lib_socket="-lnetwork"])
if test -z "$gl_cv_lib_socket"; then
LIBS="$gl_save_LIBS -lnet"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
#ifdef __cplusplus
"C"
#endif
char setsockopt();]], [[setsockopt();]])],
[gl_cv_lib_socket="-lnet"])
fi
fi
LIBS="$gl_save_LIBS"
])
if test -z "$gl_cv_lib_socket"; then
gl_cv_lib_socket="none needed"
fi
])
if test "$gl_cv_lib_socket" != "none needed"; then
LIBSOCKET="$gl_cv_lib_socket"
fi
fi
AC_SUBST([LIBSOCKET])
])

17
m4/sockets.m4 Normal file
View file

@ -0,0 +1,17 @@
# sockets.m4 serial 7
dnl Copyright (C) 2008, 2009, 2010 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_SOCKETS],
[
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([gl_SOCKETLIB])
gl_PREREQ_SOCKETS
])
# Prerequisites of lib/sockets.c.
AC_DEFUN([gl_PREREQ_SOCKETS], [
:
])

View file

@ -1,4 +1,4 @@
# serial 5 # serial 6
# Copyright (C) 2009, 2010 Free Software Foundation, Inc. # Copyright (C) 2009, 2010 Free Software Foundation, Inc.
# #
@ -36,11 +36,15 @@ AC_DEFUN([gl_FUNC_STAT],
AC_RUN_IFELSE( AC_RUN_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(
[[#include <sys/stat.h> [[#include <sys/stat.h>
]], [[struct stat st; ]], [[int result = 0;
if (!stat ("conftest.tmp/", &st)) return 1; struct stat st;
if (!stat ("conftest.tmp/", &st))
result |= 1;
#if HAVE_LSTAT #if HAVE_LSTAT
if (!stat ("conftest.lnk/", &st)) return 2; if (!stat ("conftest.lnk/", &st))
result |= 2;
#endif #endif
return result;
]])], ]])],
[gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
[gl_cv_func_stat_file_slash="guessing no"]) [gl_cv_func_stat_file_slash="guessing no"])

View file

@ -1,4 +1,4 @@
# stdint.m4 serial 35 # stdint.m4 serial 36
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -259,7 +259,7 @@ static const char *macro_values[] =
|| strncmp (value, "((int)"/*)*/, 6) == 0 || strncmp (value, "((int)"/*)*/, 6) == 0
|| strncmp (value, "((signed short)"/*)*/, 15) == 0 || strncmp (value, "((signed short)"/*)*/, 15) == 0
|| strncmp (value, "((signed char)"/*)*/, 14) == 0) || strncmp (value, "((signed char)"/*)*/, 14) == 0)
return 1; return mv - macro_values + 1;
} }
return 0; return 0;
]])], ]])],

View file

@ -1,4 +1,4 @@
# stdlib_h.m4 serial 30 # stdlib_h.m4 serial 31
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -73,6 +73,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise. dnl Assume proper GNU behavior unless another module says otherwise.

View file

@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 17 # serial 18
# Written by Paul Eggert. # Written by Paul Eggert.
@ -28,8 +28,8 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
gl_WARN_ON_USE_PREPARE([[#include <string.h> gl_WARN_ON_USE_PREPARE([[#include <string.h>
]], ]],
[memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r
strverscmp]) strsignal strverscmp])
]) ])
AC_DEFUN([gl_STRING_MODULE_INDICATOR], AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@ -75,6 +75,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
@ -94,6 +95,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
@ -103,6 +105,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])

View file

@ -1,4 +1,4 @@
# sys_socket_h.m4 serial 17 # sys_socket_h.m4 serial 20
dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -57,6 +57,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
if test $ac_cv_type_sa_family_t = no; then if test $ac_cv_type_sa_family_t = no; then
HAVE_SA_FAMILY_T=0 HAVE_SA_FAMILY_T=0
fi fi
if test $ac_cv_type_struct_sockaddr_storage != no; then
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
[],
[HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
fi
if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
|| test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
SYS_SOCKET_H='sys/socket.h'
fi
gl_PREREQ_SYS_H_WINSOCK2 gl_PREREQ_SYS_H_WINSOCK2
dnl Check for declarations of anything we want to poison if the dnl Check for declarations of anything we want to poison if the
@ -64,10 +81,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
gl_WARN_ON_USE_PREPARE([[ gl_WARN_ON_USE_PREPARE([[
/* Some systems require prerequisite headers. */ /* Some systems require prerequisite headers. */
#include <sys/types.h> #include <sys/types.h>
#if !defined __GLIBC__ && HAVE_SYS_TIME_H #include <sys/socket.h>
# include <sys/time.h>
#endif
#include <sys/select.h>
]], [socket connect accept bind getpeername getsockname getsockopt ]], [socket connect accept bind getpeername getsockname getsockopt
listen recv send recvfrom sendto setsockopt shutdown accept4]) listen recv send recvfrom sendto setsockopt shutdown accept4])
]) ])
@ -148,6 +162,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
]) ])

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 46 # unistd_h.m4 serial 48
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -27,7 +27,7 @@ AC_DEFUN([gl_UNISTD_H],
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <unistd.h> gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
/* Some systems declare various items in the wrong headers. */ /* Some systems declare various items in the wrong headers. */
#ifndef __GLIBC__ #if !(defined __GLIBC__ && !defined __UCLIBC__)
# include <fcntl.h> # include <fcntl.h>
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
@ -104,7 +104,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) 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_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
@ -125,6 +124,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
@ -136,6 +136,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])

View file

@ -1,4 +1,4 @@
# vasnprintf.m4 serial 31 # vasnprintf.m4 serial 32
dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc. dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -40,6 +40,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
# Prequisites of lib/printf-parse.h, lib/printf-parse.c. # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
AC_DEFUN([gl_PREREQ_PRINTF_PARSE], AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
[ [
AC_REQUIRE([gl_FEATURES_H])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([gt_TYPE_WINT_T])

View file

@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake. dnl Written by Eric Blake.
# wchar_h.m4 serial 33 # wchar_h.m4 serial 35
AC_DEFUN([gl_WCHAR_H], AC_DEFUN([gl_WCHAR_H],
[ [
@ -26,6 +26,8 @@ AC_DEFUN([gl_WCHAR_H],
fi fi
AC_SUBST([HAVE_WCHAR_H]) AC_SUBST([HAVE_WCHAR_H])
AC_REQUIRE([gl_FEATURES_H])
AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([gt_TYPE_WINT_T])
if test $gt_cv_c_wint_t = yes; then if test $gt_cv_c_wint_t = yes; then
HAVE_WINT_T=1 HAVE_WINT_T=1
@ -38,7 +40,7 @@ AC_DEFUN([gl_WCHAR_H],
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[ gl_WARN_ON_USE_PREPARE([[
/* Some systems require additional headers. */ /* Some systems require additional headers. */
#ifndef __GLIBC__ #if !(defined __GLIBC__ && !defined __UCLIBC__)
# include <stddef.h> # include <stddef.h>
# include <stdio.h> # include <stdio.h>
# include <time.h> # include <time.h>

View file

@ -590,10 +590,19 @@ sc_changelog:
sc_program_name: sc_program_name:
@require='set_program_name *\(m?argv\[0\]\);' \ @require='set_program_name *\(m?argv\[0\]\);' \
in_vc_files='\.c$$' \ in_vc_files='\.c$$' \
containing='^main *(' \ containing='\<main *(' \
halt='the above files do not call set_program_name' \ halt='the above files do not call set_program_name' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Ensure that each .c file containing a "main" function also
# calls bindtextdomain.
sc_bindtextdomain:
@require='bindtextdomain *\(' \
in_vc_files='\.c$$' \
containing='\<main *(' \
halt='the above files do not call bindtextdomain' \
$(_sc_search_regexp)
# Require that the final line of each test-lib.sh-using test be this one: # Require that the final line of each test-lib.sh-using test be this one:
# Exit $fail # Exit $fail
# Note: this test requires GNU grep's --label= option. # Note: this test requires GNU grep's --label= option.
@ -668,8 +677,9 @@ sc_prohibit_always_true_header_tests:
@or=$(gl_header_upper_case_or_); \ @or=$(gl_header_upper_case_or_); \
re="HAVE_($$or)_H"; \ re="HAVE_($$or)_H"; \
prohibit='\<'"$$re"'\>' \ prohibit='\<'"$$re"'\>' \
halt='do not test the above HAVE_<header>_H symbol(s);\n'\ halt=$$(printf '%s\n' \
' with the corresponding gnulib module, they are always true' \ 'do not test the above HAVE_<header>_H symbol(s);' \
' with the corresponding gnulib module, they are always true') \
$(_sc_search_regexp) $(_sc_search_regexp)
# ================================================================== # ==================================================================
@ -731,7 +741,8 @@ sc_GFDL_version:
halt='GFDL vN, N!=3' \ halt='GFDL vN, N!=3' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Don't use Texinfo @acronym{} as it is not a good idea. # Don't use Texinfo's @acronym{}.
# http://lists.gnu.org/archive/html/bug-gnulib/2010-03/msg00321.html
texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$ texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
sc_texinfo_acronym: sc_texinfo_acronym:
@prohibit='@acronym\{' \ @prohibit='@acronym\{' \
@ -807,6 +818,13 @@ sc_prohibit_test_minus_ao:
halt='$(_ptm1); $(_ptm2)' \ halt='$(_ptm1); $(_ptm2)' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Avoid a test bashism.
sc_prohibit_test_double_equal:
@prohibit='(\<test| \[+) .+ == ' \
containing='#! */bin/[a-z]*sh' \
halt='use "test x = x", not "test x =''= x"' \
$(_sc_search_regexp)
# Each program that uses proper_name_utf8 must link with one of the # Each program that uses proper_name_utf8 must link with one of the
# ICONV libraries. Otherwise, some ICONV library must appear in LDADD. # ICONV libraries. Otherwise, some ICONV library must appear in LDADD.
# The perl -0777 invocation below extracts the possibly-multi-line # The perl -0777 invocation below extracts the possibly-multi-line
@ -1012,9 +1030,10 @@ sc_Wundef_boolean:
sc_vulnerable_makefile_CVE-2009-4029: sc_vulnerable_makefile_CVE-2009-4029:
@prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \ @prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
in_files=$$(find $(srcdir) -name Makefile.in) \ in_files=$$(find $(srcdir) -name Makefile.in) \
halt='the above files are vulnerable; beware of running\n'\ halt=$$(printf '%s\n' \
'"make dist*" rules, and upgrade to fixed automake\n'\ 'the above files are vulnerable; beware of running' \
'see http://bugzilla.redhat.com/542609 for details' \ ' "make dist*" rules, and upgrade to fixed automake' \
' see http://bugzilla.redhat.com/542609 for details') \
$(_sc_search_regexp) $(_sc_search_regexp)
vc-diff-check: vc-diff-check:
@ -1079,7 +1098,6 @@ emit_upload_commands:
@echo ===================================== @echo =====================================
@echo ===================================== @echo =====================================
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
define emit-commit-log define emit-commit-log
printf '%s\n' 'post-release administrivia' '' \ printf '%s\n' 'post-release administrivia' '' \
'* NEWS: Add header line for next release.' \ '* NEWS: Add header line for next release.' \
@ -1117,6 +1135,7 @@ alpha beta stable: $(local-check) writable-files no-submodule-changes
# Override this in cfg.mk if you follow different procedures. # Override this in cfg.mk if you follow different procedures.
release-prep-hook ?= release-prep release-prep-hook ?= release-prep
gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
.PHONY: release-prep .PHONY: release-prep
release-prep: release-prep:
case $$RELEASE_TYPE in alpha|beta|stable) ;; \ case $$RELEASE_TYPE in alpha|beta|stable) ;; \
@ -1128,7 +1147,7 @@ release-prep:
fi fi
echo $(VERSION) > $(prev_version_file) echo $(VERSION) > $(prev_version_file)
$(MAKE) update-NEWS-hash $(MAKE) update-NEWS-hash
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS perl -pi -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' NEWS
$(emit-commit-log) > .ci-msg $(emit-commit-log) > .ci-msg
$(VC) commit -F .ci-msg -a $(VC) commit -F .ci-msg -a
rm .ci-msg rm .ci-msg