summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2011-03-07 06:27:42 -0500
committerMark H Weaver <mhw@netris.org>2011-03-09 17:06:05 -0500
commitdd36ce77cd899c7b179026603e751e3bb47b2943 (patch)
treed2f26243f1b6bbb025dea3919ce47f7bc29993cc
parentdf1297956211b7353155c9b54d7e9c22d05ce493 (diff)
Update Gnulib; add new modules; remove `round' module.
This updates Gnulib to v0.0-4951-g6ff7b70. * m4/gnulib-cache.m4: Add floor, ceil, frexp, and ldexp. Add wchar as an explicit dependency; it had been present as an indirect dependency before, but no longer. Remove round, which I had requested earlier, but turned out to be unnecessary.
-rwxr-xr-xbuild-aux/config.rpath97
-rwxr-xr-xbuild-aux/git-version-gen31
-rw-r--r--lib/Makefile.am58
-rw-r--r--lib/ceil.c109
-rw-r--r--lib/dosname.h53
-rw-r--r--lib/flock.c34
-rw-r--r--lib/frexp.c166
-rw-r--r--lib/isnand-nolibm.h33
-rw-r--r--lib/round.c168
-rw-r--r--lib/stat.c1
-rw-r--r--lib/stdint.in.h7
-rw-r--r--lib/stdio-write.c148
-rw-r--r--lib/stdlib.in.h30
-rw-r--r--lib/vasnprintf.c6
-rw-r--r--lib/vasnprintf.h14
-rw-r--r--lib/version-etc.h8
-rw-r--r--libguile/Makefile.am4
-rw-r--r--m4/asm-underscore.m448
-rw-r--r--m4/dos.m471
-rw-r--r--m4/frexp.m4165
-rw-r--r--m4/gnulib-cache.m48
-rw-r--r--m4/gnulib-comp.m431
-rw-r--r--m4/ldexp.m454
-rw-r--r--m4/lib-link.m44
-rw-r--r--m4/longlong.m481
-rw-r--r--m4/round.m4111
-rw-r--r--m4/stat.m43
-rw-r--r--m4/stdint.m415
-rw-r--r--m4/stdio_h.m423
-rw-r--r--m4/stdlib_h.m46
-rw-r--r--maint.mk26
31 files changed, 885 insertions, 728 deletions
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 0e87769f9..8bd7f5d72 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -57,13 +57,6 @@ else
aix*)
wl='-Wl,'
;;
- darwin*)
- case $cc_basename in
- xlc*)
- wl='-Wl,'
- ;;
- esac
- ;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
@@ -72,9 +65,7 @@ else
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
- newsos6)
- ;;
- linux* | k*bsd*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
@@ -85,17 +76,26 @@ else
lf95*)
wl='-Wl,'
;;
- pgcc | pgf77 | pgf90)
+ nagfor*)
+ wl='-Wl,-Wl,,'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
+ xl* | bgxl* | bgf* | mpixl*)
+ wl='-Wl,'
+ ;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ wl=
+ ;;
*Sun\ C*)
wl='-Wl,'
;;
@@ -103,13 +103,24 @@ else
;;
esac
;;
+ newsos6)
+ ;;
+ *nto* | *qnx*)
+ ;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
- wl='-Wl,'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ wl='-Qoption ld '
+ ;;
+ *)
+ wl='-Wl,'
+ ;;
+ esac
;;
sunos4*)
wl='-Qoption ld '
@@ -171,15 +182,14 @@ if test "$with_gnu_ld" = yes; then
fi
;;
amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we cannot use
- # them.
- ld_shlibs=no
+ case "$host_cpu" in
+ powerpc)
+ ;;
+ m68k)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -198,11 +208,13 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
+ haiku*)
+ ;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
- gnu* | linux* | k*bsd*-gnu)
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
@@ -325,10 +337,14 @@ else
fi
;;
amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # see comment about different semantics on the GNU ld section
- ld_shlibs=no
+ case "$host_cpu" in
+ powerpc)
+ ;;
+ m68k)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
;;
bsdi[45]*)
;;
@@ -342,16 +358,10 @@ else
;;
darwin* | rhapsody*)
hardcode_direct=no
- if test "$GCC" = yes ; then
+ if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
:
else
- case $cc_basename in
- xlc*)
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
+ ld_shlibs=no
fi
;;
dgux*)
@@ -417,6 +427,8 @@ else
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
+ *nto* | *qnx*)
+ ;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
@@ -512,7 +524,12 @@ case "$host_os" in
library_names_spec='$libname$shrext'
;;
amigaos*)
- library_names_spec='$libname.a'
+ case "$host_cpu" in
+ powerpc*)
+ library_names_spec='$libname$shrext' ;;
+ m68k)
+ library_names_spec='$libname.a' ;;
+ esac
;;
beos*)
library_names_spec='$libname$shrext'
@@ -542,6 +559,9 @@ case "$host_os" in
gnu*)
library_names_spec='$libname$shrext'
;;
+ haiku*)
+ library_names_spec='$libname$shrext'
+ ;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
@@ -577,7 +597,7 @@ case "$host_os" in
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
- linux* | k*bsd*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
@@ -589,7 +609,7 @@ case "$host_os" in
newsos6)
library_names_spec='$libname$shrext'
;;
- nto-qnx*)
+ *nto* | *qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
@@ -620,6 +640,9 @@ case "$host_os" in
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
+ tpf*)
+ library_names_spec='$libname$shrext'
+ ;;
uts4*)
library_names_spec='$libname$shrext'
;;
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 68c7d6440..686f7031a 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
#!/bin/sh
# Print a version string.
-scriptversion=2011-01-04.17; # UTC
+scriptversion=2011-02-19.19; # UTC
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
#
@@ -80,6 +80,7 @@ nl='
# Avoid meddling by environment variable of the same name.
v=
+v_from_git=
# First see if there is a tarball-only version file.
# then try "git describe", then default.
@@ -134,24 +135,30 @@ then
# Change the first '-' to a '.', so version-comparing tools work properly.
# Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
+ v_from_git=1
else
v=UNKNOWN
fi
v=`echo "$v" |sed 's/^v//'`
-# Don't declare a version "dirty" merely because a time stamp has changed.
-git update-index --refresh > /dev/null 2>&1
+# Test whether to append the "-dirty" suffix only if the version
+# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
+# or if it came from .tarball-version.
+if test -n "$v_from_git"; then
+ # Don't declare a version "dirty" merely because a time stamp has changed.
+ git update-index --refresh > /dev/null 2>&1
-dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
-case "$dirty" in
- '') ;;
- *) # Append the suffix only if there isn't one already.
- case $v in
- *-dirty) ;;
- *) v="$v-dirty" ;;
- esac ;;
-esac
+ dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
+ case "$dirty" in
+ '') ;;
+ *) # Append the suffix only if there isn't one already.
+ case $v in
+ *-dirty) ;;
+ *) v="$v-dirty" ;;
+ esac ;;
+ esac
+fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
echo "$v" | tr -d "$nl"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 50c374239..5d0c22971 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl close connect duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom round send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc 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 accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc verify version-etc-fsf vsnprintf warnings wchar
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@@ -37,7 +37,9 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
EXTRA_libgnu_la_SOURCES =
libgnu_la_LDFLAGS = $(AM_LDFLAGS)
libgnu_la_LDFLAGS += -no-undefined
+libgnu_la_LDFLAGS += $(CEIL_LIBM)
libgnu_la_LDFLAGS += $(FLOOR_LIBM)
+libgnu_la_LDFLAGS += $(FREXP_LIBM)
libgnu_la_LDFLAGS += $(GETADDRINFO_LIB)
libgnu_la_LDFLAGS += $(HOSTENT_LIB)
libgnu_la_LDFLAGS += $(INET_NTOP_LIB)
@@ -45,12 +47,12 @@ libgnu_la_LDFLAGS += $(INET_PTON_LIB)
libgnu_la_LDFLAGS += $(ISNAND_LIBM)
libgnu_la_LDFLAGS += $(ISNANF_LIBM)
libgnu_la_LDFLAGS += $(ISNANL_LIBM)
+libgnu_la_LDFLAGS += $(LDEXP_LIBM)
libgnu_la_LDFLAGS += $(LIBSOCKET)
libgnu_la_LDFLAGS += $(LOG1P_LIBM)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
libgnu_la_LDFLAGS += $(LTLIBUNISTRING)
-libgnu_la_LDFLAGS += $(ROUND_LIBM)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
libgnu_la_LDFLAGS += $(TRUNC_LIBM)
@@ -231,6 +233,15 @@ EXTRA_libgnu_la_SOURCES += canonicalize-lgpl.c
## end gnulib module canonicalize-lgpl
+## begin gnulib module ceil
+
+
+EXTRA_DIST += ceil.c
+
+EXTRA_libgnu_la_SOURCES += ceil.c
+
+## end gnulib module ceil
+
## begin gnulib module close
@@ -257,6 +268,13 @@ EXTRA_libgnu_la_SOURCES += connect.c
## end gnulib module connect
+## begin gnulib module dosname
+
+
+EXTRA_DIST += dosname.h
+
+## end gnulib module dosname
+
## begin gnulib module duplocale
@@ -343,6 +361,15 @@ EXTRA_libgnu_la_SOURCES += floor.c
## end gnulib module floor
+## begin gnulib module frexp
+
+
+EXTRA_DIST += frexp.c
+
+EXTRA_libgnu_la_SOURCES += frexp.c
+
+## end gnulib module frexp
+
## begin gnulib module full-read
libgnu_la_SOURCES += full-read.h full-read.c
@@ -558,6 +585,15 @@ EXTRA_libgnu_la_SOURCES += isnan.c isnand.c
## end gnulib module isnand
+## begin gnulib module isnand-nolibm
+
+
+EXTRA_DIST += float+.h isnan.c isnand-nolibm.h isnand.c
+
+EXTRA_libgnu_la_SOURCES += isnan.c isnand.c
+
+## end gnulib module isnand-nolibm
+
## begin gnulib module isnanf
@@ -904,15 +940,6 @@ EXTRA_libgnu_la_SOURCES += recvfrom.c
## end gnulib module recvfrom
-## begin gnulib module round
-
-
-EXTRA_DIST += round.c
-
-EXTRA_libgnu_la_SOURCES += round.c
-
-## end gnulib module round
-
## begin gnulib module safe-read
@@ -1097,6 +1124,7 @@ stdint.h: stdint.in.h
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
-e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
-e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
@@ -1229,9 +1257,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
mv $@-t $@
MOSTLYCLEANFILES += stdio.h stdio.h-t
-EXTRA_DIST += stdio-write.c stdio.in.h
-
-EXTRA_libgnu_la_SOURCES += stdio-write.c
+EXTRA_DIST += stdio.in.h
## end gnulib module stdio
@@ -1256,6 +1282,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
-e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
+ -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
-e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
@@ -1274,6 +1301,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
-e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+ -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \
< $(srcdir)/stdlib.in.h | \
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
@@ -1302,6 +1330,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
+ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
@@ -1309,6 +1338,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
diff --git a/lib/ceil.c b/lib/ceil.c
new file mode 100644
index 000000000..e5367636d
--- /dev/null
+++ b/lib/ceil.c
@@ -0,0 +1,109 @@
+/* Round towards positive infinity.
+ Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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 Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+#include <float.h>
+
+#undef MIN
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC ceill
+# define DOUBLE long double
+# define MANT_DIG LDBL_MANT_DIG
+# define MIN LDBL_MIN
+# define L_(literal) literal##L
+#elif ! defined USE_FLOAT
+# define FUNC ceil
+# define DOUBLE double
+# define MANT_DIG DBL_MANT_DIG
+# define MIN DBL_MIN
+# define L_(literal) literal
+#else /* defined USE_FLOAT */
+# define FUNC ceilf
+# define DOUBLE float
+# define MANT_DIG FLT_MANT_DIG
+# define MIN FLT_MIN
+# define L_(literal) literal##f
+#endif
+
+/* -0.0. See minus-zero.h. */
+#if defined __hpux || defined __sgi || defined __ICC
+# define MINUS_ZERO (-MIN * MIN)
+#else
+# define MINUS_ZERO L_(-0.0)
+#endif
+
+/* 2^(MANT_DIG-1). */
+static const DOUBLE TWO_MANT_DIG =
+ /* Assume MANT_DIG <= 5 * 31.
+ Use the identity
+ n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
+ (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
+
+DOUBLE
+FUNC (DOUBLE x)
+{
+ /* The use of 'volatile' guarantees that excess precision bits are dropped
+ at each addition step and before the following comparison at the caller's
+ site. It is necessary on x86 systems where double-floats are not IEEE
+ compliant by default, to avoid that the results become platform and compiler
+ option dependent. 'volatile' is a portable alternative to gcc's
+ -ffloat-store option. */
+ volatile DOUBLE y = x;
+ volatile DOUBLE z = y;
+
+ if (z > L_(0.0))
+ {
+ /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
+ if (z < TWO_MANT_DIG)
+ {
+ /* Round to the next integer (nearest or up or down, doesn't matter). */
+ z += TWO_MANT_DIG;
+ z -= TWO_MANT_DIG;
+ /* Enforce rounding up. */
+ if (z < y)
+ z += L_(1.0);
+ }
+ }
+ else if (z < L_(0.0))
+ {
+ /* For -1 < x < 0, return -0.0 regardless of the current rounding
+ mode. */
+ if (z > L_(-1.0))
+ z = MINUS_ZERO;
+ /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
+ else if (z > - TWO_MANT_DIG)
+ {
+ /* Round to the next integer (nearest or up or down, doesn't matter). */
+ z -= TWO_MANT_DIG;
+ z += TWO_MANT_DIG;
+ /* Enforce rounding up. */
+ if (z < y)
+ z += L_(1.0);
+ }
+ }
+ return z;
+}
diff --git a/lib/dosname.h b/lib/dosname.h
new file mode 100644
index 000000000..3087d39dc
--- /dev/null
+++ b/lib/dosname.h
@@ -0,0 +1,53 @@
+/* File names on MS-DOS/Windows systems.
+
+ Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ From Paul Eggert and Jim Meyering. */
+
+#ifndef _DOSNAME_H
+#define _DOSNAME_H
+
+#if (defined _WIN32 || defined __WIN32__ || \
+ defined __MSDOS__ || defined __CYGWIN__ || \
+ defined __EMX__ || defined __DJGPP__)
+ /* This internal macro assumes ASCII, but all hosts that support drive
+ letters use ASCII. */
+# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
+ <= 'z' - 'a')
+# define FILE_SYSTEM_PREFIX_LEN(Filename) \
+ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
+# ifndef __CYGWIN__
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
+# endif
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
+# define ISSLASH(C) ((C) == '/')
+#endif
+
+#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+#endif
+
+#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
+# else
+# define IS_ABSOLUTE_FILE_NAME(F) \
+ (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
+#endif
+#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
+
+#endif /* DOSNAME_H_ */
diff --git a/lib/flock.c b/lib/flock.c
index bdec6d48e..8f018e50c 100644
--- a/lib/flock.c
+++ b/lib/flock.c
@@ -27,13 +27,13 @@
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* _get_osfhandle */
-#include <io.h>
+# include <io.h>
/* LockFileEx */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
-#include <errno.h>
+# include <errno.h>
/* Determine the current size of a file. Because the other braindead
* APIs we'll call need lower/upper 32 bit pairs, keep the file size
@@ -47,9 +47,9 @@ file_size (HANDLE h, DWORD * lower, DWORD * upper)
}
/* LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems. */
-#ifndef LOCKFILE_FAIL_IMMEDIATELY
-# define LOCKFILE_FAIL_IMMEDIATELY 1
-#endif
+# ifndef LOCKFILE_FAIL_IMMEDIATELY
+# define LOCKFILE_FAIL_IMMEDIATELY 1
+# endif
/* Acquire a lock. */
static BOOL
@@ -160,17 +160,17 @@ flock (int fd, int operation)
#else /* !Windows */
-#ifdef HAVE_STRUCT_FLOCK_L_TYPE
+# ifdef HAVE_STRUCT_FLOCK_L_TYPE
/* We know how to implement flock in terms of fcntl. */
-#include <fcntl.h>
+# include <fcntl.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
-#include <errno.h>
-#include <string.h>
+# include <errno.h>
+# include <string.h>
int
flock (int fd, int operation)
@@ -211,10 +211,10 @@ flock (int fd, int operation)
return r;
}
-#else /* !HAVE_STRUCT_FLOCK_L_TYPE */
+# else /* !HAVE_STRUCT_FLOCK_L_TYPE */
-#error "This platform lacks flock function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+# error "This platform lacks flock function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
-#endif /* !HAVE_STRUCT_FLOCK_L_TYPE */
+# endif /* !HAVE_STRUCT_FLOCK_L_TYPE */
#endif /* !Windows */
diff --git a/lib/frexp.c b/lib/frexp.c
new file mode 100644
index 000000000..c7687e0df
--- /dev/null
+++ b/lib/frexp.c
@@ -0,0 +1,166 @@
+/* Split a double into fraction and mantissa.
+ Copyright (C) 2007-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 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 <bonzini@gnu.org>, 2003, and
+ Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+#include <float.h>
+#ifdef USE_LONG_DOUBLE
+# include "isnanl-nolibm.h"
+# include "fpucw.h"
+#else
+# include "isnand-nolibm.h"
+#endif
+
+/* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater
+ than 2, or not even a power of 2, some rounding errors can occur, so that
+ then the returned mantissa is only guaranteed to be <= 1.0, not < 1.0. */
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC frexpl
+# define DOUBLE long double
+# define ISNAN isnanl
+# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING ()
+# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING ()
+# define L_(literal) literal##L
+#else
+# define FUNC frexp
+# define DOUBLE double
+# define ISNAN isnand
+# define DECL_ROUNDING
+# define BEGIN_ROUNDING()
+# define END_ROUNDING()
+# define L_(literal) literal
+#endif
+
+DOUBLE
+FUNC (DOUBLE x, int *expptr)
+{
+ int sign;
+ int exponent;
+ DECL_ROUNDING
+
+ /* Test for NaN, infinity, and zero. */
+ if (ISNAN (x) || x + x == x)
+ {
+ *expptr = 0;
+ return x;
+ }
+
+ sign = 0;
+ if (x < 0)
+ {
+ x = - x;
+ sign = -1;
+ }
+
+ BEGIN_ROUNDING ();
+
+ {
+ /* Since the exponent is an 'int', it fits in 64 bits. Therefore the
+ loops are executed no more than 64 times. */
+ DOUBLE pow2[64]; /* pow2[i] = 2^2^i */
+ DOUBLE powh[64]; /* powh[i] = 2^-2^i */
+ int i;
+
+ exponent = 0;
+ if (x >= L_(1.0))
+ {
+ /* A positive exponent. */
+ DOUBLE pow2_i; /* = pow2[i] */
+ DOUBLE powh_i; /* = powh[i] */
+
+ /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+ x * 2^exponent = argument, x >= 1.0. */
+ for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+ ;
+ i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+ {
+ if (x >= pow2_i)
+ {
+ exponent += (1 << i);
+ x *= powh_i;
+ }
+ else
+ break;
+
+ pow2[i] = pow2_i;
+ powh[i] = powh_i;
+ }
+ /* Avoid making x too small, as it could become a denormalized
+ number and thus lose precision. */
+ while (i > 0 && x < pow2[i - 1])
+ {
+ i--;
+ powh_i = powh[i];
+ }
+ exponent += (1 << i);
+ x *= powh_i;
+ /* Here 2^-2^i <= x < 1.0. */
+ }
+ else
+ {
+ /* A negative or zero exponent. */
+ DOUBLE pow2_i; /* = pow2[i] */
+ DOUBLE powh_i; /* = powh[i] */
+
+ /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+ x * 2^exponent = argument, x < 1.0. */
+ for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+ ;
+ i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+ {
+ if (x < powh_i)
+ {
+ exponent -= (1 << i);
+ x *= pow2_i;
+ }
+ else
+ break;
+
+ pow2[i] = pow2_i;
+ powh[i] = powh_i;
+ }
+ /* Here 2^-2^i <= x < 1.0. */
+ }
+
+ /* Invariants: x * 2^exponent = argument, and 2^-2^i <= x < 1.0. */
+ while (i > 0)
+ {
+ i--;
+ if (x < powh[i])
+ {
+ exponent -= (1 << i);
+ x *= pow2[i];
+ }
+ }
+ /* Here 0.5 <= x < 1.0. */
+ }
+
+ if (sign < 0)
+ x = - x;
+
+ END_ROUNDING ();
+
+ *expptr = exponent;
+ return x;
+}
diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h
new file mode 100644
index 000000000..e434a7bd0
--- /dev/null
+++ b/lib/isnand-nolibm.h
@@ -0,0 +1,33 @@
+/* Test for NaN that does not need libm.
+ Copyright (C) 2007-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 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/>. */
+
+#if HAVE_ISNAND_IN_LIBC
+/* Get declaration of isnan macro. */
+# include <math.h>
+# if __GNUC__ >= 4
+ /* GCC 4.0 and newer provides three built-ins for isnan. */
+# undef isnand
+# define isnand(x) __builtin_isnan ((double)(x))
+# else
+# undef isnand
+# define isnand(x) isnan ((double)(x))
+# endif
+#else
+/* Test whether X is a NaN. */
+# undef isnand
+# define isnand rpl_isnand
+extern int isnand (double x);
+#endif
diff --git a/lib/round.c b/lib/round.c
deleted file mode 100644
index 1630a6d79..000000000
--- a/lib/round.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Round toward nearest, breaking ties away from zero.
- Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU 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 Ben Pfaff <blp@gnu.org>, 2007.
- Based heavily on code by Bruno Haible. */
-
-#include <config.h>
-
-/* Specification. */
-#include <math.h>
-
-#include <float.h>
-
-#undef MIN
-
-#ifdef USE_LONG_DOUBLE
-# define ROUND roundl
-# define FLOOR floorl
-# define CEIL ceill
-# define DOUBLE long double
-# define MANT_DIG LDBL_MANT_DIG
-# define MIN LDBL_MIN
-# define L_(literal) literal##L
-# define HAVE_FLOOR_AND_CEIL HAVE_FLOORL_AND_CEILL
-#elif ! defined USE_FLOAT
-# define ROUND round
-# define FLOOR floor
-# define CEIL ceil
-# define DOUBLE double
-# define MANT_DIG DBL_MANT_DIG
-# define MIN DBL_MIN
-# define L_(literal) literal
-# define HAVE_FLOOR_AND_CEIL 1
-#else /* defined USE_FLOAT */
-# define ROUND roundf
-# define FLOOR floorf
-# define CEIL ceilf
-# define DOUBLE float
-# define MANT_DIG FLT_MANT_DIG
-# define MIN FLT_MIN
-# define L_(literal) literal##f
-# define HAVE_FLOOR_AND_CEIL HAVE_FLOORF_AND_CEILF
-#endif
-
-/* -0.0. See minus-zero.h. */
-#if defined __hpux || defined __sgi || defined __ICC
-# define MINUS_ZERO (-MIN * MIN)
-#else
-# define MINUS_ZERO L_(-0.0)
-#endif
-
-/* If we're being included from test-round2[f].c, it already defined names for
- our round implementations. Otherwise, pick the preferred implementation for
- this machine. */
-#if !defined FLOOR_BASED_ROUND && !defined FLOOR_FREE_ROUND
-# if HAVE_FLOOR_AND_CEIL
-# define FLOOR_BASED_ROUND ROUND
-# else
-# define FLOOR_FREE_ROUND ROUND
-# endif
-#endif
-
-#ifdef FLOOR_BASED_ROUND
-/* An implementation of the C99 round function based on floor and ceil. We use
- this when floor and ceil are available, on the assumption that they are
- faster than the open-coded versions below. */
-DOUBLE
-FLOOR_BASED_ROUND (DOUBLE x)
-{
- if (x >= L_(0.0))
- {
- DOUBLE y = FLOOR (x);
- if (x - y >= L_(0.5))
- y += L_(1.0);
- return y;
- }
- else
- {
- DOUBLE y = CEIL (x);
- if (y - x >= L_(0.5))
- y -= L_(1.0);
- return y;
- }
-}
-#endif /* FLOOR_BASED_ROUND */
-
-#ifdef FLOOR_FREE_ROUND
-/* An implementation of the C99 round function without floor or ceil.
- We use this when floor or ceil is missing. */
-DOUBLE
-FLOOR_FREE_ROUND (DOUBLE x)
-{
- /* 2^(MANT_DIG-1). */
- static const DOUBLE TWO_MANT_DIG =
- /* Assume MANT_DIG <= 5 * 31.
- Use the identity
- n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
- (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
- * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
- * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
- * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
- * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
-
- /* The use of 'volatile' guarantees that excess precision bits are dropped at
- each addition step and before the following comparison at the caller's
- site. It is necessary on x86 systems where double-floats are not IEEE
- compliant by default, to avoid that the results become platform and
- compiler option dependent. 'volatile' is a portable alternative to gcc's
- -ffloat-store option. */
- volatile DOUBLE y = x;
- volatile DOUBLE z = y;
-
- if (z > L_(0.0))
- {
- /* Avoid rounding error for x = 0.5 - 2^(-MANT_DIG-1). */
- if (z < L_(0.5))
- z = L_(0.0);
- /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
- else if (z < TWO_MANT_DIG)
- {
- /* Add 0.5 to the absolute value. */
- y = z += L_(0.5);
- /* Round to the next integer (nearest or up or down, doesn't
- matter). */
- z += TWO_MANT_DIG;
- z -= TWO_MANT_DIG;
- /* Enforce rounding down. */
- if (z > y)
- z -= L_(1.0);
- }
- }
- else if (z < L_(0.0))
- {
- /* Avoid rounding error for x = -(0.5 - 2^(-MANT_DIG-1)). */
- if (z > - L_(0.5))
- z = MINUS_ZERO;
- /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
- else if (z > -TWO_MANT_DIG)
- {
- /* Add 0.5 to the absolute value. */
- y = z -= L_(0.5);
- /* Round to the next integer (nearest or up or down, doesn't
- matter). */
- z -= TWO_MANT_DIG;
- z += TWO_MANT_DIG;
- /* Enforce rounding up. */
- if (z < y)
- z += L_(1.0);
- }
- }
- return z;
-}
-#endif /* FLOOR_FREE_ROUND */
-
diff --git a/lib/stat.c b/lib/stat.c
index d154a18b0..aa369d0f2 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf)
#include <limits.h>
#include <stdbool.h>
#include <string.h>
+#include "dosname.h"
/* Store information about NAME into ST. Work around bugs with
trailing slashes. Mingw has other bugs (such as st_ino always
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 319b8aa15..b60e9cc0b 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -497,7 +497,12 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
sequence of nested includes
<wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
<stdint.h> and assumes its types are already defined. */
-#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+ /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+ included before <wchar.h>. */
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
# include <wchar.h>
# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
diff --git a/lib/stdio-write.c b/lib/stdio-write.c
deleted file mode 100644
index 252d9bce8..000000000
--- a/lib/stdio-write.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* POSIX compatible FILE stream write function.
- Copyright (C) 2008-2011 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2008.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU 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 <stdio.h>
-
-/* Replace these functions only if module 'sigpipe' is requested. */
-#if GNULIB_SIGPIPE
-
-/* On native Windows platforms, SIGPIPE does not exist. When write() is
- called on a pipe with no readers, WriteFile() fails with error
- GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
- error EINVAL. This write() function is at the basis of the function
- which flushes the buffer of a FILE stream. */
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-# include <errno.h>
-# include <signal.h>
-# include <io.h>
-
-# define WIN32_LEAN_AND_MEAN /* avoid including junk */
-# include <windows.h>
-
-# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
- if (ferror (stream)) \
- return (EXPRESSION); \
- else \
- { \
- RETTYPE ret; \
- SetLastError (0); \
- ret = (EXPRESSION); \
- if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \
- { \
- int fd = fileno (stream); \
- if (fd >= 0 \
- && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
- { \
- /* Try to raise signal SIGPIPE. */ \
- raise (SIGPIPE); \
- /* If it is currently blocked or ignored, change errno from \
- EINVAL to EPIPE. */ \
- errno = EPIPE; \
- } \
- } \
- return ret; \
- }
-
-# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
-int
-printf (const char *format, ...)
-{
- int retval;
- va_list args;
-
- va_start (args, format);
- retval = vfprintf (stdout, format, args);
- va_end (args);
-
- return retval;
-}
-# endif
-
-# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
-int
-fprintf (FILE *stream, const char *format, ...)
-{
- int retval;
- va_list args;
-
- va_start (args, format);
- retval = vfprintf (stream, format, args);
- va_end (args);
-
- return retval;
-}
-# endif
-
-# if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */
-int
-vprintf (const char *format, va_list args)
-{
- return vfprintf (stdout, format, args);
-}
-# endif
-
-# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */
-int
-vfprintf (FILE *stream, const char *format, va_list args)
-#undef vfprintf
-{
- CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
-}
-# endif
-
-int
-putchar (int c)
-{
- return fputc (c, stdout);
-}
-
-int
-fputc (int c, FILE *stream)
-#undef fputc
-{
- CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
-}
-
-int
-fputs (const char *string, FILE *stream)
-#undef fputs
-{
- CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
-}
-
-int
-puts (const char *string)
-#undef puts
-{
- FILE *stream = stdout;
- CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
-}
-
-size_t
-fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
-#undef fwrite
-{
- CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
-}
-
-# endif
-#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index e2d945767..980b909af 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -274,6 +274,21 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
"use gnulib module malloc-posix for portability");
#endif
+/* Convert a multibyte character to a wide character. */
+#if @GNULIB_MBTOWC@
+# if @REPLACE_MBTOWC@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef mbtowc
+# define mbtowc rpl_mbtowc
+# endif
+_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# else
+_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# endif
+_GL_CXXALIASWARN (mbtowc);
+#endif
+
#if @GNULIB_MKDTEMP@
/* Create a unique temporary directory from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
@@ -723,6 +738,21 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
# endif
#endif
+/* Convert a wide character to a multibyte character. */
+#if @GNULIB_WCTOMB@
+# if @REPLACE_WCTOMB@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef wctomb
+# define wctomb rpl_wctomb
+# endif
+_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
+_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
+# else
+_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
+# endif
+_GL_CXXALIASWARN (wctomb);
+#endif
+
#endif /* _GL_STDLIB_H */
#endif /* _GL_STDLIB_H */
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index cad862f9d..fec68c825 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -935,11 +935,11 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
abort ();
m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
}
-#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
- precision. */
+# if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
+ precision. */
if (!(y == 0.0L))
abort ();
-#endif
+# endif
/* Normalise. */
while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
m.nlimbs--;
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index 7ae03da8e..e2de468aa 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -24,16 +24,16 @@
/* Get size_t. */
#include <stddef.h>
-#ifndef __attribute__
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The __-protected variants of the attributes 'format' and 'printf' are
accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable __attribute__ only if these are supported too, because
+ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
gnulib and libintl do '#define printf __printf__' when they override
the 'printf' function. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(Spec) /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
#ifdef __cplusplus
@@ -69,9 +69,9 @@ extern "C" {
# define vasnprintf rpl_vasnprintf
#endif
extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
+ _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 3, 0)));
+ _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0));
#ifdef __cplusplus
}
diff --git a/lib/version-etc.h b/lib/version-etc.h
index 9446dec14..b197ad11f 100644
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -23,11 +23,11 @@
# include <stdio.h>
/* The `sentinel' attribute was added in gcc 4.0. */
-#ifndef ATTRIBUTE_SENTINEL
+#ifndef _GL_ATTRIBUTE_SENTINEL
# if 4 <= __GNUC__
-# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
+# define _GL_ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
# else
-# define ATTRIBUTE_SENTINEL /* empty */
+# define _GL_ATTRIBUTE_SENTINEL /* empty */
# endif
#endif
@@ -70,7 +70,7 @@ extern void version_etc (FILE *stream,
const char *command_name, const char *package,
const char *version,
/* const char *author1, ..., NULL */ ...)
- ATTRIBUTE_SENTINEL;
+ _GL_ATTRIBUTE_SENTINEL;
/* Display the usual `Report bugs to' stanza */
extern void emit_bug_reporting_address (void);
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 20c179520..ac27eb8fb 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -460,7 +460,9 @@ version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGU
libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
$(BDW_GC_LIBS) $(LIBFFI_LIBS) \
+ $(CEIL_LIBM) \
$(FLOOR_LIBM) \
+ $(FREXP_LIBM) \
$(GETADDRINFO_LIB) \
$(HOSTENT_LIB) \
$(INET_NTOP_LIB) \
@@ -468,12 +470,12 @@ libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
$(ISNAND_LIBM) \
$(ISNANF_LIBM) \
$(ISNANL_LIBM) \
+ $(LDEXP_LIBM) \
$(LIBSOCKET) \
$(LOG1P_LIBM) \
$(LTLIBICONV) \
$(LTLIBINTL) \
$(LTLIBUNISTRING) \
- $(ROUND_LIBM) \
$(SERVENT_LIB) \
$(TRUNC_LIBM) \
-version-info $(version_info) \
diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4
deleted file mode 100644
index 15c89cca9..000000000
--- a/m4/asm-underscore.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-# asm-underscore.m4 serial 1
-dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp.
-
-# gl_ASM_SYMBOL_PREFIX
-# Tests for the prefix of C symbols at the assembly language level and the
-# linker level. This prefix is either an underscore or empty. Defines the
-# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to
-# a stringified variant of this prefix.
-
-AC_DEFUN([gl_ASM_SYMBOL_PREFIX],
-[
- dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because
- dnl 1. It works only for GCC.
- dnl 2. It is incorrectly defined on some platforms, in some GCC versions.
- AC_CACHE_CHECK(
- [whether C symbols are prefixed with underscore at the linker level],
- [gl_cv_prog_as_underscore],
- [cat > conftest.c <<EOF
-#ifdef __cplusplus
-extern "C" int foo (void);
-#endif
-int foo(void) { return 0; }
-EOF
- # Look for the assembly language name in the .s file.
- AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c) >/dev/null 2>&1
- if grep _foo conftest.s >/dev/null ; then
- gl_cv_prog_as_underscore=yes
- else
- gl_cv_prog_as_underscore=no
- fi
- rm -f conftest*
- ])
- if test $gl_cv_prog_as_underscore = yes; then
- USER_LABEL_PREFIX=_
- else
- USER_LABEL_PREFIX=
- fi
- AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX],
- [Define to the prefix of C symbols at the assembler and linker level,
- either an underscore or empty.])
- ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"'
- AC_SUBST([ASM_SYMBOL_PREFIX])
-])
diff --git a/m4/dos.m4 b/m4/dos.m4
deleted file mode 100644
index ed9c4cee6..000000000
--- a/m4/dos.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-#serial 11 -*- autoconf -*-
-
-# Define some macros required for proper operation of code in lib/*.c
-# on MSDOS/Windows systems.
-
-# Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# From Jim Meyering.
-
-AC_DEFUN([gl_AC_DOS],
- [
- AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
- [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
-neither MSDOS nor Windows
-#endif]])],
- [ac_cv_win_or_dos=yes],
- [ac_cv_win_or_dos=no])
- ])
-
- if test x"$ac_cv_win_or_dos" = xyes; then
- ac_fs_accepts_drive_letter_prefix=1
- ac_fs_backslash_is_file_name_separator=1
- AC_CACHE_CHECK([whether drive letter can start relative path],
- [ac_cv_drive_letter_can_be_relative],
- [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if defined __CYGWIN__
-drive letters are always absolute
-#endif]])],
- [ac_cv_drive_letter_can_be_relative=yes],
- [ac_cv_drive_letter_can_be_relative=no])
- ])
- if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
- ac_fs_drive_letter_can_be_relative=1
- else
- ac_fs_drive_letter_can_be_relative=0
- fi
- else
- ac_fs_accepts_drive_letter_prefix=0
- ac_fs_backslash_is_file_name_separator=0
- ac_fs_drive_letter_can_be_relative=0
- fi
-
- AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
- $ac_fs_accepts_drive_letter_prefix,
- [Define on systems for which file names may have a so-called
- `drive letter' prefix, define this to compute the length of that
- prefix, including the colon.])
-
- AH_VERBATIM(ISSLASH,
- [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define ISSLASH(C) ((C) == '/')
-#endif])
-
- AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
- $ac_fs_backslash_is_file_name_separator,
- [Define if the backslash character may also serve as a file name
- component separator.])
-
- AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
- $ac_fs_drive_letter_can_be_relative,
- [Define if a drive letter prefix denotes a relative path if it is
- not followed by a file name component separator.])
- ])
diff --git a/m4/frexp.m4 b/m4/frexp.m4
new file mode 100644
index 000000000..2e0fb3b47
--- /dev/null
+++ b/m4/frexp.m4
@@ -0,0 +1,165 @@
+# frexp.m4 serial 10
+dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FREXP],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
+ FREXP_LIBM=
+ if test $gl_cv_func_frexp_no_libm = no; then
+ AC_CACHE_CHECK([whether frexp() can be used with libm],
+ [gl_cv_func_frexp_in_libm],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lm"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x;]],
+ [[int e; return frexp (x, &e) > 0;]])],
+ [gl_cv_func_frexp_in_libm=yes],
+ [gl_cv_func_frexp_in_libm=no])
+ LIBS="$save_LIBS"
+ ])
+ if test $gl_cv_func_frexp_in_libm = yes; then
+ FREXP_LIBM=-lm
+ fi
+ fi
+ if test $gl_cv_func_frexp_no_libm = yes \
+ || test $gl_cv_func_frexp_in_libm = yes; then
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $FREXP_LIBM"
+ gl_FUNC_FREXP_WORKS
+ LIBS="$save_LIBS"
+ case "$gl_cv_func_frexp_works" in
+ *yes) gl_func_frexp=yes ;;
+ *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;;
+ esac
+ else
+ gl_func_frexp=no
+ fi
+ if test $gl_func_frexp = yes; then
+ AC_DEFINE([HAVE_FREXP], [1],
+ [Define if the frexp() function is available and works.])
+ else
+ AC_LIBOBJ([frexp])
+ fi
+ AC_SUBST([FREXP_LIBM])
+])
+
+AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
+ if test $gl_cv_func_frexp_no_libm = yes; then
+ gl_FUNC_FREXP_WORKS
+ case "$gl_cv_func_frexp_works" in
+ *yes) gl_func_frexp_no_libm=yes ;;
+ *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;;
+ esac
+ else
+ gl_func_frexp_no_libm=no
+ dnl Set REPLACE_FREXP here because the system may have frexp in libm.
+ REPLACE_FREXP=1
+ fi
+ if test $gl_func_frexp_no_libm = yes; then
+ AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
+ [Define if the frexp() function is available in libc.])
+ else
+ AC_LIBOBJ([frexp])
+ fi
+])
+
+dnl Test whether frexp() can be used without linking with libm.
+dnl Set gl_cv_func_frexp_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_FREXP_NO_LIBM],
+[
+ AC_CACHE_CHECK([whether frexp() can be used without linking with libm],
+ [gl_cv_func_frexp_no_libm],
+ [
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x;]],
+ [[int e; return frexp (x, &e) > 0;]])],
+ [gl_cv_func_frexp_no_libm=yes],
+ [gl_cv_func_frexp_no_libm=no])
+ ])
+])
+
+dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on
+dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw),
+dnl and on negative zero (this fails e.g. on NetBSD 4.99).
+AC_DEFUN([gl_FUNC_FREXP_WORKS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <float.h>
+#include <math.h>
+#include <string.h>
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+ ICC 10.0 has a bug when optimizing the expression -zero.
+ The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
+ to PowerPC on MacOS X 10.5. */
+#if defined __hpux || defined __sgi || defined __ICC
+static double
+compute_minus_zero (void)
+{
+ return -DBL_MIN * DBL_MIN;
+}
+# define minus_zero compute_minus_zero ()
+#else
+double minus_zero = -0.0;
+#endif
+int main()
+{
+ int result = 0;
+ int i;
+ volatile double x;
+ double zero = 0.0;
+ /* Test on denormalized numbers. */
+ for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
+ ;
+ if (x > 0.0)
+ {
+ int exp;
+ double y = frexp (x, &exp);
+ /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022.
+ On NetBSD: y = 0.75. Correct: y = 0.5. */
+ if (y != 0.5)
+ result |= 1;
+ }
+ /* Test on infinite numbers. */
+ x = 1.0 / 0.0;
+ {
+ int exp;
+ double y = frexp (x, &exp);
+ if (y != x)
+ result |= 2;
+ }
+ /* Test on negative zero. */
+ x = minus_zero;
+ {
+ int exp;
+ double y = frexp (x, &exp);
+ if (memcmp (&y, &x, sizeof x))
+ result |= 4;
+ }
+ return result;
+}]])],
+ [gl_cv_func_frexp_works=yes],
+ [gl_cv_func_frexp_works=no],
+ [case "$host_os" in
+ netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";;
+ *) gl_cv_func_frexp_works="guessing yes";;
+ esac
+ ])
+ ])
+])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 63d329358..2d84c7f24 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl close connect duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom round send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc 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 accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strcase strftime striconveh string sys_stat trunc verify version-etc-fsf vsnprintf warnings wchar
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
@@ -28,13 +28,16 @@ gl_MODULES([
bind
byteswap
canonicalize-lgpl
+ ceil
close
connect
duplocale
environ
extensions
flock
+ floor
fpieee
+ frexp
full-read
full-write
func
@@ -53,6 +56,7 @@ gl_MODULES([
inet_pton
isinf
isnan
+ ldexp
lib-symbol-versions
lib-symbol-visibility
libunistring
@@ -66,7 +70,6 @@ gl_MODULES([
putenv
recv
recvfrom
- round
send
sendto
setsockopt
@@ -84,6 +87,7 @@ gl_MODULES([
version-etc-fsf
vsnprintf
warnings
+ wchar
])
gl_AVOID([])
gl_SOURCE_BASE([lib])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index a64693b3a..8a70734a3 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -42,9 +42,11 @@ AC_DEFUN([gl_EARLY],
# Code from module c-strcase:
# Code from module c-strcaseeq:
# Code from module canonicalize-lgpl:
+ # Code from module ceil:
# Code from module close:
# Code from module close-hook:
# Code from module connect:
+ # Code from module dosname:
# Code from module duplocale:
# Code from module environ:
# Code from module errno:
@@ -56,6 +58,7 @@ AC_DEFUN([gl_EARLY],
# Code from module floor:
# Code from module fpieee:
AC_REQUIRE([gl_FP_IEEE])
+ # Code from module frexp:
# Code from module full-read:
# Code from module full-write:
# Code from module func:
@@ -84,8 +87,10 @@ AC_DEFUN([gl_EARLY],
# Code from module isinf:
# Code from module isnan:
# Code from module isnand:
+ # Code from module isnand-nolibm:
# Code from module isnanf:
# Code from module isnanl:
+ # Code from module ldexp:
# Code from module lib-symbol-versions:
# Code from module lib-symbol-visibility:
# Code from module libunistring:
@@ -108,7 +113,6 @@ AC_DEFUN([gl_EARLY],
# Code from module readlink:
# Code from module recv:
# Code from module recvfrom:
- # Code from module round:
# Code from module safe-read:
# Code from module safe-write:
# Code from module send:
@@ -217,6 +221,9 @@ AC_DEFUN([gl_INIT],
gl_MODULE_INDICATOR([canonicalize-lgpl])
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
gl_STDLIB_MODULE_INDICATOR([realpath])
+ # Code from module ceil:
+ gl_FUNC_CEIL
+ gl_MATH_MODULE_INDICATOR([ceil])
# Code from module close:
gl_FUNC_CLOSE
gl_UNISTD_MODULE_INDICATOR([close])
@@ -227,6 +234,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([connect])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([connect])
+ # Code from module dosname:
# Code from module duplocale:
gl_FUNC_DUPLOCALE
gl_LOCALE_MODULE_INDICATOR([duplocale])
@@ -248,6 +256,9 @@ AC_DEFUN([gl_INIT],
gl_FUNC_FLOOR
gl_MATH_MODULE_INDICATOR([floor])
# Code from module fpieee:
+ # Code from module frexp:
+ gl_FUNC_FREXP
+ gl_MATH_MODULE_INDICATOR([frexp])
# Code from module full-read:
# Code from module full-write:
# Code from module func:
@@ -324,12 +335,16 @@ AC_DEFUN([gl_INIT],
# Code from module isnand:
gl_FUNC_ISNAND
gl_MATH_MODULE_INDICATOR([isnand])
+ # Code from module isnand-nolibm:
+ gl_FUNC_ISNAND_NO_LIBM
# Code from module isnanf:
gl_FUNC_ISNANF
gl_MATH_MODULE_INDICATOR([isnanf])
# Code from module isnanl:
gl_FUNC_ISNANL
gl_MATH_MODULE_INDICATOR([isnanl])
+ # Code from module ldexp:
+ gl_FUNC_LDEXP
# Code from module lib-symbol-versions:
gl_LD_VERSION_SCRIPT
# Code from module lib-symbol-visibility:
@@ -394,9 +409,6 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([recvfrom])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
- # Code from module round:
- gl_FUNC_ROUND
- gl_MATH_MODULE_INDICATOR([round])
# Code from module safe-read:
gl_SAFE_READ
# Code from module safe-write:
@@ -713,10 +725,12 @@ AC_DEFUN([gl_FILE_LIST], [
lib/c-strcaseeq.h
lib/c-strncasecmp.c
lib/canonicalize-lgpl.c
+ lib/ceil.c
lib/close-hook.c
lib/close-hook.h
lib/close.c
lib/connect.c
+ lib/dosname.h
lib/duplocale.c
lib/errno.in.h
lib/fclose.c
@@ -724,6 +738,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/float.in.h
lib/flock.c
lib/floor.c
+ lib/frexp.c
lib/full-read.c
lib/full-read.h
lib/full-write.c
@@ -748,6 +763,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/inet_pton.c
lib/isinf.c
lib/isnan.c
+ lib/isnand-nolibm.h
lib/isnand.c
lib/isnanf.c
lib/isnanl.c
@@ -775,7 +791,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/readlink.c
lib/recv.c
lib/recvfrom.c
- lib/round.c
lib/safe-read.c
lib/safe-read.h
lib/safe-write.c
@@ -795,7 +810,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
- lib/stdio-write.c
lib/stdio.in.h
lib/stdlib.in.h
lib/strcasecmp.c
@@ -839,14 +853,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/absolute-header.m4
m4/alloca.m4
m4/arpa_inet_h.m4
- m4/asm-underscore.m4
m4/autobuild.m4
m4/byteswap.m4
m4/canonicalize.m4
m4/ceil.m4
m4/check-math-lib.m4
m4/close.m4
- m4/dos.m4
m4/double-slash-root.m4
m4/duplocale.m4
m4/eealloc.m4
@@ -861,6 +873,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/flock.m4
m4/floor.m4
m4/fpieee.m4
+ m4/frexp.m4
m4/func.m4
m4/getaddrinfo.m4
m4/gnulib-common.m4
@@ -880,6 +893,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/isnanf.m4
m4/isnanl.m4
m4/ld-version-script.m4
+ m4/ldexp.m4
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
@@ -902,7 +916,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/printf.m4
m4/putenv.m4
m4/readlink.m4
- m4/round.m4
m4/safe-read.m4
m4/safe-write.m4
m4/servent.m4
diff --git a/m4/ldexp.m4 b/m4/ldexp.m4
new file mode 100644
index 000000000..dd400d469
--- /dev/null
+++ b/m4/ldexp.m4
@@ -0,0 +1,54 @@
+# ldexp.m4 serial 1
+dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LDEXP],
+[
+ AC_REQUIRE([gl_CHECK_LDEXP_NO_LIBM])
+ LDEXP_LIBM=
+ if test $gl_cv_func_ldexp_no_libm = no; then
+ AC_CACHE_CHECK([whether ldexp() can be used with libm],
+ [gl_cv_func_ldexp_in_libm],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lm"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double (*funcptr) (double, int) = ldexp;
+ double x;]],
+ [[return ldexp (x, -1) > 0;]])],
+ [gl_cv_func_ldexp_in_libm=yes],
+ [gl_cv_func_ldexp_in_libm=no])
+ LIBS="$save_LIBS"
+ ])
+ if test $gl_cv_func_ldexp_in_libm = yes; then
+ LDEXP_LIBM=-lm
+ fi
+ fi
+ AC_SUBST([LDEXP_LIBM])
+])
+
+dnl Test whether ldexp() can be used without linking with libm.
+dnl Set gl_cv_func_ldexp_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_LDEXP_NO_LIBM],
+[
+ AC_CACHE_CHECK([whether ldexp() can be used without linking with libm],
+ [gl_cv_func_ldexp_no_libm],
+ [
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double (*funcptr) (double, int) = ldexp;
+ double x;]],
+ [[return ldexp (x, -1) > 0;]])],
+ [gl_cv_func_ldexp_no_libm=yes],
+ [gl_cv_func_ldexp_no_libm=no])
+ ])
+])
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
index b024dd4e9..e7c9ba9d3 100644
--- a/m4/lib-link.m4
+++ b/m4/lib-link.m4
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 25 (gettext-0.18.2)
+# lib-link.m4 serial 26 (gettext-0.18.2)
dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -116,6 +116,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
dnl Determine the platform dependent parameters needed to use rpath:
dnl acl_libext,
dnl acl_shlibext,
+dnl acl_libname_spec,
+dnl acl_library_names_spec,
dnl acl_hardcode_libdir_flag_spec,
dnl acl_hardcode_libdir_separator,
dnl acl_hardcode_direct,
diff --git a/m4/longlong.m4 b/m4/longlong.m4
index a4d95aa1a..aed816cfa 100644
--- a/m4/longlong.m4
+++ b/m4/longlong.m4
@@ -1,4 +1,4 @@
-# longlong.m4 serial 14
+# longlong.m4 serial 16
dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
+# This fixes a bug in Autoconf 2.61, and can be faster
+# than what's in Autoconf 2.62 through 2.68.
# Note: If the type 'long long int' exists but is only 32 bits large
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -16,35 +16,39 @@ dnl From Paul Eggert.
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
- [AC_LINK_IFELSE(
- [_AC_TYPE_LONG_LONG_SNIPPET],
- [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
- dnl If cross compiling, assume the bug isn't important, since
- dnl nobody cross compiles for this platform as far as we know.
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[@%:@include <limits.h>
- @%:@ifndef LLONG_MAX
- @%:@ define HALF \
- (1LL << (sizeof (long long int) * CHAR_BIT - 2))
- @%:@ define LLONG_MAX (HALF - 1 + HALF)
- @%:@endif]],
- [[long long int n = 1;
- int i;
- for (i = 0; ; i++)
- {
- long long int m = n << i;
- if (m >> i != n)
- return 1;
- if (LLONG_MAX / 2 < m)
- break;
- }
- return 0;]])],
- [ac_cv_type_long_long_int=yes],
- [ac_cv_type_long_long_int=no],
- [ac_cv_type_long_long_int=yes])],
- [ac_cv_type_long_long_int=no])])
+ [ac_cv_type_long_long_int=yes
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+ ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
+ if test $ac_cv_type_long_long_int = yes; then
+ dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
+ dnl If cross compiling, assume the bug is not important, since
+ dnl nobody cross compiles for this platform as far as we know.
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[@%:@include <limits.h>
+ @%:@ifndef LLONG_MAX
+ @%:@ define HALF \
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+ @%:@ define LLONG_MAX (HALF - 1 + HALF)
+ @%:@endif]],
+ [[long long int n = 1;
+ int i;
+ for (i = 0; ; i++)
+ {
+ long long int m = n << i;
+ if (m >> i != n)
+ return 1;
+ if (LLONG_MAX / 2 < m)
+ break;
+ }
+ return 0;]])],
+ [],
+ [ac_cv_type_long_long_int=no],
+ [:])
+ fi
+ fi])
if test $ac_cv_type_long_long_int = yes; then
AC_DEFINE([HAVE_LONG_LONG_INT], [1],
[Define to 1 if the system has the type `long long int'.])
@@ -52,8 +56,8 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
])
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
+# This fixes a bug in Autoconf 2.61, and can be faster
+# than what's in Autoconf 2.62 through 2.68.
# Note: If the type 'unsigned long long int' exists but is only 32 bits
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
@@ -64,10 +68,13 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
[
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
- [AC_LINK_IFELSE(
- [_AC_TYPE_LONG_LONG_SNIPPET],
- [ac_cv_type_unsigned_long_long_int=yes],
- [ac_cv_type_unsigned_long_long_int=no])])
+ [ac_cv_type_unsigned_long_long_int=yes
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+ AC_LINK_IFELSE(
+ [_AC_TYPE_LONG_LONG_SNIPPET],
+ [],
+ [ac_cv_type_unsigned_long_long_int=no])
+ fi])
if test $ac_cv_type_unsigned_long_long_int = yes; then
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
[Define to 1 if the system has the type `unsigned long long int'.])
diff --git a/m4/round.m4 b/m4/round.m4
deleted file mode 100644
index a95d905ef..000000000
--- a/m4/round.m4
+++ /dev/null
@@ -1,111 +0,0 @@
-# round.m4 serial 10
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_ROUND],
-[
- m4_divert_text([DEFAULTS], [gl_round_required=plain])
- AC_REQUIRE([gl_MATH_H_DEFAULTS])
- dnl Persuade glibc <math.h> to declare round().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_DECLS([round], , , [#include <math.h>])
- if test "$ac_cv_have_decl_round" = yes; then
- gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);])
- if test "$ROUND_LIBM" != missing; then
- dnl Test whether round() produces correct results. On NetBSD 3.0, for
- dnl x = 1/2 - 2^-54, the system's round() returns a wrong result.
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether round works], [gl_cv_func_round_works],
- [
- save_LIBS="$LIBS"
- LIBS="$LIBS $ROUND_LIBM"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <float.h>
-#include <math.h>
-int main()
-{
- /* 2^DBL_MANT_DIG. */
- static const double TWO_MANT_DIG =
- /* Assume DBL_MANT_DIG <= 5 * 31.
- Use the identity
- n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
- (double) (1U << (DBL_MANT_DIG / 5))
- * (double) (1U << ((DBL_MANT_DIG + 1) / 5))
- * (double) (1U << ((DBL_MANT_DIG + 2) / 5))
- * (double) (1U << ((DBL_MANT_DIG + 3) / 5))
- * (double) (1U << ((DBL_MANT_DIG + 4) / 5));
- volatile double x = 0.5 - 0.5 / TWO_MANT_DIG;
- exit (x < 0.5 && round (x) != 0.0);
-}]])], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
- [case "$host_os" in
- netbsd* | aix*) gl_cv_func_round_works="guessing no";;
- *) gl_cv_func_round_works="guessing yes";;
- esac
- ])
- LIBS="$save_LIBS"
- ])
- case "$gl_cv_func_round_works" in
- *no) ROUND_LIBM=missing ;;
- esac
- fi
- if test "$ROUND_LIBM" = missing; then
- REPLACE_ROUND=1
- fi
- m4_ifdef([gl_FUNC_ROUND_IEEE], [
- if test $gl_round_required = ieee && test $REPLACE_ROUND = 0; then
- AC_CACHE_CHECK([whether round works according to ISO C 99 with IEC 60559],
- [gl_cv_func_round_ieee],
- [
- save_LIBS="$LIBS"
- LIBS="$LIBS $ROUND_LIBM"
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#ifndef __NO_MATH_INLINES
-# define __NO_MATH_INLINES 1 /* for glibc */
-#endif
-#include <math.h>
-]gl_DOUBLE_MINUS_ZERO_CODE[
-]gl_DOUBLE_SIGNBIT_CODE[
-int main()
-{
- /* Test whether round (-0.0) is -0.0. */
- if (signbitd (minus_zerod) && !signbitd (round (minus_zerod)))
- return 1;
- return 0;
-}
- ]])],
- [gl_cv_func_round_ieee=yes],
- [gl_cv_func_round_ieee=no],
- [gl_cv_func_round_ieee="guessing no"])
- LIBS="$save_LIBS"
- ])
- case "$gl_cv_func_round_ieee" in
- *yes) ;;
- *) REPLACE_ROUND=1 ;;
- esac
- fi
- ])
- else
- HAVE_DECL_ROUND=0
- fi
- if test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1; then
- AC_LIBOBJ([round])
- gl_FUNC_FLOOR_LIBS
- gl_FUNC_CEIL_LIBS
- ROUND_LIBM=
- dnl Append $FLOOR_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
- case " $ROUND_LIBM " in
- *" $FLOOR_LIBM "*) ;;
- *) ROUND_LIBM="$ROUND_LIBM $FLOOR_LIBM" ;;
- esac
- dnl Append $CEIL_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
- case " $ROUND_LIBM " in
- *" $CEIL_LIBM "*) ;;
- *) ROUND_LIBM="$ROUND_LIBM $CEIL_LIBM" ;;
- esac
- fi
- AC_SUBST([ROUND_LIBM])
-])
diff --git a/m4/stat.m4 b/m4/stat.m4
index 4883fe25e..27f82d5a9 100644
--- a/m4/stat.m4
+++ b/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
# Copyright (C) 2009-2011 Free Software Foundation, Inc.
#
@@ -9,7 +9,6 @@
AC_DEFUN([gl_FUNC_STAT],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_REQUIRE([gl_AC_DOS])
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([lstat])
dnl mingw is the only known platform where stat(".") and stat("./") differ
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 26654c68e..e7d0d0765 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 37
+# stdint.m4 serial 39
dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,15 @@ AC_DEFUN([gl_STDINT_H],
fi
AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
+ dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
+ AC_CHECK_HEADERS_ONCE([wchar.h])
+ if test $ac_cv_header_wchar_h = yes; then
+ HAVE_WCHAR_H=1
+ else
+ HAVE_WCHAR_H=0
+ fi
+ AC_SUBST([HAVE_WCHAR_H])
+
dnl Check for <inttypes.h>.
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
if test $ac_cv_header_inttypes_h = yes; then
@@ -292,10 +301,6 @@ static const char *macro_values[] =
fi
AC_SUBST([HAVE_SYS_BITYPES_H])
- dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
- dnl character support).
- AC_CHECK_HEADERS_ONCE([wchar.h])
-
gl_STDINT_TYPE_PROPERTIES
STDINT_H=stdint.h
fi
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index b6163d680..7f3ae5629 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 32
+# stdio_h.m4 serial 33
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_STDIO_H],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
gl_NEXT_HEADERS([stdio.h])
dnl No need to create extra modules for these functions. Everyone who uses
dnl <stdio.h> likely needs them.
@@ -139,23 +138,3 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
])
-
-dnl Code shared by fseeko and ftello. Determine if large files are supported,
-dnl but stdin does not start as a large file by default.
-AC_DEFUN([gl_STDIN_LARGE_OFFSET],
- [
- AC_CACHE_CHECK([whether stdin defaults to large file offsets],
- [gl_cv_var_stdin_large_offset],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
-[[#if defined __SL64 && defined __SCLE /* cygwin */
- /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
- fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
- it is easier to do a version check than building a runtime test. */
-# include <cygwin/version.h>
-# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
- choke me
-# endif
-#endif]])],
- [gl_cv_var_stdin_large_offset=yes],
- [gl_cv_var_stdin_large_offset=no])])
-])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index d28b552e9..25fdada0d 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 36
+# stdlib_h.m4 serial 37
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -44,6 +44,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
+ GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
@@ -62,6 +63,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
+ GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
@@ -91,6 +93,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
+ REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
@@ -98,4 +101,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
+ REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
])
diff --git a/maint.mk b/maint.mk
index 606d42ed1..90c22cfed 100644
--- a/maint.mk
+++ b/maint.mk
@@ -126,8 +126,13 @@ syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
$(srcdir)/$(ME) $(_cfg_mk)))
.PHONY: $(syntax-check-rules)
-local-checks-available = \
- $(syntax-check-rules)
+ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0)
+local-checks-available += $(syntax-check-rules)
+else
+local-checks-available += no-vc-detected
+no-vc-detected:
+ @echo "No version control files detected; skipping syntax check"
+endif
.PHONY: $(local-checks-available)
# Arrange to print the name of each syntax-checking rule just before running it.
@@ -773,17 +778,22 @@ sc_prohibit_cvs_keyword:
# perl -ln -0777 -e '/\n(\n+)$/ and print "$ARGV: ".length $1' ...
# but that would be far less efficient, reading the entire contents
# of each file, rather than just the last two bytes of each.
+# In addition, while the code below detects both blank lines and a missing
+# newline at EOF, the above detects only the former.
#
# This is a perl script that is expected to be the single-quoted argument
# to a command-line "-le". The remaining arguments are file names.
-# Print the name of each file that ends in two or more newline bytes.
+# Print the name of each file that ends in exactly one newline byte.
+# I.e., warn if there are blank lines (2 or more newlines), or if the
+# last byte is not a newline. However, currently we don't complain
+# about any file that contains exactly one byte.
# Exit nonzero if at least one such file is found, otherwise, exit 0.
# Warn about, but otherwise ignore open failure. Ignore seek/read failure.
#
# Use this if you want to remove trailing empty lines from selected files:
# perl -pi -0777 -e 's/\n\n+$/\n/' files...
#
-detect_empty_lines_at_EOF_ = \
+require_exactly_one_NL_at_EOF_ = \
foreach my $$f (@ARGV) \
{ \
open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next; \
@@ -793,12 +803,14 @@ detect_empty_lines_at_EOF_ = \
defined $$p and $$p = sysread F, $$last_two_bytes, 2; \
close F; \
$$c = "ignore read failure"; \
- $$p && $$last_two_bytes eq "\n\n" and (print $$f), $$fail=1; \
+ $$p && ($$last_two_bytes eq "\n\n" \
+ || substr ($$last_two_bytes,1) ne "\n") \
+ and (print $$f), $$fail=1; \
} \
END { exit defined $$fail }
sc_prohibit_empty_lines_at_EOF:
- @perl -le '$(detect_empty_lines_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
- || { echo '$(ME): the above files end with empty line(s)' \
+ @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
+ || { echo '$(ME): empty line(s) or no newline at EOF' \
1>&2; exit 1; } || :; \
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.