diff options
496 files changed, 3134 insertions, 45736 deletions
diff --git a/.gitignore b/.gitignore index 4b94e31cb9..9d976429bc 100644 --- a/.gitignore +++ b/.gitignore @@ -278,40 +278,40 @@ lib/includes/gnutls/gnutls.h lib/libgnutls.la lib/libgnutlsxx.la lib/libtool -lib/m4/codeset.m4 -lib/m4/gettext.m4 -lib/m4/glibc2.m4 -lib/m4/glibc21.m4 -lib/m4/iconv.m4 -lib/m4/intdiv0.m4 -lib/m4/intl.m4 -lib/m4/intldir.m4 -lib/m4/intlmacosx.m4 -lib/m4/intmax.m4 -lib/m4/inttypes-pri.m4 -lib/m4/inttypes_h.m4 -lib/m4/lcmessage.m4 -lib/m4/lib-ld.m4 -lib/m4/lib-link.m4 -lib/m4/lib-prefix.m4 -lib/m4/libtool.m4 -lib/m4/lock.m4 -lib/m4/longlong.m4 -lib/m4/ltoptions.m4 -lib/m4/ltsugar.m4 -lib/m4/ltversion.m4 -lib/m4/lt~obsolete.m4 -lib/m4/nls.m4 -lib/m4/po.m4 -lib/m4/printf-posix.m4 -lib/m4/progtest.m4 -lib/m4/size_max.m4 -lib/m4/stdint_h.m4 -lib/m4/uintmax_t.m4 -lib/m4/visibility.m4 -lib/m4/wchar_t.m4 -lib/m4/wint_t.m4 -lib/m4/xsize.m4 +m4/codeset.m4 +m4/gettext.m4 +m4/glibc2.m4 +m4/glibc21.m4 +m4/iconv.m4 +m4/intdiv0.m4 +m4/intl.m4 +m4/intldir.m4 +m4/intlmacosx.m4 +m4/intmax.m4 +m4/inttypes-pri.m4 +m4/inttypes_h.m4 +m4/lcmessage.m4 +m4/lib-ld.m4 +m4/lib-link.m4 +m4/lib-prefix.m4 +m4/libtool.m4 +m4/lock.m4 +m4/longlong.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +m4/nls.m4 +m4/po.m4 +m4/printf-posix.m4 +m4/progtest.m4 +m4/size_max.m4 +m4/stdint_h.m4 +m4/uintmax_t.m4 +m4/visibility.m4 +m4/wchar_t.m4 +m4/wint_t.m4 +m4/xsize.m4 lib/minitasn1/Makefile lib/minitasn1/Makefile.in lib/minitasn1/libminitasn1.la @@ -323,25 +323,25 @@ lib/openpgp/Makefile lib/openpgp/Makefile.in lib/openpgp/libgnutls_openpgp.la lib/openpgp/pgp-api.texi -lib/po/*.gmo -lib/po/*.po -lib/po/Makefile -lib/po/Makefile.in -lib/po/Makefile.in.in -lib/po/Makevars.template -lib/po/POTFILES -lib/po/Rules-quot -lib/po/boldquot.sed -lib/po/en@boldquot.header -lib/po/en@boldquot.insert-header -lib/po/en@quot.header -lib/po/en@quot.insert-header -lib/po/insert-header.sin -lib/po/libgnutls.pot -lib/po/quot.sed -lib/po/remove-potcdate.sed -lib/po/remove-potcdate.sin -lib/po/stamp-po +po/*.gmo +po/*.po +po/Makefile +po/Makefile.in +po/Makefile.in.in +po/Makevars.template +po/POTFILES +po/Rules-quot +po/boldquot.sed +po/en@boldquot.header +po/en@boldquot.insert-header +po/en@quot.header +po/en@quot.insert-header +po/insert-header.sin +po/gnutls.pot +po/quot.sed +po/remove-potcdate.sed +po/remove-potcdate.sin +po/stamp-po lib/stamp-h1 lib/x509/Makefile lib/x509/Makefile.in @@ -374,11 +374,6 @@ libextra/includes/Makefile.in libextra/libgnutls-extra.la libextra/libgnutls-openssl.la libextra/libtool -libextra/m4/libtool.m4 -libextra/m4/ltoptions.m4 -libextra/m4/ltsugar.m4 -libextra/m4/ltversion.m4 -libextra/m4/lt~obsolete.m4 libextra/stamp-h1 libtool m4/libtool.m4 @@ -493,3 +488,7 @@ tests/x509paths/ tests/x509self tests/x509sign-verify tests/x509signself +doc/examples/ex-cert-select-pkcs11 +gl/m4/fcntl-o.m4 +gl/m4/fcntl_h.m4 +gl/m4/pipe.m4 diff --git a/Makefile.am b/Makefile.am index 0bcd8d7b1e..d0b7159e58 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,12 +22,12 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc -SUBDIRS = lib libextra gl src doc tests +SUBDIRS = lib libextra gl po src doc tests if HAVE_GUILE SUBDIRS += guile endif -ACLOCAL_AMFLAGS = -I m4 -I gl/m4 -I lib/gl/m4 -I libextra/gl/m4 -I lib/m4 -I libextra/m4 +ACLOCAL_AMFLAGS = -I m4 -I gl/m4 EXTRA_DIST = cfg.mk maint.mk .clcopying @@ -23,7 +23,7 @@ WFLAGS ?= --enable-gcc-warnings ADDFLAGS ?= CFGFLAGS ?= --enable-gtk-doc --enable-gtk-doc-pdf $(ADDFLAGS) $(WFLAGS) -INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./lib/gl/ -e ^./gl/ -e ^./libextra/gl/ -e ^./src/cfg/ -e -gaa.[ch] -e asn1_tab.c -e ^./tests/suite/` +INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./gl/ -e ^./src/cfg/ -e -gaa.[ch] -e asn1_tab.c -e ^./tests/suite/` ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile) .DEFAULT_GOAL := bootstrap @@ -46,7 +46,7 @@ autoreconf: done mv lib/build-aux/config.rpath lib/build-aux/config.rpath- test -f ./configure || autoreconf --install - test `hostname` = "gaggia" && cp lib/gl/m4/size_max.m4 lib/m4/ || true + test `hostname` = "gaggia" && cp gl/m4/size_max.m4 m4/ || true mv lib/build-aux/config.rpath- lib/build-aux/config.rpath update-po: refresh-po @@ -59,10 +59,20 @@ update-po: refresh-po bootstrap: autoreconf ./configure $(CFGFLAGS) +#Two runs the first should add the LGPL components and the +#second the components used by src/ files. glimport: - gnulib-tool --m4-base gl/m4 --add-import - cd lib && gnulib-tool --m4-base gl/m4 --add-import - cd libextra && gnulib-tool --m4-base gl/m4 --add-import + ../gnulib/gnulib-tool --m4-base gl/m4 --tests-base=gl/tests --libtool \ + --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl \ + --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests \ + --import crypto/hmac-md5 crypto/md5 extensions havelib lib-msvc-compat lib-symbol-versions \ + byteswap c-ctype func gettext lib-msvc-compat lib-symbol-versions memmem-simple minmax \ + netdb read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd \ + vasprintf vsnprintf manywarnings warnings netinet_in alloca getpass u64 + ../gnulib/gnulib-tool --m4-base gl/m4 --tests-base=gl/tests --libtool \ + --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl \ + --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests \ + --add-import progname version-etc timespec version-etc-fsf gettime # Code Coverage diff --git a/configure.ac b/configure.ac index f7a253f777..b9d7524b6f 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,9 @@ AC_MSG_RESULT([*** dnl Checks for programs. AC_PROG_CC +AC_PROG_CXX +gl_EARLY + AC_PROG_LN_S GTK_DOC_CHECK(1.1) AC_PATH_PROG([GAA], [gaa]) @@ -48,7 +51,6 @@ if test "x$GAA" = "x"; then ***]]) fi -gl_EARLY AC_C_INLINE # For the C++ code @@ -66,6 +68,12 @@ AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no") LIBGNUTLS_HOOKS LIBGNUTLS_EXTRA_HOOKS +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.17]) + +AC_C_BIGENDIAN + + AC_HEADER_STDC AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.]) AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.]) @@ -189,8 +197,58 @@ AC_MSG_RESULT($libcfg_enabled) AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL +# For includes/gnutls/gnutls.h.in. +AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`) +AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`) +AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`) +AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`) +AC_CHECK_TYPE(ssize_t, + [ + DEFINE_SSIZE_T="#include <sys/types.h>" + AC_SUBST(DEFINE_SSIZE_T) + ], [ + AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found]) + DEFINE_SSIZE_T="typedef int ssize_t;" + AC_SUBST(DEFINE_SSIZE_T) + ], [ + #include <sys/types.h> + ]) + +# For minitasn1. +AC_CHECK_SIZEOF(unsigned long int, 4) +AC_CHECK_SIZEOF(unsigned int, 4) + +AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], + [disable zlib compression support]), + ac_zlib=$withval, ac_zlib=yes) +AC_MSG_CHECKING([whether to include zlib compression support]) +if test x$ac_zlib != xno; then + AC_MSG_RESULT(yes) + AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);]) + if test x$ac_cv_libz != xyes; then + AC_MSG_WARN( +*** +*** ZLIB was not found. You will not be able to use ZLIB compression.) + fi +else + AC_MSG_RESULT(no) +fi + +if test x$ac_zlib != xno; then + if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then + GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib" + else + GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE , zlib" + fi +fi +AC_SUBST(GNUTLS_REQUIRES_PRIVATE) + +AC_CHECK_FUNCS(getrusage,,) +AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);]) + gl_INIT + AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], [turn on lots of GCC warnings (for developers)])], @@ -202,6 +260,7 @@ AC_ARG_ENABLE([gcc-warnings], [gl_gcc_warnings=no] ) + if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS]) @@ -245,16 +304,24 @@ if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-fdiagnostics-show-option]) fi -# Export things for */configure.ac. -export WERROR_CFLAGS -export WSTACK_CFLAGS -export WARN_CFLAGS -export use_cxx +AC_SUBST([WERROR_CFLAGS]) +AC_SUBST([WSTACK_CFLAGS]) +AC_SUBST([WARN_CFLAGS]) +AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no") -AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.]) +LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LZO_LIBS $LIBGNUTLS_LIBS" +LIBGNUTLS_EXTRA_CFLAGS="-I${includedir}" +AC_SUBST(LIBGNUTLS_EXTRA_LIBS) +AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS) + +LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS" +LIBGNUTLS_CFLAGS="-I${includedir}" +AC_SUBST(LIBGNUTLS_LIBS) +AC_SUBST(LIBGNUTLS_CFLAGS) -AC_CONFIG_SUBDIRS([lib]) -AC_CONFIG_SUBDIRS([libextra]) + +AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.]) +AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.]) AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile]) AC_CONFIG_FILES([ @@ -293,6 +360,20 @@ AC_CONFIG_FILES([ tests/rsa-md5-collision/Makefile tests/sha2/Makefile tests/userid/Makefile + libextra/Makefile + libextra/gnutls-extra.pc + libextra/includes/Makefile + lib/Makefile + lib/gnutls.pc + lib/includes/Makefile + lib/includes/gnutls/gnutls.h + lib/minitasn1/Makefile + lib/opencdk/Makefile + lib/openpgp/Makefile + po/Makefile.in + lib/x509/Makefile + lib/gcrypt/Makefile + lib/nettle/Makefile ]) if test -d tests/suite;then AC_CONFIG_FILES([tests/suite/Makefile]) diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index 068d7fc25c..f7f61d89eb 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -23,8 +23,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes \ - -I$(top_srcdir)/libextra/includes \ - -I$(top_srcdir)/gl -I$(top_builddir)/gl + -I$(top_srcdir)/libextra/includes # Gnulib warns and suggests use of fseeko instead of fseek, which is # used in ex-cert-select.c, but certificate files will not be > 4 GB, diff --git a/doc/gendocs_template b/doc/gendocs_template deleted file mode 100644 index 5c860fd63d..0000000000 --- a/doc/gendocs_template +++ /dev/null @@ -1,103 +0,0 @@ -<!--#include virtual="/server/header.html" --> -<title>%%TITLE%% - GNU Project - Free Software Foundation (FSF)</title> -<!--#include virtual="/server/banner.html" --> -<h2>%%TITLE%%</h2> - -<!-- This document is in XML, and xhtml 1.0 --> -<!-- Please make sure to properly nest your tags --> -<!-- and ensure that your final document validates --> -<!-- consistent with W3C xhtml 1.0 and CSS standards --> -<!-- See validator.w3.org --> - -<address>Free Software Foundation</address> -<address>last updated %%DATE%%</address> - -<p>This manual (%%PACKAGE%%) is available in the following formats:</p> - -<ul> -<li><a href="%%PACKAGE%%.html">HTML - (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li> -<li><a href="html_node/index.html">HTML</a> - with one web page per - node.</li> -%%IF HTML_SECTION%% -<li><a href="html_section/index.html">HTML</a> - with one web page per - section.</li> -%%ENDIF HTML_SECTION%% -%%IF HTML_CHAPTER%% -<li><a href="html_chapter/index.html">HTML</a> - with one web page per - chapter.</li> -%%ENDIF HTML_CHAPTER%% -<li><a href="%%PACKAGE%%.html.gz">HTML compressed - (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on - one web page.</li> -<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed - (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> - - with one web page per node.</li> -%%IF HTML_SECTION%% -<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed - (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> - - with one web page per section.</li> -%%ENDIF HTML_SECTION%% -%%IF HTML_CHAPTER%% -<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed - (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> - - with one web page per chapter.</li> -%%ENDIF HTML_CHAPTER%% -<li><a href="%%PACKAGE%%.info.tar.gz">Info document - (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li> -<li><a href="%%PACKAGE%%.txt">ASCII text - (%%ASCII_SIZE%%K bytes)</a>.</li> -<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed - (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li> -<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file - (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li> -<li><a href="%%PACKAGE%%.ps.gz">PostScript file - (%%PS_GZ_SIZE%%K bytes gzipped)</a>.</li> -<li><a href="%%PACKAGE%%.pdf">PDF file - (%%PDF_SIZE%%K bytes)</a>.</li> -<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source - (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li> -</ul> - -<p>You can <a href="http://shop.fsf.org/">buy printed copies of -some manuals</a> (among other items) from the Free Software Foundation; -this helps support FSF activities.</p> - -<p>There is also an API reference manual:</p> - -<ul> - <li><a href="../reference/">HTML API Reference Manual (GTK-DOC)</a>.</li> - <li><a href="../reference/gnutls.devhelp">DevHelp API Reference Manual (GTK-DOC)</a>.</li> -</ul> - -<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%% -script</a>.)</p> - -<!-- If needed, change the copyright block at the bottom. In general, --> -<!-- all pages on the GNU web server should have the section about --> -<!-- verbatim copying. Please do NOT remove this without talking --> -<!-- with the webmasters first. --> -<!-- Please make sure the copyright date is consistent with the document --> -<!-- and that it is like this "2001, 2002" not this "2001-2002." --> -</div><!-- for id="content", starts in the include above --> -<!--#include virtual="/server/footer.html" --> -<div id="footer"> - -<p> -Please send FSF & GNU inquiries to -<a href="mailto:gnu@gnu.org"><gnu@gnu.org></a>. -There are also <a href="/contact/">other ways to contact</a> -the FSF.<br /> -Please send broken links and other corrections or suggestions to -<a href="mailto:%%EMAIL%%"><%%EMAIL%%></a>. -</p> - -<p>Copyright © 2010 Free Software Foundation, Inc.</p> - -<p>Verbatim copying and distribution of this entire article is -permitted in any medium, provided this notice is preserved.</p> - -</div> -</div> -</body> -</html> diff --git a/gl/.gitignore b/gl/.gitignore new file mode 100644 index 0000000000..5b0b9a5b3f --- /dev/null +++ b/gl/.gitignore @@ -0,0 +1,82 @@ +/alignof.h +/alloca.c +/alloca.in.h +/asnprintf.c +/asprintf.c +/byteswap.in.h +/c-ctype.c +/c-ctype.h +/close-hook.c +/close-hook.h +/errno.in.h +/float+.h +/float.in.h +/ftello.c +/gettext.h +/hmac-md5.c +/hmac.h +/lseek.c +/malloc.c +/md5.c +/md5.h +/memchr.c +/memchr.valgrind +/memmem.c +/memxor.c +/memxor.h +/minmax.h +/netdb.in.h +/netinet_in.in.h +/printf-args.c +/printf-args.h +/printf-parse.c +/printf-parse.h +/read-file.c +/read-file.h +/realloc.c +/size_max.h +/snprintf.c +/sockets.c +/sockets.h +/stdbool.in.h +/stddef.in.h +/stdint.in.h +/stdio-impl.h +/stdio.in.h +/stdlib.in.h +/str-two-way.h +/strcasecmp.c +/string.in.h +/strings.in.h +/strncasecmp.c +/strverscmp.c +/sys_socket.in.h +/sys_stat.in.h +/time.in.h +/time_r.c +/unistd.in.h +/vasnprintf.c +/vasnprintf.h +/vasprintf.c +/verify.h +/vsnprintf.c +/w32sock.h +/wchar.in.h +/xsize.h +/fseeko.c +/getdelim.c +/getline.c +/getpass.c +/getpass.h +/strdup.c +/u64.h +/progname.c +/progname.h +/stdarg.in.h +/version-etc.c +/version-etc.h +/timespec.h +/version-etc-fsf.c +/gettime.c +/gettimeofday.c +/sys_time.in.h diff --git a/gl/Makefile.am b/gl/Makefile.am index a4c50aad10..b7512c12d7 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright valgrind-tests version-etc-fsf warnings +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --libtool --macro-prefix=gl alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd vasprintf version-etc version-etc-fsf vsnprintf warnings AUTOMAKE_OPTIONS = 1.5 gnits @@ -39,24 +39,9 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) EXTRA_libgnu_la_SOURCES = 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 += $(LIBSOCKET) libgnu_la_LDFLAGS += $(LIB_CLOCK_GETTIME) libgnu_la_LDFLAGS += $(LTLIBINTL) -libgnu_la_LDFLAGS += $(LTLIBREADLINE) -libgnu_la_LDFLAGS += $(SERVENT_LIB) - -## begin gnulib module accept - - -EXTRA_DIST += accept.c w32sock.h - -EXTRA_libgnu_la_SOURCES += accept.c - -## end gnulib module accept ## begin gnulib module alignof @@ -82,12 +67,17 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. -alloca.h: alloca.in.h +if GL_GENERATE_ALLOCA_H +alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +alloca.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += alloca.h alloca.h-t EXTRA_DIST += alloca.in.h @@ -118,46 +108,28 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h ## end gnulib module arg-nonnull -## begin gnulib module arpa_inet +## begin gnulib module byteswap -BUILT_SOURCES += arpa/inet.h +BUILT_SOURCES += $(BYTESWAP_H) -# We need the following in order to create <arpa/inet.h> when the system +# We need the following in order to create <byteswap.h> when the system # doesn't have one. -arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) - $(AM_V_at)$(MKDIR_P) arpa +if GL_GENERATE_BYTESWAP_H +byteswap.h: byteswap.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_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|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ - -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \ - -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ - -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/arpa_inet.in.h; \ + cat $(srcdir)/byteswap.in.h; \ } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t -MOSTLYCLEANDIRS += arpa - -EXTRA_DIST += arpa_inet.in.h - -## end gnulib module arpa_inet - -## begin gnulib module bind - - -EXTRA_DIST += bind.c w32sock.h + mv -f $@-t $@ +else +byteswap.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += byteswap.h byteswap.h-t -EXTRA_libgnu_la_SOURCES += bind.c +EXTRA_DIST += byteswap.in.h -## end gnulib module bind +## end gnulib module byteswap ## begin gnulib module c++defs @@ -189,31 +161,31 @@ libgnu_la_SOURCES += c-ctype.h c-ctype.c ## end gnulib module c-ctype -## begin gnulib module close +## begin gnulib module close-hook +libgnu_la_SOURCES += close-hook.c -EXTRA_DIST += close.c +EXTRA_DIST += close-hook.h -EXTRA_libgnu_la_SOURCES += close.c +## end gnulib module close-hook -## end gnulib module close +## begin gnulib module crypto/hmac-md5 -## begin gnulib module close-hook -libgnu_la_SOURCES += close-hook.c +EXTRA_DIST += hmac-md5.c hmac.h -EXTRA_DIST += close-hook.h +EXTRA_libgnu_la_SOURCES += hmac-md5.c -## end gnulib module close-hook +## end gnulib module crypto/hmac-md5 -## begin gnulib module connect +## begin gnulib module crypto/md5 -EXTRA_DIST += connect.c w32sock.h +EXTRA_DIST += md5.c md5.h -EXTRA_libgnu_la_SOURCES += connect.c +EXTRA_libgnu_la_SOURCES += md5.c -## end gnulib module connect +## end gnulib module crypto/md5 ## begin gnulib module errno @@ -221,7 +193,8 @@ BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create <errno.h> when the system # doesn't have one that is POSIX compliant. -errno.h: errno.in.h +if GL_GENERATE_ERRNO_H +errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -237,37 +210,24 @@ errno.h: errno.in.h < $(srcdir)/errno.in.h; \ } > $@-t && \ mv $@-t $@ +else +errno.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += errno.h errno.h-t EXTRA_DIST += errno.in.h ## end gnulib module errno -## begin gnulib module error - - -EXTRA_DIST += error.c error.h - -EXTRA_libgnu_la_SOURCES += error.c - -## end gnulib module error - -## begin gnulib module fclose - - -EXTRA_DIST += fclose.c - -EXTRA_libgnu_la_SOURCES += fclose.c - -## end gnulib module fclose - ## begin gnulib module float BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. -float.h: float.in.h +if GL_GENERATE_FLOAT_H +float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -277,6 +237,10 @@ float.h: float.in.h < $(srcdir)/float.in.h; \ } > $@-t && \ mv $@-t $@ +else +float.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += float.h float.h-t EXTRA_DIST += float.in.h @@ -301,22 +265,6 @@ EXTRA_libgnu_la_SOURCES += ftello.c ## end gnulib module ftello -## begin gnulib module gendocs - - -EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh - -## end gnulib module gendocs - -## begin gnulib module getaddrinfo - - -EXTRA_DIST += gai_strerror.c getaddrinfo.c - -EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c - -## end gnulib module getaddrinfo - ## begin gnulib module getdelim @@ -335,14 +283,30 @@ EXTRA_libgnu_la_SOURCES += getline.c ## end gnulib module getline -## begin gnulib module getpass-gnu +## begin gnulib module getpass EXTRA_DIST += getpass.c getpass.h EXTRA_libgnu_la_SOURCES += getpass.c -## end gnulib module getpass-gnu +## end gnulib module getpass + +## begin gnulib module gettext + +# This is for those projects which use "gettextize --intl" to put a source-code +# copy of libintl into their package. In such projects, every Makefile.am needs +# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory. +# For the Makefile.ams in other directories it is the maintainer's +# responsibility; for the one from gnulib we do it here. +# This option has no effect when the user disables NLS (because then the intl +# directory contains no libintl.h file) or when the project does not use +# "gettextize --intl". +AM_CPPFLAGS += -I$(top_builddir)/intl + +EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath + +## end gnulib module gettext ## begin gnulib module gettext-h @@ -368,23 +332,6 @@ EXTRA_libgnu_la_SOURCES += gettimeofday.c ## end gnulib module gettimeofday -## begin gnulib module gnumakefile - -distclean-local: clean-GNUmakefile -clean-GNUmakefile: - test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || : - -EXTRA_DIST += $(top_srcdir)/GNUmakefile - -## end gnulib module gnumakefile - -## begin gnulib module gnupload - - -EXTRA_DIST += $(top_srcdir)/build-aux/gnupload - -## end gnulib module gnupload - ## begin gnulib module havelib @@ -392,40 +339,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath ## end gnulib module havelib -## begin gnulib module inet_ntop - - -EXTRA_DIST += inet_ntop.c - -EXTRA_libgnu_la_SOURCES += inet_ntop.c - -## end gnulib module inet_ntop - -## begin gnulib module inet_pton - - -EXTRA_DIST += inet_pton.c - -EXTRA_libgnu_la_SOURCES += inet_pton.c - -## end gnulib module inet_pton - -## begin gnulib module intprops - - -EXTRA_DIST += intprops.h - -## end gnulib module intprops - -## begin gnulib module listen - - -EXTRA_DIST += listen.c w32sock.h - -EXTRA_libgnu_la_SOURCES += listen.c - -## end gnulib module listen - ## begin gnulib module lseek @@ -435,12 +348,6 @@ EXTRA_libgnu_la_SOURCES += lseek.c ## end gnulib module lseek -## begin gnulib module maintainer-makefile - -EXTRA_DIST += $(top_srcdir)/maint.mk - -## end gnulib module maintainer-makefile - ## begin gnulib module malloc-posix @@ -459,6 +366,24 @@ EXTRA_libgnu_la_SOURCES += memchr.c ## end gnulib module memchr +## begin gnulib module memmem-simple + + +EXTRA_DIST += memmem.c str-two-way.h + +EXTRA_libgnu_la_SOURCES += memmem.c + +## end gnulib module memmem-simple + +## begin gnulib module memxor + + +EXTRA_DIST += memxor.c memxor.h + +EXTRA_libgnu_la_SOURCES += memxor.c + +## end gnulib module memxor + ## begin gnulib module minmax libgnu_la_SOURCES += minmax.h @@ -471,7 +396,7 @@ BUILT_SOURCES += netdb.h # We need the following in order to create <netdb.h> when the system # doesn't have one that works with the given compiler. -netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H) +netdb.h: netdb.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -502,7 +427,8 @@ BUILT_SOURCES += $(NETINET_IN_H) # We need the following in order to create <netinet/in.h> when the system # doesn't have one. -netinet/in.h: netinet_in.in.h +if GL_GENERATE_NETINET_IN_H +netinet/in.h: netinet_in.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) netinet $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -514,6 +440,10 @@ netinet/in.h: netinet_in.in.h < $(srcdir)/netinet_in.in.h; \ } > $@-t && \ mv $@-t $@ +else +netinet/in.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t MOSTLYCLEANDIRS += netinet @@ -521,22 +451,6 @@ EXTRA_DIST += netinet_in.in.h ## end gnulib module netinet_in -## begin gnulib module perror - - -EXTRA_DIST += perror.c - -EXTRA_libgnu_la_SOURCES += perror.c - -## end gnulib module perror - -## begin gnulib module pmccabe2html - - -EXTRA_DIST += $(top_srcdir)/build-aux/pmccabe2html $(top_srcdir)/build-aux/pmccabe.css - -## end gnulib module pmccabe2html - ## begin gnulib module progname libgnu_la_SOURCES += progname.h progname.c @@ -552,15 +466,6 @@ EXTRA_libgnu_la_SOURCES += read-file.c ## end gnulib module read-file -## begin gnulib module readline - - -EXTRA_DIST += readline.c readline.h - -EXTRA_libgnu_la_SOURCES += readline.c - -## end gnulib module readline - ## begin gnulib module realloc-posix @@ -570,51 +475,6 @@ EXTRA_libgnu_la_SOURCES += realloc.c ## end gnulib module realloc-posix -## begin gnulib module recv - - -EXTRA_DIST += recv.c w32sock.h - -EXTRA_libgnu_la_SOURCES += recv.c - -## end gnulib module recv - -## begin gnulib module select - - -EXTRA_DIST += select.c - -EXTRA_libgnu_la_SOURCES += select.c - -## end gnulib module select - -## begin gnulib module send - - -EXTRA_DIST += send.c w32sock.h - -EXTRA_libgnu_la_SOURCES += send.c - -## end gnulib module send - -## begin gnulib module setsockopt - - -EXTRA_DIST += setsockopt.c w32sock.h - -EXTRA_libgnu_la_SOURCES += setsockopt.c - -## end gnulib module setsockopt - -## begin gnulib module shutdown - - -EXTRA_DIST += shutdown.c w32sock.h - -EXTRA_libgnu_la_SOURCES += shutdown.c - -## end gnulib module shutdown - ## begin gnulib module size_max libgnu_la_SOURCES += size_max.h @@ -630,15 +490,6 @@ EXTRA_libgnu_la_SOURCES += snprintf.c ## end gnulib module snprintf -## begin gnulib module socket - - -EXTRA_DIST += socket.c w32sock.h - -EXTRA_libgnu_la_SOURCES += socket.c - -## end gnulib module socket - ## begin gnulib module sockets libgnu_la_SOURCES += sockets.h sockets.c @@ -653,7 +504,8 @@ BUILT_SOURCES += $(STDARG_H) # We need the following in order to create <stdarg.h> when the system # doesn't have one that works with the given compiler. -stdarg.h: stdarg.in.h +if GL_GENERATE_STDARG_H +stdarg.h: stdarg.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -663,6 +515,10 @@ stdarg.h: stdarg.in.h < $(srcdir)/stdarg.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdarg.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdarg.h stdarg.h-t EXTRA_DIST += stdarg.in.h @@ -675,12 +531,17 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. -stdbool.h: stdbool.in.h +if GL_GENERATE_STDBOOL_H +stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdbool.h stdbool.h-t EXTRA_DIST += stdbool.in.h @@ -693,7 +554,8 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create <stddef.h> when the system # doesn't have one that works with the given compiler. -stddef.h: stddef.in.h +if GL_GENERATE_STDDEF_H +stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -705,6 +567,10 @@ stddef.h: stddef.in.h < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ +else +stddef.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h @@ -717,7 +583,8 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. -stdint.h: stdint.in.h +if GL_GENERATE_STDINT_H +stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @@ -729,6 +596,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' \ @@ -748,6 +616,10 @@ stdint.h: stdint.in.h < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdint.h stdint.h-t EXTRA_DIST += stdint.in.h @@ -760,7 +632,7 @@ BUILT_SOURCES += stdio.h # We need the following in order to create <stdio.h> when the system # doesn't have one that works with the given compiler. -stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -810,6 +682,8 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ + -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ + -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ @@ -859,9 +733,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 @@ -871,7 +743,7 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -886,6 +758,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' \ @@ -904,7 +777,9 @@ 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|@''HAVE__EXIT''@|$(HAVE__EXIT)|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' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ @@ -920,17 +795,18 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ - -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ - -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ + -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -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' \ @@ -938,10 +814,10 @@ 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)' \ - < $(srcdir)/stdlib.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t @@ -950,14 +826,23 @@ EXTRA_DIST += stdlib.in.h ## end gnulib module stdlib -## begin gnulib module strerror +## begin gnulib module strcase + + +EXTRA_DIST += strcasecmp.c strncasecmp.c + +EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c + +## end gnulib module strcase +## begin gnulib module strdup-posix -EXTRA_DIST += strerror.c -EXTRA_libgnu_la_SOURCES += strerror.c +EXTRA_DIST += strdup.c -## end gnulib module strerror +EXTRA_libgnu_la_SOURCES += strdup.c + +## end gnulib module strdup-posix ## begin gnulib module string @@ -965,7 +850,7 @@ BUILT_SOURCES += string.h # We need the following in order to create <string.h> when the system # doesn't have one that works with the given compiler. -string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -1053,35 +938,40 @@ EXTRA_DIST += string.in.h ## end gnulib module string -## begin gnulib module sys_select +## begin gnulib module strings -BUILT_SOURCES += sys/select.h +BUILT_SOURCES += strings.h -# We need the following in order to create <sys/select.h> when the system +# We need the following in order to create <strings.h> when the system # doesn't have one that works with the given compiler. -sys/select.h: sys_select.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) - $(AM_V_at)$(MKDIR_P) sys +strings.h: strings.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \ - -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \ - -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \ - -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ - -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ + -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ + -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/sys_select.in.h; \ + < $(srcdir)/strings.in.h; \ } > $@-t && \ mv $@-t $@ -MOSTLYCLEANFILES += sys/select.h sys/select.h-t -MOSTLYCLEANDIRS += sys +MOSTLYCLEANFILES += strings.h strings.h-t + +EXTRA_DIST += strings.in.h + +## end gnulib module strings + +## begin gnulib module strverscmp -EXTRA_DIST += sys_select.in.h -## end gnulib module sys_select +EXTRA_DIST += strverscmp.c + +EXTRA_libgnu_la_SOURCES += strverscmp.c + +## end gnulib module strverscmp ## begin gnulib module sys_socket @@ -1089,7 +979,7 @@ BUILT_SOURCES += sys/socket.h # We need the following in order to create <sys/socket.h> when the system # doesn't have one that works with the given compiler. -sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) +sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1139,7 +1029,7 @@ BUILT_SOURCES += sys/stat.h # We need the following in order to create <sys/stat.h> when the system # has one that is incomplete. -sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1198,7 +1088,7 @@ BUILT_SOURCES += sys/time.h # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. -sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1229,7 +1119,7 @@ BUILT_SOURCES += time.h # We need the following in order to create <time.h> when the system # doesn't have one that works with the given compiler. -time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -1241,7 +1131,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \ -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \ -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \ - -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \ + -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ @@ -1264,6 +1154,15 @@ EXTRA_DIST += time.in.h ## end gnulib module time +## begin gnulib module time_r + + +EXTRA_DIST += time_r.c + +EXTRA_libgnu_la_SOURCES += time_r.c + +## end gnulib module time_r + ## begin gnulib module timespec @@ -1271,13 +1170,20 @@ EXTRA_DIST += timespec.h ## end gnulib module timespec +## begin gnulib module u64 + + +EXTRA_DIST += u64.h + +## end gnulib module u64 + ## begin gnulib module unistd BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -1309,6 +1215,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_PIPE''@|$(GNULIB_PIPE)|g' \ -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ @@ -1343,6 +1250,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ @@ -1351,23 +1259,26 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ - -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|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_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ + -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ - -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + | \ + sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ + -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ @@ -1398,20 +1309,6 @@ EXTRA_DIST += unistd.in.h ## end gnulib module unistd -## begin gnulib module update-copyright - - -EXTRA_DIST += $(top_srcdir)/build-aux/update-copyright - -## end gnulib module update-copyright - -## begin gnulib module useless-if-before-free - - -EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free - -## end gnulib module useless-if-before-free - ## begin gnulib module vasnprintf @@ -1421,12 +1318,14 @@ EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ## end gnulib module vasnprintf -## begin gnulib module vc-list-files +## begin gnulib module vasprintf -EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files +EXTRA_DIST += asprintf.c vasprintf.c -## end gnulib module vc-list-files +EXTRA_libgnu_la_SOURCES += asprintf.c vasprintf.c + +## end gnulib module vasprintf ## begin gnulib module verify @@ -1446,6 +1345,15 @@ libgnu_la_SOURCES += version-etc-fsf.c ## end gnulib module version-etc-fsf +## begin gnulib module vsnprintf + + +EXTRA_DIST += vsnprintf.c + +EXTRA_libgnu_la_SOURCES += vsnprintf.c + +## end gnulib module vsnprintf + ## begin gnulib module warn-on-use BUILT_SOURCES += warn-on-use.h @@ -1471,7 +1379,7 @@ BUILT_SOURCES += wchar.h # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -1491,7 +1399,36 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ + -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \ + -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \ + -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \ + -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \ + -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \ + -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \ + -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \ + -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \ + -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \ + -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \ + -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \ + -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \ + -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \ + -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \ + -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \ + -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \ + -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \ + -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \ + -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \ + -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \ + -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \ + -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \ + -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \ + -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \ + -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \ + -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \ + -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \ + -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \ + < $(srcdir)/wchar.in.h | \ + sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ @@ -1501,9 +1438,38 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ + -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ + -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ + -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ + -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ + -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ + -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ + -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ + -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ + -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ + -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ + -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ + -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ + -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ + -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ + -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ + -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ + -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ + -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ + -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ + -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ + -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ + -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ + -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ + -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ + -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ + -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ + -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ + -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ - -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ + | \ + sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ @@ -1515,10 +1481,10 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/wchar.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t diff --git a/gl/accept.c b/gl/accept.c deleted file mode 100644 index a68f7dcfc0..0000000000 --- a/gl/accept.c +++ /dev/null @@ -1,42 +0,0 @@ -/* accept.c --- wrappers for Windows accept function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef accept - -int -rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen) -{ - SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen); - if (fh == INVALID_SOCKET) - { - set_winsock_errno (); - return -1; - } - else - return SOCKET_TO_FD (fh); -} diff --git a/gl/alignof.h b/gl/alignof.h index 240468c682..03bed6f4a9 100644 --- a/gl/alignof.h +++ b/gl/alignof.h @@ -1,5 +1,5 @@ /* Determine alignment of types. - Copyright (C) 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2003-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 General Public License as published by diff --git a/gl/alloca.c b/gl/alloca.c index 75afdb9607..771c2faa34 100644 --- a/gl/alloca.c +++ b/gl/alloca.c @@ -94,21 +94,20 @@ static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir static void -find_stack_direction (void) +find_stack_direction (char **ptr) { - static char *addr = NULL; /* Address of first `dummy', once known. */ auto char dummy; /* To get stack address. */ - if (addr == NULL) + if (*ptr == NULL) { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); + *ptr = ADDRESS_FUNCTION (dummy); - find_stack_direction (); /* Recurse once. */ + find_stack_direction (ptr); /* Recurse once. */ } else { /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) + if (ADDRESS_FUNCTION (dummy) > *ptr) stack_dir = 1; /* Stack grew upward. */ else stack_dir = -1; /* Stack grew downward. */ @@ -155,7 +154,10 @@ alloca (size_t size) # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); + { + char *addr = NULL; /* Address of first `dummy', once known. */ + find_stack_direction (&addr); + } # endif /* Reclaim garbage, defined as all alloca'd storage that diff --git a/gl/alloca.in.h b/gl/alloca.in.h index 44f20b7a1a..5b69c6c81a 100644 --- a/gl/alloca.in.h +++ b/gl/alloca.in.h @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h deleted file mode 100644 index f17d642b84..0000000000 --- a/gl/arpa_inet.in.h +++ /dev/null @@ -1,102 +0,0 @@ -/* A GNU-like <arpa/inet.h>. - - Copyright (C) 2005-2006, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_ARPA_INET_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#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 - under MinGW. - But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# include <sys/socket.h> -#endif - -#if @HAVE_ARPA_INET_H@ - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@ - -#endif - -#ifndef _GL_ARPA_INET_H -#define _GL_ARPA_INET_H - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if @GNULIB_INET_NTOP@ -# if !@HAVE_DECL_INET_NTOP@ -/* Converts an internet address from internal format to a printable, - presentable format. - AF is an internet address family, such as AF_INET or AF_INET6. - SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr' - (for AF_INET6). - DST points to a buffer having room for CNT bytes. - The printable representation of the address (in numeric form, not - surrounded by [...], no reverse DNS is done) is placed in DST, and - DST is returned. If an error occurs, the return value is NULL and - errno is set. If CNT bytes are not sufficient to hold the result, - the return value is NULL and errno is set to ENOSPC. A good value - for CNT is 46. - - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */ -extern const char *inet_ntop (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) - _GL_ARG_NONNULL ((2, 3)); -# endif -#elif defined GNULIB_POSIXCHECK -# undef inet_ntop -# if HAVE_RAW_DECL_INET_NTOP -_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " - "use gnulib module inet_ntop for portability"); -# endif -#endif - -#if @GNULIB_INET_PTON@ -# if !@HAVE_DECL_INET_PTON@ -extern int inet_pton (int af, const char *restrict src, void *restrict dst) - _GL_ARG_NONNULL ((2, 3)); -# endif -#elif defined GNULIB_POSIXCHECK -# undef inet_pton -# if HAVE_RAW_DECL_INET_PTON -_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " - "use gnulib module inet_pton for portability"); -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_ARPA_INET_H */ -#endif /* _GL_ARPA_INET_H */ diff --git a/gl/asnprintf.c b/gl/asnprintf.c index 3bd2229d52..e4fd95c6ee 100644 --- a/gl/asnprintf.c +++ b/gl/asnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 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 General Public License as published by diff --git a/gl/bind.c b/gl/bind.c deleted file mode 100644 index b974d63c8a..0000000000 --- a/gl/bind.c +++ /dev/null @@ -1,40 +0,0 @@ -/* bind.c --- wrappers for Windows bind function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef bind - -int -rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = bind (sock, sockaddr, len); - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/c-ctype.c b/gl/c-ctype.c index 0d8da205b6..0fb42953ab 100644 --- a/gl/c-ctype.c +++ b/gl/c-ctype.c @@ -1,6 +1,6 @@ /* Character handling in C locale. - Copyright 2000-2003, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright 2000-2003, 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 General Public License as published by diff --git a/gl/c-ctype.h b/gl/c-ctype.h index 0eb27e659b..57e71ee02c 100644 --- a/gl/c-ctype.h +++ b/gl/c-ctype.h @@ -5,7 +5,7 @@ <ctype.h> functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/close-hook.c b/gl/close-hook.c index 0253c4dc59..ecc5f46cdb 100644 --- a/gl/close-hook.c +++ b/gl/close-hook.c @@ -1,5 +1,5 @@ /* Hook for making the close() function extensible. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 @@ -10,7 +10,7 @@ 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. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ diff --git a/gl/close-hook.h b/gl/close-hook.h index 1e115516d6..283bebbe3f 100644 --- a/gl/close-hook.h +++ b/gl/close-hook.h @@ -1,5 +1,5 @@ /* Hook for making the close() function extensible. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -9,7 +9,7 @@ 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. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ diff --git a/gl/close.c b/gl/close.c deleted file mode 100644 index afa8f64058..0000000000 --- a/gl/close.c +++ /dev/null @@ -1,42 +0,0 @@ -/* close replacement. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -#include "close-hook.h" - -/* Override close() to call into other gnulib modules. */ - -int -rpl_close (int fd) -#undef close -{ -#if WINDOWS_SOCKETS - int retval = execute_all_close_hooks (fd); -#else - int retval = close (fd); -#endif - -#if REPLACE_FCHDIR - if (retval >= 0) - _gl_unregister_fd (fd); -#endif - - return retval; -} diff --git a/gl/connect.c b/gl/connect.c deleted file mode 100644 index 70a5ff6d06..0000000000 --- a/gl/connect.c +++ /dev/null @@ -1,47 +0,0 @@ -/* connect.c --- wrappers for Windows connect function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef connect - -int -rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = connect (sock, sockaddr, len); - if (r < 0) - { - /* EINPROGRESS is not returned by WinSock 2.0; for backwards - compatibility, connect(2) uses EWOULDBLOCK. */ - if (WSAGetLastError () == WSAEWOULDBLOCK) - WSASetLastError (WSAEINPROGRESS); - - set_winsock_errno (); - } - - return r; -} diff --git a/gl/errno.in.h b/gl/errno.in.h index 7ebaddcfc2..a91f5912ea 100644 --- a/gl/errno.in.h +++ b/gl/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like <errno.h>. - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/error.c b/gl/error.c deleted file mode 100644 index ed9dba0d27..0000000000 --- a/gl/error.c +++ /dev/null @@ -1,394 +0,0 @@ -/* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ - -#if !_LIBC -# include <config.h> -#endif - -#include "error.h" - -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if !_LIBC && ENABLE_NLS -# include "gettext.h" -# define _(msgid) gettext (msgid) -#endif - -#ifdef _LIBC -# include <libintl.h> -# include <stdbool.h> -# include <stdint.h> -# include <wchar.h> -# define mbsrtowcs __mbsrtowcs -#endif - -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - -#ifndef _ -# define _(String) String -#endif - -/* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -void (*error_print_progname) (void); - -/* This variable is incremented each time `error' is called. */ -unsigned int error_message_count; - -#ifdef _LIBC -/* In the GNU C library, there is a predefined variable for this. */ - -# define program_name program_invocation_name -# include <errno.h> -# include <limits.h> -# include <libio/libioP.h> - -/* In GNU libc we want do not want to use the common name `error' directly. - Instead make it a weak alias. */ -extern void __error (int status, int errnum, const char *message, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); -extern void __error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, - ...) - __attribute__ ((__format__ (__printf__, 5, 6)));; -# define error __error -# define error_at_line __error_at_line - -# include <libio/iolibio.h> -# define fflush(s) INTUSE(_IO_fflush) (s) -# undef putc -# define putc(c, fp) INTUSE(_IO_putc) (c, fp) - -# include <bits/libc-lock.h> - -#else /* not _LIBC */ - -# include <fcntl.h> -# include <unistd.h> - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -# endif - -/* The gnulib override of fcntl is not needed in this file. */ -# undef fcntl - -# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P -# ifndef HAVE_DECL_STRERROR_R -"this configure-time declaration test was not run" -# endif -char *strerror_r (); -# endif - -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; - -# if HAVE_STRERROR_R || defined strerror_r -# define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ -#endif /* not _LIBC */ - -#if !_LIBC -/* Return non-zero if FD is open. */ -static inline int -is_open (int fd) -{ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On Win32: The initial state of unassigned standard file descriptors is - that they are open but point to an INVALID_HANDLE_VALUE. There is no - fcntl, and the gnulib replacement fcntl does not support F_GETFL. */ - return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; -# else -# ifndef F_GETFL -# error Please port fcntl to your platform -# endif - return 0 <= fcntl (fd, F_GETFL); -# endif -} -#endif - -static inline void -flush_stdout (void) -{ -#if !_LIBC - int stdout_fd; - -# if GNULIB_FREOPEN_SAFER - /* Use of gnulib's freopen-safer module normally ensures that - fileno (stdout) == 1 - whenever stdout is open. */ - stdout_fd = STDOUT_FILENO; -# else - /* POSIX states that fileno (stdout) after fclose is unspecified. But in - practice it is not a problem, because stdout is statically allocated and - the fd of a FILE stream is stored as a field in its allocated memory. */ - stdout_fd = fileno (stdout); -# endif - /* POSIX states that fflush (stdout) after fclose is unspecified; it - is safe in glibc, but not on all other platforms. fflush (NULL) - is always defined, but too draconian. */ - if (0 <= stdout_fd && is_open (stdout_fd)) -#endif - fflush (stdout); -} - -static void -print_errno_message (int errnum) -{ - char const *s; - -#if defined HAVE_STRERROR_R || _LIBC - char errbuf[1024]; -# if STRERROR_R_CHAR_P || _LIBC - s = __strerror_r (errnum, errbuf, sizeof errbuf); -# else - if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) - s = errbuf; - else - s = 0; -# endif -#else - s = strerror (errnum); -#endif - -#if !_LIBC - if (! s) - s = _("Unknown system error"); -#endif - -#if _LIBC - __fxprintf (NULL, ": %s", s); -#else - fprintf (stderr, ": %s", s); -#endif -} - -static void -error_tail (int status, int errnum, const char *message, va_list args) -{ -#if _LIBC - if (_IO_fwide (stderr, 0) > 0) - { -# define ALLOCA_LIMIT 2000 - size_t len = strlen (message) + 1; - wchar_t *wmessage = NULL; - mbstate_t st; - size_t res; - const char *tmp; - bool use_malloc = false; - - while (1) - { - if (__libc_use_alloca (len * sizeof (wchar_t))) - wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); - else - { - if (!use_malloc) - wmessage = NULL; - - wchar_t *p = (wchar_t *) realloc (wmessage, - len * sizeof (wchar_t)); - if (p == NULL) - { - free (wmessage); - fputws_unlocked (L"out of memory\n", stderr); - return; - } - wmessage = p; - use_malloc = true; - } - - memset (&st, '\0', sizeof (st)); - tmp = message; - - res = mbsrtowcs (wmessage, &tmp, len, &st); - if (res != len) - break; - - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) - { - /* This really should not happen if everything is fine. */ - res = (size_t) -1; - break; - } - - len *= 2; - } - - if (res == (size_t) -1) - { - /* The string cannot be converted. */ - if (use_malloc) - { - free (wmessage); - use_malloc = false; - } - wmessage = (wchar_t *) L"???"; - } - - __vfwprintf (stderr, wmessage, args); - - if (use_malloc) - free (wmessage); - } - else -#endif - vfprintf (stderr, message, args); - va_end (args); - - ++error_message_count; - if (errnum) - print_errno_message (errnum); -#if _LIBC - __fxprintf (NULL, "\n"); -#else - putc ('\n', stderr); -#endif - fflush (stderr); - if (status) - exit (status); -} - - -/* Print the program name and error message MESSAGE, which is a printf-style - format string with optional args. - If ERRNUM is nonzero, print its corresponding system error message. - Exit with status STATUS if it is nonzero. */ -void -error (int status, int errnum, const char *message, ...) -{ - va_list args; - -#if defined _LIBC && defined __libc_ptf_call - /* We do not want this call to be cut short by a thread - cancellation. Therefore disable cancellation for now. */ - int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); -#endif - - flush_stdout (); -#ifdef _LIBC - _IO_flockfile (stderr); -#endif - if (error_print_progname) - (*error_print_progname) (); - else - { -#if _LIBC - __fxprintf (NULL, "%s: ", program_name); -#else - fprintf (stderr, "%s: ", program_name); -#endif - } - - va_start (args, message); - error_tail (status, errnum, message, args); - -#ifdef _LIBC - _IO_funlockfile (stderr); -# ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); -# endif -#endif -} - -/* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -int error_one_per_line; - -void -error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, ...) -{ - va_list args; - - if (error_one_per_line) - { - static const char *old_file_name; - static unsigned int old_line_number; - - if (old_line_number == line_number - && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) - /* Simply return and print nothing. */ - return; - - old_file_name = file_name; - old_line_number = line_number; - } - -#if defined _LIBC && defined __libc_ptf_call - /* We do not want this call to be cut short by a thread - cancellation. Therefore disable cancellation for now. */ - int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); -#endif - - flush_stdout (); -#ifdef _LIBC - _IO_flockfile (stderr); -#endif - if (error_print_progname) - (*error_print_progname) (); - else - { -#if _LIBC - __fxprintf (NULL, "%s:", program_name); -#else - fprintf (stderr, "%s:", program_name); -#endif - } - -#if _LIBC - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); -#else - fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); -#endif - - va_start (args, message); - error_tail (status, errnum, message, args); - -#ifdef _LIBC - _IO_funlockfile (stderr); -# ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); -# endif -#endif -} - -#ifdef _LIBC -/* Make the weak alias. */ -# undef error -# undef error_at_line -weak_alias (__error, error) -weak_alias (__error_at_line, error_at_line) -#endif diff --git a/gl/error.h b/gl/error.h deleted file mode 100644 index 9deef02d2f..0000000000 --- a/gl/error.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _ERROR_H -#define _ERROR_H 1 - -#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 - 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 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Print a message with `fprintf (stderr, FORMAT, ...)'; - if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). - If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ - -extern void error (int __status, int __errnum, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); - -extern void error_at_line (int __status, int __errnum, const char *__fname, - unsigned int __lineno, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 5, 6))); - -/* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -extern void (*error_print_progname) (void); - -/* This variable is incremented each time `error' is called. */ -extern unsigned int error_message_count; - -/* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -extern int error_one_per_line; - -#ifdef __cplusplus -} -#endif - -#endif /* error.h */ diff --git a/gl/fclose.c b/gl/fclose.c deleted file mode 100644 index 9f4388912a..0000000000 --- a/gl/fclose.c +++ /dev/null @@ -1,47 +0,0 @@ -/* fclose replacement. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> -#include <unistd.h> - -/* Override fclose() to call the overridden close(). */ - -int -rpl_fclose (FILE *fp) -#undef fclose -{ - int saved_errno = 0; - - if (fflush (fp)) - saved_errno = errno; - - if (close (fileno (fp)) < 0 && saved_errno == 0) - saved_errno = errno; - - fclose (fp); /* will fail with errno = EBADF */ - - if (saved_errno != 0) - { - errno = saved_errno; - return EOF; - } - return 0; -} diff --git a/gl/float+.h b/gl/float+.h index bf6714ae10..2e844890c9 100644 --- a/gl/float+.h +++ b/gl/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software; you can redistribute it and/or modify diff --git a/gl/float.in.h b/gl/float.in.h index a68ec61a96..d32f20ee4d 100644 --- a/gl/float.in.h +++ b/gl/float.in.h @@ -1,6 +1,6 @@ /* A correct <float.h>. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/fseeko.c b/gl/fseeko.c index 05a7384c07..2dd4cdcd94 100644 --- a/gl/fseeko.c +++ b/gl/fseeko.c @@ -1,5 +1,5 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ fseeko (FILE *fp, off_t offset, int whence) && fp->_rcount == 0 && fp->_wcount == 0 && fp->_ungetc_count == 0) -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ if (fp_->_ptr == fp_->_base && (fp_->_ptr == NULL || fp_->_cnt == 0)) #elif defined __UCLIBC__ /* uClibc */ @@ -131,7 +131,7 @@ fseeko (FILE *fp, off_t offset, int whence) fp_->_flags &= ~__SEOF; #elif defined __EMX__ /* emx+gcc */ fp->_flags &= ~_IOEOF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ fp->_flag &= ~_IOEOF; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__offset = pos; diff --git a/gl/ftello.c b/gl/ftello.c index 098e36ae58..fbdc44f2ea 100644 --- a/gl/ftello.c +++ b/gl/ftello.c @@ -1,5 +1,5 @@ /* An ftello() function that works around platform bugs. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ ftello (FILE *fp) ftello (fp); /* Compute the file position ourselves. */ - pos = llseek (fileno (fp), (off_t) 0, SEEK_CUR); + pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR); if (pos >= 0) { if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL) diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c deleted file mode 100644 index c05b5c47ee..0000000000 --- a/gl/gai_strerror.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 Free - Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _LIBC -# include <config.h> -#endif - -#include <stdio.h> -#include <netdb.h> - -#ifdef _LIBC -# include <libintl.h> -#else -# include "gettext.h" -# define _(String) gettext (String) -# define N_(String) String -#endif - -static struct - { - int code; - const char *msg; - } -values[] = - { - { EAI_ADDRFAMILY, N_("Address family for hostname not supported") }, - { EAI_AGAIN, N_("Temporary failure in name resolution") }, - { EAI_BADFLAGS, N_("Bad value for ai_flags") }, - { EAI_FAIL, N_("Non-recoverable failure in name resolution") }, - { EAI_FAMILY, N_("ai_family not supported") }, - { EAI_MEMORY, N_("Memory allocation failure") }, - { EAI_NODATA, N_("No address associated with hostname") }, - { EAI_NONAME, N_("Name or service not known") }, - { EAI_SERVICE, N_("Servname not supported for ai_socktype") }, - { EAI_SOCKTYPE, N_("ai_socktype not supported") }, - { EAI_SYSTEM, N_("System error") }, - { EAI_OVERFLOW, N_("Argument buffer too small") }, -#ifdef EAI_INPROGRESS - { EAI_INPROGRESS, N_("Processing request in progress") }, - { EAI_CANCELED, N_("Request canceled") }, - { EAI_NOTCANCELED, N_("Request not canceled") }, - { EAI_ALLDONE, N_("All requests done") }, - { EAI_INTR, N_("Interrupted by a signal") }, - { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") } -#endif - }; - -const char * -gai_strerror (int code) -{ - size_t i; - for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i) - if (values[i].code == code) - return _(values[i].msg); - - return _("Unknown error"); -} -#ifdef _LIBC -libc_hidden_def (gai_strerror) -#endif diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c deleted file mode 100644 index 4734606a47..0000000000 --- a/gl/getaddrinfo.c +++ /dev/null @@ -1,444 +0,0 @@ -/* Get address information (partial implementation). - Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc. - Contributed by Simon Josefsson <simon@josefsson.org>. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc - optimizes away the sa == NULL test below. */ -#define _GL_ARG_NONNULL(params) - -#include <netdb.h> - -#if HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif - -/* Get inet_ntop. */ -#include <arpa/inet.h> - -/* Get calloc. */ -#include <stdlib.h> - -/* Get memcpy, strdup. */ -#include <string.h> - -/* Get snprintf. */ -#include <stdio.h> - -#include <stdbool.h> - -#include "gettext.h" -#define _(String) gettext (String) -#define N_(String) String - -/* BeOS has AF_INET, but not PF_INET. */ -#ifndef PF_INET -# define PF_INET AF_INET -#endif -/* BeOS also lacks PF_UNSPEC. */ -#ifndef PF_UNSPEC -# define PF_UNSPEC 0 -#endif - -#if defined _WIN32 || defined __WIN32__ -# define WIN32_NATIVE -#endif - -/* gl_sockets_startup */ -#include "sockets.h" - -#ifdef WIN32_NATIVE -typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*, - const struct addrinfo*, - struct addrinfo**); -typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*); -typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*, - socklen_t, char*, DWORD, - char*, DWORD, int); - -static getaddrinfo_func getaddrinfo_ptr = NULL; -static freeaddrinfo_func freeaddrinfo_ptr = NULL; -static getnameinfo_func getnameinfo_ptr = NULL; - -static int -use_win32_p (void) -{ - static int done = 0; - HMODULE h; - - if (done) - return getaddrinfo_ptr ? 1 : 0; - - done = 1; - - h = GetModuleHandle ("ws2_32.dll"); - - if (h) - { - getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo"); - freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo"); - getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo"); - } - - /* If either is missing, something is odd. */ - if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr) - { - getaddrinfo_ptr = NULL; - freeaddrinfo_ptr = NULL; - getnameinfo_ptr = NULL; - return 0; - } - - gl_sockets_startup (SOCKETS_1_1); - - return 1; -} -#endif - -static inline bool -validate_family (int family) -{ - /* FIXME: Support more families. */ -#if HAVE_IPV4 - if (family == PF_INET) - return true; -#endif -#if HAVE_IPV6 - if (family == PF_INET6) - return true; -#endif - if (family == PF_UNSPEC) - return true; - return false; -} - -/* Translate name of a service location and/or a service name to set of - socket addresses. */ -int -getaddrinfo (const char *restrict nodename, - const char *restrict servname, - const struct addrinfo *restrict hints, - struct addrinfo **restrict res) -{ - struct addrinfo *tmp; - int port = 0; - struct hostent *he; - void *storage; - size_t size; -#if HAVE_IPV6 - struct v6_pair { - struct addrinfo addrinfo; - struct sockaddr_in6 sockaddr_in6; - }; -#endif -#if HAVE_IPV4 - struct v4_pair { - struct addrinfo addrinfo; - struct sockaddr_in sockaddr_in; - }; -#endif - -#ifdef WIN32_NATIVE - if (use_win32_p ()) - return getaddrinfo_ptr (nodename, servname, hints, res); -#endif - - if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE))) - /* FIXME: Support more flags. */ - return EAI_BADFLAGS; - - if (hints && !validate_family (hints->ai_family)) - return EAI_FAMILY; - - if (hints && - hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM) - /* FIXME: Support other socktype. */ - return EAI_SOCKTYPE; /* FIXME: Better return code? */ - - if (!nodename) - { - if (!(hints->ai_flags & AI_PASSIVE)) - return EAI_NONAME; - -#ifdef HAVE_IPV6 - nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0"; -#else - nodename = "0.0.0.0"; -#endif - } - - if (servname) - { - struct servent *se = NULL; - const char *proto = - (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp"; - - if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV)) - /* FIXME: Use getservbyname_r if available. */ - se = getservbyname (servname, proto); - - if (!se) - { - char *c; - if (!(*servname >= '0' && *servname <= '9')) - return EAI_NONAME; - port = strtoul (servname, &c, 10); - if (*c || port > 0xffff) - return EAI_NONAME; - port = htons (port); - } - else - port = se->s_port; - } - - /* FIXME: Use gethostbyname_r if available. */ - he = gethostbyname (nodename); - if (!he || he->h_addr_list[0] == NULL) - return EAI_NONAME; - - switch (he->h_addrtype) - { -#if HAVE_IPV6 - case PF_INET6: - size = sizeof (struct v6_pair); - break; -#endif - -#if HAVE_IPV4 - case PF_INET: - size = sizeof (struct v4_pair); - break; -#endif - - default: - return EAI_NODATA; - } - - storage = calloc (1, size); - if (!storage) - return EAI_MEMORY; - - switch (he->h_addrtype) - { -#if HAVE_IPV6 - case PF_INET6: - { - struct v6_pair *p = storage; - struct sockaddr_in6 *sinp = &p->sockaddr_in6; - tmp = &p->addrinfo; - - if (port) - sinp->sin6_port = port; - - if (he->h_length != sizeof (sinp->sin6_addr)) - { - free (storage); - return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ - } - - memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr); - - tmp->ai_addr = (struct sockaddr *) sinp; - tmp->ai_addrlen = sizeof *sinp; - } - break; -#endif - -#if HAVE_IPV4 - case PF_INET: - { - struct v4_pair *p = storage; - struct sockaddr_in *sinp = &p->sockaddr_in; - tmp = &p->addrinfo; - - if (port) - sinp->sin_port = port; - - if (he->h_length != sizeof (sinp->sin_addr)) - { - free (storage); - return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ - } - - memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr); - - tmp->ai_addr = (struct sockaddr *) sinp; - tmp->ai_addrlen = sizeof *sinp; - } - break; -#endif - - default: - free (storage); - return EAI_NODATA; - } - - if (hints && hints->ai_flags & AI_CANONNAME) - { - const char *cn; - if (he->h_name) - cn = he->h_name; - else - cn = nodename; - - tmp->ai_canonname = strdup (cn); - if (!tmp->ai_canonname) - { - free (storage); - return EAI_MEMORY; - } - } - - tmp->ai_protocol = (hints) ? hints->ai_protocol : 0; - tmp->ai_socktype = (hints) ? hints->ai_socktype : 0; - tmp->ai_addr->sa_family = he->h_addrtype; - tmp->ai_family = he->h_addrtype; - -#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - switch (he->h_addrtype) - { -#if HAVE_IPV4 - case AF_INET: - tmp->ai_addr->sa_len = sizeof (struct sockaddr_in); - break; -#endif -#if HAVE_IPV6 - case AF_INET6: - tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6); - break; -#endif - } -#endif - - /* FIXME: If more than one address, create linked list of addrinfo's. */ - - *res = tmp; - - return 0; -} - -/* Free `addrinfo' structure AI including associated storage. */ -void -freeaddrinfo (struct addrinfo *ai) -{ -#ifdef WIN32_NATIVE - if (use_win32_p ()) - { - freeaddrinfo_ptr (ai); - return; - } -#endif - - while (ai) - { - struct addrinfo *cur; - - cur = ai; - ai = ai->ai_next; - - free (cur->ai_canonname); - free (cur); - } -} - -int -getnameinfo (const struct sockaddr *restrict sa, socklen_t salen, - char *restrict node, socklen_t nodelen, - char *restrict service, socklen_t servicelen, - int flags) -{ -#ifdef WIN32_NATIVE - if (use_win32_p ()) - return getnameinfo_ptr (sa, salen, node, nodelen, - service, servicelen, flags); -#endif - - /* FIXME: Support other flags. */ - if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) || - (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) || - (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV))) - return EAI_BADFLAGS; - - if (sa == NULL || salen < sizeof (sa->sa_family)) - return EAI_FAMILY; - - switch (sa->sa_family) - { -#if HAVE_IPV4 - case AF_INET: - if (salen < sizeof (struct sockaddr_in)) - return EAI_FAMILY; - break; -#endif -#if HAVE_IPV6 - case AF_INET6: - if (salen < sizeof (struct sockaddr_in6)) - return EAI_FAMILY; - break; -#endif - default: - return EAI_FAMILY; - } - - if (node && nodelen > 0 && flags & NI_NUMERICHOST) - { - switch (sa->sa_family) - { -#if HAVE_IPV4 - case AF_INET: - if (!inet_ntop (AF_INET, - &(((const struct sockaddr_in *) sa)->sin_addr), - node, nodelen)) - return EAI_SYSTEM; - break; -#endif - -#if HAVE_IPV6 - case AF_INET6: - if (!inet_ntop (AF_INET6, - &(((const struct sockaddr_in6 *) sa)->sin6_addr), - node, nodelen)) - return EAI_SYSTEM; - break; -#endif - - default: - return EAI_FAMILY; - } - } - - if (service && servicelen > 0 && flags & NI_NUMERICSERV) - switch (sa->sa_family) - { -#if HAVE_IPV4 - case AF_INET: -#endif -#if HAVE_IPV6 - case AF_INET6: -#endif - { - unsigned short int port - = ntohs (((const struct sockaddr_in *) sa)->sin_port); - if (servicelen <= snprintf (service, servicelen, "%u", port)) - return EAI_OVERFLOW; - } - break; - } - - return 0; -} diff --git a/gl/getdelim.c b/gl/getdelim.c index 66d07b9ae0..14a8bce818 100644 --- a/gl/getdelim.c +++ b/gl/getdelim.c @@ -1,6 +1,6 @@ /* getdelim.c --- Implementation of replacement getdelim function. - Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2011 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/gl/getline.c b/gl/getline.c index 30c076e870..e6e918724d 100644 --- a/gl/getline.c +++ b/gl/getline.c @@ -1,5 +1,5 @@ /* getline.c --- Implementation of replacement getline function. - Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/gl/getpass.c b/gl/getpass.c index e9b4eb9b1b..90392f9069 100644 --- a/gl/getpass.c +++ b/gl/getpass.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,53 +26,53 @@ #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) -#include <stdbool.h> +# include <stdbool.h> -#if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING -# if HAVE_STDIO_EXT_H -# include <stdio_ext.h> +# if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif +# else +# define __fsetlocking(stream, type) /* empty */ # endif -#else -# define __fsetlocking(stream, type) /* empty */ -#endif - -#if HAVE_TERMIOS_H -# include <termios.h> -#endif -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#else -# if !HAVE_DECL_FFLUSH_UNLOCKED -# undef fflush_unlocked -# define fflush_unlocked(x) fflush (x) -# endif -# if !HAVE_DECL_FLOCKFILE -# undef flockfile -# define flockfile(x) ((void) 0) +# if HAVE_TERMIOS_H +# include <termios.h> # endif -# if !HAVE_DECL_FUNLOCKFILE -# undef funlockfile -# define funlockfile(x) ((void) 0) -# endif -# if !HAVE_DECL_FPUTS_UNLOCKED -# undef fputs_unlocked -# define fputs_unlocked(str,stream) fputs (str, stream) -# endif -# if !HAVE_DECL_PUTC_UNLOCKED -# undef putc_unlocked -# define putc_unlocked(c,stream) putc (c, stream) + +# if USE_UNLOCKED_IO +# include "unlocked-io.h" +# else +# if !HAVE_DECL_FFLUSH_UNLOCKED +# undef fflush_unlocked +# define fflush_unlocked(x) fflush (x) +# endif +# if !HAVE_DECL_FLOCKFILE +# undef flockfile +# define flockfile(x) ((void) 0) +# endif +# if !HAVE_DECL_FUNLOCKFILE +# undef funlockfile +# define funlockfile(x) ((void) 0) +# endif +# if !HAVE_DECL_FPUTS_UNLOCKED +# undef fputs_unlocked +# define fputs_unlocked(str,stream) fputs (str, stream) +# endif +# if !HAVE_DECL_PUTC_UNLOCKED +# undef putc_unlocked +# define putc_unlocked(c,stream) putc (c, stream) +# endif # endif -#endif /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is done in software; there is no need to change the state of the terminal hardware. */ -#ifndef TCSASOFT -# define TCSASOFT 0 -#endif +# ifndef TCSASOFT +# define TCSASOFT 0 +# endif static void call_fclose (void *arg) @@ -112,7 +112,7 @@ getpass (const char *prompt) flockfile (out); /* Turn echoing off if it is on now. */ -#if HAVE_TCGETATTR +# if HAVE_TCGETATTR if (tcgetattr (fileno (in), &t) == 0) { /* Save the old one. */ @@ -121,7 +121,7 @@ getpass (const char *prompt) t.c_lflag &= ~(ECHO | ISIG); tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0); } -#endif +# endif /* Write the prompt. */ fputs_unlocked (prompt, out); @@ -158,10 +158,10 @@ getpass (const char *prompt) } /* Restore the original setting. */ -#if HAVE_TCSETATTR +# if HAVE_TCSETATTR if (tty_changed) tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s); -#endif +# endif funlockfile (out); @@ -176,15 +176,15 @@ getpass (const char *prompt) improved by Simon Josefsson. */ /* For PASS_MAX. */ -#include <limits.h> +# include <limits.h> /* For _getch(). */ -#include <conio.h> +# include <conio.h> /* For strdup(). */ -#include <string.h> +# include <string.h> -#ifndef PASS_MAX -# define PASS_MAX 512 -#endif +# ifndef PASS_MAX +# define PASS_MAX 512 +# endif char * getpass (const char *prompt) diff --git a/gl/getpass.h b/gl/getpass.h index 6a54261afe..f1e67b5aa6 100644 --- a/gl/getpass.h +++ b/gl/getpass.h @@ -1,5 +1,5 @@ /* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin. - Copyright (C) 2004, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2011 Free Software Foundation, Inc. Contributed by Simon Josefsson <jas@extundo.com>, 2004. This program is free software; you can redistribute it and/or modify diff --git a/gl/gettext.h b/gl/gettext.h index f08759e186..88d9867e39 100644 --- a/gl/gettext.h +++ b/gl/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -93,6 +93,12 @@ #endif +/* Prefer gnulib's setlocale override over libintl's setlocale override. */ +#ifdef GNULIB_defined_setlocale +# undef setlocale +# define setlocale rpl_setlocale +#endif + /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. diff --git a/gl/gettime.c b/gl/gettime.c index 044b26f0f3..6dbb4574c6 100644 --- a/gl/gettime.c +++ b/gl/gettime.c @@ -1,6 +1,6 @@ /* gettime -- get the system clock - Copyright (C) 2002, 2004-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2002, 2004-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/gettimeofday.c b/gl/gettimeofday.c index 74fc558139..adfb51f049 100644 --- a/gl/gettimeofday.c +++ b/gl/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,10 +40,10 @@ static struct tm tm_zero_buffer; static struct tm *localtime_buffer_addr = &tm_zero_buffer; -#undef localtime +# undef localtime extern struct tm *localtime (time_t const *); -#undef gmtime +# undef gmtime extern struct tm *gmtime (time_t const *); /* This is a wrapper for localtime. It is used only on systems for which @@ -79,7 +79,7 @@ rpl_gmtime (time_t const *timep) #if TZSET_CLOBBERS_LOCALTIME -#undef tzset +# undef tzset extern void tzset (void); /* This is a wrapper for tzset, for systems on which tzset may clobber diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c deleted file mode 100644 index 8746114bbe..0000000000 --- a/gl/inet_ntop.c +++ /dev/null @@ -1,234 +0,0 @@ -/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form - - Copyright (C) 2005-2006, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* - * Copyright (c) 1996-1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include <config.h> - -/* Specification. */ -#include <arpa/inet.h> - -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#define NS_IN6ADDRSZ 16 -#define NS_INT16SZ 2 - -/* - * 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. - */ -typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1]; - -static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size); -#if HAVE_IPV6 -static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size); -#endif - - -/* char * - * inet_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * return: - * pointer to presentation format address (`dst'), or NULL (see errno). - * author: - * Paul Vixie, 1996. - */ -const char * -inet_ntop (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) -{ - switch (af) - { -#if HAVE_IPV4 - case AF_INET: - return (inet_ntop4 (src, dst, cnt)); -#endif - -#if HAVE_IPV6 - case AF_INET6: - return (inet_ntop6 (src, dst, cnt)); -#endif - - default: - errno = EAFNOSUPPORT; - return (NULL); - } - /* NOTREACHED */ -} - -/* const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address - * return: - * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a u_char* not an in_addr as input - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4 (const unsigned char *src, char *dst, socklen_t size) -{ - char tmp[sizeof "255.255.255.255"]; - int len; - - len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]); - if (len < 0) - return NULL; - - if (len > size) - { - errno = ENOSPC; - return NULL; - } - - return strcpy (dst, tmp); -} - -#if HAVE_IPV6 - -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop6 (const unsigned char *src, char *dst, socklen_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; - struct - { - int base, len; - } best, cur; - unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; - int i; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset (words, '\0', sizeof words); - for (i = 0; i < NS_IN6ADDRSZ; i += 2) - words[i / 2] = (src[i] << 8) | src[i + 1]; - best.base = -1; - cur.base = -1; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) - { - if (words[i] == 0) - { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } - else - { - if (cur.base != -1) - { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) - { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) - { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && i < (best.base + best.len)) - { - if (i == best.base) - *tp++ = ':'; - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) - { - if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp))) - return (NULL); - tp += strlen (tp); - break; - } - { - int len = sprintf (tp, "%x", words[i]); - if (len < 0) - return NULL; - tp += len; - } - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((socklen_t) (tp - tmp) > size) - { - errno = ENOSPC; - return NULL; - } - - return strcpy (dst, tmp); -} - -#endif diff --git a/gl/inet_pton.c b/gl/inet_pton.c deleted file mode 100644 index d8a2dee0ff..0000000000 --- a/gl/inet_pton.c +++ /dev/null @@ -1,253 +0,0 @@ -/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form - - Copyright (C) 2006, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* - * Copyright (c) 1996,1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include <config.h> - -/* Specification. */ -#include <arpa/inet.h> - -#include <c-ctype.h> -#include <string.h> -#include <errno.h> - -#define NS_INADDRSZ 4 -#define NS_IN6ADDRSZ 16 -#define NS_INT16SZ 2 - -/* - * 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. - */ - -static int inet_pton4 (const char *src, unsigned char *dst); -#if HAVE_IPV6 -static int inet_pton6 (const char *src, unsigned char *dst); -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -inet_pton (int af, const char *restrict src, void *restrict dst) -{ - switch (af) - { - case AF_INET: - return (inet_pton4 (src, dst)); - -#if HAVE_IPV6 - case AF_INET6: - return (inet_pton6 (src, dst)); -#endif - - default: - errno = EAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal, octal (with the - * exception of 0) and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4 (const char *restrict src, unsigned char *restrict dst) -{ - int saw_digit, octets, ch; - unsigned char tmp[NS_INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') - { - - if (ch >= '0' && ch <= '9') - { - unsigned new = *tp * 10 + (ch - '0'); - - if (saw_digit && *tp == 0) - return (0); - if (new > 255) - return (0); - *tp = new; - if (!saw_digit) - { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } - else if (ch == '.' && saw_digit) - { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } - else - return (0); - } - if (octets < 4) - return (0); - memcpy (dst, tmp, NS_INADDRSZ); - return (1); -} - -#if HAVE_IPV6 - -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6 (const char *restrict src, unsigned char *restrict dst) -{ - static const char xdigits[] = "0123456789abcdef"; - unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *curtok; - int ch, saw_xdigit; - unsigned val; - - tp = memset (tmp, '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = c_tolower (*src++)) != '\0') - { - const char *pch; - - pch = strchr (xdigits, ch); - if (pch != NULL) - { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') - { - curtok = src; - if (!saw_xdigit) - { - if (colonp) - return (0); - colonp = tp; - continue; - } - else if (*src == '\0') - { - return (0); - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4 (curtok, tp) > 0) - { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) - { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - } - if (colonp != NULL) - { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - if (tp == endp) - return (0); - for (i = 1; i <= n; i++) - { - endp[-i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memcpy (dst, tmp, NS_IN6ADDRSZ); - return (1); -} -#endif diff --git a/gl/intprops.h b/gl/intprops.h deleted file mode 100644 index 0c2787582f..0000000000 --- a/gl/intprops.h +++ /dev/null @@ -1,87 +0,0 @@ -/* intprops.h -- properties of integer types - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paul Eggert. */ - -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H - -# include <limits.h> - -/* The extra casts in the following macros work around compiler bugs, - e.g., in Cray C 5.0.3.0. */ - -/* True if the arithmetic type T is an integer type. bool counts as - an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) - -/* True if negative values of the signed integer type T use two's - complement, ones' complement, or signed magnitude representation, - respectively. Much GNU code assumes two's complement, but some - people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) - -/* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - -/* The maximum and minimum values for the integer type T. These - macros have undefined behavior if T is signed and has padding bits. - If this is a problem for you, please let us know how to fix it for - your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) - -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif - -/* Bound on length of the string representing an unsigned integer - value representable in B bits. log10 (2.0) < 146/485. The - smallest value of B where this bound is not tight is 2621. */ -# define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) - -/* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if T is signed, and then add 1 more for - a minus sign if needed. */ -# define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) \ - + signed_type_or_expr__ (t)) - -/* Bound on buffer size needed to represent an integer type or expression T, - including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) - -#endif /* GL_INTPROPS_H */ diff --git a/gl/listen.c b/gl/listen.c deleted file mode 100644 index 4a77de22ea..0000000000 --- a/gl/listen.c +++ /dev/null @@ -1,40 +0,0 @@ -/* listen.c --- wrappers for Windows listen function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef listen - -int -rpl_listen (int fd, int backlog) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = listen (sock, backlog); - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/lseek.c b/gl/lseek.c index 0d5376ab34..8339044ba8 100644 --- a/gl/lseek.c +++ b/gl/lseek.c @@ -1,5 +1,5 @@ /* An lseek() function that detects pipes. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/m4/.gitignore b/gl/m4/.gitignore new file mode 100644 index 0000000000..f27af06de0 --- /dev/null +++ b/gl/m4/.gitignore @@ -0,0 +1,49 @@ +/byteswap.m4 +/codeset.m4 +/func.m4 +/gettext.m4 +/glibc2.m4 +/glibc21.m4 +/gnulib-comp.m4 +/hmac-md5.m4 +/iconv.m4 +/intdiv0.m4 +/intl.m4 +/intldir.m4 +/intlmacosx.m4 +/intmax.m4 +/inttypes-pri.m4 +/lcmessage.m4 +/ld-output-def.m4 +/ld-version-script.m4 +/lock.m4 +/md5.m4 +/memmem.m4 +/memxor.m4 +/nls.m4 +/po.m4 +/printf-posix.m4 +/progtest.m4 +/strcase.m4 +/strings_h.m4 +/strverscmp.m4 +/threadlib.m4 +/time_r.m4 +/uintmax_t.m4 +/vasprintf.m4 +/visibility.m4 +/vsnprintf.m4 +/manywarnings.m4 +/warnings.m4 +/netinet_in_h.m4 +/stdarg.m4 +/getdelim.m4 +/getline.m4 +/getpass.m4 +/strdup.m4 +/version-etc.m4 +/timespec.m4 +/clock_time.m4 +/gettime.m4 +/gettimeofday.m4 +/sys_time_h.m4 diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index 301469b31c..7feed46694 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index 80d67aad77..689da75a2a 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 10 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, +# alloca.m4 serial 11 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,6 +36,7 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) + AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) ]) # Prerequisites of lib/alloca.c. diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 deleted file mode 100644 index 80fdb406b6..0000000000 --- a/gl/m4/arpa_inet_h.m4 +++ /dev/null @@ -1,59 +0,0 @@ -# arpa_inet_h.m4 serial 10 -dnl Copyright (C) 2006, 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 Written by Simon Josefsson and Bruno Haible - -AC_DEFUN([gl_HEADER_ARPA_INET], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) - - AC_CHECK_HEADERS_ONCE([arpa/inet.h]) - if test $ac_cv_header_arpa_inet_h = yes; then - HAVE_ARPA_INET_H=1 - else - HAVE_ARPA_INET_H=0 - fi - AC_SUBST([HAVE_ARPA_INET_H]) - dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. - 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 corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[ -/* On some systems, this header is not self-consistent. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) -# include <sys/socket.h> -#endif -#include <arpa/inet.h> - ]], [inet_ntop inet_pton]) -]) - -dnl Unconditionally enables the replacement of <arpa/inet.h>. -AC_DEFUN([gl_REPLACE_ARPA_INET_H], -[ - dnl This is a no-op, because <arpa/inet.h> is always overridden. - : -]) - -AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], -[ - GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP]) - GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) - HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) -]) diff --git a/gl/m4/asm-underscore.m4 b/gl/m4/asm-underscore.m4 deleted file mode 100644 index 1736cc432a..0000000000 --- a/gl/m4/asm-underscore.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# asm-underscore.m4 serial 1 -dnl Copyright (C) 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 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/gl/m4/autobuild.m4 b/gl/m4/autobuild.m4 deleted file mode 100644 index 93ccb5468a..0000000000 --- a/gl/m4/autobuild.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# autobuild.m4 serial 7 -dnl Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -dnl 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 Simon Josefsson - -# Usage: AB_INIT([MODE]). -AC_DEFUN([AB_INIT], -[ - AC_REQUIRE([AC_CANONICAL_BUILD]) - AC_REQUIRE([AC_CANONICAL_HOST]) - - if test -z "$AB_PACKAGE"; then - AB_PACKAGE=${PACKAGE_NAME:-$PACKAGE} - fi - AC_MSG_NOTICE([autobuild project... $AB_PACKAGE]) - - if test -z "$AB_VERSION"; then - AB_VERSION=${PACKAGE_VERSION:-$VERSION} - fi - AC_MSG_NOTICE([autobuild revision... $AB_VERSION]) - - hostname=`hostname` - if test "$hostname"; then - AC_MSG_NOTICE([autobuild hostname... $hostname]) - fi - - ifelse([$1],[],,[AC_MSG_NOTICE([autobuild mode... $1])]) - - date=`TZ=UTC0 date +%Y%m%dT%H%M%SZ` - if test "$?" != 0; then - date=`date` - fi - if test "$date"; then - AC_MSG_NOTICE([autobuild timestamp... $date]) - fi -]) diff --git a/gl/m4/clock_time.m4 b/gl/m4/clock_time.m4 index 8be179db87..3c085129c1 100644 --- a/gl/m4/clock_time.m4 +++ b/gl/m4/clock_time.m4 @@ -1,5 +1,5 @@ # clock_time.m4 serial 10 -dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 deleted file mode 100644 index 1ee3add9b9..0000000000 --- a/gl/m4/close.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# close.m4 serial 5 -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. - -AC_DEFUN([gl_FUNC_CLOSE], -[ - m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ - gl_PREREQ_SYS_H_WINSOCK2 - if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then - dnl Even if the 'socket' module is not used here, another part of the - dnl application may use it and pass file descriptors that refer to - dnl sockets to the close() function. So enable the support for sockets. - gl_REPLACE_CLOSE - fi - ]) -]) - -AC_DEFUN([gl_REPLACE_CLOSE], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - REPLACE_CLOSE=1 - AC_LIBOBJ([close]) - gl_REPLACE_FCLOSE -]) diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index e4325ac660..a6d37f3b32 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,5 +1,5 @@ -# errno_h.m4 serial 7 -dnl Copyright (C) 2004, 2006, 2008-2010 Free Software Foundation, Inc. +# errno_h.m4 serial 9 +dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -50,10 +50,11 @@ booboo if test $gl_cv_header_errno_h_complete = yes; then ERRNO_H='' else - gl_CHECK_NEXT_HEADERS([errno.h]) + gl_NEXT_HEADERS([errno.h]) ERRNO_H='errno.h' fi AC_SUBST([ERRNO_H]) + AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) gl_REPLACE_ERRNO_VALUE([ENOLINK]) gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 deleted file mode 100644 index dd5a197b6e..0000000000 --- a/gl/m4/error.m4 +++ /dev/null @@ -1,39 +0,0 @@ -#serial 13 - -# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_ERROR], -[ - AC_FUNC_ERROR_AT_LINE - dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). - gl_PREREQ_ERROR -]) - -# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in -# Autoconf. -AC_DEFUN([AC_FUNC_ERROR_AT_LINE], -[ - AC_LIBSOURCES([error.h, error.c])dnl - AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <error.h>]], - [[error_at_line (0, 0, "", 0, "an error occurred");]])], - [ac_cv_lib_error_at_line=yes], - [ac_cv_lib_error_at_line=no])]) - if test $ac_cv_lib_error_at_line = no; then - AC_LIBOBJ([error]) - fi -]) - -# Prerequisites of lib/error.c. -AC_DEFUN([gl_PREREQ_ERROR], -[ - AC_REQUIRE([AC_FUNC_STRERROR_R]) - AC_REQUIRE([AC_C_INLINE]) - : -]) diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 7d9458a8d6..1330503f0d 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 @@ -1,7 +1,7 @@ # serial 9 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-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. diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4 deleted file mode 100644 index 85de629423..0000000000 --- a/gl/m4/fclose.m4 +++ /dev/null @@ -1,16 +0,0 @@ -# fclose.m4 serial 2 -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. - -AC_DEFUN([gl_FUNC_FCLOSE], -[ -]) - -AC_DEFUN([gl_REPLACE_FCLOSE], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - REPLACE_FCLOSE=1 - AC_LIBOBJ([fclose]) -]) diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index f6099db405..21a7529fe0 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 @@ -1,5 +1,5 @@ -# float_h.m4 serial 4 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +# float_h.m4 serial 6 +dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,9 @@ AC_DEFUN([gl_FLOAT_H], case "$host_os" in beos* | openbsd* | mirbsd*) FLOAT_H=float.h - gl_CHECK_NEXT_HEADERS([float.h]) + gl_NEXT_HEADERS([float.h]) ;; esac AC_SUBST([FLOAT_H]) + AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) ]) diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 index b97df53377..76507d128f 100644 --- a/gl/m4/fseeko.m4 +++ b/gl/m4/fseeko.m4 @@ -1,5 +1,5 @@ -# fseeko.m4 serial 9 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# fseeko.m4 serial 11 +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. @@ -10,6 +10,11 @@ AC_DEFUN([gl_FUNC_FSEEKO], AC_REQUIRE([gl_HAVE_FSEEKO]) AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + AC_CHECK_DECLS_ONCE([fseeko]) + if test $ac_cv_have_decl_fseeko = no; then + HAVE_DECL_FSEEKO=0 + fi + if test $gl_cv_func_fseeko = no; then HAVE_FSEEKO=0 gl_REPLACE_FSEEKO @@ -48,3 +53,23 @@ AC_DEFUN([gl_REPLACE_FSEEKO], dnl If we are also using the fseek module, then fseek needs replacing, too. m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK]) ]) + +dnl Code shared by fseeko and ftello. Determine if large files are supported, +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/gl/m4/ftello.m4 b/gl/m4/ftello.m4 index 33201a0107..599f8f2047 100644 --- a/gl/m4/ftello.m4 +++ b/gl/m4/ftello.m4 @@ -1,5 +1,5 @@ -# ftello.m4 serial 8 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# ftello.m4 serial 9 +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. @@ -13,6 +13,11 @@ AC_DEFUN([gl_FUNC_FTELLO], dnl Persuade glibc <stdio.h> to declare ftello(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_DECLS_ONCE([ftello]) + if test $ac_cv_have_decl_ftello = no; then + HAVE_DECL_FTELLO=0 + fi + AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], [ AC_LINK_IFELSE( diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 deleted file mode 100644 index bc3066db18..0000000000 --- a/gl/m4/getaddrinfo.m4 +++ /dev/null @@ -1,173 +0,0 @@ -# getaddrinfo.m4 serial 23 -dnl Copyright (C) 2004-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_GETADDRINFO], -[ - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H - AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) - GETADDRINFO_LIB= - gai_saved_LIBS="$LIBS" - - dnl Where is getaddrinfo()? - dnl - On Solaris, it is in libsocket. - dnl - On Haiku, it is in libnetwork. - dnl - On BeOS, it is in libnet. - dnl - On native Windows, it is in ws2_32.dll. - dnl - Otherwise it is in libc. - AC_SEARCH_LIBS([getaddrinfo], [socket network net], - [if test "$ac_cv_search_getaddrinfo" != "none required"; then - GETADDRINFO_LIB="$ac_cv_search_getaddrinfo" - fi]) - LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" - - AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#include <stddef.h> -]], [[getaddrinfo("", "", NULL, NULL);]])], - [gl_cv_func_getaddrinfo=yes], - [gl_cv_func_getaddrinfo=no])]) - if test $gl_cv_func_getaddrinfo = no; then - AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], - gl_cv_w32_getaddrinfo, [ - gl_cv_w32_getaddrinfo=no - am_save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif -#include <stddef.h> -]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) - LIBS="$am_save_LIBS" - ]) - if test "$gl_cv_w32_getaddrinfo" = "yes"; then - GETADDRINFO_LIB="-lws2_32" - LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" - else - AC_LIBOBJ([getaddrinfo]) - fi - fi - - # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an - # inline function declared in ws2tcpip.h, so we need to get that - # header included somehow. - AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], - gl_cv_func_gai_strerror, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif -#include <stddef.h> -]], [[gai_strerror (NULL);]])], - [gl_cv_func_gai_strerror=yes], - [gl_cv_func_gai_strerror=no])]) - if test $gl_cv_func_gai_strerror = no; then - AC_LIBOBJ([gai_strerror]) - fi - - LIBS="$gai_saved_LIBS" - - gl_PREREQ_GETADDRINFO - - AC_SUBST([GETADDRINFO_LIB]) -]) - -# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. -AC_DEFUN([gl_PREREQ_GETADDRINFO], [ - AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB - AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB - AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB - AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - dnl Including sys/socket.h is wrong for Windows, but Windows does not - dnl have sa_len so the result is correct anyway. - AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) - - AC_CHECK_HEADERS_ONCE([netinet/in.h]) - - AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif -]) - if test $ac_cv_have_decl_getaddrinfo = no; then - HAVE_DECL_GETADDRINFO=0 - fi - if test $ac_cv_have_decl_freeaddrinfo = no; then - HAVE_DECL_FREEADDRINFO=0 - fi - if test $ac_cv_have_decl_gai_strerror = no; then - HAVE_DECL_GAI_STRERROR=0 - fi - if test $ac_cv_have_decl_getnameinfo = no; then - HAVE_DECL_GETNAMEINFO=0 - fi - - AC_CHECK_TYPES([struct addrinfo],,,[ -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif -]) - if test $ac_cv_type_struct_addrinfo = no; then - HAVE_STRUCT_ADDRINFO=0 - fi - - dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. - case " $GETADDRINFO_LIB " in - *" $HOSTENT_LIB "*) ;; - *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;; - esac - - dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. - case " $GETADDRINFO_LIB " in - *" $SERVENT_LIB "*) ;; - *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;; - esac - - dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. - case " $GETADDRINFO_LIB " in - *" $INET_NTOP_LIB "*) ;; - *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;; - esac -]) diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 49c14444a7..ef1273668b 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,6 +1,6 @@ # getdelim.m4 serial 8 -dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 8f6c5851b4..ec001b91be 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 @@ -1,6 +1,6 @@ # getline.m4 serial 23 -dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation, +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl dnl This file is free software; the Free Software Foundation diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4 index 313ad7fa26..79dfbbe493 100644 --- a/gl/m4/getpagesize.m4 +++ b/gl/m4/getpagesize.m4 @@ -1,5 +1,5 @@ # getpagesize.m4 serial 8 -dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation, +dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/getpass.m4 b/gl/m4/getpass.m4 index 8072e46442..c6ec427f08 100644 --- a/gl/m4/getpass.m4 +++ b/gl/m4/getpass.m4 @@ -1,5 +1,5 @@ # getpass.m4 serial 12 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/gettime.m4 b/gl/m4/gettime.m4 index 9e7fde4272..2b148abb5c 100644 --- a/gl/m4/gettime.m4 +++ b/gl/m4/gettime.m4 @@ -1,5 +1,5 @@ # gettime.m4 serial 7 -dnl Copyright (C) 2002, 2004-2006, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004-2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4 index 709a4d4fb4..84acadf216 100644 --- a/gl/m4/gettimeofday.m4 +++ b/gl/m4/gettimeofday.m4 @@ -1,6 +1,6 @@ # serial 15 -# Copyright (C) 2001-2003, 2005, 2007, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2001-2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 0987814cfe..439742bdb1 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -15,52 +15,50 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright valgrind-tests version-etc-fsf warnings +# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --libtool --macro-prefix=gl alloca byteswap c-ctype crypto/hmac-md5 crypto/md5 extensions func getpass gettext gettime havelib lib-msvc-compat lib-symbol-versions manywarnings memmem-simple minmax netdb netinet_in progname read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd vasprintf version-etc version-etc-fsf vsnprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gl/override]) gl_MODULES([ - accept - arpa_inet - autobuild - bind - close - connect - error - fdl-1.3 - gendocs - getaddrinfo - getline - getpass-gnu + alloca + byteswap + c-ctype + crypto/hmac-md5 + crypto/md5 + extensions + func + getpass + gettext gettime - gnupload - gpl-3.0 - inet_ntop - inet_pton - lgpl-2.1 - listen - maintainer-makefile + havelib + lib-msvc-compat + lib-symbol-versions manywarnings + memmem-simple minmax - perror - pmccabe2html + netdb + netinet_in progname read-file - readline - recv - select - send - setsockopt - shutdown - socket + snprintf sockets + socklen + stdint + strcase + strverscmp + sys_socket sys_stat - update-copyright - valgrind-tests + time_r + timespec + u64 + unistd + vasprintf + version-etc version-etc-fsf + vsnprintf warnings ]) -gl_AVOID([]) +gl_AVOID([alignof-tests lseek-tests]) gl_SOURCE_BASE([gl]) gl_M4_BASE([gl/m4]) gl_PO_BASE([]) @@ -72,4 +70,3 @@ gl_MAKEFILE_NAME([]) gl_LIBTOOL gl_MACRO_PREFIX([gl]) gl_PO_DOMAIN([]) -gl_VC_FILES([false]) diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index d0c8b66287..c4d7a20ea3 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 21 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# gnulib-common.m4 serial 24 +dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -102,6 +102,27 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [Define to 1 when the gnulib module $1 should be tested.]) ]) +# gl_ASSERT_NO_GNULIB_POSIXCHECK +# asserts that there will never be a need to #define GNULIB_POSIXCHECK. +# and thereby enables an optimization of configure and config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], +[ + dnl Override gl_WARN_ON_USE_PREPARE. + dnl But hide this definition from 'aclocal'. + AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) +]) + +# gl_ASSERT_NO_GNULIB_TESTS +# asserts that there will be no gnulib tests in the scope of the configure.ac +# and thereby enables an optimization of config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], +[ + dnl Override gl_MODULE_INDICATOR_FOR_TESTS. + AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) +]) + # Test whether <features.h> exists. # Set HAVE_FEATURES_H. AC_DEFUN([gl_FEATURES_H], diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 56f86b804a..b3b61b37b8 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -26,34 +26,30 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) - # Code from module accept: # Code from module alignof: - # Code from module alignof-tests: # Code from module alloca: # Code from module alloca-opt: # Code from module alloca-opt-tests: # Code from module arg-nonnull: - # Code from module arpa_inet: - # Code from module arpa_inet-tests: - # Code from module autobuild: - AB_INIT # Code from module binary-io: # Code from module binary-io-tests: - # Code from module bind: + # Code from module byteswap: + # Code from module byteswap-tests: # Code from module c++defs: # Code from module c-ctype: # Code from module c-ctype-tests: # Code from module clock-time: - # Code from module close: # Code from module close-hook: - # Code from module connect: + # Code from module crypto/hmac-md5: + # Code from module crypto/hmac-md5-tests: + # Code from module crypto/md5: + # Code from module crypto/md5-tests: # Code from module errno: # Code from module errno-tests: - # Code from module error: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - # Code from module fclose: - # Code from module fdl-1.3: + # Code from module fcntl-h: + # Code from module fcntl-h-tests: # Code from module float: # Code from module fseeko: AC_REQUIRE([AC_FUNC_FSEEKO]) @@ -61,65 +57,44 @@ AC_DEFUN([gl_EARLY], # Code from module ftello: AC_REQUIRE([AC_FUNC_FSEEKO]) # Code from module ftello-tests: - # Code from module gendocs: - # Code from module getaddrinfo: - # Code from module getaddrinfo-tests: + # Code from module func: + # Code from module func-tests: # Code from module getdelim: # Code from module getdelim-tests: # Code from module getline: # Code from module getline-tests: # Code from module getpagesize: - # Code from module getpass-gnu: + # Code from module getpass: + # Code from module gettext: # Code from module gettext-h: # Code from module gettime: # Code from module gettimeofday: # Code from module gettimeofday-tests: - # Code from module gnumakefile: - # Code from module gnupload: - # Code from module gpl-3.0: # Code from module havelib: - # Code from module hostent: # Code from module include_next: - # Code from module inet_ntop: - # Code from module inet_ntop-tests: - # Code from module inet_pton: - # Code from module inet_pton-tests: # Code from module intprops: - # Code from module ioctl: - # Code from module lgpl-2.1: - # Code from module listen: + # Code from module lib-msvc-compat: + # Code from module lib-symbol-versions: # Code from module lseek: - # Code from module lseek-tests: - # Code from module maintainer-makefile: # Code from module malloc-posix: # Code from module manywarnings: # Code from module memchr: # Code from module memchr-tests: + # Code from module memmem-simple: + # Code from module memxor: # Code from module minmax: # Code from module multiarch: # Code from module netdb: # Code from module netdb-tests: # Code from module netinet_in: # Code from module netinet_in-tests: - # Code from module perror: - # Code from module perror-tests: - # Code from module pmccabe2html: # Code from module progname: # Code from module read-file: # Code from module read-file-tests: - # Code from module readline: # Code from module realloc-posix: - # Code from module recv: - # Code from module select: - # Code from module select-tests: - # Code from module send: - # Code from module servent: - # Code from module setsockopt: - # Code from module shutdown: # Code from module size_max: # Code from module snprintf: # Code from module snprintf-tests: - # Code from module socket: # Code from module socketlib: # Code from module sockets: # Code from module sockets-tests: @@ -140,14 +115,14 @@ AC_DEFUN([gl_EARLY], # Code from module stdio-tests: # Code from module stdlib: # Code from module stdlib-tests: - # Code from module strerror: - # Code from module strerror-tests: + # Code from module strcase: + # Code from module strdup-posix: # Code from module string: # Code from module string-tests: - # Code from module sys_ioctl: - # Code from module sys_ioctl-tests: - # Code from module sys_select: - # Code from module sys_select-tests: + # Code from module strings: + # Code from module strings-tests: + # Code from module strverscmp: + # Code from module strverscmp-tests: # Code from module sys_socket: # Code from module sys_socket-tests: # Code from module sys_stat: @@ -156,22 +131,23 @@ AC_DEFUN([gl_EARLY], # Code from module sys_time-tests: # Code from module time: # Code from module time-tests: + # Code from module time_r: # Code from module timespec: + # Code from module u64: + # Code from module u64-tests: # Code from module unistd: # Code from module unistd-tests: - # Code from module update-copyright: - # Code from module update-copyright-tests: - # Code from module useless-if-before-free: - # Code from module valgrind-tests: # Code from module vasnprintf: # Code from module vasnprintf-tests: - # Code from module vc-list-files: - # Code from module vc-list-files-tests: + # Code from module vasprintf: + # Code from module vasprintf-tests: # Code from module verify: # Code from module verify-tests: # Code from module version-etc: # Code from module version-etc-fsf: # Code from module version-etc-tests: + # Code from module vsnprintf: + # Code from module vsnprintf-tests: # Code from module warn-on-use: # Code from module warnings: # Code from module wchar: @@ -193,12 +169,6 @@ AC_DEFUN([gl_INIT], m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='gl' - # Code from module accept: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([accept]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([accept]) # Code from module alignof: # Code from module alloca: changequote(,)dnl @@ -208,42 +178,20 @@ AC_SUBST([LTALLOCA]) # Code from module alloca-opt: gl_FUNC_ALLOCA # Code from module arg-nonnull: - # Code from module arpa_inet: - gl_HEADER_ARPA_INET - AC_PROG_MKDIR_P - # Code from module autobuild: - # Code from module bind: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([bind]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([bind]) + # Code from module byteswap: + gl_BYTESWAP # Code from module c++defs: # Code from module c-ctype: # Code from module clock-time: gl_CLOCK_TIME - # Code from module close: - gl_FUNC_CLOSE - gl_UNISTD_MODULE_INDICATOR([close]) # Code from module close-hook: - # Code from module connect: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([connect]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([connect]) + # Code from module crypto/hmac-md5: + gl_HMAC_MD5 + # Code from module crypto/md5: + gl_MD5 # Code from module errno: gl_HEADER_ERRNO_H - # Code from module error: - gl_ERROR - m4_ifdef([AM_XGETTEXT_OPTION], - [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) - AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) # Code from module extensions: - # Code from module fclose: - gl_FUNC_FCLOSE - gl_STDIO_MODULE_INDICATOR([fclose]) - # Code from module fdl-1.3: # Code from module float: gl_FLOAT_H # Code from module fseeko: @@ -252,18 +200,19 @@ AC_SUBST([LTALLOCA]) # Code from module ftello: gl_FUNC_FTELLO gl_STDIO_MODULE_INDICATOR([ftello]) - # Code from module gendocs: - # Code from module getaddrinfo: - gl_GETADDRINFO - gl_NETDB_MODULE_INDICATOR([getaddrinfo]) + # Code from module func: + gl_FUNC # Code from module getdelim: gl_FUNC_GETDELIM gl_STDIO_MODULE_INDICATOR([getdelim]) # Code from module getline: gl_FUNC_GETLINE gl_STDIO_MODULE_INDICATOR([getline]) - # Code from module getpass-gnu: - gl_FUNC_GETPASS_GNU + # Code from module getpass: + gl_FUNC_GETPASS + # Code from module gettext: + dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. + AM_GNU_GETTEXT_VERSION([0.18.1]) # Code from module gettext-h: AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) @@ -272,43 +221,15 @@ AC_SUBST([LTALLOCA]) # Code from module gettimeofday: gl_FUNC_GETTIMEOFDAY gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) - # Code from module gnumakefile: - # Autoconf 2.61a.99 and earlier don't support linking a file only - # in VPATH builds. But since GNUmakefile is for maintainer use - # only, it does not matter if we skip the link with older autoconf. - # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH - # builds, so use a shell variable to bypass this. - GNUmakefile=GNUmakefile - m4_if(m4_version_compare([2.61a.100], - m4_defn([m4_PACKAGE_VERSION])), [1], [], - [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], - [GNUmakefile=$GNUmakefile])]) - # Code from module gnupload: - # Code from module gpl-3.0: # Code from module havelib: - # Code from module hostent: - gl_HOSTENT # Code from module include_next: - # Code from module inet_ntop: - gl_FUNC_INET_NTOP - gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) - # Code from module inet_pton: - gl_FUNC_INET_PTON - gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) - # Code from module intprops: - # Code from module lgpl-2.1: - # Code from module listen: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([listen]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([listen]) + # Code from module lib-msvc-compat: + gl_LD_OUTPUT_DEF + # Code from module lib-symbol-versions: + gl_LD_VERSION_SCRIPT # Code from module lseek: gl_FUNC_LSEEK gl_UNISTD_MODULE_INDICATOR([lseek]) - # Code from module maintainer-makefile: - AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER], - [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])]) # Code from module malloc-posix: gl_FUNC_MALLOC_POSIX gl_STDLIB_MODULE_INDICATOR([malloc-posix]) @@ -316,6 +237,11 @@ AC_SUBST([LTALLOCA]) # Code from module memchr: gl_FUNC_MEMCHR gl_STRING_MODULE_INDICATOR([memchr]) + # Code from module memmem-simple: + gl_FUNC_MEMMEM_SIMPLE + gl_STRING_MODULE_INDICATOR([memmem]) + # Code from module memxor: + gl_MEMXOR # Code from module minmax: gl_MINMAX # Code from module multiarch: @@ -325,70 +251,20 @@ AC_SUBST([LTALLOCA]) # Code from module netinet_in: gl_HEADER_NETINET_IN AC_PROG_MKDIR_P - # Code from module perror: - gl_FUNC_PERROR - gl_STRING_MODULE_INDICATOR([perror]) - # Code from module pmccabe2html: - AC_PATH_PROG([PMCCABE], [pmccabe], [false]) # Code from module progname: AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>]) AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>]) # Code from module read-file: gl_FUNC_READ_FILE - # Code from module readline: - gl_FUNC_READLINE # Code from module realloc-posix: gl_FUNC_REALLOC_POSIX gl_STDLIB_MODULE_INDICATOR([realloc-posix]) - # Code from module recv: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([recv]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([recv]) - # Code from module select: - gl_FUNC_SELECT - gl_SYS_SELECT_MODULE_INDICATOR([select]) - # Code from module send: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([send]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([send]) - # Code from module servent: - gl_SERVENT - # Code from module setsockopt: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([setsockopt]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) - # Code from module shutdown: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([shutdown]) - fi - gl_SYS_SOCKET_MODULE_INDICATOR([shutdown]) # Code from module size_max: gl_SIZE_MAX # Code from module snprintf: gl_FUNC_SNPRINTF gl_STDIO_MODULE_INDICATOR([snprintf]) - # Code from module socket: - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([socket]) - fi - # When this module is used, sockets may actually occur as file descriptors, - # hence it is worth warning if the modules 'close' and 'ioctl' are not used. - m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) - m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) - AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2]) - if test "$ac_cv_header_winsock2_h" = yes; then - UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 - SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 - fi - gl_SYS_SOCKET_MODULE_INDICATOR([socket]) + gl_MODULE_INDICATOR([snprintf]) # Code from module socketlib: gl_SOCKETLIB # Code from module sockets: @@ -407,14 +283,18 @@ AC_SUBST([LTALLOCA]) gl_STDIO_H # Code from module stdlib: gl_STDLIB_H - # Code from module strerror: - gl_FUNC_STRERROR - gl_STRING_MODULE_INDICATOR([strerror]) + # Code from module strcase: + gl_STRCASE + # Code from module strdup-posix: + gl_FUNC_STRDUP_POSIX + gl_STRING_MODULE_INDICATOR([strdup]) # Code from module string: gl_HEADER_STRING_H - # Code from module sys_select: - gl_HEADER_SYS_SELECT - AC_PROG_MKDIR_P + # Code from module strings: + gl_HEADER_STRINGS_H + # Code from module strverscmp: + gl_FUNC_STRVERSCMP + gl_STRING_MODULE_INDICATOR([strverscmp]) # Code from module sys_socket: gl_HEADER_SYS_SOCKET AC_PROG_MKDIR_P @@ -426,21 +306,30 @@ AC_SUBST([LTALLOCA]) AC_PROG_MKDIR_P # Code from module time: gl_HEADER_TIME_H + # Code from module time_r: + gl_TIME_R + gl_TIME_MODULE_INDICATOR([time_r]) # Code from module timespec: gl_TIMESPEC + # Code from module u64: + AC_REQUIRE([AC_C_INLINE]) # Code from module unistd: gl_UNISTD_H - # Code from module update-copyright: - # Code from module useless-if-before-free: - # Code from module valgrind-tests: - gl_VALGRIND_TESTS # Code from module vasnprintf: gl_FUNC_VASNPRINTF - # Code from module vc-list-files: + # Code from module vasprintf: + gl_FUNC_VASPRINTF + gl_STDIO_MODULE_INDICATOR([vasprintf]) + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) + AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) # Code from module verify: # Code from module version-etc: gl_VERSION_ETC # Code from module version-etc-fsf: + # Code from module vsnprintf: + gl_FUNC_VSNPRINTF + gl_STDIO_MODULE_INDICATOR([vsnprintf]) # Code from module warn-on-use: # Code from module warnings: AC_SUBST([WARN_CFLAGS]) @@ -494,29 +383,18 @@ changequote([, ])dnl AC_SUBST([gltests_WITNESS]) gl_module_indicator_condition=$gltests_WITNESS m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) + gl_FCNTL_H gl_FUNC_UNGETC_WORKS gl_FUNC_UNGETC_WORKS gl_FUNC_GETPAGESIZE gl_UNISTD_MODULE_INDICATOR([getpagesize]) - AC_C_BIGENDIAN - AC_C_BIGENDIAN - gl_FUNC_IOCTL - gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) - AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h]) gt_TYPE_WCHAR_T gt_TYPE_WINT_T - gl_SYS_IOCTL_H - AC_PROG_MKDIR_P AC_CHECK_FUNCS_ONCE([shutdown]) - abs_aux_dir=`cd "$ac_aux_dir"; pwd` - AC_SUBST([abs_aux_dir]) - gl_VALGRIND_TESTS - abs_aux_dir=`cd "$ac_aux_dir"; pwd` - AC_SUBST([abs_aux_dir]) m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || @@ -612,41 +490,22 @@ AC_DEFUN([gl_FILE_LIST], [ build-aux/arg-nonnull.h build-aux/c++defs.h build-aux/config.rpath - build-aux/gendocs.sh - build-aux/gnupload - build-aux/pmccabe.css - build-aux/pmccabe2html - build-aux/update-copyright - build-aux/useless-if-before-free - build-aux/vc-list-files build-aux/warn-on-use.h - doc/fdl-1.3.texi - doc/gendocs_template - doc/gpl-3.0.texi - doc/lgpl-2.1.texi - lib/accept.c lib/alignof.h lib/alloca.c lib/alloca.in.h - lib/arpa_inet.in.h lib/asnprintf.c - lib/bind.c + lib/asprintf.c + lib/byteswap.in.h lib/c-ctype.c lib/c-ctype.h lib/close-hook.c lib/close-hook.h - lib/close.c - lib/connect.c lib/errno.in.h - lib/error.c - lib/error.h - lib/fclose.c lib/float+.h lib/float.in.h lib/fseeko.c lib/ftello.c - lib/gai_strerror.c - lib/getaddrinfo.c lib/getdelim.c lib/getline.c lib/getpass.c @@ -654,18 +513,20 @@ AC_DEFUN([gl_FILE_LIST], [ lib/gettext.h lib/gettime.c lib/gettimeofday.c - lib/inet_ntop.c - lib/inet_pton.c - lib/intprops.h - lib/listen.c + lib/hmac-md5.c + lib/hmac.h lib/lseek.c lib/malloc.c + lib/md5.c + lib/md5.h lib/memchr.c lib/memchr.valgrind + lib/memmem.c + lib/memxor.c + lib/memxor.h lib/minmax.h lib/netdb.in.h lib/netinet_in.in.h - lib/perror.c lib/printf-args.c lib/printf-args.h lib/printf-parse.c @@ -674,17 +535,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/progname.h lib/read-file.c lib/read-file.h - lib/readline.c - lib/readline.h lib/realloc.c - lib/recv.c - lib/select.c - lib/send.c - lib/setsockopt.c - lib/shutdown.c lib/size_max.h lib/snprintf.c - lib/socket.c lib/sockets.c lib/sockets.h lib/stdarg.in.h @@ -692,76 +545,95 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stddef.in.h lib/stdint.in.h lib/stdio-impl.h - lib/stdio-write.c lib/stdio.in.h lib/stdlib.in.h - lib/strerror.c + lib/str-two-way.h + lib/strcasecmp.c + lib/strdup.c lib/string.in.h - lib/sys_select.in.h + lib/strings.in.h + lib/strncasecmp.c + lib/strverscmp.c lib/sys_socket.in.h lib/sys_stat.in.h lib/sys_time.in.h lib/time.in.h + lib/time_r.c lib/timespec.h + lib/u64.h lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h + lib/vasprintf.c lib/verify.h lib/version-etc-fsf.c lib/version-etc.c lib/version-etc.h + lib/vsnprintf.c lib/w32sock.h lib/wchar.in.h lib/xsize.h m4/00gnulib.m4 m4/alloca.m4 - m4/arpa_inet_h.m4 - m4/asm-underscore.m4 - m4/autobuild.m4 + m4/byteswap.m4 m4/clock_time.m4 - m4/close.m4 + m4/codeset.m4 m4/errno_h.m4 - m4/error.m4 m4/extensions.m4 - m4/fclose.m4 + m4/fcntl-o.m4 + m4/fcntl_h.m4 m4/float_h.m4 m4/fseeko.m4 m4/ftello.m4 - m4/getaddrinfo.m4 + m4/func.m4 m4/getdelim.m4 m4/getline.m4 m4/getpagesize.m4 m4/getpass.m4 + m4/gettext.m4 m4/gettime.m4 m4/gettimeofday.m4 + m4/glibc2.m4 + m4/glibc21.m4 m4/gnulib-common.m4 - m4/hostent.m4 + m4/hmac-md5.m4 + m4/iconv.m4 m4/include_next.m4 - m4/inet_ntop.m4 - m4/inet_pton.m4 + m4/intdiv0.m4 + m4/intl.m4 + m4/intldir.m4 + m4/intlmacosx.m4 + m4/intmax.m4 m4/intmax_t.m4 + m4/inttypes-pri.m4 m4/inttypes_h.m4 - m4/ioctl.m4 + m4/lcmessage.m4 + m4/ld-output-def.m4 + m4/ld-version-script.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 + m4/lock.m4 m4/longlong.m4 m4/lseek.m4 m4/malloc.m4 m4/manywarnings.m4 + m4/md5.m4 m4/memchr.m4 + m4/memmem.m4 + m4/memxor.m4 m4/minmax.m4 m4/mmap-anon.m4 m4/multiarch.m4 m4/netdb_h.m4 m4/netinet_in_h.m4 - m4/perror.m4 + m4/nls.m4 + m4/po.m4 + m4/printf-posix.m4 m4/printf.m4 + m4/progtest.m4 m4/read-file.m4 - m4/readline.m4 m4/realloc.m4 - m4/select.m4 - m4/servent.m4 m4/size_max.m4 m4/snprintf.m4 m4/socketlib.m4 @@ -775,20 +647,26 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stdint_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4 - m4/strerror.m4 + m4/strcase.m4 + m4/strdup.m4 m4/string_h.m4 - m4/sys_ioctl_h.m4 - m4/sys_select_h.m4 + m4/strings_h.m4 + m4/strverscmp.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_time_h.m4 + m4/threadlib.m4 m4/time_h.m4 + m4/time_r.m4 m4/timespec.m4 + m4/uintmax_t.m4 m4/ungetc.m4 m4/unistd_h.m4 - m4/valgrind-tests.m4 m4/vasnprintf.m4 + m4/vasprintf.m4 m4/version-etc.m4 + m4/visibility.m4 + m4/vsnprintf.m4 m4/warn-on-use.m4 m4/warnings.m4 m4/wchar_h.m4 @@ -798,13 +676,13 @@ AC_DEFUN([gl_FILE_LIST], [ tests/init.sh tests/macros.h tests/signature.h - tests/test-alignof.c tests/test-alloca-opt.c - tests/test-arpa_inet.c tests/test-binary-io.c tests/test-binary-io.sh + tests/test-byteswap.c tests/test-c-ctype.c tests/test-errno.c + tests/test-fcntl-h.c tests/test-fseeko.c tests/test-fseeko.sh tests/test-fseeko2.sh @@ -812,25 +690,16 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-ftello.sh tests/test-ftello2.sh tests/test-ftello3.c - tests/test-getaddrinfo.c + tests/test-func.c tests/test-getdelim.c tests/test-getline.c tests/test-gettimeofday.c - tests/test-inet_ntop.c - tests/test-inet_pton.c - tests/test-lseek.c - tests/test-lseek.sh + tests/test-hmac-md5.c + tests/test-md5.c tests/test-memchr.c tests/test-netdb.c tests/test-netinet_in.c - tests/test-perror.c - tests/test-perror.sh tests/test-read-file.c - tests/test-select-fd.c - tests/test-select-in.sh - tests/test-select-out.sh - tests/test-select-stdin.c - tests/test-select.c tests/test-snprintf.c tests/test-sockets.c tests/test-stdbool.c @@ -838,32 +707,28 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-stdint.c tests/test-stdio.c tests/test-stdlib.c - tests/test-strerror.c tests/test-string.c - tests/test-sys_ioctl.c - tests/test-sys_select.c + tests/test-strings.c + tests/test-strverscmp.c tests/test-sys_socket.c tests/test-sys_stat.c tests/test-sys_time.c tests/test-sys_wait.h tests/test-time.c + tests/test-u64.c tests/test-unistd.c - tests/test-update-copyright.sh tests/test-vasnprintf.c - tests/test-vc-list-files-cvs.sh - tests/test-vc-list-files-git.sh + tests/test-vasprintf.c tests/test-verify.c tests/test-verify.sh tests/test-version-etc.c tests/test-version-etc.sh + tests/test-vsnprintf.c tests/test-wchar.c tests/zerosize-ptr.h tests=lib/binary-io.h tests=lib/dummy.c + tests=lib/fcntl.in.h tests=lib/getpagesize.c - tests=lib/ioctl.c - tests=lib/sys_ioctl.in.h - tests=lib/w32sock.h - top/GNUmakefile - top/maint.mk + tests=lib/intprops.h ]) diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index 69e7733b99..ed41e9d415 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 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. diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 deleted file mode 100644 index 7104b3089a..0000000000 --- a/gl/m4/hostent.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# hostent.m4 serial 2 -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. - -AC_DEFUN([gl_HOSTENT], -[ - dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(), - dnl gethostbyaddr() defined? - dnl - On Solaris, they are in libnsl. Ignore libxnet. - dnl - On Haiku, they are in libnetwork. - dnl - On BeOS, they are in libnet. - dnl - On native Windows, they are in ws2_32.dll. - dnl - Otherwise they are in libc. - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - HOSTENT_LIB= - gl_saved_libs="$LIBS" - AC_SEARCH_LIBS([gethostbyname], [nsl network net], - [if test "$ac_cv_search_gethostbyname" != "none required"; then - HOSTENT_LIB="$ac_cv_search_gethostbyname" - fi]) - LIBS="$gl_saved_libs" - if test -z "$HOSTENT_LIB"; then - AC_CHECK_FUNCS([gethostbyname], , [ - AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], - [gl_cv_w32_gethostbyname], - [gl_cv_w32_gethostbyname=no - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif -#include <stddef.h> - ]], - [[gethostbyname(NULL);]])], - [gl_cv_w32_gethostbyname=yes]) - LIBS="$gl_save_LIBS" - ]) - if test "$gl_cv_w32_gethostbyname" = "yes"; then - HOSTENT_LIB="-lws2_32" - fi - ]) - fi - AC_SUBST([HOSTENT_LIB]) -]) diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index e37eb0567d..b3c7849185 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 16 -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +# include_next.m4 serial 18 +dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -147,11 +147,33 @@ choke me # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. +# +# This macro also checks whether each header exists, by invoking +# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ + gl_NEXT_HEADERS_INTERNAL([$1], [check]) +]) + +# gl_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------ +# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist. +# This is suitable for headers like <stddef.h> that are standardized by C89 +# and therefore can be assumed to exist. +AC_DEFUN([gl_NEXT_HEADERS], +[ + gl_NEXT_HEADERS_INTERNAL([$1], [assume]) +]) + +# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. +AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], +[ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADERS_ONCE([$1]) + + m4_if([$2], [check], + [AC_CHECK_HEADERS_ONCE([$1]) + ]) m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], @@ -162,39 +184,44 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS], AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], m4_defn([gl_next_header]), - [AS_VAR_PUSHDEF([gl_header_exists], - [ac_cv_header_]m4_defn([gl_HEADER_NAME])) - if test AS_VAR_GET(gl_header_exists) = yes; then - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - dnl AIX "xlc -E" and "cc -E" omit #line directives for header files - dnl that contain only a #include of other header files and no - dnl non-comment tokens of their own. This leads to a failure to - dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> - dnl and others. The workaround is to force preservation of comments - dnl through option -C. This ensures all necessary #line directives - dnl are present. GCC supports option -C as well. - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - dnl eval is necessary to expand gl_absname_cpp. - dnl Ultrix and Pyramid sh refuse to redirect output of eval, - dnl so use subshell. - AS_VAR_SET([gl_next_header], - ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) - else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - fi - AS_VAR_POPDEF([gl_header_exists])]) + [m4_if([$2], [check], + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME])) + if test AS_VAR_GET(gl_header_exists) = yes; then + AS_VAR_POPDEF([gl_header_exists]) + ]) + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header + dnl files that contain only a #include of other header files and + dnl no non-comment tokens of their own. This leads to a failure + dnl to detect the absolute name of <dirent.h>, <signal.h>, + dnl <poll.h> and others. The workaround is to force preservation + dnl of comments through option -C. This ensures all necessary + dnl #line directives are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_next_header], + ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ + s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"']) + m4_if([$2], [check], + [else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + ]) + ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 deleted file mode 100644 index a6d219c208..0000000000 --- a/gl/m4/inet_ntop.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# inet_ntop.m4 serial 12 -dnl Copyright (C) 2005, 2006, 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_FUNC_INET_NTOP], -[ - dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - gl_REPLACE_ARPA_INET_H - - dnl Most platforms that provide inet_ntop define it in libc. - dnl Solaris 8..10 provide inet_ntop in libnsl instead. - gl_save_LIBS=$LIBS - AC_SEARCH_LIBS([inet_ntop], [nsl], [], - [AC_REPLACE_FUNCS([inet_ntop])]) - LIBS=$gl_save_LIBS - INET_NTOP_LIB= - if test "$ac_cv_search_inet_ntop" != "no" && - test "$ac_cv_search_inet_ntop" != "none required"; then - INET_NTOP_LIB="$ac_cv_search_inet_ntop" - fi - AC_SUBST([INET_NTOP_LIB]) - - gl_PREREQ_INET_NTOP -]) - -# Prerequisites of lib/inet_ntop.c. -AC_DEFUN([gl_PREREQ_INET_NTOP], [ - AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>]) - if test $ac_cv_have_decl_inet_ntop = no; then - HAVE_DECL_INET_NTOP=0 - fi - AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([AC_C_RESTRICT]) -]) diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4 deleted file mode 100644 index 193f17d0a3..0000000000 --- a/gl/m4/inet_pton.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# inet_pton.m4 serial 10 -dnl Copyright (C) 2006, 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_FUNC_INET_PTON], -[ - dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - gl_REPLACE_ARPA_INET_H - - dnl Most platforms that provide inet_pton define it in libc. - dnl Solaris 8..10 provide inet_pton in libnsl instead. - gl_save_LIBS=$LIBS - AC_SEARCH_LIBS([inet_pton], [nsl], [], - [AC_REPLACE_FUNCS([inet_pton])]) - LIBS=$gl_save_LIBS - INET_PTON_LIB= - if test "$ac_cv_search_inet_pton" != "no" && - test "$ac_cv_search_inet_pton" != "none required"; then - INET_PTON_LIB="$ac_cv_search_inet_pton" - fi - AC_SUBST([INET_PTON_LIB]) - - gl_PREREQ_INET_PTON -]) - -# Prerequisites of lib/inet_pton.c. -AC_DEFUN([gl_PREREQ_INET_PTON], [ - AC_CHECK_DECLS([inet_pton],,,[#include <arpa/inet.h>]) - if test $ac_cv_have_decl_inet_pton = no; then - HAVE_DECL_INET_PTON=0 - fi - AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([AC_C_RESTRICT]) -]) diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 493e4a9328..7341054b6f 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,5 +1,5 @@ # intmax_t.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 9d8f926926..f10fd54f63 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 @@ -1,5 +1,5 @@ # inttypes_h.m4 serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/ioctl.m4 b/gl/m4/ioctl.m4 deleted file mode 100644 index 4a0a99f16a..0000000000 --- a/gl/m4/ioctl.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# ioctl.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. - -AC_DEFUN([gl_FUNC_IOCTL], -[ - AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - dnl Even if the 'socket' module is not used here, another part of the - dnl application may use it and pass file descriptors that refer to - dnl sockets to the ioctl() function. So enable the support for sockets. - AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H - else - AC_CHECK_FUNCS([ioctl]) - dnl On glibc systems, the second parameter is 'unsigned long int request', - dnl not 'int request'. We cannot simply cast the function pointer, but - dnl instead need a wrapper. - AC_CACHE_CHECK([for ioctl with POSIX signature], - [gl_cv_func_ioctl_posix_signature], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/ioctl.h>]], - [[extern int ioctl (int, int, ...);]]) - ], - [gl_cv_func_ioctl_posix_signature=yes], - [gl_cv_func_ioctl_posix_signature=no]) - ]) - if test $gl_cv_func_ioctl_posix_signature != yes; then - REPLACE_IOCTL=1 - AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H - fi - fi -]) diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4 index 294db72e13..ae003f7c59 100644 --- a/gl/m4/lib-ld.m4 +++ b/gl/m4/lib-ld.m4 @@ -1,5 +1,5 @@ # lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 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. diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index 2ea9d6d073..e7c9ba9d3d 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 @@ -1,5 +1,5 @@ -# lib-link.m4 serial 25 (gettext-0.18.2) -dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -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/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4 index 1601ceaefd..7e5f0bde03 100644 --- a/gl/m4/lib-prefix.m4 +++ b/gl/m4/lib-prefix.m4 @@ -1,5 +1,5 @@ # lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 index cca3c1a90f..aed816cfa5 100644 --- a/gl/m4/longlong.m4 +++ b/gl/m4/longlong.m4 @@ -1,5 +1,5 @@ -# longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. 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/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index b0612c7e17..f6452f6f20 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,5 +1,5 @@ # lseek.m4 serial 6 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +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. diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 7a749254a1..8094444507 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 serial 12 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +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. diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4 index 844a9ba2a0..e928821952 100644 --- a/gl/m4/manywarnings.m4 +++ b/gl/m4/manywarnings.m4 @@ -1,5 +1,5 @@ # manywarnings.m4 serial 1 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 46db9fb654..3c2b313916 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 @@ -1,5 +1,5 @@ # memchr.m4 serial 10 -dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index a5c42dea0f..beb9cb1782 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 @@ -1,5 +1,5 @@ # minmax.m4 serial 4 -dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 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. diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index e20fc3c670..7ba7fd26b6 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 @@ -1,5 +1,5 @@ # mmap-anon.m4 serial 9 -dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 389bd2bbaa..691d89270b 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 @@ -1,5 +1,5 @@ -# multiarch.m4 serial 5 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# multiarch.m4 serial 6 +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -16,8 +16,7 @@ dnl with or without modifications, as long as this notice is preserved. # CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ # CPP="gcc -E" CXXCPP="g++ -E" # -# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the -# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. +# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. AC_DEFUN_ONCE([gl_MULTIARCH], [ @@ -55,8 +54,6 @@ AC_DEFUN_ONCE([gl_MULTIARCH], done ]) if test $gl_cv_c_multiarch = yes; then - AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1], - [Define if the compiler is building for multiple architectures of Apple platforms at once.]) APPLE_UNIVERSAL_BUILD=1 else APPLE_UNIVERSAL_BUILD=0 diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index c870fb61b9..9a01cd6a76 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 @@ -1,5 +1,5 @@ -# netdb_h.m4 serial 9 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# netdb_h.m4 serial 10 +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_HEADER_NETDB], [ AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - AC_CHECK_HEADERS_ONCE([netdb.h]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then HAVE_NETDB_H=1 diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index cc7a44cc21..87235b73bc 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,5 +1,5 @@ -# netinet_in_h.m4 serial 4 -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +# netinet_in_h.m4 serial 5 +dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,4 +27,5 @@ AC_DEFUN([gl_HEADER_NETINET_IN], AC_SUBST([HAVE_NETINET_IN_H]) fi AC_SUBST([NETINET_IN_H]) + AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"]) ]) diff --git a/gl/m4/perror.m4 b/gl/m4/perror.m4 deleted file mode 100644 index 350cd4203f..0000000000 --- a/gl/m4/perror.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# perror.m4 serial 1 -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_FUNC_PERROR], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_ERRNO_H]) - if test -n "$ERRNO_H"; then - dnl The system's perror() cannot know about the new errno values we add - dnl to <errno.h>. Replace it. - REPLACE_PERROR=1 - AC_LIBOBJ([perror]) - fi -]) diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 6d1cbfe209..9c2ed1ef2f 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,5 +1,5 @@ -# printf.m4 serial 40 -dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. +# printf.m4 serial 42 +dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -71,8 +71,8 @@ changequote(,)dnl gl_cv_func_printf_sizes_c99="guessing no";; openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; - solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_sizes_c99="guessing no";; @@ -591,8 +591,8 @@ changequote(,)dnl darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; darwin*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; - solaris*) gl_cv_func_printf_directive_f="guessing yes";; + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # If we don't know, assume the worst. *) gl_cv_func_printf_directive_f="guessing no";; esac @@ -890,8 +890,9 @@ changequote([,])dnl 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 floating-point or pointer output. On Solaris 10/x86, precisions larger -dnl than 510 in floating-point output crash the program. On BeOS, precisions -dnl larger than 1044 crash the program. +dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC, +dnl precisions larger than 510 in floating-point output yield wrong results. +dnl On BeOS, precisions larger than 1044 crash the program. dnl Result is gl_cv_func_printf_precision. AC_DEFUN([gl_PRINTF_PRECISION], @@ -917,6 +918,9 @@ int main () result |= 1; if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) result |= 2; + if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 + || buf[0] != '1') + result |= 4; return result; }]])], [gl_cv_func_printf_precision=yes], @@ -1102,7 +1106,8 @@ changequote(,)dnl gl_cv_func_snprintf_truncation_c99="guessing no";; openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; @@ -1161,6 +1166,10 @@ int main () strcpy (buf, "ABCDEF"); if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; + if (snprintf (buf, 0, "%d %d", 4567, 89) != 7) + return 2; + if (snprintf (NULL, 0, "%d %d", 4567, 89) != 7) + return 3; return 0; }]])], [gl_cv_func_snprintf_retval_c99=yes], @@ -1180,9 +1189,9 @@ changequote(,)dnl openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_retval_c99="guessing no";; openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; - solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; @@ -1243,7 +1252,8 @@ changequote(,)dnl darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_directive_n="guessing no";; solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; @@ -1371,7 +1381,8 @@ changequote(,)dnl # Guess yes on Cygwin. cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; @@ -1452,10 +1463,10 @@ dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . . dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . -dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . +dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . . -dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . +dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # @@ -1465,6 +1476,6 @@ dnl OSF/1 4.0d # . # # # # . . . . . # . . # dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . -dnl Haiku . . . # # # . # . . . . . ? . . . . . . -dnl BeOS # # . # # # . ? # . ? . # ? . . . . . . +dnl Haiku . . . # # # . # . . . . . ? . . ? . . . +dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . dnl mingw # # # # # # . . # # . # # ? . # # # . . diff --git a/gl/m4/read-file.m4 b/gl/m4/read-file.m4 index 35a3a4817f..60d03600a8 100644 --- a/gl/m4/read-file.m4 +++ b/gl/m4/read-file.m4 @@ -1,6 +1,5 @@ # read-file.m4 serial 2 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software -dnl Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/readline.m4 b/gl/m4/readline.m4 deleted file mode 100644 index 7a97ecba91..0000000000 --- a/gl/m4/readline.m4 +++ /dev/null @@ -1,86 +0,0 @@ -# readline.m4 serial 8 -dnl Copyright (C) 2005, 2006, 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. - -dnl Written by Simon Josefsson, with help from Bruno Haible and Oskar -dnl Liljeblad. - -AC_DEFUN([gl_FUNC_READLINE], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libreadline and define LIBREADLINE, LTLIBREADLINE and - dnl INCREADLINE accordingly. - AC_LIB_LINKFLAGS_BODY([readline]) - - dnl Add $INCREADLINE to CPPFLAGS before performing the following checks, - dnl because if the user has installed libreadline and not disabled its use - dnl via --without-libreadline-prefix, he wants to use it. The AC_LINK_IFELSE - dnl will then succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCREADLINE]) - - AC_CACHE_CHECK([for readline], [gl_cv_lib_readline], [ - gl_cv_lib_readline=no - am_save_LIBS="$LIBS" - dnl On some systems, -lreadline doesn't link without an additional - dnl -lncurses or -ltermcap. - dnl Try -lncurses before -ltermcap, because libtermcap is unsecure - dnl by design and obsolete since 1994. Try -lcurses last, because - dnl libcurses is unusable on some old Unices. - for extra_lib in "" ncurses termcap curses; do - LIBS="$am_save_LIBS $LIBREADLINE" - if test -n "$extra_lib"; then - LIBS="$LIBS -l$extra_lib" - fi - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> -#include <readline/readline.h>]], - [[readline((char*)0);]])], - [if test -n "$extra_lib"; then - gl_cv_lib_readline="yes, requires -l$extra_lib" - else - gl_cv_lib_readline="yes" - fi - ]) - if test "$gl_cv_lib_readline" != no; then - break - fi - done - LIBS="$am_save_LIBS" - ]) - - if test "$gl_cv_lib_readline" != no; then - AC_DEFINE([HAVE_READLINE], [1], [Define if you have the readline library.]) - extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'` - if test -n "$extra_lib"; then - LIBREADLINE="$LIBREADLINE $extra_lib" - LTLIBREADLINE="$LTLIBREADLINE $extra_lib" - fi - AC_MSG_CHECKING([how to link with libreadline]) - AC_MSG_RESULT([$LIBREADLINE]) - else - dnl If $LIBREADLINE didn't lead to a usable library, we don't - dnl need $INCREADLINE either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBREADLINE= - LTLIBREADLINE= - fi - AC_SUBST([LIBREADLINE]) - AC_SUBST([LTLIBREADLINE]) - - AC_CHECK_HEADERS([readline/readline.h]) - - if test "$gl_cv_lib_readline" = no; then - AC_LIBOBJ([readline]) - gl_PREREQ_READLINE - fi -]) - -# Prerequisites of lib/readline.c. -AC_DEFUN([gl_PREREQ_READLINE], [ - : -]) diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index 01c1234f7e..a403d9fb32 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 @@ -1,5 +1,5 @@ # realloc.m4 serial 11 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +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. diff --git a/gl/m4/select.m4 b/gl/m4/select.m4 deleted file mode 100644 index da266f0bfa..0000000000 --- a/gl/m4/select.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# select.m4 serial 3 -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_FUNC_SELECT], -[ - AC_REQUIRE([gl_HEADER_SYS_SELECT]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_REQUIRE([gl_SOCKETS]) - if test "$ac_cv_header_winsock2_h" = yes; then - AC_LIBOBJ([select]) - else - dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error - dnl EFAULT. - AC_CHECK_HEADERS_ONCE([sys/select.h]) - AC_CACHE_CHECK([whether select supports a 0 argument], - [gl_cv_func_select_supports0], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include <sys/types.h> -#include <sys/time.h> -#if HAVE_SYS_SELECT_H -#include <sys/select.h> -#endif -int main () -{ - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 5; - return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0; -}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess no on Interix. - interix*) gl_cv_func_select_supports0="guessing no";; - # Guess yes otherwise. - *) gl_cv_func_select_supports0="guessing yes";; - esac -changequote([,])dnl - ]) - ]) - case "$gl_cv_func_select_supports0" in - *yes) ;; - *) - REPLACE_SELECT=1 - AC_LIBOBJ([select]) - ;; - esac - fi -]) diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 deleted file mode 100644 index 2486511aad..0000000000 --- a/gl/m4/servent.m4 +++ /dev/null @@ -1,51 +0,0 @@ -# servent.m4 serial 2 -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. - -AC_DEFUN([gl_SERVENT], -[ - dnl Where are getservent(), setservent(), endservent(), getservbyname(), - dnl getservbyport() defined? - dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(), - dnl getprotobynumber() defined? - dnl - On Solaris, they are in libsocket. Ignore libxnet. - dnl - On Haiku, they are in libnetwork. - dnl - On BeOS, they are in libnet. - dnl - On native Windows, they are in ws2_32.dll. - dnl - Otherwise they are in libc. - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - SERVENT_LIB= - gl_saved_libs="$LIBS" - AC_SEARCH_LIBS([getservbyname], [socket network net], - [if test "$ac_cv_search_getservbyname" != "none required"; then - SERVENT_LIB="$ac_cv_search_getservbyname" - fi]) - LIBS="$gl_saved_libs" - if test -z "$SERVENT_LIB"; then - AC_CHECK_FUNCS([getservbyname], , [ - AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], - [gl_cv_w32_getservbyname], - [gl_cv_w32_getservbyname=no - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif -#include <stddef.h> - ]], - [[getservbyname(NULL,NULL);]])], - [gl_cv_w32_getservbyname=yes]) - LIBS="$gl_save_LIBS" - ]) - if test "$gl_cv_w32_getservbyname" = "yes"; then - SERVENT_LIB="-lws2_32" - fi - ]) - fi - AC_SUBST([SERVENT_LIB]) -]) diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index f3b1a9dfb2..e8070981a8 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 @@ -1,5 +1,5 @@ # size_max.m4 serial 10 -dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 522b107b12..8aa5dbe598 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 @@ -1,5 +1,5 @@ # snprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,7 +13,12 @@ AC_DEFUN([gl_FUNC_SNPRINTF], gl_SNPRINTF_SIZE1 case "$gl_cv_func_snprintf_size1" in *yes) - gl_cv_func_snprintf_usable=yes + gl_SNPRINTF_RETVAL_C99 + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + gl_cv_func_snprintf_usable=yes + ;; + esac ;; esac fi diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index 7bf02b5aee..2aa972dd88 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 @@ -1,5 +1,5 @@ # socketlib.m4 serial 1 -dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index ba9a563d8e..cbe754f8d5 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 @@ -1,5 +1,5 @@ # sockets.m4 serial 7 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index d0d6baab55..4475154448 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,5 +1,5 @@ -# socklen.m4 serial 8 -dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. +# socklen.m4 serial 10 +dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,15 +9,11 @@ dnl From Albert Chin, Windows fixes from Simon Josefsson. dnl Check for socklen_t: historically on BSD it is an int, and in dnl POSIX 1g it is a type of its own, but some platforms use different dnl types for the argument to getsockopt, getpeername, etc.: -dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS. +dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. dnl So we have to test to find something that will work. -dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's sys_socket.in.h, which -dnl all users of this module should include. Cygwin must not include -dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], - [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl + [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl AC_CHECK_TYPE([socklen_t], , [AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([gl_cv_socklen_t_equiv], @@ -45,9 +41,37 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T], AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], [type to use in place of socklen_t if not defined])], - [#include <sys/types.h> - #if HAVE_SYS_SOCKET_H - # include <sys/socket.h> - #elif HAVE_WS2TCPIP_H - # include <ws2tcpip.h> - #endif])]) + [gl_SOCKET_HEADERS])]) + +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find +dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users +dnl of this module should use the same include pattern as gl_SOCKET_HEADERS. +dnl When you change this macro, keep also in sync: +dnl - gl_CHECK_SOCKET_HEADERS, +dnl - the Include section of modules/socklen. +AC_DEFUN([gl_SOCKET_HEADERS], +[ +/* <sys/types.h> is not needed according to POSIX, but the + <sys/socket.h> in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include <sys/types.h> +#if HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#elif HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif +]) + +dnl Tests for the existence of the header for socket facilities. +dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H. +dnl This macro must match gl_SOCKET_HEADERS. +AC_DEFUN([gl_CHECK_SOCKET_HEADERS], + [AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = no; then + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([ws2tcpip.h]) + fi + ]) diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 8806705ae2..c38daea5b7 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 @@ -1,5 +1,5 @@ -# sockpfaf.m4 serial 7 -dnl Copyright (C) 2004, 2006, 2009, 2010 Free Software Foundation, Inc. +# sockpfaf.m4 serial 8 +dnl Copyright (C) 2004, 2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -59,3 +59,29 @@ AC_DEFUN([gl_SOCKET_FAMILIES], AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) fi ]) + +AC_DEFUN([gl_SOCKET_FAMILY_UNIX], +[ + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_CHECK_HEADERS_ONCE([sys/un.h]) + + AC_MSG_CHECKING([for UNIX domain sockets]) + AC_CACHE_VAL([gl_cv_socket_unix], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_UN_H +#include <sys/un.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif]], +[[int x = AF_UNIX; struct sockaddr_un y; + if (&x && &y) return 0;]])], + gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) + AC_MSG_RESULT([$gl_cv_socket_unix]) + if test $gl_cv_socket_unix = yes; then + AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) + fi +]) diff --git a/gl/m4/stdarg.m4 b/gl/m4/stdarg.m4 index 8a62f2e844..5705de9eca 100644 --- a/gl/m4/stdarg.m4 +++ b/gl/m4/stdarg.m4 @@ -1,5 +1,5 @@ -# stdarg.m4 serial 4 -dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. +# stdarg.m4 serial 6 +dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,8 +9,8 @@ dnl Provide a working va_copy in combination with <stdarg.h>. AC_DEFUN([gl_STDARG_H], [ - STDARG_H=''; AC_SUBST([STDARG_H]) - NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H]) + STDARG_H='' + NEXT_STDARG_H='<stdarg.h>' AC_MSG_CHECKING([for va_copy]) AC_CACHE_VAL([gl_cv_func_va_copy], [ AC_COMPILE_IFELSE( @@ -41,7 +41,7 @@ void (*func) (va_list, va_list) = va_copy; if test $gl_aixcc = yes; then dnl Provide a substitute <stdarg.h> file. STDARG_H=stdarg.h - gl_CHECK_NEXT_HEADERS([stdarg.h]) + gl_NEXT_HEADERS([stdarg.h]) dnl Fallback for the case when <stdarg.h> contains only macro definitions. if test "$gl_cv_next_stdarg_h" = '""'; then gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' @@ -72,4 +72,7 @@ error, bail out fi fi fi + AC_SUBST([STDARG_H]) + AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) + AC_SUBST([NEXT_STDARG_H]) ]) diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4 index 1efe59ea1c..1ebf3e6808 100644 --- a/gl/m4/stdbool.m4 +++ b/gl/m4/stdbool.m4 @@ -1,17 +1,17 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -#serial 3 +#serial 5 # Prepare for substituting <stdbool.h> if it is not supported. AC_DEFUN([AM_STDBOOL_H], [ - AC_REQUIRE([AC_HEADER_STDBOOL]) + AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) # Define two additional variables used in the Makefile substitution. @@ -21,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H], STDBOOL_H='stdbool.h' fi AC_SUBST([STDBOOL_H]) + AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 @@ -33,11 +34,9 @@ AC_DEFUN([AM_STDBOOL_H], # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) -# This version of the macro is needed in autoconf <= 2.67. Autoconf has -# it built in since 2.60, but we want the tweaks from the 2.68 version -# to avoid rejecting xlc and clang due to relying on extensions. +# This version of the macro is needed in autoconf <= 2.68. -AC_DEFUN([AC_HEADER_STDBOOL], +AC_DEFUN([AC_CHECK_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_COMPILE_IFELSE( @@ -98,6 +97,4 @@ AC_DEFUN([AC_HEADER_STDBOOL], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) - if test $ac_cv_header_stdbool_h = yes; then - AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) - fi]) +]) diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index c3ae569431..1ae2344318 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 @@ -1,6 +1,6 @@ dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 2 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# stddef_h.m4 serial 4 +dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,7 @@ AC_DEFUN([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) + STDDEF_H= if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -24,8 +25,10 @@ AC_DEFUN([gl_STDDEF_H], REPLACE_NULL=1 STDDEF_H=stddef.h fi + AC_SUBST([STDDEF_H]) + AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then - gl_CHECK_NEXT_HEADERS([stddef.h]) + gl_NEXT_HEADERS([stddef.h]) fi ]) @@ -41,5 +44,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) - STDDEF_H=''; AC_SUBST([STDDEF_H]) ]) diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 7fe28362fc..dff37fe1bf 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,5 +1,5 @@ -# stdint.m4 serial 36 -dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. +# stdint.m4 serial 40 +dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -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 @@ -145,9 +154,11 @@ uintmax_t j = UINTMAX_MAX; #include <limits.h> /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) #define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) struct s { int check_PTRDIFF: PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) @@ -290,14 +301,11 @@ 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 AC_SUBST([STDINT_H]) + AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 670c0cc2bf..356b14e120 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 @@ -1,5 +1,5 @@ # stdint_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index f5650cdeab..7f3ae56295 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,5 +1,5 @@ -# stdio_h.m4 serial 31 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -8,8 +8,7 @@ AC_DEFUN([gl_STDIO_H], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) - gl_CHECK_NEXT_HEADERS([stdio.h]) + gl_NEXT_HEADERS([stdio.h]) dnl No need to create extra modules for these functions. Everyone who uses dnl <stdio.h> likely needs them. GNULIB_FPRINTF=1 @@ -95,6 +94,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) + HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) + HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) @@ -137,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/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index e4697ce213..25fdada0de 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 31 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -7,21 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([stdlib.h]) - AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) - if test $ac_cv_header_random_h = yes; then - HAVE_RANDOM_H=1 - else - HAVE_RANDOM_H=0 - fi - AC_SUBST([HAVE_RANDOM_H]) - AC_CHECK_TYPES([struct random_data], - [], [HAVE_STRUCT_RANDOM_DATA=0], - [[#include <stdlib.h> - #if HAVE_RANDOM_H - # include <random.h> - #endif - ]]) + gl_NEXT_HEADERS([stdlib.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not @@ -58,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]) @@ -76,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]) @@ -89,20 +77,23 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) + HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) - HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) 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]) @@ -110,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/gl/m4/strerror.m4 b/gl/m4/strerror.m4 deleted file mode 100644 index 1649b24511..0000000000 --- a/gl/m4/strerror.m4 +++ /dev/null @@ -1,68 +0,0 @@ -# strerror.m4 serial 9 -dnl Copyright (C) 2002, 2007-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_FUNC_STRERROR], -[ - AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) - if test $REPLACE_STRERROR = 1; then - AC_LIBOBJ([strerror]) - AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], - [Define this to 1 if strerror is broken.]) - fi -]) - -# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). -AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], -[ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_ERRNO_H]) - if test -z "$ERRNO_H"; then - AC_CACHE_CHECK([for working strerror function], - [gl_cv_func_working_strerror], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <string.h> - ]], - [[return !*strerror (-2);]])], - [gl_cv_func_working_strerror=yes], - [gl_cv_func_working_strerror=no], - [dnl Assume crossbuild works if it compiles. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <string.h> - ]], - [[return !*strerror (-2);]])], - [gl_cv_func_working_strerror=yes], - [gl_cv_func_working_strerror=no]) - ]) - ]) - if test $gl_cv_func_working_strerror = no; then - dnl The system's strerror() fails to return a string for out-of-range - dnl integers. Replace it. - REPLACE_STRERROR=1 - fi - else - dnl The system's strerror() cannot know about the new errno values we add - dnl to <errno.h>. Replace it. - REPLACE_STRERROR=1 - fi - if test $REPLACE_STRERROR = 1; then - gl_PREREQ_STRERROR - fi -]) - -# Prerequisites of lib/strerror.c. -AC_DEFUN([gl_PREREQ_STRERROR], [ - AC_CHECK_DECLS([strerror]) - AC_CHECK_HEADERS_ONCE([sys/socket.h]) - if test $ac_cv_header_sys_socket_h != yes; then - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([winsock2.h]) - fi -]) diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index 5844b2d660..30ddfbc3a4 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007-2010 Free Software Foundation, Inc. +# Copyright (C) 2007-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. -# serial 18 +# serial 19 # Written by Paul Eggert. @@ -20,7 +20,7 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([string.h]) + gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not diff --git a/gl/m4/sys_ioctl_h.m4 b/gl/m4/sys_ioctl_h.m4 deleted file mode 100644 index 5c342a5b1d..0000000000 --- a/gl/m4/sys_ioctl_h.m4 +++ /dev/null @@ -1,71 +0,0 @@ -# sys_ioctl_h.m4 serial 9 -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 Written by Bruno Haible. - -AC_DEFUN([gl_SYS_IOCTL_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) - - AC_CHECK_HEADERS_ONCE([sys/ioctl.h]) - if test $ac_cv_header_sys_ioctl_h = yes; then - HAVE_SYS_IOCTL_H=1 - dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other - dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. - AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], - [gl_cv_decl_ioctl_in_sys_ioctl_h], - [dnl We cannot use AC_CHECK_DECL because it produces its own messages. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT([#include <sys/ioctl.h>])], - [(void) ioctl;])], - [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], - [gl_cv_decl_ioctl_in_sys_ioctl_h=no]) - ]) - else - HAVE_SYS_IOCTL_H=0 - fi - AC_SUBST([HAVE_SYS_IOCTL_H]) - dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h> -/* Some platforms declare ioctl in the wrong header. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <unistd.h> -#endif - ]], [ioctl]) -]) - -dnl Unconditionally enables the replacement of <sys/ioctl.h>. -AC_DEFUN([gl_REPLACE_SYS_IOCTL_H], -[ - dnl This is a no-op, because <sys/ioctl.h> is always overridden. - : -]) - -AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS], -[ - GNULIB_IOCTL=0; AC_SUBST([GNULIB_IOCTL]) - dnl Assume proper GNU behavior unless another module says otherwise. - SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H]) - SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; - AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) - REPLACE_IOCTL=0; AC_SUBST([REPLACE_IOCTL]) -]) diff --git a/gl/m4/sys_select_h.m4 b/gl/m4/sys_select_h.m4 deleted file mode 100644 index 0e8063ea97..0000000000 --- a/gl/m4/sys_select_h.m4 +++ /dev/null @@ -1,85 +0,0 @@ -# sys_select_h.m4 serial 15 -dnl Copyright (C) 2006-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_HEADER_SYS_SELECT], -[ - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) - AC_CACHE_CHECK([whether <sys/select.h> is self-contained], - [gl_cv_header_sys_select_h_selfcontained], - [ - dnl Test against two bugs: - dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of - dnl <sys/types.h>. - dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration - dnl of 'struct timeval', and no definition of this type. - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], - [[struct timeval b;]])], - [gl_cv_header_sys_select_h_selfcontained=yes], - [gl_cv_header_sys_select_h_selfcontained=no]) - dnl Test against another bug: - dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation - dnl that relies on memset(), but without including <string.h>. - if test $gl_cv_header_sys_select_h_selfcontained = yes; then - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <sys/select.h>]], - [[int memset; int bzero;]]) - ], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[ - #undef memset - #define memset nonexistent_memset - extern void *memset (void *, int, unsigned long); - #undef bzero - #define bzero nonexistent_bzero - extern void bzero (void *, unsigned long); - fd_set fds; - FD_ZERO (&fds); - ]]) - ], - [], - [gl_cv_header_sys_select_h_selfcontained=no]) - ]) - fi - ]) - AC_CHECK_HEADERS_ONCE([sys/select.h]) - dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([sys/select.h]) - if test $ac_cv_header_sys_select_h = yes; then - HAVE_SYS_SELECT_H=1 - else - HAVE_SYS_SELECT_H=0 - fi - AC_SUBST([HAVE_SYS_SELECT_H]) - gl_PREREQ_SYS_H_WINSOCK2 - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[ -/* Some systems require prerequisite headers. */ -#include <sys/types.h> -#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#include <sys/select.h> - ]], [select]) -]) - -AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS], -[ - GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT]) - dnl Assume proper GNU behavior unless another module says otherwise. - REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT]) -]) diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index c7627cb94e..7da91a4a34 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,5 +1,5 @@ -# sys_socket_h.m4 serial 20 -dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 22 +dnl Copyright (C) 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,8 +9,20 @@ dnl From Simon Josefsson. AC_DEFUN([gl_HEADER_SYS_SOCKET], [ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_C_INLINE]) + dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have + dnl old-style declarations (with return type 'int' instead of 'ssize_t') + dnl unless _POSIX_PII_SOCKET is defined. + case "$host_os" in + osf*) + AC_DEFINE([_POSIX_PII_SOCKET], [1], + [Define to 1 in order to get the POSIX compatible declarations + of socket functions.]) + ;; + esac + AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], [gl_cv_header_sys_socket_h_selfcontained], [ @@ -89,17 +101,13 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], [ dnl Check prerequisites of the <sys/socket.h> replacement. + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) gl_CHECK_NEXT_HEADERS([sys/socket.h]) if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 HAVE_WS2TCPIP_H=0 else HAVE_SYS_SOCKET_H=0 - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([ws2tcpip.h]) if test $ac_cv_header_ws2tcpip_h = yes; then HAVE_WS2TCPIP_H=1 else diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index 7181c253b9..fc419129e9 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 @@ -1,5 +1,5 @@ # sys_stat_h.m4 serial 24 -*- Autoconf -*- -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/sys_time_h.m4 b/gl/m4/sys_time_h.m4 index da57527163..3a3adc8c47 100644 --- a/gl/m4/sys_time_h.m4 +++ b/gl/m4/sys_time_h.m4 @@ -1,7 +1,7 @@ # Configure a replacement for <sys/time.h>. # serial 6 -# Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index a45a10a9ee..615da1cfd3 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -1,8 +1,8 @@ # Configure a more-standard replacement for <time.h>. -# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. -# serial 2 +# serial 4 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -21,7 +21,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([time.h]) + gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) ]) @@ -95,7 +95,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R]) + HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) diff --git a/gl/m4/timespec.m4 b/gl/m4/timespec.m4 index 5dbaed74a0..4a1c7adb4d 100644 --- a/gl/m4/timespec.m4 +++ b/gl/m4/timespec.m4 @@ -1,6 +1,6 @@ #serial 14 -# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index 68ccf88349..749f6bd5dc 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 @@ -1,5 +1,5 @@ # ungetc.m4 serial 2 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index e2f7f2bf45..c81a1138e9 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 48 -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +# unistd_h.m4 serial 53 +dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -14,8 +14,6 @@ AC_DEFUN([gl_UNISTD_H], AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) - - AC_CHECK_HEADERS_ONCE([unistd.h]) if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else @@ -38,7 +36,7 @@ AC_DEFUN([gl_UNISTD_H], ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell - endusershell lchown link linkat lseek pipe2 pread pwrite readlink + endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep]) ]) @@ -78,6 +76,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) @@ -112,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) @@ -120,14 +120,15 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) - HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) + HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) + HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) @@ -137,6 +138,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) + REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) diff --git a/gl/m4/valgrind-tests.m4 b/gl/m4/valgrind-tests.m4 deleted file mode 100644 index e2434c6b83..0000000000 --- a/gl/m4/valgrind-tests.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# valgrind-tests.m4 serial 1 -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. - -dnl From Simon Josefsson - -# gl_VALGRIND_TESTS() -# ------------------- -# Check if valgrind is available, and set VALGRIND to it if available. -AC_DEFUN([gl_VALGRIND_TESTS], -[ - AC_ARG_ENABLE(valgrind-tests, - AS_HELP_STRING([--enable-valgrind-tests], - [run self tests under valgrind]), - [opt_valgrind_tests=$enableval], [opt_valgrind_tests=yes]) - - # Run self-tests under valgrind? - if test "$opt_valgrind_tests" = "yes" && test "$cross_compiling" = no; then - AC_CHECK_PROGS(VALGRIND, valgrind) - fi - - if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then - opt_valgrind_tests=yes - VALGRIND="$VALGRIND -q" - else - opt_valgrind_tests=no - VALGRIND= - fi - - AC_MSG_CHECKING([whether self tests are run under valgrind]) - AC_MSG_RESULT($opt_valgrind_tests) -]) diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 9c04520242..32ea985b3f 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,5 +1,5 @@ # vasnprintf.m4 serial 32 -dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/version-etc.m4 b/gl/m4/version-etc.m4 index 2c572b4bca..5032bf8553 100644 --- a/gl/m4/version-etc.m4 +++ b/gl/m4/version-etc.m4 @@ -1,5 +1,5 @@ # version-etc.m4 serial 1 -# Copyright (C) 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index 42daae87b8..e0d0f27640 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 @@ -1,5 +1,5 @@ # warn-on-use.m4 serial 2 -dnl Copyright (C) 2010 Free Software Foundation, Inc. +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. diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4 index dad5c1f29c..a8f3466326 100644 --- a/gl/m4/warnings.m4 +++ b/gl/m4/warnings.m4 @@ -1,5 +1,5 @@ # warnings.m4 serial 2 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index 8c8fad96df..6255ff352d 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 @@ -1,13 +1,13 @@ dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +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. dnl Written by Eric Blake. -# wchar_h.m4 serial 35 +# wchar_h.m4 serial 38 AC_DEFUN([gl_WCHAR_H], [ @@ -17,7 +17,6 @@ AC_DEFUN([gl_WCHAR_H], dnl Check for <wchar.h> (missing in Linux uClibc when built without wide dnl character support). dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. - AC_CHECK_HEADERS_ONCE([wchar.h]) gl_CHECK_NEXT_HEADERS([wchar.h]) if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 @@ -39,15 +38,23 @@ AC_DEFUN([gl_WCHAR_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ -/* Some systems require additional headers. */ +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include <stddef.h> # include <stdio.h> # include <time.h> #endif #include <wchar.h> - ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb - wcsrtombs wcsnrtombs wcwidth]) + ]], + [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb + wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset + wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp + wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr + wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth + ]) ]) dnl Check whether <wchar.h> is usable at all. @@ -63,6 +70,13 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], [gl_cv_header_wchar_h_correct_inline=yes AC_LANG_CONFTEST([ AC_LANG_SOURCE([[#define wcstod renamed_wcstod +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> #include <wchar.h> extern int zero (void); int main () { return zero(); } @@ -71,6 +85,13 @@ int main () { return zero(); } mv conftest.$ac_objext conftest1.$ac_objext AC_LANG_CONFTEST([ AC_LANG_SOURCE([[#define wcstod renamed_wcstod +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> #include <wchar.h> int zero (void) { return 0; } ]])]) @@ -116,17 +137,45 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], AC_DEFUN([gl_WCHAR_H_DEFAULTS], [ - GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) - GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) - GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) - GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) - GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) - GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) - GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) - GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) - GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) - GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) - GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) + GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) + GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) + GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) + GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) + GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) + GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) + GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) + GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) + GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) + GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) + GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) + GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) + GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) + GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) + GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) + GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) + GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) + GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) + GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) + GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) + GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) + GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) + GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) + GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) + GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) + GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) + GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) + GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) + GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) + GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) + GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) + GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) + GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) + GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) + GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) + GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) @@ -137,6 +186,34 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) + HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR]) + HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) + HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) + HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) + HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) + HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) + HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) + HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY]) + HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY]) + HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY]) + HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY]) + HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT]) + HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT]) + HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP]) + HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP]) + HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP]) + HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP]) + HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL]) + HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM]) + HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP]) + HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR]) + HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR]) + HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN]) + HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN]) + HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK]) + HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) + HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) + HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) @@ -151,4 +228,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) + REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) ]) diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index a133e6ad58..d2c03c42d2 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index 58ef865565..da1ce3df60 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,5 +1,5 @@ # wint_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index b653693a30..8c693bc633 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 @@ -1,5 +1,5 @@ # xsize.m4 serial 4 -dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/malloc.c b/gl/malloc.c index 4fa38ee41b..a325d619b2 100644 --- a/gl/malloc.c +++ b/gl/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/memchr.c b/gl/memchr.c index 6c2b2d6c7d..6d903b1014 100644 --- a/gl/memchr.c +++ b/gl/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2011 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff --git a/gl/minmax.h b/gl/minmax.h index 78ca8479d8..172fafee4d 100644 --- a/gl/minmax.h +++ b/gl/minmax.h @@ -1,5 +1,5 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009, 2010 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/gl/netdb.in.h b/gl/netdb.in.h index b0c553ef0d..44a4530714 100644 --- a/gl/netdb.in.h +++ b/gl/netdb.in.h @@ -1,5 +1,5 @@ /* Provide a netdb.h header file for systems lacking it (read: MinGW). - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -37,7 +37,8 @@ #ifndef _GL_NETDB_H #define _GL_NETDB_H -/* Get netdb.h definitions such as struct hostent for MinGW. */ +/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and + 'struct hostent' on MinGW. */ #include <sys/socket.h> /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -51,6 +52,7 @@ # if !@HAVE_STRUCT_ADDRINFO@ +# if !GNULIB_defined_struct_addrinfo /* Structure to contain information about address of a service provider. */ struct addrinfo { @@ -63,6 +65,8 @@ struct addrinfo char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; +# define GNULIB_defined_struct_addrinfo 1 +# endif # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h index 4b0710fb8d..f5eea43d69 100644 --- a/gl/netinet_in.in.h +++ b/gl/netinet_in.in.h @@ -1,5 +1,5 @@ /* Substitute for <netinet/in.h>. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/perror.c b/gl/perror.c deleted file mode 100644 index bc3c764911..0000000000 --- a/gl/perror.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Print a message describing error code. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. - Written by Bruno Haible and Simon Josefsson. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> -#include <string.h> - -void -perror (const char *string) -{ - const char *errno_description = strerror (errno); - - if (string != NULL && *string != '\0') - fprintf (stderr, "%s: %s\n", string, errno_description); - else - fprintf (stderr, "%s\n", errno_description); -} diff --git a/gl/printf-args.c b/gl/printf-args.c index 46c03a21ea..8f3727bb48 100644 --- a/gl/printf-args.c +++ b/gl/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/gl/printf-args.h b/gl/printf-args.h index 2536ebafd3..70cca4fb65 100644 --- a/gl/printf-args.h +++ b/gl/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -136,10 +136,14 @@ typedef struct } argument; +/* Number of directly allocated arguments (no malloc() needed). */ +#define N_DIRECT_ALLOC_ARGUMENTS 7 + typedef struct { size_t count; argument *arg; + argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS]; } arguments; diff --git a/gl/printf-parse.c b/gl/printf-parse.c index 58cd889089..ff24ba47e2 100644 --- a/gl/printf-parse.c +++ b/gl/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,6 +63,9 @@ /* malloc(), realloc(), free(). */ #include <stdlib.h> +/* memcpy(). */ +#include <string.h> + /* errno. */ #include <errno.h> @@ -80,23 +83,20 @@ STATIC int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { - const CHAR_T *cp = format; /* pointer into format */ + const CHAR_T *cp = format; /* pointer into format */ size_t arg_posn = 0; /* number of regular arguments consumed */ - size_t d_allocated; /* allocated elements of d->dir */ - size_t a_allocated; /* allocated elements of a->arg */ + size_t d_allocated; /* allocated elements of d->dir */ + size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; - d_allocated = 1; - d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); - if (d->dir == NULL) - /* Out of memory. */ - goto out_of_memory_1; + d_allocated = N_DIRECT_ALLOC_DIRECTIVES; + d->dir = d->direct_alloc_dir; a->count = 0; - a_allocated = 0; - a->arg = NULL; + a_allocated = N_DIRECT_ALLOC_ARGUMENTS; + a->arg = a->direct_alloc_arg; #define REGISTER_ARG(_index_,_type_) \ { \ @@ -113,12 +113,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto out_of_memory; \ - memory = (argument *) (a->arg \ + memory = (argument *) (a->arg != a->direct_alloc_arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto out_of_memory; \ + if (a->arg == a->direct_alloc_arg) \ + memcpy (memory, a->arg, a->count * sizeof (argument)); \ a->arg = memory; \ } \ while (a->count <= n) \ @@ -588,10 +590,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto out_of_memory; - memory = (DIRECTIVE *) realloc (d->dir, memory_size); + memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir + ? realloc (d->dir, memory_size) + : malloc (memory_size)); if (memory == NULL) /* Out of memory. */ goto out_of_memory; + if (d->dir == d->direct_alloc_dir) + memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE)); d->dir = memory; } } @@ -610,19 +616,18 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) return 0; error: - if (a->arg) + if (a->arg != a->direct_alloc_arg) free (a->arg); - if (d->dir) + if (d->dir != d->direct_alloc_dir) free (d->dir); errno = EINVAL; return -1; out_of_memory: - if (a->arg) + if (a->arg != a->direct_alloc_arg) free (a->arg); - if (d->dir) + if (d->dir != d->direct_alloc_dir) free (d->dir); -out_of_memory_1: errno = ENOMEM; return -1; } diff --git a/gl/printf-parse.h b/gl/printf-parse.h index 1b27040b7e..76e5ba3268 100644 --- a/gl/printf-parse.h +++ b/gl/printf-parse.h @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -47,6 +47,9 @@ /* xxx_directive: A parsed directive. xxx_directives: A parsed format string. */ +/* Number of directly allocated directives (no malloc() needed). */ +#define N_DIRECT_ALLOC_DIRECTIVES 7 + /* A parsed directive. */ typedef struct { @@ -71,6 +74,7 @@ typedef struct char_directive *dir; size_t max_width_length; size_t max_precision_length; + char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } char_directives; @@ -100,6 +104,7 @@ typedef struct u8_directive *dir; size_t max_width_length; size_t max_precision_length; + u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u8_directives; @@ -127,6 +132,7 @@ typedef struct u16_directive *dir; size_t max_width_length; size_t max_precision_length; + u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u16_directives; @@ -154,6 +160,7 @@ typedef struct u32_directive *dir; size_t max_width_length; size_t max_precision_length; + u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u32_directives; diff --git a/gl/progname.c b/gl/progname.c index 1415e6a55f..2465748175 100644 --- a/gl/progname.c +++ b/gl/progname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/gl/progname.h b/gl/progname.h index 5ba303bd07..084406607d 100644 --- a/gl/progname.h +++ b/gl/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/gl/read-file.c b/gl/read-file.c index 8d70880e7d..bcbfbbb460 100644 --- a/gl/read-file.c +++ b/gl/read-file.c @@ -1,5 +1,5 @@ /* read-file.c -- read file contents into a string - Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. Written by Simon Josefsson and Bruno Haible. This program is free software; you can redistribute it and/or modify @@ -39,12 +39,12 @@ and set *LENGTH to the length of the string. The string is zero-terminated, but the terminating zero byte is not counted in *LENGTH. On errors, *LENGTH is undefined, errno preserves the - values set by system functions (if any), and NULL is returned. */ + values set by system functions (if any), and NULL is returned. */ char * -fread_file (FILE * stream, size_t * length) +fread_file (FILE *stream, size_t *length) { char *buf = NULL; - size_t alloc = 0; + size_t alloc = BUFSIZ; /* For a regular file, allocate a buffer that has exactly the right size. This avoids the need to do dynamic reallocations later. */ @@ -59,59 +59,31 @@ fread_file (FILE * stream, size_t * length) { off_t alloc_off = st.st_size - pos; - if (SIZE_MAX <= alloc_off) + /* '1' below, accounts for the trailing NUL. */ + if (SIZE_MAX - 1 < alloc_off) { errno = ENOMEM; return NULL; } alloc = alloc_off + 1; - - buf = malloc (alloc); - if (!buf) - /* errno is ENOMEM. */ - return NULL; } } } + if (!(buf = malloc (alloc))) + return NULL; /* errno is ENOMEM. */ + { size_t size = 0; /* number of bytes read so far */ int save_errno; for (;;) { - size_t count; - size_t requested; - - if (size + BUFSIZ + 1 > alloc) - { - char *new_buf; - size_t new_alloc = alloc + alloc / 2; - - /* Check against overflow. */ - if (new_alloc < alloc) - { - save_errno = ENOMEM; - break; - } - - alloc = new_alloc; - if (alloc < size + BUFSIZ + 1) - alloc = size + BUFSIZ + 1; - - new_buf = realloc (buf, alloc); - if (!new_buf) - { - save_errno = errno; - break; - } - - buf = new_buf; - } - - requested = alloc - size - 1; - count = fread (buf + size, 1, requested, stream); + /* This reads 1 more than the size of a regular file + so that we get eof immediately. */ + size_t requested = alloc - size; + size_t count = fread (buf + size, 1, requested, stream); size += count; if (count != requested) @@ -121,7 +93,7 @@ fread_file (FILE * stream, size_t * length) break; /* Shrink the allocated memory if possible. */ - if (size + 1 < alloc) + if (size < alloc - 1) { char *smaller_buf = realloc (buf, size + 1); if (smaller_buf != NULL) @@ -132,6 +104,29 @@ fread_file (FILE * stream, size_t * length) *length = size; return buf; } + + { + char *new_buf; + + if (alloc == SIZE_MAX) + { + save_errno = ENOMEM; + break; + } + + if (alloc < SIZE_MAX - alloc / 2) + alloc = alloc + alloc / 2; + else + alloc = SIZE_MAX; + + if (!(new_buf = realloc (buf, alloc))) + { + save_errno = errno; + break; + } + + buf = new_buf; + } } free (buf); @@ -141,7 +136,7 @@ fread_file (FILE * stream, size_t * length) } static char * -internal_read_file (const char *filename, size_t * length, const char *mode) +internal_read_file (const char *filename, size_t *length, const char *mode) { FILE *stream = fopen (filename, mode); char *out; @@ -175,7 +170,7 @@ internal_read_file (const char *filename, size_t * length, const char *mode) undefined, errno preserves the values set by system functions (if any), and NULL is returned. */ char * -read_file (const char *filename, size_t * length) +read_file (const char *filename, size_t *length) { return internal_read_file (filename, length, "r"); } @@ -188,7 +183,7 @@ read_file (const char *filename, size_t * length) preserves the values set by system functions (if any), and NULL is returned. */ char * -read_binary_file (const char *filename, size_t * length) +read_binary_file (const char *filename, size_t *length) { return internal_read_file (filename, length, "rb"); } diff --git a/gl/read-file.h b/gl/read-file.h index 8b6ae436cd..42663ef666 100644 --- a/gl/read-file.h +++ b/gl/read-file.h @@ -1,5 +1,5 @@ /* read-file.h -- read file contents into a string - Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify diff --git a/gl/readline.c b/gl/readline.c deleted file mode 100644 index d42f29669e..0000000000 --- a/gl/readline.c +++ /dev/null @@ -1,55 +0,0 @@ -/* readline.c --- Simple implementation of readline. - Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. - Written by Simon Josefsson - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* This module is intended to be used when the application only needs - the readline interface. If you need more functions from the - readline library, it is recommended to require the readline library - (or improve this module) rather than #if-protect part of your - application (doing so would add assumptions of this module into - your application). The application should use #include - "readline.h", that header file will include <readline/readline.h> - if the real library is present on the system. */ - -/* Get specification. */ -#include "readline.h" - -#include <stdio.h> -#include <string.h> - -char * -readline (const char *prompt) -{ - char *out = NULL; - size_t size = 0; - - if (prompt) - { - fputs (prompt, stdout); - fflush (stdout); - } - - if (getline (&out, &size, stdin) < 0) - return NULL; - - while (*out && (out[strlen (out) - 1] == '\r' - || out[strlen (out) - 1] == '\n')) - out[strlen (out) - 1] = '\0'; - - return out; -} diff --git a/gl/readline.h b/gl/readline.h deleted file mode 100644 index 44ec014062..0000000000 --- a/gl/readline.h +++ /dev/null @@ -1,34 +0,0 @@ -/* readline.h --- Simple implementation of readline. - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. - Written by Simon Josefsson - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef GL_READLINE_H -#define GL_READLINE_H - -#if HAVE_READLINE_READLINE_H -/* <readline/readline.h> makes use of the FILE type without including - <stdio.h> itself. */ -# include <stdio.h> -# include <readline/readline.h> -#else -/* Prints a prompt PROMPT and then reads and returns a single line of - text from the user. If PROMPT is NULL or the empty string, no - prompt is displayed. The returned line is allocated with malloc; - the caller should free the line when it has finished with it. */ -extern char *readline (const char *prompt); -#endif - -#endif /* GL_READLINE_H */ diff --git a/gl/realloc.c b/gl/realloc.c index 053208f375..6ef37e794f 100644 --- a/gl/realloc.c +++ b/gl/realloc.c @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2010 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/gl/recv.c b/gl/recv.c deleted file mode 100644 index cd93cbc120..0000000000 --- a/gl/recv.c +++ /dev/null @@ -1,40 +0,0 @@ -/* recv.c --- wrappers for Windows recv function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef recv - -ssize_t -rpl_recv (int fd, void *buf, size_t len, int flags) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = recv (sock, buf, len, flags); - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/select.c b/gl/select.c deleted file mode 100644 index 2e99f96001..0000000000 --- a/gl/select.c +++ /dev/null @@ -1,491 +0,0 @@ -/* Emulation for select(2) - Contributed by Paolo Bonzini. - - Copyright 2008-2010 Free Software Foundation, Inc. - - This file is part of gnulib. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> -#include <alloca.h> -#include <assert.h> - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Native Win32. */ - -#include <sys/types.h> -#include <stdbool.h> -#include <errno.h> -#include <limits.h> - -#include <winsock2.h> -#include <windows.h> -#include <io.h> -#include <stdio.h> -#include <conio.h> -#include <time.h> - -struct bitset { - unsigned char in[FD_SETSIZE / CHAR_BIT]; - unsigned char out[FD_SETSIZE / CHAR_BIT]; -}; - -/* Declare data structures for ntdll functions. */ -typedef struct _FILE_PIPE_LOCAL_INFORMATION { - ULONG NamedPipeType; - ULONG NamedPipeConfiguration; - ULONG MaximumInstances; - ULONG CurrentInstances; - ULONG InboundQuota; - ULONG ReadDataAvailable; - ULONG OutboundQuota; - ULONG WriteQuotaAvailable; - ULONG NamedPipeState; - ULONG NamedPipeEnd; -} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; - -typedef struct _IO_STATUS_BLOCK -{ - union { - DWORD Status; - PVOID Pointer; - } u; - ULONG_PTR Information; -} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; - -typedef enum _FILE_INFORMATION_CLASS { - FilePipeLocalInformation = 24 -} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; - -typedef DWORD (WINAPI *PNtQueryInformationFile) - (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS); - -#ifndef PIPE_BUF -#define PIPE_BUF 512 -#endif - -#define IsConsoleHandle(h) (((long) (h) & 3) == 3) - -static BOOL -IsSocketHandle (HANDLE h) -{ - WSANETWORKEVENTS ev; - - if (IsConsoleHandle (h)) - return FALSE; - - /* Under Wine, it seems that getsockopt returns 0 for pipes too. - WSAEnumNetworkEvents instead distinguishes the two correctly. */ - ev.lNetworkEvents = 0xDEADBEEF; - WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev); - return ev.lNetworkEvents != 0xDEADBEEF; -} - -/* Compute output fd_sets for libc descriptor FD (whose Win32 handle is H). */ - -static int -win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits, - struct bitset *xbits) -{ - BOOL read, write, except; - int i, ret; - INPUT_RECORD *irbuffer; - DWORD avail, nbuffer; - BOOL bRet; - IO_STATUS_BLOCK iosb; - FILE_PIPE_LOCAL_INFORMATION fpli; - static PNtQueryInformationFile NtQueryInformationFile; - static BOOL once_only; - - read = write = except = FALSE; - switch (GetFileType (h)) - { - case FILE_TYPE_DISK: - read = TRUE; - write = TRUE; - break; - - case FILE_TYPE_PIPE: - if (!once_only) - { - NtQueryInformationFile = (PNtQueryInformationFile) - GetProcAddress (GetModuleHandle ("ntdll.dll"), - "NtQueryInformationFile"); - once_only = TRUE; - } - - if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0) - { - if (avail) - read = TRUE; - } - else if (GetLastError () == ERROR_BROKEN_PIPE) - ; - - else - { - /* It was the write-end of the pipe. Check if it is writable. - If NtQueryInformationFile fails, optimistically assume the pipe is - writable. This could happen on Win9x, where NtQueryInformationFile - is not available, or if we inherit a pipe that doesn't permit - FILE_READ_ATTRIBUTES access on the write end (I think this should - not happen since WinXP SP2; WINE seems fine too). Otherwise, - ensure that enough space is available for atomic writes. */ - memset (&iosb, 0, sizeof (iosb)); - memset (&fpli, 0, sizeof (fpli)); - - if (!NtQueryInformationFile - || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), - FilePipeLocalInformation) - || fpli.WriteQuotaAvailable >= PIPE_BUF - || (fpli.OutboundQuota < PIPE_BUF && - fpli.WriteQuotaAvailable == fpli.OutboundQuota)) - write = TRUE; - } - break; - - case FILE_TYPE_CHAR: - write = TRUE; - if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) - break; - - ret = WaitForSingleObject (h, 0); - if (ret == WAIT_OBJECT_0) - { - if (!IsConsoleHandle (h)) - { - read = TRUE; - break; - } - - nbuffer = avail = 0; - bRet = GetNumberOfConsoleInputEvents (h, &nbuffer); - - /* Screen buffers handles are filtered earlier. */ - assert (bRet); - if (nbuffer == 0) - { - except = TRUE; - break; - } - - irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD)); - bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail); - if (!bRet || avail == 0) - { - except = TRUE; - break; - } - - for (i = 0; i < avail; i++) - if (irbuffer[i].EventType == KEY_EVENT) - read = TRUE; - } - break; - - default: - ret = WaitForSingleObject (h, 0); - write = TRUE; - if (ret == WAIT_OBJECT_0) - read = TRUE; - - break; - } - - ret = 0; - if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) - { - rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); - ret++; - } - - if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) - { - wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); - ret++; - } - - if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) - { - xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); - ret++; - } - - return ret; -} - -int -rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, - struct timeval *timeout) -{ - static struct timeval tv0; - static HANDLE hEvent; - HANDLE h, handle_array[FD_SETSIZE + 2]; - fd_set handle_rfds, handle_wfds, handle_xfds; - struct bitset rbits, wbits, xbits; - unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT]; - DWORD ret, wait_timeout, nhandles, nsock, nbuffer; - MSG msg; - int i, fd, rc; - - if (nfds > FD_SETSIZE) - nfds = FD_SETSIZE; - - if (!timeout) - wait_timeout = INFINITE; - else - { - wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; - - /* select is also used as a portable usleep. */ - if (!rfds && !wfds && !xfds) - { - Sleep (wait_timeout); - return 0; - } - } - - if (!hEvent) - hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); - - handle_array[0] = hEvent; - nhandles = 1; - nsock = 0; - - /* Copy descriptors to bitsets. At the same time, eliminate - bits in the "wrong" direction for console input buffers - and screen buffers, because screen buffers are waitable - and they will block until a character is available. */ - memset (&rbits, 0, sizeof (rbits)); - memset (&wbits, 0, sizeof (wbits)); - memset (&xbits, 0, sizeof (xbits)); - memset (anyfds_in, 0, sizeof (anyfds_in)); - if (rfds) - for (i = 0; i < rfds->fd_count; i++) - { - fd = rfds->fd_array[i]; - h = (HANDLE) _get_osfhandle (fd); - if (IsConsoleHandle (h) - && !GetNumberOfConsoleInputEvents (h, &nbuffer)) - continue; - - rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - } - else - rfds = (fd_set *) alloca (sizeof (fd_set)); - - if (wfds) - for (i = 0; i < wfds->fd_count; i++) - { - fd = wfds->fd_array[i]; - h = (HANDLE) _get_osfhandle (fd); - if (IsConsoleHandle (h) - && GetNumberOfConsoleInputEvents (h, &nbuffer)) - continue; - - wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - } - else - wfds = (fd_set *) alloca (sizeof (fd_set)); - - if (xfds) - for (i = 0; i < xfds->fd_count; i++) - { - fd = xfds->fd_array[i]; - xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - } - else - xfds = (fd_set *) alloca (sizeof (fd_set)); - - /* Zero all the fd_sets, including the application's. */ - FD_ZERO (rfds); - FD_ZERO (wfds); - FD_ZERO (xfds); - FD_ZERO (&handle_rfds); - FD_ZERO (&handle_wfds); - FD_ZERO (&handle_xfds); - - /* Classify handles. Create fd sets for sockets, poll the others. */ - for (i = 0; i < nfds; i++) - { - if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) - continue; - - h = (HANDLE) _get_osfhandle (i); - if (!h) - { - errno = EBADF; - return -1; - } - - if (IsSocketHandle (h)) - { - int requested = FD_CLOSE; - - /* See above; socket handles are mapped onto select, but we - need to map descriptors to handles. */ - if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - requested |= FD_READ | FD_ACCEPT; - FD_SET ((SOCKET) h, rfds); - FD_SET ((SOCKET) h, &handle_rfds); - } - if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - requested |= FD_WRITE | FD_CONNECT; - FD_SET ((SOCKET) h, wfds); - FD_SET ((SOCKET) h, &handle_wfds); - } - if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - requested |= FD_OOB; - FD_SET ((SOCKET) h, xfds); - FD_SET ((SOCKET) h, &handle_xfds); - } - - WSAEventSelect ((SOCKET) h, hEvent, requested); - nsock++; - } - else - { - handle_array[nhandles++] = h; - - /* Poll now. If we get an event, do not wait below. */ - if (wait_timeout != 0 - && win32_poll_handle (h, i, &rbits, &wbits, &xbits)) - wait_timeout = 0; - } - } - - if (wait_timeout == 0 || nsock == 0) - rc = 0; - else - { - /* See if we need to wait in the loop below. If any select is ready, - do MsgWaitForMultipleObjects anyway to dispatch messages, but - no need to call select again. */ - rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0); - if (rc == 0) - { - /* Restore the fd_sets for the other select we do below. */ - memcpy (&handle_rfds, rfds, sizeof (fd_set)); - memcpy (&handle_wfds, wfds, sizeof (fd_set)); - memcpy (&handle_xfds, xfds, sizeof (fd_set)); - } - else - wait_timeout = 0; - } - - for (;;) - { - ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, - wait_timeout, QS_ALLINPUT); - - if (ret == WAIT_OBJECT_0 + nhandles) - { - /* new input of some other kind */ - BOOL bRet; - while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0) - { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - } - else - break; - } - - /* If we haven't done it yet, check the status of the sockets. */ - if (rc == 0 && nsock > 0) - rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0); - - /* Now fill in the results. */ - FD_ZERO (rfds); - FD_ZERO (wfds); - FD_ZERO (xfds); - - /* Place a sentinel at the end of the array. */ - handle_array[nhandles] = NULL; - nhandles = 1; - for (i = 0; i < nfds; i++) - { - if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) - continue; - - h = (HANDLE) _get_osfhandle (i); - if (h != handle_array[nhandles]) - { - /* Perform handle->descriptor mapping. Don't update rc, as these - results are counted in the return value of Winsock's select. */ - WSAEventSelect ((SOCKET) h, NULL, 0); - if (FD_ISSET (h, &handle_rfds)) - FD_SET (i, rfds); - if (FD_ISSET (h, &handle_wfds)) - FD_SET (i, wfds); - if (FD_ISSET (h, &handle_xfds)) - FD_SET (i, xfds); - } - else - { - /* Not a socket. */ - nhandles++; - win32_poll_handle (h, i, &rbits, &wbits, &xbits); - if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - rc++; - FD_SET (i, rfds); - } - if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - rc++; - FD_SET (i, wfds); - } - if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - { - rc++; - FD_SET (i, xfds); - } - } - } - - return rc; -} - -#else /* ! Native Win32. */ - -#include <sys/select.h> - -#undef select - -int -rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, - struct timeval *timeout) -{ - /* Interix 3.5 has a bug: it does not support nfds == 0. */ - if (nfds == 0) - { - nfds = 1; - rfds = NULL; - wfds = NULL; - xfds = NULL; - } - return select (nfds, rfds, wfds, xfds, timeout); -} - -#endif diff --git a/gl/send.c b/gl/send.c deleted file mode 100644 index 6ab4b01265..0000000000 --- a/gl/send.c +++ /dev/null @@ -1,40 +0,0 @@ -/* send.c --- wrappers for Windows send function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef send - -ssize_t -rpl_send (int fd, const void *buf, size_t len, int flags) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = send (sock, buf, len, flags); - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/setsockopt.c b/gl/setsockopt.c deleted file mode 100644 index 24a8d6e5bf..0000000000 --- a/gl/setsockopt.c +++ /dev/null @@ -1,56 +0,0 @@ -/* setsockopt.c --- wrappers for Windows setsockopt function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get struct timeval. */ -#include <sys/time.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef setsockopt - -int -rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) -{ - int r; - SOCKET sock = FD_TO_SOCKET (fd); - - if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)) - { - const struct timeval *tv = optval; - int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000; - optval = &milliseconds; - r = setsockopt (sock, level, optname, optval, sizeof (int)); - } - else - { - r = setsockopt (sock, level, optname, optval, optlen); - } - - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/shutdown.c b/gl/shutdown.c deleted file mode 100644 index 251c890180..0000000000 --- a/gl/shutdown.c +++ /dev/null @@ -1,40 +0,0 @@ -/* shutdown.c --- wrappers for Windows shutdown function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#undef shutdown - -int -rpl_shutdown (int fd, int how) -{ - SOCKET sock = FD_TO_SOCKET (fd); - int r = shutdown (sock, how); - if (r < 0) - set_winsock_errno (); - - return r; -} diff --git a/gl/size_max.h b/gl/size_max.h index 56d5a9b1c5..d5f31522c8 100644 --- a/gl/size_max.h +++ b/gl/size_max.h @@ -1,5 +1,5 @@ /* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify diff --git a/gl/snprintf.c b/gl/snprintf.c index 810ca14bc9..9db2379a88 100644 --- a/gl/snprintf.c +++ b/gl/snprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc. Written by Simon Josefsson and Paul Eggert. This program is free software; you can redistribute it and/or modify diff --git a/gl/socket.c b/gl/socket.c deleted file mode 100644 index 63e0aaea6e..0000000000 --- a/gl/socket.c +++ /dev/null @@ -1,49 +0,0 @@ -/* socket.c --- wrappers for Windows socket function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -#include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -#include "w32sock.h" - -#include "sockets.h" - -int -rpl_socket (int domain, int type, int protocol) -{ - SOCKET fh; - - gl_sockets_startup (SOCKETS_1_1); - - /* We have to use WSASocket() to create non-overlapped IO sockets. - Overlapped IO sockets cannot be used with read/write. */ - fh = WSASocket (domain, type, protocol, NULL, 0, 0); - - if (fh == INVALID_SOCKET) - { - set_winsock_errno (); - return -1; - } - else - return SOCKET_TO_FD (fh); -} diff --git a/gl/sockets.c b/gl/sockets.c index b946c7e63d..4e905e1ddd 100644 --- a/gl/sockets.c +++ b/gl/sockets.c @@ -1,6 +1,6 @@ /* sockets.c --- wrappers for Windows socket functions - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/sockets.h b/gl/sockets.h index 921bf6f793..93ae5d2800 100644 --- a/gl/sockets.h +++ b/gl/sockets.h @@ -1,6 +1,6 @@ /* sockets.h - wrappers for Windows socket functions - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h index 8b88449e2f..4469d54e4f 100644 --- a/gl/stdarg.in.h +++ b/gl/stdarg.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <stdarg.h>. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/stdbool.in.h b/gl/stdbool.in.h index 574c281a8f..b64dc75b20 100644 --- a/gl/stdbool.in.h +++ b/gl/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software; you can redistribute it and/or modify diff --git a/gl/stddef.in.h b/gl/stddef.in.h index 6642d49e2a..62a91a7a6a 100644 --- a/gl/stddef.in.h +++ b/gl/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/stdint.in.h b/gl/stdint.in.h index 9909f57e4b..b32227bb04 100644 --- a/gl/stdint.in.h +++ b/gl/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -108,6 +108,8 @@ warnings in the signed case. */ \ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +#if !GNULIB_defined_stdint_types + /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer @@ -137,9 +139,10 @@ typedef unsigned int 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. */ + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ -#if INT64_MAX +#ifdef INT64_MAX # define GL_INT64_T #else /* Do not undefine int64_t if gnulib is not being used with 64-bit @@ -162,7 +165,7 @@ typedef long long int gl_int64_t; # endif #endif -#if UINT64_MAX +#ifdef UINT64_MAX # define GL_UINT64_T #else # if ULONG_MAX >> 31 >> 31 >> 1 == 1 @@ -295,6 +298,9 @@ typedef unsigned long int gl_uintmax_t; typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ + /* 7.18.2. Limits of specified-width integer types */ #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS @@ -491,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/gl/stdio-impl.h b/gl/stdio-impl.h index 0e67f66ef6..d41c32f4b7 100644 --- a/gl/stdio-impl.h +++ b/gl/stdio-impl.h @@ -1,5 +1,5 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,6 +75,17 @@ /* SystemV derived implementations. */ +#ifdef __TANDEM /* NonStop Kernel */ +# ifndef _IOERR +/* These values were determined by the program 'stdioext-flags' at + <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ +# define _IOERR 0x40 +# define _IOREAD 0x80 +# define _IOWRT 0x4 +# define _IORW 0x100 +# endif +#endif + #if defined _IOERR # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ diff --git a/gl/stdio-write.c b/gl/stdio-write.c deleted file mode 100644 index a6a0eb143d..0000000000 --- a/gl/stdio-write.c +++ /dev/null @@ -1,148 +0,0 @@ -/* POSIX compatible FILE stream write function. - Copyright (C) 2008-2010 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2008. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -/* Replace these functions only if module 'sigpipe' is requested. */ -#if GNULIB_SIGPIPE - -/* On native Windows platforms, SIGPIPE does not exist. When write() is - called on a pipe with no readers, WriteFile() fails with error - GetLastError() = ERROR_NO_DATA, and write() in consequence fails with - error EINVAL. This write() function is at the basis of the function - which flushes the buffer of a FILE stream. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# include <errno.h> -# include <signal.h> -# include <io.h> - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include <windows.h> - -# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ - if (ferror (stream)) \ - return (EXPRESSION); \ - else \ - { \ - RETTYPE ret; \ - SetLastError (0); \ - ret = (EXPRESSION); \ - if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ - { \ - int fd = fileno (stream); \ - if (fd >= 0 \ - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ - } \ - return ret; \ - } - -# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ -int -printf (const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stdout, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ -int -fprintf (FILE *stream, const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stream, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_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/gl/stdio.in.h b/gl/stdio.in.h index 45eaa1c22b..57e93badce 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +21,14 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_FILE || defined __need___FILE -/* Special invocation convention inside glibc header files. */ +#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +/* Special invocation convention: + - Inside glibc header files. + - On OSF/1 5.1 we have a sequence of nested includes + <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> -> + <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>. + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ @@ -31,9 +37,13 @@ #ifndef _GL_STDIO_H +#define _GL_ALREADY_INCLUDING_STDIO_H + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ +#undef _GL_ALREADY_INCLUDING_STDIO_H + #ifndef _GL_STDIO_H #define _GL_STDIO_H @@ -42,21 +52,41 @@ #include <stddef.h> -/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */ +/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 + and eglibc 2.11.2. */ #include <sys/types.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 + +/* _GL_ATTRIBUTE_FORMAT_PRINTF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) #endif +/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, + except that it indicates to GCC that the supported format string directives + are the ones of the system printf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) + /* 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 \ @@ -82,13 +112,13 @@ # define dprintf rpl_dprintf # endif _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); # else # if !@HAVE_DPRINTF@ _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); @@ -178,9 +208,15 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " # define fprintf rpl_fprintf # endif # define GNULIB_overrides_fprintf 1 +# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# else _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); # else _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); @@ -345,7 +381,7 @@ _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); # else -# if ! @HAVE_FSEEKO@ +# if ! @HAVE_DECL_FSEEKO@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); # endif @@ -356,17 +392,20 @@ _GL_CXXALIASWARN (fseeko); /* Provide an fseek function that is consistent with fseeko. */ /* In order to avoid that fseek gets defined as a macro here, the developer can request the 'fseek' module. */ -# undef fseek -# define fseek rpl_fseek +# if !GNULIB_defined_fseek_function +# undef fseek +# define fseek rpl_fseek static inline int _GL_ARG_NONNULL ((1)) rpl_fseek (FILE *fp, long offset, int whence) { -# if @REPLACE_FSEEKO@ +# if @REPLACE_FSEEKO@ return rpl_fseeko (fp, offset, whence); -# else +# else return fseeko (fp, offset, whence); -# endif +# endif } +# define GNULIB_defined_fseek_function 1 +# endif # endif #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ @@ -421,7 +460,7 @@ _GL_CXXALIASWARN (ftell); _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); # else -# if ! @HAVE_FTELLO@ +# if ! @HAVE_DECL_FTELLO@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); @@ -431,17 +470,20 @@ _GL_CXXALIASWARN (ftello); /* Provide an ftell function that is consistent with ftello. */ /* In order to avoid that ftell gets defined as a macro here, the developer can request the 'ftell' module. */ -# undef ftell -# define ftell rpl_ftell +# if !GNULIB_defined_ftell_function +# undef ftell +# define ftell rpl_ftell static inline long _GL_ARG_NONNULL ((1)) rpl_ftell (FILE *f) { -# if @REPLACE_FTELLO@ +# if @REPLACE_FTELLO@ return rpl_ftello (f); -# else +# else return ftello (f); -# endif +# endif } +# define GNULIB_defined_ftell_function 1 +# endif # endif #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ @@ -477,6 +519,23 @@ _GL_CXXALIAS_RPL (fwrite, size_t, # else _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); + +/* Work around glibc bug 11959 + <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, + which sometimes causes an unwanted diagnostic for fwrite calls. + This affects only function declaration attributes, so it's not + needed for C++. */ +# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL +static inline size_t _GL_ARG_NONNULL ((1, 4)) +rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) +{ + size_t r = fwrite (ptr, s, n, stream); + (void) r; + return r; +} +# undef fwrite +# define fwrite rpl_fwrite +# endif # endif _GL_CXXALIASWARN (fwrite); #endif @@ -570,7 +629,7 @@ struct obstack; # endif _GL_FUNCDECL_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...)); @@ -578,7 +637,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int, # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_printf, int, @@ -591,7 +650,7 @@ _GL_CXXALIASWARN (obstack_printf); # endif _GL_FUNCDECL_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); @@ -599,7 +658,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int, # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_vprintf, int, @@ -658,17 +717,29 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ # endif +# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) + _GL_ARG_NONNULL ((1))); +# else _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) - __attribute__ ((__format__ (__printf__, 1, 2))) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define printf rpl_printf +# endif _GL_FUNCDECL_RPL (printf, int, (const char *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); # endif @@ -808,7 +879,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " # endif _GL_FUNCDECL_RPL (snprintf, int, (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, (char *str, size_t size, const char *format, ...)); @@ -816,7 +887,7 @@ _GL_CXXALIAS_RPL (snprintf, int, # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, @@ -846,7 +917,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # define sprintf rpl_sprintf # endif _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); # else @@ -891,7 +962,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " # endif _GL_FUNCDECL_RPL (asprintf, int, (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (asprintf, int, (char **result, const char *format, ...)); @@ -899,7 +970,7 @@ _GL_CXXALIAS_RPL (asprintf, int, # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (asprintf, int, (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (asprintf, int, @@ -912,7 +983,7 @@ _GL_CXXALIASWARN (asprintf); # endif _GL_FUNCDECL_RPL (vasprintf, int, (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vasprintf, int, (char **result, const char *format, va_list args)); @@ -920,7 +991,7 @@ _GL_CXXALIAS_RPL (vasprintf, int, # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (vasprintf, int, (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (vasprintf, int, @@ -935,13 +1006,13 @@ _GL_CXXALIASWARN (vasprintf); # define vdprintf rpl_vdprintf # endif _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); # else # if !@HAVE_VDPRINTF@ _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on Solaris, the third parameter will likely be @@ -965,9 +1036,15 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " # define vfprintf rpl_vfprintf # endif # define GNULIB_overrides_vfprintf 1 +# if @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# else _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is @@ -995,9 +1072,15 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " # define vprintf rpl_vprintf # endif # define GNULIB_overrides_vprintf 1 +# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) + _GL_ARG_NONNULL ((1))); +# else _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 1, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); # else /* Need to cast, because on Solaris, the second parameter is @@ -1024,7 +1107,7 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args)); @@ -1032,7 +1115,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int, # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, @@ -1054,7 +1137,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # endif _GL_FUNCDECL_RPL (vsprintf, int, (char *str, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, (char *str, const char *format, va_list args)); diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index e6dcdbc841..2697a4bd1d 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdlib.h>. - Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,21 +49,23 @@ # include <sys/loadavg.h> #endif +#if @GNULIB_RANDOM_R@ + /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included - from <stdlib.h> if _REENTRANT is defined. Include it always. */ -#if @HAVE_RANDOM_H@ -# include <random.h> -#endif + from <stdlib.h> if _REENTRANT is defined. Include it whenever we need + 'struct random_data'. */ +# if @HAVE_RANDOM_H@ +# include <random.h> +# endif -#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \ - || defined GNULIB_POSIXCHECK -# include <stdint.h> -#endif +# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@ +# include <stdint.h> +# 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 +# if !GNULIB_defined_struct_random_data struct random_data { int32_t *fptr; /* Front pointer. */ @@ -74,7 +76,8 @@ struct random_data int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; -# define GNULIB_defined_struct_random_data 1 +# define GNULIB_defined_struct_random_data 1 +# endif # endif #endif @@ -85,10 +88,10 @@ struct random_data # include <unistd.h> #endif -#ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(Spec) /* empty */ -# endif +#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#else +# define _GL_ATTRIBUTE_NORETURN #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -116,7 +119,7 @@ struct random_data /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ # if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__))); +_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); @@ -271,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"; @@ -584,7 +602,7 @@ _GL_FUNCDECL_RPL (setenv, int, _GL_CXXALIAS_RPL (setenv, int, (const char *name, const char *value, int replace)); # else -# if !@HAVE_SETENV@ +# if !@HAVE_DECL_SETENV@ _GL_FUNCDECL_SYS (setenv, int, (const char *name, const char *value, int replace) _GL_ARG_NONNULL ((1))); @@ -592,7 +610,9 @@ _GL_FUNCDECL_SYS (setenv, int, _GL_CXXALIAS_SYS (setenv, int, (const char *name, const char *value, int replace)); # endif +# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) _GL_CXXALIASWARN (setenv); +# endif #elif defined GNULIB_POSIXCHECK # undef setenv # if HAVE_RAW_DECL_SETENV @@ -702,12 +722,14 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); # else -# if !@HAVE_UNSETENV@ +# if !@HAVE_DECL_UNSETENV@ _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); # endif +# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) _GL_CXXALIASWARN (unsetenv); +# endif #elif defined GNULIB_POSIXCHECK # undef unsetenv # if HAVE_RAW_DECL_UNSETENV @@ -716,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/gl/strerror.c b/gl/strerror.c deleted file mode 100644 index 6e1c0b0ebb..0000000000 --- a/gl/strerror.c +++ /dev/null @@ -1,356 +0,0 @@ -/* strerror.c --- POSIX compatible system error routine - - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include <string.h> - -#if REPLACE_STRERROR - -# include <errno.h> -# include <stdio.h> - -# if GNULIB_defined_ESOCK /* native Windows platforms */ -# if HAVE_WINSOCK2_H -# include <winsock2.h> -# endif -# endif - -# include "intprops.h" - -/* Use the system functions, not the gnulib overrides in this file. */ -# undef sprintf - -# undef strerror -# if ! HAVE_DECL_STRERROR -# define strerror(n) NULL -# endif - -char * -rpl_strerror (int n) -{ - char const *msg = NULL; - /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ - switch (n) - { -# if GNULIB_defined_ETXTBSY - case ETXTBSY: - msg = "Text file busy"; - break; -# endif - -# if GNULIB_defined_ESOCK /* native Windows platforms */ - /* EWOULDBLOCK is the same as EAGAIN. */ - case EINPROGRESS: - msg = "Operation now in progress"; - break; - case EALREADY: - msg = "Operation already in progress"; - break; - case ENOTSOCK: - msg = "Socket operation on non-socket"; - break; - case EDESTADDRREQ: - msg = "Destination address required"; - break; - case EMSGSIZE: - msg = "Message too long"; - break; - case EPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; - case ENOPROTOOPT: - msg = "Protocol not available"; - break; - case EPROTONOSUPPORT: - msg = "Protocol not supported"; - break; - case ESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; - case EOPNOTSUPP: - msg = "Operation not supported"; - break; - case EPFNOSUPPORT: - msg = "Protocol family not supported"; - break; - case EAFNOSUPPORT: - msg = "Address family not supported by protocol"; - break; - case EADDRINUSE: - msg = "Address already in use"; - break; - case EADDRNOTAVAIL: - msg = "Cannot assign requested address"; - break; - case ENETDOWN: - msg = "Network is down"; - break; - case ENETUNREACH: - msg = "Network is unreachable"; - break; - case ENETRESET: - msg = "Network dropped connection on reset"; - break; - case ECONNABORTED: - msg = "Software caused connection abort"; - break; - case ECONNRESET: - msg = "Connection reset by peer"; - break; - case ENOBUFS: - msg = "No buffer space available"; - break; - case EISCONN: - msg = "Transport endpoint is already connected"; - break; - case ENOTCONN: - msg = "Transport endpoint is not connected"; - break; - case ESHUTDOWN: - msg = "Cannot send after transport endpoint shutdown"; - break; - case ETOOMANYREFS: - msg = "Too many references: cannot splice"; - break; - case ETIMEDOUT: - msg = "Connection timed out"; - break; - case ECONNREFUSED: - msg = "Connection refused"; - break; - case ELOOP: - msg = "Too many levels of symbolic links"; - break; - case EHOSTDOWN: - msg = "Host is down"; - break; - case EHOSTUNREACH: - msg = "No route to host"; - break; - case EPROCLIM: - msg = "Too many processes"; - break; - case EUSERS: - msg = "Too many users"; - break; - case EDQUOT: - msg = "Disk quota exceeded"; - break; - case ESTALE: - msg = "Stale NFS file handle"; - break; - case EREMOTE: - msg = "Object is remote"; - break; -# if HAVE_WINSOCK2_H - /* WSA_INVALID_HANDLE maps to EBADF */ - /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ - /* WSA_INVALID_PARAMETER maps to EINVAL */ - case WSA_OPERATION_ABORTED: - msg = "Overlapped operation aborted"; - break; - case WSA_IO_INCOMPLETE: - msg = "Overlapped I/O event object not in signaled state"; - break; - case WSA_IO_PENDING: - msg = "Overlapped operations will complete later"; - break; - /* WSAEINTR maps to EINTR */ - /* WSAEBADF maps to EBADF */ - /* WSAEACCES maps to EACCES */ - /* WSAEFAULT maps to EFAULT */ - /* WSAEINVAL maps to EINVAL */ - /* WSAEMFILE maps to EMFILE */ - /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ - /* WSAEINPROGRESS is EINPROGRESS */ - /* WSAEALREADY is EALREADY */ - /* WSAENOTSOCK is ENOTSOCK */ - /* WSAEDESTADDRREQ is EDESTADDRREQ */ - /* WSAEMSGSIZE is EMSGSIZE */ - /* WSAEPROTOTYPE is EPROTOTYPE */ - /* WSAENOPROTOOPT is ENOPROTOOPT */ - /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ - /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ - /* WSAEOPNOTSUPP is EOPNOTSUPP */ - /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ - /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ - /* WSAEADDRINUSE is EADDRINUSE */ - /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ - /* WSAENETDOWN is ENETDOWN */ - /* WSAENETUNREACH is ENETUNREACH */ - /* WSAENETRESET is ENETRESET */ - /* WSAECONNABORTED is ECONNABORTED */ - /* WSAECONNRESET is ECONNRESET */ - /* WSAENOBUFS is ENOBUFS */ - /* WSAEISCONN is EISCONN */ - /* WSAENOTCONN is ENOTCONN */ - /* WSAESHUTDOWN is ESHUTDOWN */ - /* WSAETOOMANYREFS is ETOOMANYREFS */ - /* WSAETIMEDOUT is ETIMEDOUT */ - /* WSAECONNREFUSED is ECONNREFUSED */ - /* WSAELOOP is ELOOP */ - /* WSAENAMETOOLONG maps to ENAMETOOLONG */ - /* WSAEHOSTDOWN is EHOSTDOWN */ - /* WSAEHOSTUNREACH is EHOSTUNREACH */ - /* WSAENOTEMPTY maps to ENOTEMPTY */ - /* WSAEPROCLIM is EPROCLIM */ - /* WSAEUSERS is EUSERS */ - /* WSAEDQUOT is EDQUOT */ - /* WSAESTALE is ESTALE */ - /* WSAEREMOTE is EREMOTE */ - case WSASYSNOTREADY: - msg = "Network subsystem is unavailable"; - break; - case WSAVERNOTSUPPORTED: - msg = "Winsock.dll version out of range"; - break; - case WSANOTINITIALISED: - msg = "Successful WSAStartup not yet performed"; - break; - case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; - case WSAENOMORE: case WSA_E_NO_MORE: - msg = "No more results"; - break; - case WSAECANCELLED: case WSA_E_CANCELLED: - msg = "Call was canceled"; - break; - case WSAEINVALIDPROCTABLE: - msg = "Procedure call table is invalid"; - break; - case WSAEINVALIDPROVIDER: - msg = "Service provider is invalid"; - break; - case WSAEPROVIDERFAILEDINIT: - msg = "Service provider failed to initialize"; - break; - case WSASYSCALLFAILURE: - msg = "System call failure"; - break; - case WSASERVICE_NOT_FOUND: - msg = "Service not found"; - break; - case WSATYPE_NOT_FOUND: - msg = "Class type not found"; - break; - case WSAEREFUSED: - msg = "Database query was refused"; - break; - case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; - case WSATRY_AGAIN: - msg = "Nonauthoritative host not found"; - break; - case WSANO_RECOVERY: - msg = "Nonrecoverable error"; - break; - case WSANO_DATA: - msg = "Valid name, no data record of requested type"; - break; - /* WSA_QOS_* omitted */ -# endif -# endif - -# if GNULIB_defined_ENOMSG - case ENOMSG: - msg = "No message of desired type"; - break; -# endif - -# if GNULIB_defined_EIDRM - case EIDRM: - msg = "Identifier removed"; - break; -# endif - -# if GNULIB_defined_ENOLINK - case ENOLINK: - msg = "Link has been severed"; - break; -# endif - -# if GNULIB_defined_EPROTO - case EPROTO: - msg = "Protocol error"; - break; -# endif - -# if GNULIB_defined_EMULTIHOP - case EMULTIHOP: - msg = "Multihop attempted"; - break; -# endif - -# if GNULIB_defined_EBADMSG - case EBADMSG: - msg = "Bad message"; - break; -# endif - -# if GNULIB_defined_EOVERFLOW - case EOVERFLOW: - msg = "Value too large for defined data type"; - break; -# endif - -# if GNULIB_defined_ENOTSUP - case ENOTSUP: - msg = "Not supported"; - break; -# endif - -# if GNULIB_defined_ESTALE - case ESTALE: - msg = "Stale NFS file handle"; - break; -# endif - -# if GNULIB_defined_EDQUOT - case EDQUOT: - msg = "Disk quota exceeded"; - break; -# endif - -# if GNULIB_defined_ECANCELED - case ECANCELED: - msg = "Operation canceled"; - break; -# endif - } - - if (msg) - return (char *) msg; - - { - char *result = strerror (n); - - if (result == NULL || result[0] == '\0') - { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; - } - - return result; - } -} - -#endif diff --git a/gl/string.in.h b/gl/string.in.h index b0c2ba1e1c..336e246517 100644 --- a/gl/string.in.h +++ b/gl/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,13 +37,8 @@ # include <wchar.h> #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -#endif -/* The attribute __pure__ was added in gcc 2.96. */ +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h deleted file mode 100644 index 49347b63f8..0000000000 --- a/gl/sys_select.in.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Substitute for <sys/select.h>. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -# if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -# endif -@PRAGMA_COLUMNS@ - -/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>. - Simply delegate to the system's header in this case. */ -#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE - -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE - -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -#else - -#ifndef _GL_SYS_SELECT_H - -#if @HAVE_SYS_SELECT_H@ - -/* On many platforms, <sys/select.h> assumes prior inclusion of - <sys/types.h>. */ -# include <sys/types.h> - -/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration - of 'struct timeval', and no definition of this type. - But avoid namespace pollution on glibc systems. */ -# ifndef __GLIBC__ -# include <sys/time.h> -# endif - -/* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation - that relies on memset(), but without including <string.h>. - But in any case avoid namespace pollution on glibc systems. */ -# if (defined __OpenBSD__ || defined __sun || defined __osf__ || defined __BEOS__) \ - && ! defined __GLIBC__ -# include <string.h> -# endif - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -#endif - -#ifndef _GL_SYS_SELECT_H -#define _GL_SYS_SELECT_H - -#if !@HAVE_SYS_SELECT_H@ || @REPLACE_SELECT@ -/* A platform that lacks <sys/select.h>. */ -# include <sys/socket.h> -#endif - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -#if @GNULIB_SELECT@ -# if @HAVE_WINSOCK2_H@ || @REPLACE_SELECT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef select -# define select rpl_select -# endif -_GL_FUNCDECL_RPL (select, int, - (int, fd_set *, fd_set *, fd_set *, struct timeval *)); -_GL_CXXALIAS_RPL (select, int, - (int, fd_set *, fd_set *, fd_set *, struct timeval *)); -# else -_GL_CXXALIAS_SYS (select, int, - (int, fd_set *, fd_set *, fd_set *, struct timeval *)); -# endif -_GL_CXXALIASWARN (select); -#elif @HAVE_WINSOCK2_H@ -# undef select -# define select select_used_without_requesting_gnulib_module_select -#elif defined GNULIB_POSIXCHECK -# undef select -# if HAVE_RAW_DECL_SELECT -_GL_WARN_ON_USE (select, "select is not always POSIX compliant - " - "use gnulib module select for portability"); -# endif -#endif - - -#endif /* _GL_SYS_SELECT_H */ -#endif /* _GL_SYS_SELECT_H */ -#endif /* OSF/1 */ diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h index 339cabb958..8e7672f15b 100644 --- a/gl/sys_socket.in.h +++ b/gl/sys_socket.in.h @@ -1,6 +1,6 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -50,6 +50,10 @@ <sys/types.h>. */ # include <sys/types.h> +/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL + is defined. */ +# include <stddef.h> + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ @@ -67,7 +71,10 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_SA_FAMILY_T@ +# if !GNULIB_defined_sa_family_t typedef unsigned short sa_family_t; +# define GNULIB_defined_sa_family_t 1 +# endif #endif #if @HAVE_STRUCT_SOCKADDR_STORAGE@ @@ -89,12 +96,16 @@ typedef unsigned short sa_family_t; : alignof (__ss_aligntype)) \ + sizeof (__ss_aligntype))) +# if !GNULIB_defined_struct_sockaddr_storage struct sockaddr_storage { sa_family_t ss_family; /* Address family, etc. */ __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; +# define GNULIB_defined_struct_sockaddr_storage 1 +# endif + #endif #if @HAVE_SYS_SOCKET_H@ @@ -159,7 +170,10 @@ struct sockaddr_storage # include <sys/types.h> # include <io.h> +# if !GNULIB_defined_socklen_t typedef int socklen_t; +# define GNULIB_defined_socklen_t 1 +# endif # endif @@ -167,6 +181,8 @@ typedef int socklen_t; #if @HAVE_WINSOCK2_H@ +# if !GNULIB_defined_rpl_fd_isset + /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ static inline int @@ -183,6 +199,9 @@ rpl_fd_isset (SOCKET fd, fd_set * set) return 0; } +# define GNULIB_defined_rpl_fd_isset 1 +# endif + # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) @@ -245,8 +264,11 @@ _GL_FUNCDECL_RPL (connect, int, _GL_CXXALIAS_RPL (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else -_GL_CXXALIAS_SYS (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); +/* Need to cast, because on NonStop Kernel, the third parameter is + size_t addrlen. */ +_GL_CXXALIAS_SYS_CAST (connect, int, + (int fd, + const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (connect); #elif @HAVE_WINSOCK2_H@ @@ -300,8 +322,11 @@ _GL_FUNCDECL_RPL (bind, int, _GL_CXXALIAS_RPL (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else -_GL_CXXALIAS_SYS (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); +/* Need to cast, because on NonStop Kernel, the third parameter is + size_t addrlen. */ +_GL_CXXALIAS_SYS_CAST (bind, int, + (int fd, + const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (bind); #elif @HAVE_WINSOCK2_H@ @@ -522,9 +547,11 @@ _GL_CXXALIAS_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)); # else -_GL_CXXALIAS_SYS (sendto, ssize_t, - (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen)); +/* Need to cast, because on NonStop Kernel, the sixth parameter is + size_t tolen. */ +_GL_CXXALIAS_SYS_CAST (sendto, ssize_t, + (int fd, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen)); # endif _GL_CXXALIASWARN (sendto); #elif @HAVE_WINSOCK2_H@ @@ -550,8 +577,11 @@ _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen)); # else -_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen)); +/* Need to cast, because on NonStop Kernel, the fifth parameter is + size_t optlen. */ +_GL_CXXALIAS_SYS_CAST (setsockopt, int, + (int fd, int level, int optname, + const void * optval, socklen_t optlen)); # endif _GL_CXXALIASWARN (setsockopt); #elif @HAVE_WINSOCK2_H@ diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h index f0c61c15c5..13fae7b670 100644 --- a/gl/sys_stat.in.h +++ b/gl/sys_stat.in.h @@ -1,5 +1,5 @@ /* Provide a more complete sys/stat header file. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -355,7 +355,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " #if @GNULIB_FUTIMENS@ -# if @REPLACE_FUTIMENS@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens + implementation relies on futimesat, which on Solaris 10 makes an invocation + to futimens that is meant to invoke the libc's futimens(), not gnulib's + futimens(). */ +# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef futimens # define futimens rpl_futimens @@ -368,7 +372,9 @@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif +# if @HAVE_FUTIMENS@ _GL_CXXALIASWARN (futimens); +# endif #elif defined GNULIB_POSIXCHECK # undef futimens # if HAVE_RAW_DECL_FUTIMENS @@ -461,11 +467,14 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); which are included above. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if !GNULIB_defined_rpl_mkdir static inline int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } +# define GNULIB_defined_rpl_mkdir 1 +# endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mkdir rpl_mkdir @@ -550,7 +559,8 @@ _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); +/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ +_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK @@ -608,7 +618,11 @@ _GL_WARN_ON_USE (stat, "stat is unportable - " #if @GNULIB_UTIMENSAT@ -# if @REPLACE_UTIMENSAT@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat + implementation relies on futimesat, which on Solaris 10 makes an invocation + to utimensat that is meant to invoke the libc's utimensat(), not gnulib's + utimensat(). */ +# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef utimensat # define utimensat rpl_utimensat @@ -627,7 +641,9 @@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag)); # endif +# if @HAVE_UTIMENSAT@ _GL_CXXALIASWARN (utimensat); +# endif #elif defined GNULIB_POSIXCHECK # undef utimensat # if HAVE_RAW_DECL_UTIMENSAT diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h index 0689bcb2e6..d4319d25ca 100644 --- a/gl/sys_time.in.h +++ b/gl/sys_time.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,11 +51,16 @@ extern "C" { # endif # if ! @HAVE_STRUCT_TIMEVAL@ + +# if !GNULIB_defined_struct_timeval struct timeval { time_t tv_sec; long int tv_usec; }; +# define GNULIB_defined_struct_timeval 1 +# endif + # endif # ifdef __cplusplus diff --git a/gl/tests/.gitignore b/gl/tests/.gitignore new file mode 100644 index 0000000000..fd28609a7e --- /dev/null +++ b/gl/tests/.gitignore @@ -0,0 +1,22 @@ +/intprops.h +/test-byteswap.c +/test-func.c +/test-hmac-md5.c +/test-md5.c +/test-strings.c +/test-strverscmp.c +/test-vasprintf.c +/test-vsnprintf.c +/test-netinet_in.c +/test-fseeko.c +/test-fseeko.sh +/test-fseeko2.sh +/test-getdelim.c +/test-getline.c +/test-u64.c +/test-version-etc.c +/test-version-etc.sh +/version-etc-fsf.c +/dummy.c +/test-gettimeofday.c +/test-sys_time.c diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index acfc33e34c..3b5778b79b 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -46,15 +46,6 @@ AM_LIBTOOLFLAGS = --preserve-dup-deps TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' -## begin gnulib module alignof-tests - -TESTS += test-alignof -check_PROGRAMS += test-alignof - -EXTRA_DIST += test-alignof.c - -## end gnulib module alignof-tests - ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt @@ -88,14 +79,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h ## end gnulib module arg-nonnull -## begin gnulib module arpa_inet-tests - -TESTS += test-arpa_inet -check_PROGRAMS += test-arpa_inet -EXTRA_DIST += test-arpa_inet.c - -## end gnulib module arpa_inet-tests - ## begin gnulib module binary-io libtests_a_SOURCES += binary-io.h @@ -111,6 +94,14 @@ EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h ## end gnulib module binary-io-tests +## begin gnulib module byteswap-tests + +TESTS += test-byteswap +check_PROGRAMS += test-byteswap +EXTRA_DIST += test-byteswap.c macros.h + +## end gnulib module byteswap-tests + ## begin gnulib module c++defs # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -144,6 +135,22 @@ EXTRA_DIST += test-c-ctype.c macros.h ## end gnulib module c-ctype-tests +## begin gnulib module crypto/hmac-md5-tests + +TESTS += test-hmac-md5 +check_PROGRAMS += test-hmac-md5 +EXTRA_DIST += test-hmac-md5.c + +## end gnulib module crypto/hmac-md5-tests + +## begin gnulib module crypto/md5-tests + +TESTS += test-md5 +check_PROGRAMS += test-md5 +EXTRA_DIST += test-md5.c + +## end gnulib module crypto/md5-tests + ## begin gnulib module errno-tests TESTS += test-errno @@ -153,6 +160,47 @@ EXTRA_DIST += test-errno.c ## end gnulib module errno-tests +## begin gnulib module fcntl-h + +BUILT_SOURCES += fcntl.h + +# We need the following in order to create <fcntl.h> when the system +# doesn't have one that works with the given compiler. +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \ + -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ + -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/fcntl.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += fcntl.h fcntl.h-t + +EXTRA_DIST += fcntl.in.h + +## end gnulib module fcntl-h + +## begin gnulib module fcntl-h-tests + +TESTS += test-fcntl-h +check_PROGRAMS += test-fcntl-h +EXTRA_DIST += test-fcntl-h.c + +## end gnulib module fcntl-h-tests + ## begin gnulib module fseeko-tests TESTS += test-fseeko.sh test-fseeko2.sh @@ -170,14 +218,13 @@ EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c signat ## end gnulib module ftello-tests -## begin gnulib module getaddrinfo-tests +## begin gnulib module func-tests -TESTS += test-getaddrinfo -check_PROGRAMS += test-getaddrinfo -test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@ -EXTRA_DIST += signature.h test-getaddrinfo.c +TESTS += test-func +check_PROGRAMS += test-func +EXTRA_DIST += test-func.c macros.h -## end gnulib module getaddrinfo-tests +## end gnulib module func-tests ## begin gnulib module getdelim-tests @@ -215,40 +262,12 @@ EXTRA_DIST += signature.h test-gettimeofday.c ## end gnulib module gettimeofday-tests -## begin gnulib module inet_ntop-tests - -TESTS += test-inet_ntop -check_PROGRAMS += test-inet_ntop -test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@ -EXTRA_DIST += test-inet_ntop.c signature.h macros.h - -## end gnulib module inet_ntop-tests - -## begin gnulib module inet_pton-tests - -TESTS += test-inet_pton -check_PROGRAMS += test-inet_pton -test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@ -EXTRA_DIST += test-inet_pton.c signature.h macros.h - -## end gnulib module inet_pton-tests - -## begin gnulib module ioctl +## begin gnulib module intprops -EXTRA_DIST += ioctl.c w32sock.h +EXTRA_DIST += intprops.h -EXTRA_libtests_a_SOURCES += ioctl.c - -## end gnulib module ioctl - -## begin gnulib module lseek-tests - -TESTS += test-lseek.sh -check_PROGRAMS += test-lseek -EXTRA_DIST += test-lseek.c test-lseek.sh signature.h macros.h - -## end gnulib module lseek-tests +## end gnulib module intprops ## begin gnulib module memchr-tests @@ -274,14 +293,6 @@ EXTRA_DIST += test-netinet_in.c ## end gnulib module netinet_in-tests -## begin gnulib module perror-tests - -TESTS += test-perror.sh -check_PROGRAMS += test-perror -EXTRA_DIST += signature.h test-perror.c test-perror.sh - -## end gnulib module perror-tests - ## begin gnulib module read-file-tests TESTS += test-read-file @@ -290,18 +301,6 @@ EXTRA_DIST += test-read-file.c ## end gnulib module read-file-tests -## begin gnulib module select-tests - -TESTS += test-select test-select-in.sh test-select-out.sh -# test-select-stdin has to be run by hand. -check_PROGRAMS += test-select test-select-fd test-select-stdin -test_select_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) -test_select_fd_LDADD = $(LDADD) @LIBSOCKET@ -test_select_stdin_LDADD = $(LDADD) @LIBSOCKET@ -EXTRA_DIST += macros.h signature.h test-select.c test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c - -## end gnulib module select-tests - ## begin gnulib module snprintf-tests TESTS += test-snprintf @@ -360,14 +359,6 @@ EXTRA_DIST += test-stdlib.c test-sys_wait.h ## end gnulib module stdlib-tests -## begin gnulib module strerror-tests - -TESTS += test-strerror -check_PROGRAMS += test-strerror -EXTRA_DIST += test-strerror.c signature.h macros.h - -## end gnulib module strerror-tests - ## begin gnulib module string-tests TESTS += test-string @@ -376,52 +367,21 @@ EXTRA_DIST += test-string.c ## end gnulib module string-tests -## begin gnulib module sys_ioctl +## begin gnulib module strings-tests -BUILT_SOURCES += sys/ioctl.h +TESTS += test-strings +check_PROGRAMS += test-strings +EXTRA_DIST += test-strings.c -# We need the following in order to create <sys/ioctl.h> when the system -# does not have a complete one. -sys/ioctl.h: sys_ioctl.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) - $(AM_V_at)$(MKDIR_P) sys - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \ - -e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \ - -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \ - -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ - -e 's|@''REPLACE_IOCTL''@|$(REPLACE_IOCTL)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/sys_ioctl.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += sys/ioctl.h sys/ioctl.h-t -MOSTLYCLEANDIRS += sys - -EXTRA_DIST += sys_ioctl.in.h - -## end gnulib module sys_ioctl - -## begin gnulib module sys_ioctl-tests +## end gnulib module strings-tests -TESTS += test-sys_ioctl -check_PROGRAMS += test-sys_ioctl -EXTRA_DIST += test-sys_ioctl.c +## begin gnulib module strverscmp-tests -## end gnulib module sys_ioctl-tests +TESTS += test-strverscmp +check_PROGRAMS += test-strverscmp +EXTRA_DIST += test-strverscmp.c signature.h macros.h -## begin gnulib module sys_select-tests - -TESTS += test-sys_select -check_PROGRAMS += test-sys_select -EXTRA_DIST += test-sys_select.c - -## end gnulib module sys_select-tests +## end gnulib module strverscmp-tests ## begin gnulib module sys_socket-tests @@ -455,6 +415,14 @@ EXTRA_DIST += test-time.c ## end gnulib module time-tests +## begin gnulib module u64-tests + +TESTS += test-u64 +check_PROGRAMS += test-u64 +EXTRA_DIST += test-u64.c + +## end gnulib module u64-tests + ## begin gnulib module unistd-tests TESTS += test-unistd @@ -463,14 +431,6 @@ EXTRA_DIST += test-unistd.c ## end gnulib module unistd-tests -## begin gnulib module update-copyright-tests - -TESTS += test-update-copyright.sh -TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' -EXTRA_DIST += test-update-copyright.sh - -## end gnulib module update-copyright-tests - ## begin gnulib module vasnprintf-tests TESTS += test-vasnprintf @@ -480,14 +440,14 @@ EXTRA_DIST += test-vasnprintf.c macros.h ## end gnulib module vasnprintf-tests -## begin gnulib module vc-list-files-tests +## begin gnulib module vasprintf-tests + +TESTS += test-vasprintf +check_PROGRAMS += test-vasprintf -TESTS += test-vc-list-files-git.sh -TESTS += test-vc-list-files-cvs.sh -TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' -EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh init.sh +EXTRA_DIST += test-vasprintf.c signature.h macros.h -## end gnulib module vc-list-files-tests +## end gnulib module vasprintf-tests ## begin gnulib module verify-tests @@ -507,6 +467,15 @@ EXTRA_DIST += test-version-etc.c test-version-etc.sh ## end gnulib module version-etc-tests +## begin gnulib module vsnprintf-tests + +TESTS += test-vsnprintf +check_PROGRAMS += test-vsnprintf + +EXTRA_DIST += test-vsnprintf.c signature.h macros.h + +## end gnulib module vsnprintf-tests + ## begin gnulib module warn-on-use BUILT_SOURCES += warn-on-use.h diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h index 5451fd48f4..c09dbf5799 100644 --- a/gl/tests/binary-io.h +++ b/gl/tests/binary-io.h @@ -1,6 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 2001, 2003, 2005, 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,24 +18,13 @@ #define _BINARY_H /* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in <fcntl.h>. */ + O_BINARY is guaranteed by the gnulib <fcntl.h>. */ #include <fcntl.h> /* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...', so we include it here first. */ #include <stdio.h> -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - /* SET_BINARY (fd); changes the file descriptor fd to perform binary I/O. */ #if O_BINARY @@ -58,8 +46,6 @@ # endif #else /* On reasonable systems, binary I/O is the default. */ -# undef O_BINARY -# define O_BINARY 0 # define SET_BINARY(fd) /* do nothing */ ((void) 0) #endif diff --git a/gl/tests/dummy.c b/gl/tests/dummy.c index 0f9a277962..c958ea05d8 100644 --- a/gl/tests/dummy.c +++ b/gl/tests/dummy.c @@ -1,5 +1,5 @@ /* A dummy file, to prevent empty libraries from breaking builds. - Copyright (C) 2004, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h new file mode 100644 index 0000000000..18cac454ab --- /dev/null +++ b/gl/tests/fcntl.in.h @@ -0,0 +1,308 @@ +/* Like <fcntl.h>, but with non-working flags defined to 0. + + Copyright (C) 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* written by Paul Eggert */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_fcntl_h +/* Special invocation convention. */ + +#include <sys/types.h> +/* On some systems other than glibc, <sys/stat.h> is a prerequisite of + <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden <sys/stat.h> from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +# include <sys/stat.h> +#endif +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_FCNTL_H + +#include <sys/types.h> +/* On some systems other than glibc, <sys/stat.h> is a prerequisite of + <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden <sys/stat.h> from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +# include <sys/stat.h> +#endif +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +#ifndef _GL_FCNTL_H +#define _GL_FCNTL_H + +#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ +# include <unistd.h> +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Declare overridden functions. */ + +#if @GNULIB_FCNTL@ +# if @REPLACE_FCNTL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcntl +# define fcntl rpl_fcntl +# endif +_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); +_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); +# else +# if !@HAVE_FCNTL@ +_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); +# endif +_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); +# endif +_GL_CXXALIASWARN (fcntl); +#elif defined GNULIB_POSIXCHECK +# undef fcntl +# if HAVE_RAW_DECL_FCNTL +_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " + "use gnulib module fcntl for portability"); +# endif +#endif + +#if @GNULIB_OPEN@ +# if @REPLACE_OPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef open +# define open rpl_open +# endif +_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); +# else +_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); +# endif +/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a + default argument. _GL_CXXALIASWARN does not work in this case. */ +# if !defined __hpux +_GL_CXXALIASWARN (open); +# endif +#elif defined GNULIB_POSIXCHECK +# undef open +/* Assume open is always declared. */ +_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " + "use gnulib module open for portability"); +#endif + +#if @GNULIB_OPENAT@ +# if @REPLACE_OPENAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef openat +# define openat rpl_openat +# endif +_GL_FUNCDECL_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# else +# if !@HAVE_OPENAT@ +_GL_FUNCDECL_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# endif +_GL_CXXALIASWARN (openat); +#elif defined GNULIB_POSIXCHECK +# undef openat +# if HAVE_RAW_DECL_OPENAT +_GL_WARN_ON_USE (openat, "openat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +/* Fix up the FD_* macros, only known to be missing on mingw. */ + +#ifndef FD_CLOEXEC +# define FD_CLOEXEC 1 +#endif + +/* Fix up the supported F_* macros. Intentionally leave other F_* + macros undefined. Only known to be missing on mingw. */ + +#ifndef F_DUPFD_CLOEXEC +# define F_DUPFD_CLOEXEC 0x40000000 +/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ +# define GNULIB_defined_F_DUPFD_CLOEXEC 1 +#else +# define GNULIB_defined_F_DUPFD_CLOEXEC 0 +#endif + +#ifndef F_DUPFD +# define F_DUPFD 1 +#endif + +#ifndef F_GETFD +# define F_GETFD 2 +#endif + +/* Fix up the O_* macros. */ + +#if !defined O_DIRECT && defined O_DIRECTIO +/* Tru64 spells it `O_DIRECTIO'. */ +# define O_DIRECT O_DIRECTIO +#endif + +#if !defined O_CLOEXEC && defined O_NOINHERIT +/* Mingw spells it `O_NOINHERIT'. Intentionally leave it + undefined if not available. */ +# define O_CLOEXEC O_NOINHERIT +#endif + +#ifndef O_CLOEXEC +# define O_CLOEXEC 0 +#endif + +#ifndef O_DIRECT +# define O_DIRECT 0 +#endif + +#ifndef O_DIRECTORY +# define O_DIRECTORY 0 +#endif + +#ifndef O_DSYNC +# define O_DSYNC 0 +#endif + +#ifndef O_EXEC +# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_NDELAY +# define O_NDELAY 0 +#endif + +#ifndef O_NOATIME +# define O_NOATIME 0 +#endif + +#ifndef O_NONBLOCK +# define O_NONBLOCK O_NDELAY +#endif + +#ifndef O_NOCTTY +# define O_NOCTTY 0 +#endif + +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + +#ifndef O_NOLINKS +# define O_NOLINKS 0 +#endif + +#ifndef O_RSYNC +# define O_RSYNC 0 +#endif + +#ifndef O_SEARCH +# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_SYNC +# define O_SYNC 0 +#endif + +#ifndef O_TTY_INIT +# define O_TTY_INIT 0 +#endif + +/* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in fcntl.h */ +#if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ +# define O_BINARY _O_BINARY +# define O_TEXT _O_TEXT +#endif + +#if defined __BEOS__ || defined __HAIKU__ + /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ +# undef O_BINARY +# undef O_TEXT +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +# define O_TEXT 0 +#endif + +/* Fix up the AT_* macros. */ + +/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its + value exceeds INT_MAX, so its use as an int doesn't conform to the + C standard, and GCC and Sun C complain in some cases. If the bug + is present, undef AT_FDCWD here, so it can be redefined below. */ +#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 +# undef AT_FDCWD +#endif + +/* Use the same bit pattern as Solaris 9, but with the proper + signedness. The bit pattern is important, in case this actually is + Solaris with the above workaround. */ +#ifndef AT_FDCWD +# define AT_FDCWD (-3041965) +#endif + +/* Use the same values as Solaris 9. This shouldn't matter, but + there's no real reason to differ. */ +#ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 4096 +#endif + +#ifndef AT_REMOVEDIR +# define AT_REMOVEDIR 1 +#endif + +/* Solaris 9 lacks these two, so just pick unique values. */ +#ifndef AT_SYMLINK_FOLLOW +# define AT_SYMLINK_FOLLOW 2 +#endif + +#ifndef AT_EACCESS +# define AT_EACCESS 4 +#endif + + +#endif /* _GL_FCNTL_H */ +#endif /* _GL_FCNTL_H */ +#endif diff --git a/gl/tests/getpagesize.c b/gl/tests/getpagesize.c index cc2526870f..d7c1ba807a 100644 --- a/gl/tests/getpagesize.c +++ b/gl/tests/getpagesize.c @@ -1,6 +1,6 @@ /* getpagesize emulation for systems where it cannot be done in a C macro. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/init.sh b/gl/tests/init.sh index 14f3b198d4..71c6516962 100644 --- a/gl/tests/init.sh +++ b/gl/tests/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -74,10 +74,10 @@ Exit () { set +e; (exit $1); exit $1; } # the reason for skip/failure to console, rather than to the .log files. : ${stderr_fileno_=2} -warn_() { echo "$@" 1>&$stderr_fileno_; } -fail_() { warn_ "$ME_: failed test: $@"; Exit 1; } -skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } -framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; } +warn_ () { echo "$@" 1>&$stderr_fileno_; } +fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } +skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } +framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE @@ -111,7 +111,7 @@ fi # Eval this code in a subshell to determine a shell's suitability. # 10 - passes all tests; ok to use -# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score +# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 @@ -193,7 +193,7 @@ fi test -n "$EXEEXT" && shopt -s expand_aliases # Enable glibc's malloc-perturbing option. -# This is cheap and useful for exposing code that depends on the fact that +# This is useful for exposing code that depends on the fact that # malloc-related functions often return memory that is mostly zeroed. # If you have the time and cycles, use valgrind to do an even better job. : ${MALLOC_PERTURB_=87} @@ -202,22 +202,22 @@ export MALLOC_PERTURB_ # This is a stub function that is run upon trap (upon regular exit and # interrupt). Override it with a per-test function, e.g., to unmount # a partition, or to undo any other global state changes. -cleanup_() { :; } +cleanup_ () { :; } if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { diff -u "$@"; } + compare () { diff -u "$@"; } elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { cmp -s "$@"; } + compare () { cmp -s "$@"; } else - compare() { cmp "$@"; } + compare () { cmp "$@"; } fi # An arbitrary prefix to help distinguish test directories. -testdir_prefix_() { printf gt; } +testdir_prefix_ () { printf gt; } # Run the user-overridable cleanup_ function, remove the temporary # directory and exit with the incoming value of $?. -remove_tmp_() +remove_tmp_ () { __st=$? cleanup_ @@ -233,7 +233,7 @@ remove_tmp_() # contains only the specified bytes (see the case stmt below), then print # a space-separated list of those names and return 0. Otherwise, don't # print anything and return 1. Naming constraints apply also to DIR. -find_exe_basenames_() +find_exe_basenames_ () { feb_dir_=$1 feb_fail_=0 @@ -245,6 +245,9 @@ find_exe_basenames_() # below, just skip it. test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ && continue + # Exempt [.exe, since we can't create a function by that name, yet + # we can't invoke [ by PATH search anyways due to shell builtins. + test "x$feb_file_" = "x$feb_dir_/[.exe" && continue case $feb_file_ in *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; *) # Remove leading file name components as well as the .exe suffix. @@ -263,7 +266,7 @@ find_exe_basenames_() # PROG that simply invokes PROG.exe, then return 0. If any selected # file name or the directory name, $1, contains an unexpected character, # define no alias and return 1. -create_exe_shims_() +create_exe_shims_ () { case $EXEEXT in '') return 0 ;; @@ -272,7 +275,7 @@ create_exe_shims_() esac base_names_=`find_exe_basenames_ $1` \ - || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } + || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; } if test -n "$base_names_"; then for base_ in $base_names_; do @@ -285,7 +288,7 @@ create_exe_shims_() # Use this function to prepend to PATH an absolute name for each # specified, possibly-$initial_cwd_-relative, directory. -path_prepend_() +path_prepend_ () { while test $# != 0; do path_dir_=$1 @@ -308,7 +311,7 @@ path_prepend_() export PATH } -setup_() +setup_ () { if test "$VERBOSE" = yes; then # Test whether set -x may cause the selected shell to corrupt an @@ -324,6 +327,7 @@ setup_() fi initial_cwd_=$PWD + fail=0 pfx_=`testdir_prefix_` test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ @@ -360,7 +364,7 @@ setup_() # - make only $MAX_TRIES_ attempts # Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_() +rand_bytes_ () { n_=$1 @@ -392,7 +396,7 @@ rand_bytes_() | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ } -mktempd_() +mktempd_ () { case $# in 2);; @@ -413,11 +417,10 @@ mktempd_() case $template_ in *XXXX) ;; - *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; + *) fail_ \ + "invalid template: $template_ (must have a suffix of at least 4 X's)";; esac - fail=0 - # First, try to use mktemp. d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \ || fail=1 diff --git a/gl/tests/ioctl.c b/gl/tests/ioctl.c deleted file mode 100644 index 91eb3be1b9..0000000000 --- a/gl/tests/ioctl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* ioctl.c --- wrappers for Windows ioctl function - - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini */ - -#include <config.h> - -#include <sys/ioctl.h> - -#include <stdarg.h> - -#if HAVE_IOCTL - -/* Provide a wrapper with the POSIX prototype. */ -# undef ioctl -int -rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) -{ - void *buf; - va_list args; - - va_start (args, request); - buf = va_arg (args, void *); - va_end (args); - - return ioctl (fd, request, buf); -} - -#else /* mingw */ - -# define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -# include <sys/socket.h> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -# include "w32sock.h" - -int -ioctl (int fd, int req, ...) -{ - void *buf; - va_list args; - SOCKET sock; - int r; - - va_start (args, req); - buf = va_arg (args, void *); - va_end (args); - - sock = FD_TO_SOCKET (fd); - r = ioctlsocket (sock, req, buf); - if (r < 0) - set_winsock_errno (); - - return r; -} - -#endif diff --git a/gl/tests/macros.h b/gl/tests/macros.h index 11db5a8af0..89226758ec 100644 --- a/gl/tests/macros.h +++ b/gl/tests/macros.h @@ -1,5 +1,5 @@ /* Common macros used by gnulib tests. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/signature.h b/gl/tests/signature.h index 6e15c43a2a..8256989d0e 100644 --- a/gl/tests/signature.h +++ b/gl/tests/signature.h @@ -1,5 +1,5 @@ /* Macro for checking that a function declaration is compliant. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h deleted file mode 100644 index 871b676981..0000000000 --- a/gl/tests/sys_ioctl.in.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Substitute for and wrapper around <sys/ioctl.h>. - 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_SYS_IOCTL_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_SYS_IOCTL_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@ -#endif - -#ifndef _GL_SYS_IOCTL_H -#define _GL_SYS_IOCTL_H - -/* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, - but not in <sys/ioctl.h>. - But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# include <unistd.h> -#endif - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -/* Declare overridden functions. */ - -#if @GNULIB_IOCTL@ -# if @REPLACE_IOCTL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef ioctl -# define ioctl rpl_ioctl -# endif -_GL_FUNCDECL_RPL (ioctl, int, - (int fd, int request, ... /* {void *,char *} arg */)); -_GL_CXXALIAS_RPL (ioctl, int, - (int fd, int request, ... /* {void *,char *} arg */)); -# else -# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1 -_GL_FUNCDECL_SYS (ioctl, int, - (int fd, int request, ... /* {void *,char *} arg */)); -# endif -_GL_CXXALIAS_SYS (ioctl, int, - (int fd, int request, ... /* {void *,char *} arg */)); -# endif -_GL_CXXALIASWARN (ioctl); -#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ -# undef ioctl -# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl -#elif defined GNULIB_POSIXCHECK -# undef ioctl -# if HAVE_RAW_DECL_IOCTL -_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - " - "use gnulib module ioctl for portability"); -# endif -#endif - - -#endif /* _GL_SYS_IOCTL_H */ -#endif /* _GL_SYS_IOCTL_H */ diff --git a/gl/tests/test-alignof.c b/gl/tests/test-alignof.c deleted file mode 100644 index a8b6d18996..0000000000 --- a/gl/tests/test-alignof.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Test of <alignof.h>. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2009. */ - -#include <config.h> - -#include <alignof.h> - -#include <stddef.h> -#include <stdint.h> - -#include "verify.h" - -typedef long double longdouble; -typedef struct { char a[1]; } struct1; -typedef struct { char a[2]; } struct2; -typedef struct { char a[3]; } struct3; -typedef struct { char a[4]; } struct4; - -#define CHECK(type) \ - typedef struct { char slot1; type slot2; } type##_helper; \ - verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \ - const int type##_slot_alignment = alignof_slot (type); \ - const int type##_type_alignment = alignof_type (type); - -CHECK (char) -CHECK (short) -CHECK (int) -CHECK (long) -CHECK (float) -CHECK (double) -CHECK (longdouble) -#ifdef INT64_MAX -CHECK (int64_t) -#endif -CHECK (struct1) -CHECK (struct2) -CHECK (struct3) -CHECK (struct4) - -int -main () -{ - return 0; -} diff --git a/gl/tests/test-alloca-opt.c b/gl/tests/test-alloca-opt.c index cfbecafcb9..5aa16455d0 100644 --- a/gl/tests/test-alloca-opt.c +++ b/gl/tests/test-alloca-opt.c @@ -1,5 +1,5 @@ /* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-arpa_inet.c b/gl/tests/test-arpa_inet.c deleted file mode 100644 index 262686ac47..0000000000 --- a/gl/tests/test-arpa_inet.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <arpa/inet.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <arpa/inet.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-binary-io.c b/gl/tests/test-binary-io.c index 125150b21f..8e5d193f69 100644 --- a/gl/tests/test-binary-io.c +++ b/gl/tests/test-binary-io.c @@ -1,5 +1,5 @@ /* Test of binary mode I/O. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-c-ctype.c b/gl/tests/test-c-ctype.c index ebe594dd4f..9d748ffe88 100644 --- a/gl/tests/test-c-ctype.c +++ b/gl/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-errno.c b/gl/tests/test-errno.c index 129b236fe9..7851c22d0f 100644 --- a/gl/tests/test-errno.c +++ b/gl/tests/test-errno.c @@ -1,5 +1,5 @@ /* Test of <errno.h> substitute. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/gl/tests/test-stdio.c b/gl/tests/test-fcntl-h.c index 87100576f0..dd20fbb406 100644 --- a/lib/gl/tests/test-stdio.c +++ b/gl/tests/test-fcntl-h.c @@ -1,5 +1,5 @@ -/* Test of <stdio.h> substitute. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. +/* Test of <fcntl.h> substitute. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,23 +18,18 @@ #include <config.h> -#include <stdio.h> +#include <fcntl.h> -#include "verify.h" +/* Check that the various O_* macros are defined. */ +int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK + | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC | O_TTY_INIT + | O_BINARY | O_TEXT; /* Check that the various SEEK_* macros are defined. */ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the types are all defined. */ -fpos_t t1; -off_t t2; -size_t t3; -ssize_t t4; -va_list t5; +/* Check that the FD_* macros are defined. */ +int fd = FD_CLOEXEC; int main (void) diff --git a/gl/tests/test-fseeko.c b/gl/tests/test-fseeko.c index be2a78dce1..ad5eec8de9 100644 --- a/gl/tests/test-fseeko.c +++ b/gl/tests/test-fseeko.c @@ -1,5 +1,5 @@ /* Test of fseeko() function. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-ftello.c b/gl/tests/test-ftello.c index 5fae570f28..636da81190 100644 --- a/gl/tests/test-ftello.c +++ b/gl/tests/test-ftello.c @@ -1,5 +1,5 @@ /* Test of ftello() function. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-ftello3.c b/gl/tests/test-ftello3.c index b07ba64610..50d4b882fd 100644 --- a/gl/tests/test-ftello3.c +++ b/gl/tests/test-ftello3.c @@ -1,5 +1,5 @@ /* Test of ftello() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c deleted file mode 100644 index 15d6569b4a..0000000000 --- a/gl/tests/test-getaddrinfo.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Test the getaddrinfo module. - - Copyright (C) 2006-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Simon Josefsson. */ - -#include <config.h> - -#include <netdb.h> - -#include "signature.h" -SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *)); -SIGNATURE_CHECK (gai_strerror, char const *, (int)); -SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *, - struct addrinfo const *, - struct addrinfo **)); - -#include <arpa/inet.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdio.h> -#include <string.h> - -/* Whether to print debugging messages. */ -#define ENABLE_DEBUGGING 0 - -#if ENABLE_DEBUGGING -# define dbgprintf printf -#else -# define dbgprintf if (0) printf -#endif - -/* BeOS does not have AF_UNSPEC. */ -#ifndef AF_UNSPEC -# define AF_UNSPEC 0 -#endif - -#ifndef EAI_SERVICE -# define EAI_SERVICE 0 -#endif - -static int -simple (char const *host, char const *service) -{ - char buf[BUFSIZ]; - static int skip = 0; - struct addrinfo hints; - struct addrinfo *ai0, *ai; - int res; - int err; - - /* Once we skipped the test, do not try anything else */ - if (skip) - return 0; - - dbgprintf ("Finding %s service %s...\n", host, service); - - /* This initializes "hints" but does not use it. Is there a reason - for this? If so, please fix this comment. */ - memset (&hints, 0, sizeof (hints)); - hints.ai_flags = AI_CANONNAME; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - res = getaddrinfo (host, service, 0, &ai0); - err = errno; - - dbgprintf ("res %d: %s\n", res, gai_strerror (res)); - - if (res != 0) - { - /* EAI_AGAIN is returned if no network is available. Don't fail - the test merely because someone is down the country on their - in-law's farm. */ - if (res == EAI_AGAIN) - { - skip++; - fprintf (stderr, "skipping getaddrinfo test: no network?\n"); - return 77; - } - /* IRIX reports EAI_NONAME for "https". Don't fail the test - merely because of this. */ - if (res == EAI_NONAME) - return 0; - /* Solaris reports EAI_SERVICE for "http" and "https". Don't - fail the test merely because of this. */ - if (res == EAI_SERVICE) - return 0; -#ifdef EAI_NODATA - /* AIX reports EAI_NODATA for "https". Don't fail the test - merely because of this. */ - if (res == EAI_NODATA) - return 0; -#endif - /* Provide details if errno was set. */ - if (res == EAI_SYSTEM) - dbgprintf ("system error: %s\n", strerror (err)); - - return 1; - } - - for (ai = ai0; ai; ai = ai->ai_next) - { - dbgprintf ("\tflags %x\n", ai->ai_flags); - dbgprintf ("\tfamily %x\n", ai->ai_family); - dbgprintf ("\tsocktype %x\n", ai->ai_socktype); - dbgprintf ("\tprotocol %x\n", ai->ai_protocol); - dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen); - dbgprintf ("\tFound %s\n", - inet_ntop (ai->ai_family, - &((struct sockaddr_in *) - ai->ai_addr)->sin_addr, - buf, sizeof (buf) - 1)); - if (ai->ai_canonname) - dbgprintf ("\tFound %s...\n", ai->ai_canonname); - - { - char ipbuf[BUFSIZ]; - char portbuf[BUFSIZ]; - - res = getnameinfo (ai->ai_addr, ai->ai_addrlen, - ipbuf, sizeof (ipbuf) - 1, - portbuf, sizeof (portbuf) - 1, - NI_NUMERICHOST|NI_NUMERICSERV); - dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res)); - if (res == 0) - { - dbgprintf ("\t\tip %s\n", ipbuf); - dbgprintf ("\t\tport %s\n", portbuf); - } - } - - } - - freeaddrinfo (ai0); - - return 0; -} - -#define HOST1 "www.gnu.org" -#define SERV1 "http" -#define HOST2 "www.ibm.com" -#define SERV2 "https" -#define HOST3 "microsoft.com" -#define SERV3 "http" -#define HOST4 "google.org" -#define SERV4 "ldap" - -int main (void) -{ - return simple (HOST1, SERV1) - + simple (HOST2, SERV2) - + simple (HOST3, SERV3) - + simple (HOST4, SERV4); -} diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c index a5df49f1dd..f4d1c9d506 100644 --- a/gl/tests/test-getdelim.c +++ b/gl/tests/test-getdelim.c @@ -1,5 +1,5 @@ /* Test of getdelim() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c index 6a661ce530..bead4b6aad 100644 --- a/gl/tests/test-getline.c +++ b/gl/tests/test-getline.c @@ -1,5 +1,5 @@ /* Test of getline() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c index ff2bc72b54..7d09fc3ad0 100644 --- a/gl/tests/test-gettimeofday.c +++ b/gl/tests/test-gettimeofday.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. * Written by Jim Meyering. * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-inet_ntop.c b/gl/tests/test-inet_ntop.c deleted file mode 100644 index d3b045c353..0000000000 --- a/gl/tests/test-inet_ntop.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test of inet_ntop function. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2009. */ - -#include <config.h> - -#include <arpa/inet.h> - -#include "signature.h" -SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *, - socklen_t)); - -#include <netinet/in.h> -#include <sys/socket.h> -#include <string.h> - -#include "macros.h" - -int -main (void) -{ -#if defined AF_INET /* HAVE_IPV4 */ - { - struct in_addr internal; - char printable[16]; - const char *result; - - /* This machine was for a long time known as - ma2s2.mathematik.uni-karlsruhe.de. */ -# ifdef WORDS_BIGENDIAN - internal.s_addr = 0x810D7302; -# else - internal.s_addr = 0x02730D81; -# endif - result = inet_ntop (AF_INET, &internal, printable, sizeof (printable)); - ASSERT (result != NULL); - ASSERT (strcmp (result, "129.13.115.2") == 0); - } -#endif - - return 0; -} diff --git a/gl/tests/test-inet_pton.c b/gl/tests/test-inet_pton.c deleted file mode 100644 index 74afc0c07b..0000000000 --- a/gl/tests/test-inet_pton.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Test of inet_pton function. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2009. */ - -#include <config.h> - -#include <arpa/inet.h> - -#include "signature.h" -SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *)); - -#include <netinet/in.h> -#include <sys/socket.h> - -#include "macros.h" - -int -main (void) -{ -#if defined AF_INET /* HAVE_IPV4 */ - { - /* This machine was for a long time known as - ma2s2.mathematik.uni-karlsruhe.de. */ - const char printable[] = "129.13.115.2"; - struct in_addr internal; - int ret; - - ret = inet_pton (AF_INET, printable, &internal); - ASSERT (ret == 1); - /* Verify that internal is filled in network byte order. */ - ASSERT (((unsigned char *) &internal)[0] == 0x81); - ASSERT (((unsigned char *) &internal)[1] == 0x0D); - ASSERT (((unsigned char *) &internal)[2] == 0x73); - ASSERT (((unsigned char *) &internal)[3] == 0x02); -# ifdef WORDS_BIGENDIAN - ASSERT (internal.s_addr == 0x810D7302); -# else - ASSERT (internal.s_addr == 0x02730D81); -# endif - } -#endif - - return 0; -} diff --git a/gl/tests/test-lseek.c b/gl/tests/test-lseek.c deleted file mode 100644 index 3d893a0d05..0000000000 --- a/gl/tests/test-lseek.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Test of lseek() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake, 2007. */ - -#include <config.h> - -#include <unistd.h> - -#include "signature.h" -SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); - -#include <errno.h> - -#include "macros.h" - -/* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' - if they are pipes, and '2' if they are closed. Check for proper - semantics of lseek. */ -int -main (int argc, char **argv) -{ - if (argc != 2) - return 2; - switch (*argv[1]) - { - case '0': /* regular files */ - ASSERT (lseek (0, (off_t)2, SEEK_SET) == 2); - ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); - ASSERT (errno == EINVAL); - errno = 0; -#if ! defined __BEOS__ - /* POSIX says that the last lseek call, when failing, does not change - the current offset. But BeOS sets it to 0. */ - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); -#endif -#if 0 /* leads to SIGSYS on IRIX 6.5 */ - ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); - ASSERT (errno == EINVAL); -#endif - ASSERT (lseek (1, (off_t)2, SEEK_SET) == 2); - errno = 0; - ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); - ASSERT (errno == EINVAL); - errno = 0; -#if ! defined __BEOS__ - /* POSIX says that the last lseek call, when failing, does not change - the current offset. But BeOS sets it to 0. */ - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); -#endif -#if 0 /* leads to SIGSYS on IRIX 6.5 */ - ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); - ASSERT (errno == EINVAL); -#endif - break; - - case '1': /* pipes */ - errno = 0; - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == ESPIPE); - errno = 0; - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == ESPIPE); - break; - - case '2': /* closed */ - /* Explicitly close file descriptors 0 and 1. The <&- and >&- in the - invoking shell are not enough on HP-UX. - close (0); calling close fails on mingw -- simon@josefsson.org - close (1); */ - errno = 0; - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == EBADF); - errno = 0; - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == EBADF); - break; - - default: - return 1; - } - return 0; -} diff --git a/gl/tests/test-lseek.sh b/gl/tests/test-lseek.sh deleted file mode 100755 index c0c2946c43..0000000000 --- a/gl/tests/test-lseek.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -tmpfiles= -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles=t-lseek.tmp -# seekable files -./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1 - -# pipes -echo hi | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; cat > /dev/null; } | cat -test "`cat t-lseek.tmp`" = "0" || exit 1 - -# closed descriptors -# Doesn't work under mingw -- simon@josefsson.org -#./test-lseek${EXEEXT} 2 <&- >&- || exit 1 - -rm -rf $tmpfiles -exit 0 diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c index 05e1bfaed2..a11f6cdb97 100644 --- a/gl/tests/test-memchr.c +++ b/gl/tests/test-memchr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2010 Free Software Foundation, Inc. + * Copyright (C) 2008-2011 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-netdb.c b/gl/tests/test-netdb.c index 697bbc8dbf..13a8925fbe 100644 --- a/gl/tests/test-netdb.c +++ b/gl/tests/test-netdb.c @@ -1,5 +1,5 @@ /* Test of <netdb.h> substitute. - Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-netinet_in.c b/gl/tests/test-netinet_in.c index af403ed323..b1edc66add 100644 --- a/gl/tests/test-netinet_in.c +++ b/gl/tests/test-netinet_in.c @@ -1,5 +1,5 @@ /* Test of <netinet/in.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-perror.c b/gl/tests/test-perror.c deleted file mode 100644 index 2b7640c06a..0000000000 --- a/gl/tests/test-perror.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of perror() function. - 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (perror, void, (char const *)); - -#include <errno.h> - -int -main (int argc, char **argv) -{ - const char *prefix = (argc > 1 ? argv[1] : NULL); - - errno = EACCES; perror (prefix); - errno = ETIMEDOUT; perror (prefix); - errno = EOVERFLOW; perror (prefix); - - return 0; -} diff --git a/gl/tests/test-perror.sh b/gl/tests/test-perror.sh deleted file mode 100755 index f2c8fdc336..0000000000 --- a/gl/tests/test-perror.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -# Test NULL prefix. Result should not contain a number. -tmpfiles="$tmpfiles t-perror.tmp" -./test-perror${EXEEXT} 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp -if grep '[0-9]' t-perror.tmp > /dev/null; then - rm -fr $tmpfiles; exit 1 -fi - -# Test empty prefix. Result should be the same. -tmpfiles="$tmpfiles t-perror1.tmp" -./test-perror${EXEEXT} '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp -diff t-perror.tmp t-perror1.tmp -test $? = 0 || { rm -fr $tmpfiles; exit 1; } - -# Test non-empty prefix. -tmpfiles="$tmpfiles t-perror2.tmp t-perror3.tmp" -./test-perror${EXEEXT} 'foo' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp -sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp -diff t-perror2.tmp t-perror3.tmp -test $? = 0 || { rm -fr $tmpfiles; exit 1; } - -rm -fr $tmpfiles -exit 0 diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c index daa61668c6..de7a0bb9f3 100644 --- a/gl/tests/test-read-file.c +++ b/gl/tests/test-read-file.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. + * Copyright (C) 2006-2007, 2010-2011 Free Software Foundation, Inc. * Written by Simon Josefsson * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-select-fd.c b/gl/tests/test-select-fd.c deleted file mode 100644 index 4527a2fb49..0000000000 --- a/gl/tests/test-select-fd.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Test of select() substitute, reading or writing from a given file descriptor. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2008. */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <sys/select.h> - -int -main (int argc, char *argv[]) -{ - if (argc == 4) - { - char mode = argv[1][0]; - - if (mode == 'r' || mode == 'w') - { - int fd = atoi (argv[2]); - - if (fd >= 0) - { - const char *result_file_name = argv[3]; - FILE *result_file = fopen (result_file_name, "wb"); - - if (result_file != NULL) - { - fd_set fds; - struct timeval timeout; - int ret; - - FD_ZERO (&fds); - FD_SET (fd, &fds); - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - ret = (mode == 'r' - ? select (fd + 1, &fds, NULL, NULL, &timeout) - : select (fd + 1, NULL, &fds, NULL, &timeout)); - if (ret < 0) - { - perror ("select failed"); - exit (1); - } - if ((ret == 0) != ! FD_ISSET (fd, &fds)) - { - fprintf (stderr, "incorrect return value\n"); - exit (1); - } - fprintf (result_file, "%d\n", ret); - exit (0); - } - } - } - } - fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n"); - exit (1); -} diff --git a/gl/tests/test-select-in.sh b/gl/tests/test-select-in.sh deleted file mode 100755 index 2a8b742268..0000000000 --- a/gl/tests/test-select-in.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Test select() on file descriptors opened for reading. - -# This test is known to fail on Solaris 2.6 and older, due to its handling -# of /dev/null. - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-select-in.tmp" - -# Regular files. - -rm -f t-select-in.tmp -./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT} -test `cat t-select-in.tmp` = "1" || exit 1 - -# Pipes. - -rm -f t-select-in.tmp -{ sleep 1; echo abc; } | \ - { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; } -test `cat t-select-in.tmp` = "0" || exit 1 - -rm -f t-select-in.tmp -echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; } -test `cat t-select-in.tmp` = "1" || exit 1 - -# Special files. -# This part of the test is known to fail on Solaris 2.6 and older. - -# Doesn't work under mingw -- simon@josefsson.org -#rm -f t-select-in.tmp -#./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null -#test `cat t-select-in.tmp` = "1" || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/gl/tests/test-select-out.sh b/gl/tests/test-select-out.sh deleted file mode 100755 index c5fd8619f6..0000000000 --- a/gl/tests/test-select-out.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Test select() on file descriptors opened for writing. - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" - -# Regular files. - -rm -f t-select-out.tmp -./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out -test `cat t-select-out.tmp` = "1" || exit 1 - -# Pipes. - -if false; then # This test fails on some platforms. - rm -f t-select-out.tmp - ( { echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null - test `cat t-select-out.tmp` = "0" || exit 1 -fi - -rm -f t-select-out.tmp -( { sleep 1; echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null -test `cat t-select-out.tmp` = "1" || exit 1 - -# Special files. - -rm -f t-select-out.tmp -./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null -test `cat t-select-out.tmp` = "1" || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/gl/tests/test-select-stdin.c b/gl/tests/test-select-stdin.c deleted file mode 100644 index c88698cd3f..0000000000 --- a/gl/tests/test-select-stdin.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Test of select() substitute, reading from stdin. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2008. */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <sys/select.h> -#include <sys/time.h> -#include <unistd.h> - -#include "macros.h" - -int -main (void) -{ - printf ("Applying select() from standard input. Press Ctrl-C to abort.\n"); - for (;;) - { - struct timeval before; - struct timeval after; - unsigned long spent_usec; - fd_set readfds; - struct timeval timeout; - int ret; - - gettimeofday (&before, NULL); - - FD_ZERO (&readfds); - FD_SET (0, &readfds); - timeout.tv_sec = 0; - timeout.tv_usec = 500000; - ret = select (1, &readfds, NULL, NULL, &timeout); - - gettimeofday (&after, NULL); - spent_usec = (after.tv_sec - before.tv_sec) * 1000000 - + after.tv_usec - before.tv_usec; - - if (ret < 0) - { - perror ("select failed"); - exit (1); - } - if ((ret == 0) != ! FD_ISSET (0, &readfds)) - { - fprintf (stderr, "incorrect return value\n"); - exit (1); - } - if (ret == 0) - { - if (spent_usec < 250000) - { - fprintf (stderr, "returned too early\n"); - exit (1); - } - /* Timeout */ - printf ("."); - ASSERT (fflush (stdout) == 0); - } - else - { - char c; - - printf ("Input available! Trying to read 1 byte...\n"); - ASSERT (read (0, &c, 1) == 1); - } - } -} diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c deleted file mode 100644 index 9c895c3b21..0000000000 --- a/gl/tests/test-select.c +++ /dev/null @@ -1,393 +0,0 @@ -/* Test of select() substitute. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini, 2008. */ - -#include <config.h> - -#include <sys/select.h> - -#include "signature.h" -SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *, - struct timeval *)); -/* The following may be macros without underlying functions, so only - check signature if they are not macros. */ -#ifndef FD_CLR -SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *)); -#endif -#ifndef FD_ISSET -SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *)); -#endif -#ifndef FD_SET -SIGNATURE_CHECK (FD_SET, int, (int, fd_set *)); -#endif -#ifndef FD_ZERO -SIGNATURE_CHECK (FD_ZERO, void, (fd_set *)); -#endif - -#include <stdio.h> -#include <string.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stdbool.h> -#include <sys/ioctl.h> -#include <errno.h> - -#include "macros.h" - -enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 }; - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# define WIN32_NATIVE -#endif - -#ifdef WIN32_NATIVE -#include <io.h> -#define pipe(x) _pipe(x, 256, O_BINARY) -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -#ifndef SO_REUSEPORT -#define SO_REUSEPORT SO_REUSEADDR -#endif - -#define TEST_PORT 12345 - - -/* Minimal testing infrastructure. */ - -static int failures; - -static void -failed (const char *reason) -{ - if (++failures > 1) - printf (" "); - printf ("failed (%s)\n", reason); -} - -static int -test (void (*fn) (void), const char *msg) -{ - failures = 0; - printf ("%s... ", msg); - fflush (stdout); - fn (); - - if (!failures) - printf ("passed\n"); - - return failures; -} - - -/* Funny socket code. */ - -static int -open_server_socket (void) -{ - int s, x; - struct sockaddr_in ia; - - s = socket (AF_INET, SOCK_STREAM, 0); - - memset (&ia, 0, sizeof (ia)); - ia.sin_family = AF_INET; - inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); - ia.sin_port = htons (TEST_PORT); - if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0) - { - perror ("bind"); - exit (77); - } - - x = 1; - setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); - - if (listen (s, 1) < 0) - { - perror ("listen"); - exit (77); - } - - return s; -} - -static int -connect_to_socket (int blocking) -{ - int s; - struct sockaddr_in ia; - - s = socket (AF_INET, SOCK_STREAM, 0); - - memset (&ia, 0, sizeof (ia)); - ia.sin_family = AF_INET; - inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); - ia.sin_port = htons (TEST_PORT); - - if (!blocking) - { -#ifdef WIN32_NATIVE - unsigned long iMode = 1; - ioctl (s, FIONBIO, (char *) &iMode); - -#elif defined F_GETFL - int oldflags = fcntl (s, F_GETFL, NULL); - - if (!(oldflags & O_NONBLOCK)) - fcntl (s, F_SETFL, oldflags | O_NONBLOCK); -#endif - } - - if (connect (s, (struct sockaddr *) &ia, sizeof (ia)) < 0 - && (blocking || errno != EINPROGRESS)) - { - perror ("connect"); - exit (77); - } - - return s; -} - - -/* A slightly more convenient interface to select(2). */ - -static int -do_select (int fd, int ev, struct timeval *tv) -{ - fd_set rfds, wfds, xfds; - int r, rev; - - FD_ZERO (&rfds); - FD_ZERO (&wfds); - FD_ZERO (&xfds); - if (ev & SEL_IN) - FD_SET (fd, &rfds); - if (ev & SEL_OUT) - FD_SET (fd, &wfds); - if (ev & SEL_EXC) - FD_SET (fd, &xfds); - r = select (fd + 1, &rfds, &wfds, &xfds, tv); - if (r < 0) - return r; - - rev = 0; - if (FD_ISSET (fd, &rfds)) - rev |= SEL_IN; - if (FD_ISSET (fd, &wfds)) - rev |= SEL_OUT; - if (FD_ISSET (fd, &xfds)) - rev |= SEL_EXC; - if (rev && r == 0) - failed ("select returned 0"); - if (rev & ~ev) - failed ("select returned unrequested events"); - - return rev; -} - -static int -do_select_nowait (int fd, int ev) -{ - static struct timeval tv0; - return do_select (fd, ev, &tv0); -} - -static int -do_select_wait (int fd, int ev) -{ - return do_select (fd, ev, NULL); -} - - -/* Test poll(2) for TTYs. */ - -#ifdef INTERACTIVE -static void -test_tty (void) -{ - if (do_select_nowait (0, SEL_IN) != 0) - failed ("can read"); - if (do_select_nowait (0, SEL_OUT) == 0) - failed ("cannot write"); - - if (do_select_wait (0, SEL_IN) == 0) - failed ("return with infinite timeout"); - - getchar (); - if (do_select_nowait (0, SEL_IN) != 0) - failed ("can read after getc"); -} -#endif - - -/* Test poll(2) for unconnected nonblocking sockets. */ - -static void -test_connect_first (void) -{ - int s = open_server_socket (); - struct sockaddr_in ia; - socklen_t addrlen; - - int c1, c2; - - if (do_select_nowait (s, SEL_IN | SEL_EXC) != 0) - failed ("can read, socket not connected"); - - c1 = connect_to_socket (false); - - if (do_select_wait (s, SEL_IN | SEL_EXC) != SEL_IN) - failed ("expecting readability on passive socket"); - if (do_select_nowait (s, SEL_IN | SEL_EXC) != SEL_IN) - failed ("expecting readability on passive socket"); - - addrlen = sizeof (ia); - c2 = accept (s, (struct sockaddr *) &ia, &addrlen); - ASSERT (close (s) == 0); - ASSERT (close (c1) == 0); - ASSERT (close (c2) == 0); -} - - -/* Test poll(2) for unconnected blocking sockets. */ - -static void -test_accept_first (void) -{ -#ifndef WIN32_NATIVE - int s = open_server_socket (); - struct sockaddr_in ia; - socklen_t addrlen; - char buf[3]; - int c, pid; - - pid = fork (); - if (pid < 0) - return; - - if (pid == 0) - { - addrlen = sizeof (ia); - c = accept (s, (struct sockaddr *) &ia, &addrlen); - ASSERT (close (s) == 0); - ASSERT (write (c, "foo", 3) == 3); - ASSERT (read (c, buf, 3) == 3); - shutdown (c, SHUT_RD); - ASSERT (close (c) == 0); - exit (0); - } - else - { - ASSERT (close (s) == 0); - c = connect_to_socket (true); - if (do_select_nowait (c, SEL_OUT) != SEL_OUT) - failed ("cannot write after blocking connect"); - ASSERT (write (c, "foo", 3) == 3); - wait (&pid); - if (do_select_wait (c, SEL_IN) != SEL_IN) - failed ("cannot read data left in the socket by closed process"); - ASSERT (read (c, buf, 3) == 3); - ASSERT (write (c, "foo", 3) == 3); - ASSERT (close (c) == 0); - } -#endif -} - - -/* Common code for pipes and connected sockets. */ - -static void -test_pair (int rd, int wd) -{ - char buf[3]; - if (do_select_wait (wd, SEL_IN | SEL_OUT | SEL_EXC) != SEL_OUT) - failed ("expecting writability before writing"); - if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC) != SEL_OUT) - failed ("expecting writability before writing"); - - ASSERT (write (wd, "foo", 3) == 3); - if (do_select_wait (rd, SEL_IN) != SEL_IN) - failed ("expecting readability after writing"); - if (do_select_nowait (rd, SEL_IN) != SEL_IN) - failed ("expecting readability after writing"); - - ASSERT (read (rd, buf, 3) == 3); -} - - -/* Test poll(2) on connected sockets. */ - -static void -test_socket_pair (void) -{ - struct sockaddr_in ia; - - socklen_t addrlen = sizeof (ia); - int s = open_server_socket (); - int c1 = connect_to_socket (false); - int c2 = accept (s, (struct sockaddr *) &ia, &addrlen); - - ASSERT (close (s) == 0); - - test_pair (c1, c2); - ASSERT (close (c1) == 0); - ASSERT (write (c2, "foo", 3) == 3); - ASSERT (close (c2) == 0); -} - - -/* Test poll(2) on pipes. */ - -static void -test_pipe (void) -{ - int fd[2]; - - ASSERT (pipe (fd) == 0); - test_pair (fd[0], fd[1]); - ASSERT (close (fd[0]) == 0); - ASSERT (close (fd[1]) == 0); -} - - -/* Do them all. */ - -int -main (void) -{ - int result; - -#ifdef INTERACTIVE - printf ("Please press Enter\n"); - test (test_tty, "TTY"); -#endif - - result = test (test_connect_first, "Unconnected socket test"); - result += test (test_socket_pair, "Connected sockets test"); - result += test (test_accept_first, "General socket test with fork"); - result += test (test_pipe, "Pipe test"); - - exit (result); -} diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c index 62a411bf91..95a352dc5e 100644 --- a/gl/tests/test-snprintf.c +++ b/gl/tests/test-snprintf.c @@ -1,5 +1,5 @@ /* Test of snprintf() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,15 +34,16 @@ main (int argc, char *argv[]) int size; int retval; + retval = snprintf (NULL, 0, "%d", 12345); + ASSERT (retval == 5); + for (size = 0; size <= 8; size++) { memcpy (buf, "DEADBEEF", 8); retval = snprintf (buf, size, "%d", 12345); + ASSERT (retval == 5); if (size < 6) { -#if CHECK_SNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif if (size > 0) { ASSERT (memcmp (buf, "12345", size - 1) == 0); @@ -55,7 +56,6 @@ main (int argc, char *argv[]) } else { - ASSERT (retval == 5); ASSERT (memcmp (buf, "12345\0EF", 8) == 0); } } diff --git a/gl/tests/test-sockets.c b/gl/tests/test-sockets.c index ab5460ad46..0170d3754d 100644 --- a/gl/tests/test-sockets.c +++ b/gl/tests/test-sockets.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2008-2011 Free Software Foundation, Inc. * Written by Simon Josefsson. * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c index 2103d8bab9..e115ba2940 100644 --- a/gl/tests/test-stdbool.c +++ b/gl/tests/test-stdbool.c @@ -1,5 +1,5 @@ /* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,23 +52,28 @@ /* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at least, not for all compilers and compiler options. */ -#if HAVE_STDBOOL_H || defined __GNUC__ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ struct s { _Bool s: 1; _Bool t; } s; #endif char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ +/* C99 may plausibly be interpreted as not requiring support for a cast from + a variable's address to bool in a static initializer. So treat it like a + GCC extension. */ +# ifdef __GNUC__ bool e = &s; +# endif # endif char f[(_Bool) 0.0 == false ? 1 : -1]; #endif char g[true]; char h[sizeof (_Bool)]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ char i[sizeof s.t]; #endif enum { j = false, k = true, l = false * true, m = true * 256 }; @@ -85,11 +90,29 @@ _Bool *pq = &q; int main () { + int error = 0; + +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ + /* A cast from a variable's address to bool is valid in expressions. */ + { + bool e1 = &s; + if (!e1) + error = 1; + } +# endif +#endif + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This is a runtime test, since a corresponding compile-time test would rely on initializer extensions. */ - char digs[] = "0123456789"; - return &(digs + 5)[-2 + (bool) 1] != &digs[4]; + { + char digs[] = "0123456789"; + if (&(digs + 5)[-2 + (bool) 1] != &digs[4]) + error = 1; + } + + return error; } diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c index 2c392c7547..c929af837a 100644 --- a/gl/tests/test-stddef.c +++ b/gl/tests/test-stddef.c @@ -1,5 +1,5 @@ /* Test of <stddef.h> substitute. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c index d64057a256..f606cc3e24 100644 --- a/gl/tests/test-stdint.c +++ b/gl/tests/test-stdint.c @@ -1,5 +1,5 @@ /* Test of <stdint.h> substitute. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c index 87100576f0..7e7a206b7c 100644 --- a/gl/tests/test-stdio.c +++ b/gl/tests/test-stdio.c @@ -1,5 +1,5 @@ /* Test of <stdio.h> substitute. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c index 1e7956b68c..210aab4055 100644 --- a/gl/tests/test-stdlib.c +++ b/gl/tests/test-stdlib.c @@ -1,5 +1,5 @@ /* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c deleted file mode 100644 index 11ab7e3939..0000000000 --- a/gl/tests/test-strerror.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Test of strerror() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2007. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strerror, char *, (int)); - -#include <errno.h> - -#include "macros.h" - -int -main (void) -{ - char *str; - - str = strerror (EACCES); - ASSERT (str); - ASSERT (*str); - - str = strerror (ETIMEDOUT); - ASSERT (str); - ASSERT (*str); - - str = strerror (EOVERFLOW); - ASSERT (str); - ASSERT (*str); - - str = strerror (0); - ASSERT (str); - ASSERT (*str); - - str = strerror (-3); - ASSERT (str); - ASSERT (*str); - - return 0; -} diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c index 019a8174ac..54c49a9735 100644 --- a/gl/tests/test-string.c +++ b/gl/tests/test-string.c @@ -1,5 +1,5 @@ /* Test of <string.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-sys_ioctl.c b/gl/tests/test-sys_ioctl.c deleted file mode 100644 index 1f44d4a1ad..0000000000 --- a/gl/tests/test-sys_ioctl.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <sys/ioctl.h> substitute. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <sys/ioctl.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-sys_select.c deleted file mode 100644 index 3a06c64828..0000000000 --- a/gl/tests/test-sys_select.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test of <sys/select.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <sys/select.h> - -/* Check that the 'struct timeval' type is defined. */ -struct timeval t1; - -int -main (void) -{ - /* Check that FD_ZERO can be used. This should not yield a warning - such as "warning: implicit declaration of function 'memset'". */ - fd_set fds; - FD_ZERO (&fds); - - return 0; -} diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c index e976ff6a7b..8f323ca1d9 100644 --- a/gl/tests/test-sys_socket.c +++ b/gl/tests/test-sys_socket.c @@ -1,5 +1,5 @@ /* Test of <sys/socket.h> substitute. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-sys_stat.c b/gl/tests/test-sys_stat.c index 5f1aacd1cc..cd07d86e87 100644 --- a/gl/tests/test-sys_stat.c +++ b/gl/tests/test-sys_stat.c @@ -1,5 +1,5 @@ /* Test of <sys/stat.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c index 2ab849e927..da64b85c02 100644 --- a/gl/tests/test-sys_time.c +++ b/gl/tests/test-sys_time.c @@ -1,5 +1,5 @@ /* Test of <sys/time.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-sys_wait.h b/gl/tests/test-sys_wait.h index bb10450867..3c9b32293b 100644 --- a/gl/tests/test-sys_wait.h +++ b/gl/tests/test-sys_wait.h @@ -1,5 +1,5 @@ /* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-time.c b/gl/tests/test-time.c index 8e250bd2d5..0c78f36c66 100644 --- a/gl/tests/test-time.c +++ b/gl/tests/test-time.c @@ -1,5 +1,5 @@ /* Test of <time.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c index ec02eeefca..be1ae06910 100644 --- a/gl/tests/test-unistd.c +++ b/gl/tests/test-unistd.c @@ -1,5 +1,5 @@ /* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-update-copyright.sh b/gl/tests/test-update-copyright.sh deleted file mode 100755 index ea700c902b..0000000000 --- a/gl/tests/test-update-copyright.sh +++ /dev/null @@ -1,537 +0,0 @@ -#!/bin/sh -# Test suite for update-copyright. -# Copyright (C) 2009-2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -diffout=`diff -u /dev/null /dev/null 2>&1` -if test x"$diffout" = x"" && test $? -eq 0; then - compare() { diff -u "$@"; } -else - compare() { cmp "$@"; } -fi - -# Ensure the update-copyright program gets found. -PATH=$abs_aux_dir:$PATH -export PATH - -TMP_BASE=update-copyright.test -trap 'rm -f $TMP_BASE*' 0 1 2 3 15 - -## --------------------------------- ## -## Skip if user does not have perl. ## -## --------------------------------- ## - -TMP=$TMP_BASE -s=$TMP-script -cat <<\EOF > $s -eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' - & eval 'exec perl -wS -0777 -pi "$0" $argv:q' - if 0; -s/a/b/ -EOF -chmod a+x $s -echo a > $TMP-in -./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" || - { - printf '%s\n' "$0: skipping this test;" \ - 'your system has insufficient support for Perl' 1>&2 - exit 77 - } - -# Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess. -# We have a report that 5.6.1 is inadequate and that 5.8.0 works. -perl -e 'require 5.8.0' || { - echo '$0: skipping this test; Perl version is too old' 1>&2 - exit 77 -} - -# Do not let a different envvar setting perturb results. -UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72 -export UPDATE_COPYRIGHT_MAX_LINE_LENGTH - -## ----------------------------- ## -## Examples from documentation. ## -## ----------------------------- ## - -TMP=$TMP_BASE-ex -cat > $TMP.1 <<EOF -Copyright @copyright{} 1990-2005, 2007-2009 Free Software -Foundation, Inc. -EOF -cat > $TMP.2 <<EOF -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -cat > $TMP.3 <<EOF -/* - * Copyright © 90,2005,2007-2009 - * Free Software Foundation, Inc. - */ -EOF -cat > $TMP.4 <<EOF -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -cat > $TMP.5 <<EOF -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -cat > $TMP.6 <<EOF -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. -EOF -cat > $TMP.7 <<EOF -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2009 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990-2005, 2007-2009 Free Software -Foundation, Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 90,2005,2007-2009 - * Free Software Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990-2005, 2007-2010 Free Software Foundation, -Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 1990, 2005, 2007-2010 Free Software Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -# Software Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 1990, 2005, 2007, 2008, 2009, 2010 Free Software - * Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -# Software Foundation, Inc. -EOF - -rm $TMP* - -## -------------- ## -## Current year. ## -## -------------- ## - -TMP=$TMP_BASE-current-year -YEAR=`date +%Y` -cat > $TMP <<EOF -'\" Copyright (C) 2006 -'\" Free Software Foundation, -'\" Inc. -EOF -update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -'\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -'\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------------ ## -## Surrounding text. ## -## ------------------ ## - -TMP=$TMP_BASE-surrounding-text -cat > $TMP <<EOF - Undisturbed text. -dnl Undisturbed text. -dnl Copyright (C) 89 -dnl Free Software Foundation, Inc. -dnl Undisturbed text. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Undisturbed text. -dnl Undisturbed text. -dnl Copyright (C) 1989, 2010 Free Software Foundation, Inc. -dnl Undisturbed text. -EOF -rm $TMP* - -## --------------- ## -## Widest prefix. ## -## --------------- ## - -TMP=$TMP_BASE-widest-prefix -cat > $TMP <<EOF -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, -#### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -#### 2006, 2007, 2008, 2010 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976-1988, 1999-2008, 2010-2011 Free Software -#### Foundation, Inc. -EOF -rm $TMP* - -## ------------------- ## -## Prefix too large. ## -## ------------------- ## - -TMP=$TMP_BASE-prefix-too-large -cat > $TMP <<EOF -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP: warning: FSF copyright statement not found -EOF -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------- ## -## Blank lines. ## -## ------------- ## - -TMP=$TMP_BASE-blank-lines -cat > $TMP <<EOF -#Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -# -#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#2008 Free Software Foundation, Inc. - -Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - -1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP: warning: FSF copyright statement not found -EOF -compare - $TMP <<EOF || exit 1 -#Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -# -#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#2008 Free Software Foundation, Inc. - -Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - -1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008 Free Software Foundation, Inc. -EOF -rm $TMP* - -## -------------- ## -## Leading tabs. ## -## -------------- ## - -TMP=$TMP_BASE-leading-tabs -cat > $TMP <<EOF - Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free - Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright (C) 1987-1988, 1991-2011 Free Software Foundation, - Inc. -EOF -rm $TMP* - -## -------------------- ## -## Unusual whitespace. ## -## -------------------- ## - -TMP=$TMP_BASE-unusual-ws -cat > $TMP <<EOF - # Copyright (C) 87-88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - # 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - # 2009 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - # Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, - # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software - # Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - # Copyright (C) 1987-1988, 1991-2011 Free Software - # Foundation, Inc. -EOF -rm $TMP* - -## --------- ## -## DOS EOL. ## -## --------- ## - -TMP=$TMP_BASE-dos-eol -tr @ '\015' > $TMP <<\EOF -Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ -Rem 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ -Rem 2009 Free Software Foundation, Inc.@ -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -tr @ '\015' > $TMP-exp <<\EOF -Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ -Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ -Rem 2009, 2010 Free Software Foundation, Inc.@ -EOF -compare $TMP-exp $TMP || exit 1 -rm $TMP* - -## --------------- ## -## Omitted "(C)". ## -## --------------- ## - -TMP=$TMP_BASE-omitted-circle-c -cat > $TMP <<EOF - Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------------ ## -## C-style comments. ## -## ------------------ ## - -TMP=$TMP_BASE-c-style-comments -cat > $TMP.star <<EOF -/* Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - * 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - * 2009 Free Software Foundation, Inc. */ -EOF -cat > $TMP.space <<EOF - /*Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009 Free Software Foundation, Inc. */ -EOF -cat > $TMP.single-line <<EOF -/* Copyright 87, 1991, 1992 Free Software Foundation, Inc. */ -EOF -cat > $TMP.single-line-wrapped <<EOF - /* Copyright 1988, 1991, 1992, 1993 Free Software Foundation, Inc. */ -EOF -cat > $TMP.extra-text-star <<EOF - /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc. End - * More comments. */ -EOF -cat > $TMP.extra-text-space <<EOF - /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc. *** - * End of comments. */ -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP.star <<EOF || exit 1 -/* Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - * 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - * 2009, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.space <<EOF || exit 1 - /*Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.single-line <<EOF || exit 1 -/* Copyright 1987, 1991, 1992, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.single-line-wrapped <<EOF || exit 1 - /* Copyright 1988, 1991, 1992, 1993, 2010 Free Software Foundation, - * Inc. */ -EOF -compare - $TMP.extra-text-star <<EOF || exit 1 - /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation, - * Inc. End - * More comments. */ -EOF -compare - $TMP.extra-text-space <<EOF || exit 1 - /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation, - Inc. *** - * End of comments. */ -EOF -rm $TMP* - -exit 0 diff --git a/gl/tests/test-vasnprintf.c b/gl/tests/test-vasnprintf.c index 15401eb4ca..6b2a0ff05a 100644 --- a/gl/tests/test-vasnprintf.c +++ b/gl/tests/test-vasnprintf.c @@ -1,5 +1,5 @@ /* Test of vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh deleted file mode 100755 index 017b8d2460..0000000000 --- a/gl/tests/test-vc-list-files-cvs.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-cvs -repo=`pwd`/$tmpdir/repo - -fail=0 -for i in with-cvsu without; do - # On the first iteration, test using cvsu, if it's in your path. - # On the second iteration, ensure that cvsu fails, so we'll - # exercise the awk-using code. - if test $i = without; then - printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu - chmod a+x cvsu - PATH=`pwd`:$PATH - export PATH - fi - ok=0 - mkdir $tmpdir && cd $tmpdir && - # without cvs, skip the test - # The double use of 'exit' is needed for the reference to $? inside the trap. - { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \ - || skip_ "cvs not found in PATH"; } && - mkdir w && cd w && - mkdir d && - touch d/a b c && - cvs -Q -d "$repo" import -m imp m M M0 && - cvs -Q -d "$repo" co m && cd m && - printf '%s\n' b c d/a > expected && - vc-list-files | sort > actual && - compare expected actual && - ok=1 - test $ok = 0 && fail=1 -done - -Exit $fail diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh deleted file mode 100755 index 262d2ea3d2..0000000000 --- a/gl/tests/test-vc-list-files-git.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-git-$$ -GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE - -fail=1 -mkdir $tmpdir && cd $tmpdir && - # without git, skip the test - # The double use of 'exit' is needed for the reference to $? inside the trap. - { ( git init -q ) > /dev/null 2>&1 \ - || skip_ "git not found in PATH"; } && - mkdir d && - touch d/a b c && - git config user.email "you@example.com" && - git config user.name "Your Name" && - git add . > /dev/null && - git commit -q -a -m log && - printf '%s\n' b c d/a > expected && - vc-list-files > actual && - compare expected actual && - fail=0 - -Exit $fail diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c index 3f89ba9058..512c021b7d 100644 --- a/gl/tests/test-verify.c +++ b/gl/tests/test-verify.c @@ -1,6 +1,6 @@ /* Test the "verify" module. - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c index fcc86218f8..00a5d7c6f9 100644 --- a/gl/tests/test-version-etc.c +++ b/gl/tests/test-version-etc.c @@ -1,5 +1,5 @@ /* Test suite for version-etc. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This file is part of the GNUlib Library. This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh index 61d404684f..c1ed827e40 100755 --- a/gl/tests/test-version-etc.sh +++ b/gl/tests/test-version-etc.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test suite for version-etc. -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c index 2a03d6b669..2d3bad7546 100644 --- a/gl/tests/test-wchar.c +++ b/gl/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/tests/w32sock.h b/gl/tests/w32sock.h deleted file mode 100644 index b472bd0501..0000000000 --- a/gl/tests/w32sock.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by 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; - } -} diff --git a/gl/tests/zerosize-ptr.h b/gl/tests/zerosize-ptr.h index cfab200871..beeb3da3e0 100644 --- a/gl/tests/zerosize-ptr.h +++ b/gl/tests/zerosize-ptr.h @@ -1,5 +1,5 @@ /* Return a pointer to a zero-size object in memory. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/time.in.h b/gl/time.in.h index 0f6adac43f..cb533a46e1 100644 --- a/gl/time.in.h +++ b/gl/time.in.h @@ -1,6 +1,6 @@ /* A more-standard <time.h>. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,13 +69,16 @@ extern "C" { # endif -# undef timespec -# define timespec rpl_timespec +# if !GNULIB_defined_struct_timespec +# undef timespec +# define timespec rpl_timespec struct timespec { time_t tv_sec; long int tv_nsec; }; +# define GNULIB_defined_struct_timespec 1 +# endif # ifdef __cplusplus } @@ -84,6 +87,7 @@ struct timespec # endif # endif +# if !GNULIB_defined_struct_time_t_must_be_integral /* 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 @@ -92,6 +96,8 @@ struct timespec struct __time_t_must_be_integral { unsigned int __floating_time_t_unsupported : (time_t) 1; }; +# define GNULIB_defined_struct_time_t_must_be_integral 1 +# endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See @@ -147,7 +153,7 @@ _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else -# if ! @HAVE_LOCALTIME_R@ +# if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); @@ -155,7 +161,9 @@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif +# if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (localtime_r); +# endif # if @REPLACE_LOCALTIME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gmtime_r @@ -167,7 +175,7 @@ _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else -# if ! @HAVE_LOCALTIME_R@ +# if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((1, 2))); @@ -175,7 +183,9 @@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif +# if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (gmtime_r); +# endif # endif /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store diff --git a/gl/timespec.h b/gl/timespec.h index 175de7f263..74d5749df6 100644 --- a/gl/timespec.h +++ b/gl/timespec.h @@ -1,6 +1,6 @@ /* timespec -- System time interface - Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2010 Free Software + Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/gl/unistd.in.h b/gl/unistd.in.h index fcf7c43904..15893d7eec 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-2010 Free Software Foundation, Inc. + Copyright (C) 2003-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -88,9 +88,11 @@ # include <io.h> #endif -/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. */ +/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. + NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ /* But avoid namespace pollution on glibc systems. */ -#if @GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__) \ +#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ + || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ && !defined __GLIBC__ # include <netdb.h> #endif @@ -435,6 +437,10 @@ _GL_EXTERN_C void _gl_unregister_fd (int fd); _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); +# else +# if !@HAVE_DECL_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); +# endif # endif _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); @@ -650,7 +656,8 @@ _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif -/* Need to cast, because on Solaris 10 systems, the second parameter is +/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second + parameter is int len. */ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif @@ -707,13 +714,22 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_DECL_GETLOGIN_R@ +# if @REPLACE_GETLOGIN_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getlogin_r rpl_getlogin_r +# endif +_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); +# else +# if !@HAVE_DECL_GETLOGIN_R@ _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) _GL_ARG_NONNULL ((1))); -# endif +# endif /* Need to cast, because on Solaris 10 systems, the second argument is int size. */ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); +# endif _GL_CXXALIASWARN (getlogin_r); #elif defined GNULIB_POSIXCHECK # undef getlogin_r @@ -780,11 +796,14 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void)); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize() _gl_getpagesize () # else +# if !GNULIB_defined_getpagesize_function static inline int getpagesize () { return _gl_getpagesize (); } +# define GNULIB_defined_getpagesize_function 1 +# endif # endif # endif # endif @@ -972,6 +991,24 @@ _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " #endif +#if @GNULIB_PIPE@ +/* Create a pipe, defaulting to O_BINARY mode. + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. */ +# if !@HAVE_PIPE@ +_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); +_GL_CXXALIASWARN (pipe); +#elif defined GNULIB_POSIXCHECK +# undef pipe +# if HAVE_RAW_DECL_PIPE +_GL_WARN_ON_USE (pipe, "pipe is unportable - " + "use gnulib module pipe-posix for portability"); +# endif +#endif + + #if @GNULIB_PIPE2@ /* Create a pipe, applying the given flags when opening the read-end of the pipe and the write-end of the pipe. @@ -1226,7 +1263,7 @@ _GL_FUNCDECL_RPL (ttyname_r, int, _GL_CXXALIAS_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen)); # else -# if !@HAVE_TTYNAME_R@ +# if !@HAVE_DECL_TTYNAME_R@ _GL_FUNCDECL_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); # endif diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c index 1e9cd431e6..3f2e91ddfb 100644 --- a/gl/vasnprintf.c +++ b/gl/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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--; @@ -1753,8 +1753,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, return NULL; #define CLEANUP() \ - free (d.dir); \ - if (a.arg) \ + if (d.dir != d.direct_alloc_dir) \ + free (d.dir); \ + if (a.arg != a.direct_alloc_arg) \ free (a.arg); if (PRINTF_FETCHARGS (args, &a) < 0) diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h index a689bad25a..c9f4c2195c 100644 --- a/gl/vasnprintf.h +++ b/gl/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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/gl/verify.h b/gl/verify.h index 4ad780c8fa..6c1f8c9e80 100644 --- a/gl/verify.h +++ b/gl/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-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 General Public License as published by @@ -20,6 +20,17 @@ #ifndef VERIFY_H # define VERIFY_H 1 +/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the + C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and + later, and its use here generates easier-to-read diagnostics when + verify (R) fails. + + For now, use this only with GCC. Eventually whether _Static_assert + works should be determined by 'configure'. */ +# if 4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) +# define HAVE__STATIC_ASSERT 1 +# endif + /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. @@ -31,7 +42,12 @@ Symbols ending in "__" are private to this header. - The code below uses several ideas. + If _Static_assert works, verify (R) uses it directly. Similarly, + verify_true (R) works by packaging a _Static_assert inside a struct + that is an operand of sizeof. + + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: * The first step is ((R) ? 1 : -1). Given an expression R, of integral or boolean or floating-point type, this yields an @@ -109,15 +125,9 @@ __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, just as __COUNTER__ is already - being used if available. - - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -148,6 +158,13 @@ template <int w> struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; # define verify_true(R) \ (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# elif HAVE__STATIC_ASSERT +# define verify_true(R) \ + (!!sizeof \ + (struct { \ + _Static_assert (R, "verify_true (" #R ")"); \ + int verify_dummy__; \ + })) # else # define verify_true(R) \ (!!sizeof \ @@ -157,7 +174,11 @@ template <int w> /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -# define verify(R) \ +# if HAVE__STATIC_ASSERT +# define verify(R) _Static_assert (R, "verify (" #R ")") +# else +# define verify(R) \ extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# endif #endif diff --git a/gl/version-etc-fsf.c b/gl/version-etc-fsf.c index fc837a895d..c82158302c 100644 --- a/gl/version-etc-fsf.c +++ b/gl/version-etc-fsf.c @@ -1,5 +1,5 @@ /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/version-etc.c b/gl/version-etc.c index 19c873d016..b8d4724b56 100644 --- a/gl/version-etc.c +++ b/gl/version-etc.c @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ # define PACKAGE PACKAGE_TARNAME #endif -enum { COPYRIGHT_YEAR = 2010 }; +enum { COPYRIGHT_YEAR = 2011 }; /* The three functions below display the --version information the standard way. diff --git a/gl/version-etc.h b/gl/version-etc.h index 629fe83013..a9b313d23a 100644 --- a/gl/version-etc.h +++ b/gl/version-etc.h @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999, 2003, 2005, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2005, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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/gl/w32sock.h b/gl/w32sock.h index b472bd0501..651a76df6c 100644 --- a/gl/w32sock.h +++ b/gl/w32sock.h @@ -1,6 +1,6 @@ /* w32sock.h --- internal auxilliary functions for Windows socket functions - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gl/wchar.in.h b/gl/wchar.in.h index c22dc06a0b..ab4c80663a 100644 --- a/gl/wchar.in.h +++ b/gl/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -104,10 +104,12 @@ On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for implementing mbrtowc for encodings like UTF-8. */ #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ +# if !GNULIB_defined_mbstate_t typedef int rpl_mbstate_t; -# undef mbstate_t -# define mbstate_t rpl_mbstate_t -# define GNULIB_defined_mbstate_t 1 +# undef mbstate_t +# define mbstate_t rpl_mbstate_t +# define GNULIB_defined_mbstate_t 1 +# endif #endif @@ -428,6 +430,561 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " #endif +/* Search N wide characters of S for C. */ +#if @GNULIB_WMEMCHR@ +# if !@HAVE_WMEMCHR@ +_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); + wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wmemchr, + wchar_t *, (const wchar_t *, wchar_t, size_t), + const wchar_t *, (const wchar_t *, wchar_t, size_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, + (const wchar_t *s, wchar_t c, size_t n)); +# else +_GL_CXXALIASWARN (wmemchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wmemchr +# if HAVE_RAW_DECL_WMEMCHR +_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " + "use gnulib module wmemchr for portability"); +# endif +#endif + + +/* Compare N wide characters of S1 and S2. */ +#if @GNULIB_WMEMCMP@ +# if !@HAVE_WMEMCMP@ +_GL_FUNCDECL_SYS (wmemcmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemcmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wmemcmp); +#elif defined GNULIB_POSIXCHECK +# undef wmemcmp +# if HAVE_RAW_DECL_WMEMCMP +_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " + "use gnulib module wmemcmp for portability"); +# endif +#endif + + +/* Copy N wide characters of SRC to DEST. */ +#if @GNULIB_WMEMCPY@ +# if !@HAVE_WMEMCPY@ +_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wmemcpy); +#elif defined GNULIB_POSIXCHECK +# undef wmemcpy +# if HAVE_RAW_DECL_WMEMCPY +_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " + "use gnulib module wmemcpy for portability"); +# endif +#endif + + +/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for + overlapping memory areas. */ +#if @GNULIB_WMEMMOVE@ +# if !@HAVE_WMEMMOVE@ +_GL_FUNCDECL_SYS (wmemmove, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemmove, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wmemmove); +#elif defined GNULIB_POSIXCHECK +# undef wmemmove +# if HAVE_RAW_DECL_WMEMMOVE +_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " + "use gnulib module wmemmove for portability"); +# endif +#endif + + +/* Set N wide characters of S to C. */ +#if @GNULIB_WMEMSET@ +# if !@HAVE_WMEMSET@ +_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_CXXALIASWARN (wmemset); +#elif defined GNULIB_POSIXCHECK +# undef wmemset +# if HAVE_RAW_DECL_WMEMSET +_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " + "use gnulib module wmemset for portability"); +# endif +#endif + + +/* Return the number of wide characters in S. */ +#if @GNULIB_WCSLEN@ +# if !@HAVE_WCSLEN@ +_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s)); +# endif +_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); +_GL_CXXALIASWARN (wcslen); +#elif defined GNULIB_POSIXCHECK +# undef wcslen +# if HAVE_RAW_DECL_WCSLEN +_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " + "use gnulib module wcslen for portability"); +# endif +#endif + + +/* Return the number of wide characters in S, but at most MAXLEN. */ +#if @GNULIB_WCSNLEN@ +# if !@HAVE_WCSNLEN@ +_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); +# endif +_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); +_GL_CXXALIASWARN (wcsnlen); +#elif defined GNULIB_POSIXCHECK +# undef wcsnlen +# if HAVE_RAW_DECL_WCSNLEN +_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " + "use gnulib module wcsnlen for portability"); +# endif +#endif + + +/* Copy SRC to DEST. */ +#if @GNULIB_WCSCPY@ +# if !@HAVE_WCSCPY@ +_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcscpy); +#elif defined GNULIB_POSIXCHECK +# undef wcscpy +# if HAVE_RAW_DECL_WCSCPY +_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " + "use gnulib module wcscpy for portability"); +# endif +#endif + + +/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ +#if @GNULIB_WCPCPY@ +# if !@HAVE_WCPCPY@ +_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcpcpy); +#elif defined GNULIB_POSIXCHECK +# undef wcpcpy +# if HAVE_RAW_DECL_WCPCPY +_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " + "use gnulib module wcpcpy for portability"); +# endif +#endif + + +/* Copy no more than N wide characters of SRC to DEST. */ +#if @GNULIB_WCSNCPY@ +# if !@HAVE_WCSNCPY@ +_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcsncpy); +#elif defined GNULIB_POSIXCHECK +# undef wcsncpy +# if HAVE_RAW_DECL_WCSNCPY +_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " + "use gnulib module wcsncpy for portability"); +# endif +#endif + + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +#if @GNULIB_WCPNCPY@ +# if !@HAVE_WCPNCPY@ +_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcpncpy); +#elif defined GNULIB_POSIXCHECK +# undef wcpncpy +# if HAVE_RAW_DECL_WCPNCPY +_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " + "use gnulib module wcpncpy for portability"); +# endif +#endif + + +/* Append SRC onto DEST. */ +#if @GNULIB_WCSCAT@ +# if !@HAVE_WCSCAT@ +_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcscat); +#elif defined GNULIB_POSIXCHECK +# undef wcscat +# if HAVE_RAW_DECL_WCSCAT +_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " + "use gnulib module wcscat for portability"); +# endif +#endif + + +/* Append no more than N wide characters of SRC onto DEST. */ +#if @GNULIB_WCSNCAT@ +# if !@HAVE_WCSNCAT@ +_GL_FUNCDECL_SYS (wcsncat, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncat, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcsncat); +#elif defined GNULIB_POSIXCHECK +# undef wcsncat +# if HAVE_RAW_DECL_WCSNCAT +_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " + "use gnulib module wcsncat for portability"); +# endif +#endif + + +/* Compare S1 and S2. */ +#if @GNULIB_WCSCMP@ +# if !@HAVE_WCSCMP@ +_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); +# endif +_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscmp); +#elif defined GNULIB_POSIXCHECK +# undef wcscmp +# if HAVE_RAW_DECL_WCSCMP +_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " + "use gnulib module wcscmp for portability"); +# endif +#endif + + +/* Compare no more than N wide characters of S1 and S2. */ +#if @GNULIB_WCSNCMP@ +# if !@HAVE_WCSNCMP@ +_GL_FUNCDECL_SYS (wcsncmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsncmp); +#elif defined GNULIB_POSIXCHECK +# undef wcsncmp +# if HAVE_RAW_DECL_WCSNCMP +_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " + "use gnulib module wcsncmp for portability"); +# endif +#endif + + +/* Compare S1 and S2, ignoring case. */ +#if @GNULIB_WCSCASECMP@ +# if !@HAVE_WCSCASECMP@ +_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); +# endif +_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscasecmp); +#elif defined GNULIB_POSIXCHECK +# undef wcscasecmp +# if HAVE_RAW_DECL_WCSCASECMP +_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " + "use gnulib module wcscasecmp for portability"); +# endif +#endif + + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +#if @GNULIB_WCSNCASECMP@ +# if !@HAVE_WCSNCASECMP@ +_GL_FUNCDECL_SYS (wcsncasecmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncasecmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsncasecmp); +#elif defined GNULIB_POSIXCHECK +# undef wcsncasecmp +# if HAVE_RAW_DECL_WCSNCASECMP +_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " + "use gnulib module wcsncasecmp for portability"); +# endif +#endif + + +/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE + category of the current locale. */ +#if @GNULIB_WCSCOLL@ +# if !@HAVE_WCSCOLL@ +_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +# endif +_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscoll); +#elif defined GNULIB_POSIXCHECK +# undef wcscoll +# if HAVE_RAW_DECL_WCSCOLL +_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " + "use gnulib module wcscoll for portability"); +# endif +#endif + + +/* Transform S2 into array pointed to by S1 such that if wcscmp is applied + to two transformed strings the result is the as applying 'wcscoll' to the + original strings. */ +#if @GNULIB_WCSXFRM@ +# if !@HAVE_WCSXFRM@ +_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsxfrm); +#elif defined GNULIB_POSIXCHECK +# undef wcsxfrm +# if HAVE_RAW_DECL_WCSXFRM +_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " + "use gnulib module wcsxfrm for portability"); +# endif +#endif + + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_WCSDUP@ +# if !@HAVE_WCSDUP@ +_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); +# endif +_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); +_GL_CXXALIASWARN (wcsdup); +#elif defined GNULIB_POSIXCHECK +# undef wcsdup +# if HAVE_RAW_DECL_WCSDUP +_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " + "use gnulib module wcsdup for portability"); +# endif +#endif + + +/* Find the first occurrence of WC in WCS. */ +#if @GNULIB_WCSCHR@ +# if !@HAVE_WCSCHR@ +_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcschr (const wchar_t *, wchar_t); + wchar_t * std::wcschr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcschr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else +_GL_CXXALIASWARN (wcschr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcschr +# if HAVE_RAW_DECL_WCSCHR +_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " + "use gnulib module wcschr for portability"); +# endif +#endif + + +/* Find the last occurrence of WC in WCS. */ +#if @GNULIB_WCSRCHR@ +# if !@HAVE_WCSRCHR@ +_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); + wchar_t * std::wcsrchr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsrchr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else +_GL_CXXALIASWARN (wcsrchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsrchr +# if HAVE_RAW_DECL_WCSRCHR +_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " + "use gnulib module wcsrchr for portability"); +# endif +#endif + + +/* Return the length of the initial segmet of WCS which consists entirely + of wide characters not in REJECT. */ +#if @GNULIB_WCSCSPN@ +# if !@HAVE_WCSCSPN@ +_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); +# endif +_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); +_GL_CXXALIASWARN (wcscspn); +#elif defined GNULIB_POSIXCHECK +# undef wcscspn +# if HAVE_RAW_DECL_WCSCSPN +_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " + "use gnulib module wcscspn for portability"); +# endif +#endif + + +/* Return the length of the initial segmet of WCS which consists entirely + of wide characters in ACCEPT. */ +#if @GNULIB_WCSSPN@ +# if !@HAVE_WCSSPN@ +_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); +# endif +_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); +_GL_CXXALIASWARN (wcsspn); +#elif defined GNULIB_POSIXCHECK +# undef wcsspn +# if HAVE_RAW_DECL_WCSSPN +_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " + "use gnulib module wcsspn for portability"); +# endif +#endif + + +/* Find the first occurrence in WCS of any character in ACCEPT. */ +#if @GNULIB_WCSPBRK@ +# if !@HAVE_WCSPBRK@ +_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, + (const wchar_t *wcs, const wchar_t *accept)); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); + wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcspbrk, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, + (wchar_t *wcs, const wchar_t *accept)); +_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, + (const wchar_t *wcs, const wchar_t *accept)); +# else +_GL_CXXALIASWARN (wcspbrk); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcspbrk +# if HAVE_RAW_DECL_WCSPBRK +_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " + "use gnulib module wcspbrk for portability"); +# endif +#endif + + +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_WCSSTR@ +# if !@HAVE_WCSSTR@ +_GL_FUNCDECL_SYS (wcsstr, wchar_t *, + (const wchar_t *haystack, const wchar_t *needle)); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); + wchar_t * std::wcsstr (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsstr, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsstr, wchar_t *, + (wchar_t *haystack, const wchar_t *needle)); +_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, + (const wchar_t *haystack, const wchar_t *needle)); +# else +_GL_CXXALIASWARN (wcsstr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsstr +# if HAVE_RAW_DECL_WCSSTR +_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " + "use gnulib module wcsstr for portability"); +# endif +#endif + + +/* Divide WCS into tokens separated by characters in DELIM. */ +#if @GNULIB_WCSTOK@ +# if !@HAVE_WCSTOK@ +_GL_FUNCDECL_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +# endif +_GL_CXXALIAS_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +_GL_CXXALIASWARN (wcstok); +#elif defined GNULIB_POSIXCHECK +# undef wcstok +# if HAVE_RAW_DECL_WCSTOK +_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " + "use gnulib module wcstok for portability"); +# endif +#endif + + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +#if @GNULIB_WCSWIDTH@ +# if @REPLACE_WCSWIDTH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcswidth +# define wcswidth rpl_wcswidth +# endif +_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)); +_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); +# else +# if !@HAVE_WCSWIDTH@ +_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); +# endif +_GL_CXXALIASWARN (wcswidth); +#elif defined GNULIB_POSIXCHECK +# undef wcswidth +# if HAVE_RAW_DECL_WCSWIDTH +_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " + "use gnulib module wcswidth for portability"); +# endif +#endif + + #endif /* _GL_WCHAR_H */ #endif /* _GL_WCHAR_H */ #endif diff --git a/gl/xsize.h b/gl/xsize.h index fbd63290d6..6505c42e9d 100644 --- a/gl/xsize.h +++ b/gl/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/guile/src/Makefile.am b/guile/src/Makefile.am index 2ee12973fa..bc4780768b 100644 --- a/guile/src/Makefile.am +++ b/guile/src/Makefile.am @@ -40,8 +40,8 @@ GNUTLS_CORE_LIBS = $(top_builddir)/lib/libgnutls.la GNUTLS_EXTRA_LIBS = $(top_builddir)/libextra/libgnutls-extra.la # Linking against Gnulib modules. -GNULIB_LIBS = $(top_builddir)/lib/gl/liblgnu.la -GNULIB_CFLAGS = -I$(top_builddir)/lib/gl -I$(top_srcdir)/lib/gl +GNULIB_LIBS = $(top_builddir)/gl/libgnu.la +GNULIB_CFLAGS = -I$(top_builddir)/gl -I$(top_srcdir)/gl libguile_gnutls_v_1_la_SOURCES = core.c errors.c utils.c diff --git a/lib/Makefile.am b/lib/Makefile.am index 26451a5c44..f8dac6716a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -21,9 +21,9 @@ # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA -ACLOCAL_AMFLAGS = -I m4 -I gl/m4 +ACLOCAL_AMFLAGS = -I ../m4 -I ../gl/m4 -SUBDIRS = gl po includes x509 +SUBDIRS = includes x509 if ENABLE_MINITASN1 SUBDIRS += minitasn1 endif @@ -33,10 +33,8 @@ localedir = $(datadir)/locale AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ - -I$(srcdir)/gl \ - -I$(builddir)/gl \ + -I$(srcdir)/../gl \ -I$(srcdir)/includes \ - -I$(builddir)/includes \ -I$(srcdir)/x509 if ENABLE_OPENPGP @@ -122,7 +120,7 @@ libgnutls_la_SOURCES = $(HFILES) $(COBJECTS) $(SRP_COBJECTS) \ libgnutls_la_LDFLAGS = -no-undefined \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -libgnutls_la_LIBADD = gl/liblgnu.la x509/libgnutls_x509.la \ +libgnutls_la_LIBADD = ../gl/libgnu.la x509/libgnutls_x509.la \ $(LTLIBZ) $(LTLIBINTL) $(LIBSOCKET) if ENABLE_OPENPGP @@ -164,7 +162,7 @@ endif if ENABLE_CXX libgnutlsxx_la_CPPFLAGS = -I$(top_srcdir)/includes -I$(top_builddir)/includes -AM_CXXFLAGS = -I$(top_srcdir)/includes/ +AM_CXXFLAGS = -I$(srcdir)/includes lib_LTLIBRARIES += libgnutlsxx.la diff --git a/lib/configure.ac b/lib/configure.ac deleted file mode 100644 index 1f667734e8..0000000000 --- a/lib/configure.ac +++ /dev/null @@ -1,126 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -# 2009, 2010 Free Software Foundation, Inc. -# -# Author: Nikos Mavrogiannopoulos, Simon Josefsson -# -# This file is part of GnuTLS. -# -# The GnuTLS 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.1 of -# the License, or (at your option) any later version. -# -# The GnuTLS 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 GnuTLS; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA - -AC_PREREQ(2.61) -AC_INIT([libgnutls], [2.11.7], [bug-gnutls@gnu.org]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) - -AM_INIT_AUTOMAKE([1.10 -Wall -Werror -Wno-override]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(config.h) - -AC_PROG_CC -lgl_EARLY - -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -LIBGNUTLS_HOOKS - -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION([0.17]) - -AC_C_BIGENDIAN - -# For includes/gnutls/gnutls.h.in. -AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`) -AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`) -AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`) -AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`) -AC_CHECK_TYPE(ssize_t, - [ - DEFINE_SSIZE_T="#include <sys/types.h>" - AC_SUBST(DEFINE_SSIZE_T) - ], [ - AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found]) - DEFINE_SSIZE_T="typedef int ssize_t;" - AC_SUBST(DEFINE_SSIZE_T) - ], [ - #include <sys/types.h> - ]) - -# For minitasn1. -AC_CHECK_SIZEOF(unsigned long int, 4) -AC_CHECK_SIZEOF(unsigned int, 4) - -AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], - [disable zlib compression support]), - ac_zlib=$withval, ac_zlib=yes) -AC_MSG_CHECKING([whether to include zlib compression support]) -if test x$ac_zlib != xno; then - AC_MSG_RESULT(yes) - AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);]) - if test "$ac_cv_libz" != yes; then - AC_MSG_WARN( -*** -*** ZLIB was not found. You will not be able to use ZLIB compression.) - fi -else - AC_MSG_RESULT(no) -fi - -if test x$ac_zlib != xno; then - if test x$GNUTLS_REQUIRES_PRIVATE = x; then - GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib" - else - GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE , zlib" - fi -fi -AC_SUBST(GNUTLS_REQUIRES_PRIVATE) - -lgl_INIT - -AC_CHECK_FUNCS(getrusage,,) -AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);]) - -LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS" -LIBGNUTLS_CFLAGS="-I${includedir}" -AC_SUBST(LIBGNUTLS_LIBS) -AC_SUBST(LIBGNUTLS_CFLAGS) - -# Finish things from ../configure.ac. -AC_SUBST([WERROR_CFLAGS]) -AC_SUBST([WSTACK_CFLAGS]) -AC_SUBST([WARN_CFLAGS]) -AC_PROG_CXX -AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no") - -AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.]) - -AC_CONFIG_FILES([ - Makefile - gnutls.pc - gl/Makefile - gl/tests/Makefile - includes/Makefile - includes/gnutls/gnutls.h - minitasn1/Makefile - opencdk/Makefile - openpgp/Makefile - po/Makefile.in - x509/Makefile - gcrypt/Makefile - nettle/Makefile -]) -AC_OUTPUT diff --git a/lib/gcrypt/Makefile.am b/lib/gcrypt/Makefile.am index 5a78b92f25..d01559b9f5 100644 --- a/lib/gcrypt/Makefile.am +++ b/lib/gcrypt/Makefile.am @@ -23,8 +23,7 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/../includes \ -I$(builddir)/../includes \ -I$(srcdir)/.. diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am deleted file mode 100644 index 210ceccd67..0000000000 --- a/lib/gl/Makefile.am +++ /dev/null @@ -1,1193 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=liblgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext lib-msvc-compat lib-symbol-versions memmem-simple minmax netdb read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf vsnprintf - -AUTOMAKE_OPTIONS = 1.5 gnits - -SUBDIRS = -noinst_HEADERS = -noinst_LIBRARIES = -noinst_LTLIBRARIES = -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = -SUBDIRS += tests -EXTRA_DIST += m4/gnulib-cache.m4 - -AM_CPPFLAGS = -AM_CFLAGS = - -noinst_LTLIBRARIES += liblgnu.la - -liblgnu_la_SOURCES = -liblgnu_la_LIBADD = $(lgl_LTLIBOBJS) -liblgnu_la_DEPENDENCIES = $(lgl_LTLIBOBJS) -EXTRA_liblgnu_la_SOURCES = -liblgnu_la_LDFLAGS = $(AM_LDFLAGS) -liblgnu_la_LDFLAGS += -no-undefined -liblgnu_la_LDFLAGS += $(LIBSOCKET) -liblgnu_la_LDFLAGS += $(LTLIBINTL) - -## begin gnulib module alignof - - -EXTRA_DIST += alignof.h - -## end gnulib module alignof - -## begin gnulib module alloca-opt - -BUILT_SOURCES += $(ALLOCA_H) - -# We need the following in order to create <alloca.h> when the system -# doesn't have one that works with the given compiler. -alloca.h: alloca.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca.in.h; \ - } > $@-t && \ - mv -f $@-t $@ -MOSTLYCLEANFILES += alloca.h alloca.h-t - -EXTRA_DIST += alloca.in.h - -## end gnulib module alloca-opt - -## begin gnulib module arg-nonnull - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/arg-nonnull.h, except that it has the copyright header cut off. -arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t - -ARG_NONNULL_H=arg-nonnull.h - -EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h - -## end gnulib module arg-nonnull - -## begin gnulib module byteswap - -BUILT_SOURCES += $(BYTESWAP_H) - -# We need the following in order to create <byteswap.h> when the system -# doesn't have one. -byteswap.h: byteswap.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/byteswap.in.h; \ - } > $@-t && \ - mv -f $@-t $@ -MOSTLYCLEANFILES += byteswap.h byteswap.h-t - -EXTRA_DIST += byteswap.in.h - -## end gnulib module byteswap - -## begin gnulib module c++defs - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t - -CXXDEFS_H=c++defs.h - -EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h - -## end gnulib module c++defs - -## begin gnulib module c-ctype - -liblgnu_la_SOURCES += c-ctype.h c-ctype.c - -## end gnulib module c-ctype - -## begin gnulib module close-hook - -liblgnu_la_SOURCES += close-hook.c - -EXTRA_DIST += close-hook.h - -## end gnulib module close-hook - -## begin gnulib module errno - -BUILT_SOURCES += $(ERRNO_H) - -# We need the following in order to create <errno.h> when the system -# doesn't have one that is POSIX compliant. -errno.h: errno.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ - -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ - -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ - -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ - -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ - -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ - -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ - < $(srcdir)/errno.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += errno.h errno.h-t - -EXTRA_DIST += errno.in.h - -## end gnulib module errno - -## begin gnulib module float - -BUILT_SOURCES += $(FLOAT_H) - -# We need the following in order to create <float.h> when the system -# doesn't have one that works with the given compiler. -float.h: float.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ - < $(srcdir)/float.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += float.h float.h-t - -EXTRA_DIST += float.in.h - -## end gnulib module float - -## begin gnulib module fseeko - - -EXTRA_DIST += fseeko.c stdio-impl.h - -EXTRA_liblgnu_la_SOURCES += fseeko.c - -## end gnulib module fseeko - -## begin gnulib module ftello - - -EXTRA_DIST += ftello.c stdio-impl.h - -EXTRA_liblgnu_la_SOURCES += ftello.c - -## end gnulib module ftello - -## begin gnulib module gettext - -# This is for those projects which use "gettextize --intl" to put a source-code -# copy of libintl into their package. In such projects, every Makefile.am needs -# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory. -# For the Makefile.ams in other directories it is the maintainer's -# responsibility; for the one from gnulib we do it here. -# This option has no effect when the user disables NLS (because then the intl -# directory contains no libintl.h file) or when the project does not use -# "gettextize --intl". -AM_CPPFLAGS += -I$(top_builddir)/intl - -EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath - -## end gnulib module gettext - -## begin gnulib module gettext-h - -liblgnu_la_SOURCES += gettext.h - -## end gnulib module gettext-h - -## begin gnulib module havelib - - -EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath - -## end gnulib module havelib - -## begin gnulib module lseek - - -EXTRA_DIST += lseek.c - -EXTRA_liblgnu_la_SOURCES += lseek.c - -## end gnulib module lseek - -## begin gnulib module malloc-posix - - -EXTRA_DIST += malloc.c - -EXTRA_liblgnu_la_SOURCES += malloc.c - -## end gnulib module malloc-posix - -## begin gnulib module memchr - - -EXTRA_DIST += memchr.c memchr.valgrind - -EXTRA_liblgnu_la_SOURCES += memchr.c - -## end gnulib module memchr - -## begin gnulib module memmem-simple - - -EXTRA_DIST += memmem.c str-two-way.h - -EXTRA_liblgnu_la_SOURCES += memmem.c - -## end gnulib module memmem-simple - -## begin gnulib module minmax - -liblgnu_la_SOURCES += minmax.h - -## end gnulib module minmax - -## begin gnulib module netdb - -BUILT_SOURCES += netdb.h - -# We need the following in order to create <netdb.h> when the system -# doesn't have one that works with the given compiler. -netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \ - -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \ - -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \ - -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \ - -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \ - -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \ - -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \ - -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/netdb.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += netdb.h netdb.h-t - -EXTRA_DIST += netdb.in.h - -## end gnulib module netdb - -## begin gnulib module read-file - - -EXTRA_DIST += read-file.c read-file.h - -EXTRA_liblgnu_la_SOURCES += read-file.c - -## end gnulib module read-file - -## begin gnulib module realloc-posix - - -EXTRA_DIST += realloc.c - -EXTRA_liblgnu_la_SOURCES += realloc.c - -## end gnulib module realloc-posix - -## begin gnulib module size_max - -liblgnu_la_SOURCES += size_max.h - -## end gnulib module size_max - -## begin gnulib module snprintf - - -EXTRA_DIST += snprintf.c - -EXTRA_liblgnu_la_SOURCES += snprintf.c - -## end gnulib module snprintf - -## begin gnulib module sockets - -liblgnu_la_SOURCES += sockets.h sockets.c - -EXTRA_DIST += w32sock.h - -## end gnulib module sockets - -## begin gnulib module stdbool - -BUILT_SOURCES += $(STDBOOL_H) - -# We need the following in order to create <stdbool.h> when the system -# doesn't have one that works. -stdbool.h: stdbool.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stdbool.h stdbool.h-t - -EXTRA_DIST += stdbool.in.h - -## end gnulib module stdbool - -## begin gnulib module stddef - -BUILT_SOURCES += $(STDDEF_H) - -# We need the following in order to create <stddef.h> when the system -# doesn't have one that works with the given compiler. -stddef.h: stddef.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ - -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ - -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ - < $(srcdir)/stddef.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stddef.h stddef.h-t - -EXTRA_DIST += stddef.in.h - -## end gnulib module stddef - -## begin gnulib module stdint - -BUILT_SOURCES += $(STDINT_H) - -# We need the following in order to create <stdint.h> when the system -# doesn't have one that works with the given compiler. -stdint.h: stdint.in.h - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ - -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ - -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ - -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ - -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ - -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ - -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ - -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ - -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ - -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ - -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ - -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ - -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stdint.h stdint.h-t - -EXTRA_DIST += stdint.in.h - -## end gnulib module stdint - -## begin gnulib module stdio - -BUILT_SOURCES += stdio.h - -# We need the following in order to create <stdio.h> when the system -# doesn't have one that works with the given compiler. -stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ - -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ - -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ - -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ - -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ - -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ - -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ - -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ - -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ - -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ - -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ - -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ - -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ - -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ - -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ - -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ - -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ - -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \ - -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ - -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ - -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ - -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ - -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ - -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ - -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ - -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ - -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ - -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ - -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ - -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ - -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ - < $(srcdir)/stdio.in.h | \ - sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ - -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ - -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ - -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ - -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ - -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ - -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ - -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ - -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ - -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ - -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ - -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ - -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ - -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ - -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ - -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ - -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ - -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ - -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ - -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ - -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ - -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ - -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ - -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ - -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ - -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ - -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ - -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ - -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ - -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ - -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ - -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ - -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ - -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ - -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ - -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ - -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ - -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ - -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ - -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ - -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ - -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ - -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|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)'; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stdio.h stdio.h-t - -EXTRA_DIST += stdio-write.c stdio.in.h - -EXTRA_liblgnu_la_SOURCES += stdio-write.c - -## end gnulib module stdio - -## begin gnulib module stdlib - -BUILT_SOURCES += stdlib.h - -# We need the following in order to create <stdlib.h> when the system -# doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ - -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ - -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ - -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ - -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ - -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ - -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ - -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ - -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ - -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ - -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ - -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ - -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ - -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ - -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ - -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ - -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ - -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ - -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ - -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ - -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ - -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ - -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ - -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ - -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ - -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ - -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ - -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ - -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ - -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ - -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ - -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ - -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ - -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ - -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ - -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ - -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ - -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ - -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ - -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ - -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_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ - -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ - -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ - -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ - -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ - -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ - -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/stdlib.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stdlib.h stdlib.h-t - -EXTRA_DIST += stdlib.in.h - -## end gnulib module stdlib - -## begin gnulib module strcase - - -EXTRA_DIST += strcasecmp.c strncasecmp.c - -EXTRA_liblgnu_la_SOURCES += strcasecmp.c strncasecmp.c - -## end gnulib module strcase - -## begin gnulib module string - -BUILT_SOURCES += string.h - -# We need the following in order to create <string.h> when the system -# doesn't have one that works with the given compiler. -string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ - -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ - -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ - -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ - -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ - -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ - -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ - -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ - -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ - -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ - -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ - -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ - -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ - -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ - -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ - -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ - -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ - -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ - -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ - -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ - -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ - -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ - -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ - -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ - -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ - -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ - -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ - -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ - -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ - -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ - -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ - -e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \ - -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ - -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ - < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ - -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ - -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ - -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ - -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ - -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ - -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ - -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ - -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ - -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ - -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ - -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ - -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ - -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ - -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|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_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ - -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ - -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ - -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|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_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ - -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ - -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ - -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ - < $(srcdir)/string.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += string.h string.h-t - -EXTRA_DIST += string.in.h - -## end gnulib module string - -## begin gnulib module strings - -BUILT_SOURCES += strings.h - -# We need the following in order to create <strings.h> when the system -# doesn't have one that works with the given compiler. -strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ - -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ - -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/strings.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += strings.h strings.h-t - -EXTRA_DIST += strings.in.h - -## end gnulib module strings - -## begin gnulib module strverscmp - - -EXTRA_DIST += strverscmp.c - -EXTRA_liblgnu_la_SOURCES += strverscmp.c - -## end gnulib module strverscmp - -## begin gnulib module sys_socket - -BUILT_SOURCES += sys/socket.h - -# We need the following in order to create <sys/socket.h> when the system -# doesn't have one that works with the given compiler. -sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) - $(AM_V_at)$(MKDIR_P) sys - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ - -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ - -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ - -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ - -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \ - -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \ - -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \ - -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \ - -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \ - -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \ - -e 's|@''GNULIB_SEND''@|$(GNULIB_SEND)|g' \ - -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ - -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ - -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ - -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ - -e 's|@''GNULIB_ACCEPT4''@|$(GNULIB_ACCEPT4)|g' \ - -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ - -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ - -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ - -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_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/sys_socket.in.h; \ - } > $@-t && \ - mv -f $@-t $@ -MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t -MOSTLYCLEANDIRS += sys - -EXTRA_DIST += sys_socket.in.h - -## end gnulib module sys_socket - -## begin gnulib module sys_stat - -BUILT_SOURCES += sys/stat.h - -# We need the following in order to create <sys/stat.h> when the system -# has one that is incomplete. -sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_at)$(MKDIR_P) sys - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ - -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ - -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ - -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ - -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ - -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ - -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ - -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ - -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ - -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ - -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ - -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ - -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ - -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ - -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ - -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ - -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ - -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ - -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ - -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ - -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ - -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ - -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ - -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ - -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ - -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ - -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ - -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ - -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ - -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ - -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ - -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ - -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/sys_stat.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t -MOSTLYCLEANDIRS += sys - -EXTRA_DIST += sys_stat.in.h - -## end gnulib module sys_stat - -## begin gnulib module time - -BUILT_SOURCES += time.h - -# We need the following in order to create <time.h> when the system -# doesn't have one that works with the given compiler. -time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \ - -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \ - -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \ - -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \ - -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \ - -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \ - -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ - -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ - -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ - -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ - -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ - -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ - -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ - -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ - -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ - -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/time.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += time.h time.h-t - -EXTRA_DIST += time.in.h - -## end gnulib module time - -## begin gnulib module time_r - - -EXTRA_DIST += time_r.c - -EXTRA_liblgnu_la_SOURCES += time_r.c - -## end gnulib module time_r - -## begin gnulib module unistd - -BUILT_SOURCES += unistd.h - -# We need the following in order to create an empty placeholder for -# <unistd.h> when the system doesn't have one. -unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ - -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ - -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ - -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ - -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ - -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ - -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ - -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ - -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ - -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ - -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ - -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ - -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ - -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ - -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ - -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ - -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ - -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ - -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ - -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ - -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ - -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ - -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ - -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ - -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ - -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ - -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ - -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ - -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ - -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ - -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ - -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ - -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ - -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ - -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ - -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ - -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ - -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ - < $(srcdir)/unistd.in.h | \ - sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ - -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ - -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ - -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ - -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ - -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ - -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ - -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ - -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ - -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ - -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ - -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ - -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ - -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ - -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ - -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ - -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ - -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ - -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ - -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ - -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ - -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ - -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ - -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ - -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ - -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ - -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ - -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|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_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ - -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ - -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ - -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ - -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ - -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ - -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ - -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ - -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|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_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ - -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ - -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ - -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ - -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ - -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ - -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ - -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ - -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ - -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ - -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ - -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ - -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ - -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ - -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ - -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ - -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ - -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|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)'; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += unistd.h unistd.h-t - -EXTRA_DIST += unistd.in.h - -## end gnulib module unistd - -## begin gnulib module vasnprintf - - -EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h - -EXTRA_liblgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c - -## end gnulib module vasnprintf - -## begin gnulib module vasprintf - - -EXTRA_DIST += asprintf.c vasprintf.c - -EXTRA_liblgnu_la_SOURCES += asprintf.c vasprintf.c - -## end gnulib module vasprintf - -## begin gnulib module verify - -liblgnu_la_SOURCES += verify.h - -## end gnulib module verify - -## begin gnulib module vsnprintf - - -EXTRA_DIST += vsnprintf.c - -EXTRA_liblgnu_la_SOURCES += vsnprintf.c - -## end gnulib module vsnprintf - -## begin gnulib module warn-on-use - -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/warn-on-use.h, except that it has the copyright header cut off. -warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h - -## end gnulib module warn-on-use - -## begin gnulib module wchar - -BUILT_SOURCES += wchar.h - -# We need the following in order to create <wchar.h> when the system -# version does not work standalone. -wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ - -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ - -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ - -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \ - -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ - -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ - -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ - -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ - -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \ - -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \ - -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \ - -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ - -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ - -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ - -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ - -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ - -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ - -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ - -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \ - -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \ - -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ - -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ - -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ - -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ - -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ - -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ - -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ - -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ - -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ - -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \ - -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \ - -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \ - -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ - -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ - -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ - -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ - -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/wchar.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += wchar.h wchar.h-t - -EXTRA_DIST += wchar.in.h - -## end gnulib module wchar - -## begin gnulib module xsize - -liblgnu_la_SOURCES += xsize.h - -## end gnulib module xsize - - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/lib/gl/alignof.h b/lib/gl/alignof.h deleted file mode 100644 index d65dd648b2..0000000000 --- a/lib/gl/alignof.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Determine alignment of types. - Copyright (C) 2003-2004, 2006, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _ALIGNOF_H -#define _ALIGNOF_H - -#include <stddef.h> - -/* Determine the alignment of a structure slot (field) of a given type, - at compile time. Note that the result depends on the ABI. - Note: The result cannot be used as a value for an 'enum' constant, - due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ -#if defined __cplusplus - template <class type> struct alignof_helper { char __slot1; type __slot2; }; -# define alignof_slot(type) offsetof (alignof_helper<type>, __slot2) -#else -# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) -#endif - -/* Determine the good alignment of a object of the given type at compile time. - Note that this is not necessarily the same as alignof_slot(type). - For example, with GNU C on x86 platforms: alignof_type(double) = 8, but - - when -malign-double is not specified: alignof_slot(double) = 4, - - when -malign-double is specified: alignof_slot(double) = 8. - Note: The result cannot be used as a value for an 'enum' constant, - due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ -#if defined __GNUC__ -# define alignof_type __alignof__ -#else -# define alignof_type alignof_slot -#endif - -/* alignof is an alias for alignof_slot semantics, since that's what most - callers need. - Note: The result cannot be used as a value for an 'enum' constant, - due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ -#define alignof alignof_slot - -#endif /* _ALIGNOF_H */ diff --git a/lib/gl/alloca.in.h b/lib/gl/alloca.in.h deleted file mode 100644 index cdb7366cdf..0000000000 --- a/lib/gl/alloca.in.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Memory allocation on the stack. - - Copyright (C) 1995, 1999, 2001-2004, 2006-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU 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. */ - -/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H - means there is a real alloca function. */ -#ifndef _GL_ALLOCA_H -#define _GL_ALLOCA_H - -/* alloca (N) returns a pointer to N bytes of memory - allocated on the stack, which will last until the function returns. - Use of alloca should be avoided: - - inside arguments of function calls - undefined behaviour, - - in inline functions - the allocation may actually last until the - calling function returns, - - for huge N (say, N >= 65536) - you never know how large (or small) - the stack is, and when the stack cannot fulfill the memory allocation - request, the program just crashes. - */ - -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _AIX -# define alloca __alloca -# elif defined _MSC_VER -# include <malloc.h> -# define alloca _alloca -# elif defined __DECC && defined __VMS -# define alloca __ALLOCA -# else -# include <stddef.h> -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -# endif -#endif - -#endif /* _GL_ALLOCA_H */ diff --git a/lib/gl/asnprintf.c b/lib/gl/asnprintf.c deleted file mode 100644 index 75f519bc34..0000000000 --- a/lib/gl/asnprintf.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include "vasnprintf.h" - -#include <stdarg.h> - -char * -asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) -{ - va_list args; - char *result; - - va_start (args, format); - result = vasnprintf (resultbuf, lengthp, format, args); - va_end (args); - return result; -} diff --git a/lib/gl/asprintf.c b/lib/gl/asprintf.c deleted file mode 100644 index 5e74dd0daa..0000000000 --- a/lib/gl/asprintf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#ifdef IN_LIBASPRINTF -# include "vasprintf.h" -#else -# include <stdio.h> -#endif - -#include <stdarg.h> - -int -asprintf (char **resultp, const char *format, ...) -{ - va_list args; - int result; - - va_start (args, format); - result = vasprintf (resultp, format, args); - va_end (args); - return result; -} diff --git a/lib/gl/byteswap.in.h b/lib/gl/byteswap.in.h deleted file mode 100644 index f245fbdc49..0000000000 --- a/lib/gl/byteswap.in.h +++ /dev/null @@ -1,44 +0,0 @@ -/* byteswap.h - Byte swapping - Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. - Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. - - 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.1 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 _GL_BYTESWAP_H -#define _GL_BYTESWAP_H - -/* Given an unsigned 16-bit argument X, return the value corresponding to - X with reversed byte order. */ -#define bswap_16(x) ((((x) & 0x00FF) << 8) | \ - (((x) & 0xFF00) >> 8)) - -/* Given an unsigned 32-bit argument X, return the value corresponding to - X with reversed byte order. */ -#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \ - (((x) & 0x0000FF00) << 8) | \ - (((x) & 0x00FF0000) >> 8) | \ - (((x) & 0xFF000000) >> 24)) - -/* Given an unsigned 64-bit argument X, return the value corresponding to - X with reversed byte order. */ -#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \ - (((x) & 0x000000000000FF00ULL) << 40) | \ - (((x) & 0x0000000000FF0000ULL) << 24) | \ - (((x) & 0x00000000FF000000ULL) << 8) | \ - (((x) & 0x000000FF00000000ULL) >> 8) | \ - (((x) & 0x0000FF0000000000ULL) >> 24) | \ - (((x) & 0x00FF000000000000ULL) >> 40) | \ - (((x) & 0xFF00000000000000ULL) >> 56)) - -#endif /* _GL_BYTESWAP_H */ diff --git a/lib/gl/c-ctype.c b/lib/gl/c-ctype.c deleted file mode 100644 index 9da8e58131..0000000000 --- a/lib/gl/c-ctype.c +++ /dev/null @@ -1,396 +0,0 @@ -/* Character handling in C locale. - - Copyright 2000-2003, 2006, 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.1 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, write to the Free Software Foundation, -Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#define NO_C_CTYPE_MACROS -#include "c-ctype.h" - -/* The function isascii is not locale dependent. Its use in EBCDIC is - questionable. */ -bool -c_isascii (int c) -{ - return (c >= 0x00 && c <= 0x7f); -} - -bool -c_isalnum (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z')); -#endif -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isalpha (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); -#else - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); -#endif -#else - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isblank (int c) -{ - return (c == ' ' || c == '\t'); -} - -bool -c_iscntrl (int c) -{ -#if C_CTYPE_ASCII - return ((c & ~0x1f) == 0 || c == 0x7f); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 0; - default: - return 1; - } -#endif -} - -bool -c_isdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS - return (c >= '0' && c <= '9'); -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - return 1; - default: - return 0; - } -#endif -} - -bool -c_islower (int c) -{ -#if C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z'); -#else - switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isgraph (int c) -{ -#if C_CTYPE_ASCII - return (c >= '!' && c <= '~'); -#else - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': - case '\'': case '(': case ')': case '*': case '+': case ',': - case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isprint (int c) -{ -#if C_CTYPE_ASCII - return (c >= ' ' && c <= '~'); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_ispunct (int c) -{ -#if C_CTYPE_ASCII - return ((c >= '!' && c <= '~') - && !((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); -#else - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': - case '\'': case '(': case ')': case '*': case '+': case ',': - case '-': case '.': case '/': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case '[': case '\\': case ']': case '^': case '_': case '`': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isspace (int c) -{ - return (c == ' ' || c == '\t' - || c == '\n' || c == '\v' || c == '\f' || c == '\r'); -} - -bool -c_isupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE - return (c >= 'A' && c <= 'Z'); -#else - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isxdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'F') - || (c >= 'a' && c <= 'f')); -#endif -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - return 1; - default: - return 0; - } -#endif -} - -int -c_tolower (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); -#else - switch (c) - { - case 'A': return 'a'; - case 'B': return 'b'; - case 'C': return 'c'; - case 'D': return 'd'; - case 'E': return 'e'; - case 'F': return 'f'; - case 'G': return 'g'; - case 'H': return 'h'; - case 'I': return 'i'; - case 'J': return 'j'; - case 'K': return 'k'; - case 'L': return 'l'; - case 'M': return 'm'; - case 'N': return 'n'; - case 'O': return 'o'; - case 'P': return 'p'; - case 'Q': return 'q'; - case 'R': return 'r'; - case 'S': return 's'; - case 'T': return 't'; - case 'U': return 'u'; - case 'V': return 'v'; - case 'W': return 'w'; - case 'X': return 'x'; - case 'Y': return 'y'; - case 'Z': return 'z'; - default: return c; - } -#endif -} - -int -c_toupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); -#else - switch (c) - { - case 'a': return 'A'; - case 'b': return 'B'; - case 'c': return 'C'; - case 'd': return 'D'; - case 'e': return 'E'; - case 'f': return 'F'; - case 'g': return 'G'; - case 'h': return 'H'; - case 'i': return 'I'; - case 'j': return 'J'; - case 'k': return 'K'; - case 'l': return 'L'; - case 'm': return 'M'; - case 'n': return 'N'; - case 'o': return 'O'; - case 'p': return 'P'; - case 'q': return 'Q'; - case 'r': return 'R'; - case 's': return 'S'; - case 't': return 'T'; - case 'u': return 'U'; - case 'v': return 'V'; - case 'w': return 'W'; - case 'x': return 'X'; - case 'y': return 'Y'; - case 'z': return 'Z'; - default: return c; - } -#endif -} diff --git a/lib/gl/c-ctype.h b/lib/gl/c-ctype.h deleted file mode 100644 index 5ac5dd25e7..0000000000 --- a/lib/gl/c-ctype.h +++ /dev/null @@ -1,295 +0,0 @@ -/* Character handling in C locale. - - These functions work like the corresponding functions in <ctype.h>, - except that they have the C (POSIX) locale hardwired, whereas the - <ctype.h> functions' behaviour depends on the current locale set via - setlocale. - - Copyright (C) 2000-2003, 2006, 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 2.1 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, write to the Free Software Foundation, -Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef C_CTYPE_H -#define C_CTYPE_H - -#include <stdbool.h> - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* The functions defined in this file assume the "C" locale and a character - set without diacritics (ASCII-US or EBCDIC-US or something like that). - Even if the "C" locale on a particular system is an extension of the ASCII - character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it - is ISO-8859-1), the functions in this file recognize only the ASCII - characters. */ - - -/* Check whether the ASCII optimizations apply. */ - -/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that - '0', '1', ..., '9' have consecutive integer values. */ -#define C_CTYPE_CONSECUTIVE_DIGITS 1 - -#if ('A' <= 'Z') \ - && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ - && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ - && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ - && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ - && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ - && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ - && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ - && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ - && ('Y' + 1 == 'Z') -#define C_CTYPE_CONSECUTIVE_UPPERCASE 1 -#endif - -#if ('a' <= 'z') \ - && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ - && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ - && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ - && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ - && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ - && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ - && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ - && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ - && ('y' + 1 == 'z') -#define C_CTYPE_CONSECUTIVE_LOWERCASE 1 -#endif - -#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) -/* The character set is ASCII or one of its variants or extensions, not EBCDIC. - Testing the value of '\n' and '\r' is not relevant. */ -#define C_CTYPE_ASCII 1 -#endif - - -/* Function declarations. */ - -/* Unlike the functions in <ctype.h>, which require an argument in the range - of the 'unsigned char' type, the functions here operate on values that are - in the 'unsigned char' range or in the 'char' range. In other words, - when you have a 'char' value, you need to cast it before using it as - argument to a <ctype.h> function: - - const char *s = ...; - if (isalpha ((unsigned char) *s)) ... - - but you don't need to cast it for the functions defined in this file: - - const char *s = ...; - if (c_isalpha (*s)) ... - */ - -extern bool c_isascii (int c); /* not locale dependent */ - -extern bool c_isalnum (int c); -extern bool c_isalpha (int c); -extern bool c_isblank (int c); -extern bool c_iscntrl (int c); -extern bool c_isdigit (int c); -extern bool c_islower (int c); -extern bool c_isgraph (int c); -extern bool c_isprint (int c); -extern bool c_ispunct (int c); -extern bool c_isspace (int c); -extern bool c_isupper (int c); -extern bool c_isxdigit (int c); - -extern int c_tolower (int c); -extern int c_toupper (int c); - - -#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS - -/* ASCII optimizations. */ - -#undef c_isascii -#define c_isascii(c) \ - ({ int __c = (c); \ - (__c >= 0x00 && __c <= 0x7f); \ - }) - -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ - }) -#else -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'Z') \ - || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif - -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ - }) -#else -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif - -#undef c_isblank -#define c_isblank(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t'); \ - }) - -#if C_CTYPE_ASCII -#undef c_iscntrl -#define c_iscntrl(c) \ - ({ int __c = (c); \ - ((__c & ~0x1f) == 0 || __c == 0x7f); \ - }) -#endif - -#if C_CTYPE_CONSECUTIVE_DIGITS -#undef c_isdigit -#define c_isdigit(c) \ - ({ int __c = (c); \ - (__c >= '0' && __c <= '9'); \ - }) -#endif - -#if C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_islower -#define c_islower(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z'); \ - }) -#endif - -#if C_CTYPE_ASCII -#undef c_isgraph -#define c_isgraph(c) \ - ({ int __c = (c); \ - (__c >= '!' && __c <= '~'); \ - }) -#endif - -#if C_CTYPE_ASCII -#undef c_isprint -#define c_isprint(c) \ - ({ int __c = (c); \ - (__c >= ' ' && __c <= '~'); \ - }) -#endif - -#if C_CTYPE_ASCII -#undef c_ispunct -#define c_ispunct(c) \ - ({ int _c = (c); \ - (c_isgraph (_c) && ! c_isalnum (_c)); \ - }) -#endif - -#undef c_isspace -#define c_isspace(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t' \ - || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ - }) - -#if C_CTYPE_CONSECUTIVE_UPPERCASE -#undef c_isupper -#define c_isupper(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z'); \ - }) -#endif - -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ - }) -#else -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'F') \ - || (__c >= 'a' && __c <= 'f')); \ - }) -#endif -#endif - -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_tolower -#define c_tolower(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ - }) -#undef c_toupper -#define c_toupper(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ - }) -#endif - -#endif /* optimizing for speed */ - - -#ifdef __cplusplus -} -#endif - -#endif /* C_CTYPE_H */ diff --git a/lib/gl/close-hook.c b/lib/gl/close-hook.c deleted file mode 100644 index 34ef8763db..0000000000 --- a/lib/gl/close-hook.c +++ /dev/null @@ -1,91 +0,0 @@ -/* 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 2.1 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 diff --git a/lib/gl/close-hook.h b/lib/gl/close-hook.h deleted file mode 100644 index cda7742ee0..0000000000 --- a/lib/gl/close-hook.h +++ /dev/null @@ -1,72 +0,0 @@ -/* 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 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - - -#ifndef CLOSE_HOOK_H -#define CLOSE_HOOK_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Currently, this entire code is only needed for the handling of sockets - on native Windows platforms. */ -#if WINDOWS_SOCKETS - - -/* An element of the list of close hooks. - The fields of this structure are considered private. */ -struct close_hook -{ - /* Doubly linked list. */ - struct close_hook *private_next; - struct close_hook *private_prev; - /* Function that treats the types of FD that it knows about and calls - execute_close_hooks (FD, REMAINING_LIST) as a fallback. */ - int (*private_fn) (int fd, const struct close_hook *remaining_list); -}; - -/* This type of function closes FD, applying special knowledge for the FD - types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST) - for the other FD types. */ -typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list); - -/* Execute the close hooks in REMAINING_LIST. - Return 0 or -1, like close() would do. */ -extern int execute_close_hooks (int fd, const struct close_hook *remaining_list); - -/* Execute all close hooks. - Return 0 or -1, like close() would do. */ -extern int execute_all_close_hooks (int fd); - -/* Add a function to the list of close hooks. - The LINK variable points to a piece of memory which is guaranteed to be - accessible until the corresponding call to unregister_close_hook. */ -extern void register_close_hook (close_hook_fn hook, struct close_hook *link); - -/* Removes a function from the list of close hooks. */ -extern void unregister_close_hook (struct close_hook *link); - - -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* CLOSE_HOOK_H */ diff --git a/lib/gl/errno.in.h b/lib/gl/errno.in.h deleted file mode 100644 index 4994ebfa48..0000000000 --- a/lib/gl/errno.in.h +++ /dev/null @@ -1,167 +0,0 @@ -/* A POSIX-like <errno.h>. - - 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 2.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_ERRNO_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ - -#ifndef _GL_ERRNO_H -#define _GL_ERRNO_H - - -/* On native Windows platforms, many macros are not defined. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */ -# define EWOULDBLOCK EAGAIN - -/* Values >= 100 seem safe to use. */ -# define ETXTBSY 100 -# define GNULIB_defined_ETXTBSY 1 - -/* These are intentionally the same values as the WSA* error numbers, defined - in <winsock2.h>. */ -# define EINPROGRESS 10036 -# define EALREADY 10037 -# define ENOTSOCK 10038 -# define EDESTADDRREQ 10039 -# define EMSGSIZE 10040 -# define EPROTOTYPE 10041 -# define ENOPROTOOPT 10042 -# define EPROTONOSUPPORT 10043 -# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ -# define EOPNOTSUPP 10045 -# define EPFNOSUPPORT 10046 /* not required by POSIX */ -# define EAFNOSUPPORT 10047 -# define EADDRINUSE 10048 -# define EADDRNOTAVAIL 10049 -# define ENETDOWN 10050 -# define ENETUNREACH 10051 -# define ENETRESET 10052 -# define ECONNABORTED 10053 -# define ECONNRESET 10054 -# define ENOBUFS 10055 -# define EISCONN 10056 -# define ENOTCONN 10057 -# define ESHUTDOWN 10058 /* not required by POSIX */ -# define ETOOMANYREFS 10059 /* not required by POSIX */ -# define ETIMEDOUT 10060 -# define ECONNREFUSED 10061 -# define ELOOP 10062 -# define EHOSTDOWN 10064 /* not required by POSIX */ -# define EHOSTUNREACH 10065 -# define EPROCLIM 10067 /* not required by POSIX */ -# define EUSERS 10068 /* not required by POSIX */ -# define EDQUOT 10069 -# define ESTALE 10070 -# define EREMOTE 10071 /* not required by POSIX */ -# define GNULIB_defined_ESOCK 1 - -# endif - - -/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros - EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ -# if @EMULTIHOP_HIDDEN@ -# define EMULTIHOP @EMULTIHOP_VALUE@ -# define GNULIB_defined_EMULTIHOP 1 -# endif -# if @ENOLINK_HIDDEN@ -# define ENOLINK @ENOLINK_VALUE@ -# define GNULIB_defined_ENOLINK 1 -# endif -# if @EOVERFLOW_HIDDEN@ -# define EOVERFLOW @EOVERFLOW_VALUE@ -# define GNULIB_defined_EOVERFLOW 1 -# endif - - -/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, - EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. - Likewise, on NonStop Kernel, EDQUOT is not defined. - Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, - HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. - - Note: When one of these systems defines some of these macros some day, - binaries will have to be recompiled so that they recognizes the new - errno values from the system. */ - -# ifndef ENOMSG -# define ENOMSG 2000 -# define GNULIB_defined_ENOMSG 1 -# endif - -# ifndef EIDRM -# define EIDRM 2001 -# define GNULIB_defined_EIDRM 1 -# endif - -# ifndef ENOLINK -# define ENOLINK 2002 -# define GNULIB_defined_ENOLINK 1 -# endif - -# ifndef EPROTO -# define EPROTO 2003 -# define GNULIB_defined_EPROTO 1 -# endif - -# ifndef EMULTIHOP -# define EMULTIHOP 2004 -# define GNULIB_defined_EMULTIHOP 1 -# endif - -# ifndef EBADMSG -# define EBADMSG 2005 -# define GNULIB_defined_EBADMSG 1 -# endif - -# ifndef EOVERFLOW -# define EOVERFLOW 2006 -# define GNULIB_defined_EOVERFLOW 1 -# endif - -# ifndef ENOTSUP -# define ENOTSUP 2007 -# define GNULIB_defined_ENOTSUP 1 -# endif - -# ifndef ESTALE -# define ESTALE 2009 -# define GNULIB_defined_ESTALE 1 -# endif - -# ifndef EDQUOT -# define EDQUOT 2010 -# define GNULIB_defined_EDQUOT 1 -# endif - -# ifndef ECANCELED -# define ECANCELED 2008 -# define GNULIB_defined_ECANCELED 1 -# endif - - -#endif /* _GL_ERRNO_H */ -#endif /* _GL_ERRNO_H */ diff --git a/lib/gl/float+.h b/lib/gl/float+.h deleted file mode 100644 index bc35df8957..0000000000 --- a/lib/gl/float+.h +++ /dev/null @@ -1,148 +0,0 @@ -/* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2007. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _FLOATPLUS_H -#define _FLOATPLUS_H - -#include <float.h> -#include <limits.h> - -/* Number of bits in the mantissa of a floating-point number, including the - "hidden bit". */ -#if FLT_RADIX == 2 -# define FLT_MANT_BIT FLT_MANT_DIG -# define DBL_MANT_BIT DBL_MANT_DIG -# define LDBL_MANT_BIT LDBL_MANT_DIG -#elif FLT_RADIX == 4 -# define FLT_MANT_BIT (FLT_MANT_DIG * 2) -# define DBL_MANT_BIT (DBL_MANT_DIG * 2) -# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2) -#elif FLT_RADIX == 16 -# define FLT_MANT_BIT (FLT_MANT_DIG * 4) -# define DBL_MANT_BIT (DBL_MANT_DIG * 4) -# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4) -#endif - -/* Bit mask that can be used to mask the exponent, as an unsigned number. */ -#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7) -#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) -#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7) - -/* Number of bits used for the exponent of a floating-point number, including - the exponent's sign. */ -#define FLT_EXP_BIT \ - (FLT_EXP_MASK < 0x100 ? 8 : \ - FLT_EXP_MASK < 0x200 ? 9 : \ - FLT_EXP_MASK < 0x400 ? 10 : \ - FLT_EXP_MASK < 0x800 ? 11 : \ - FLT_EXP_MASK < 0x1000 ? 12 : \ - FLT_EXP_MASK < 0x2000 ? 13 : \ - FLT_EXP_MASK < 0x4000 ? 14 : \ - FLT_EXP_MASK < 0x8000 ? 15 : \ - FLT_EXP_MASK < 0x10000 ? 16 : \ - FLT_EXP_MASK < 0x20000 ? 17 : \ - FLT_EXP_MASK < 0x40000 ? 18 : \ - FLT_EXP_MASK < 0x80000 ? 19 : \ - FLT_EXP_MASK < 0x100000 ? 20 : \ - FLT_EXP_MASK < 0x200000 ? 21 : \ - FLT_EXP_MASK < 0x400000 ? 22 : \ - FLT_EXP_MASK < 0x800000 ? 23 : \ - FLT_EXP_MASK < 0x1000000 ? 24 : \ - FLT_EXP_MASK < 0x2000000 ? 25 : \ - FLT_EXP_MASK < 0x4000000 ? 26 : \ - FLT_EXP_MASK < 0x8000000 ? 27 : \ - FLT_EXP_MASK < 0x10000000 ? 28 : \ - FLT_EXP_MASK < 0x20000000 ? 29 : \ - FLT_EXP_MASK < 0x40000000 ? 30 : \ - FLT_EXP_MASK <= 0x7fffffff ? 31 : \ - 32) -#define DBL_EXP_BIT \ - (DBL_EXP_MASK < 0x100 ? 8 : \ - DBL_EXP_MASK < 0x200 ? 9 : \ - DBL_EXP_MASK < 0x400 ? 10 : \ - DBL_EXP_MASK < 0x800 ? 11 : \ - DBL_EXP_MASK < 0x1000 ? 12 : \ - DBL_EXP_MASK < 0x2000 ? 13 : \ - DBL_EXP_MASK < 0x4000 ? 14 : \ - DBL_EXP_MASK < 0x8000 ? 15 : \ - DBL_EXP_MASK < 0x10000 ? 16 : \ - DBL_EXP_MASK < 0x20000 ? 17 : \ - DBL_EXP_MASK < 0x40000 ? 18 : \ - DBL_EXP_MASK < 0x80000 ? 19 : \ - DBL_EXP_MASK < 0x100000 ? 20 : \ - DBL_EXP_MASK < 0x200000 ? 21 : \ - DBL_EXP_MASK < 0x400000 ? 22 : \ - DBL_EXP_MASK < 0x800000 ? 23 : \ - DBL_EXP_MASK < 0x1000000 ? 24 : \ - DBL_EXP_MASK < 0x2000000 ? 25 : \ - DBL_EXP_MASK < 0x4000000 ? 26 : \ - DBL_EXP_MASK < 0x8000000 ? 27 : \ - DBL_EXP_MASK < 0x10000000 ? 28 : \ - DBL_EXP_MASK < 0x20000000 ? 29 : \ - DBL_EXP_MASK < 0x40000000 ? 30 : \ - DBL_EXP_MASK <= 0x7fffffff ? 31 : \ - 32) -#define LDBL_EXP_BIT \ - (LDBL_EXP_MASK < 0x100 ? 8 : \ - LDBL_EXP_MASK < 0x200 ? 9 : \ - LDBL_EXP_MASK < 0x400 ? 10 : \ - LDBL_EXP_MASK < 0x800 ? 11 : \ - LDBL_EXP_MASK < 0x1000 ? 12 : \ - LDBL_EXP_MASK < 0x2000 ? 13 : \ - LDBL_EXP_MASK < 0x4000 ? 14 : \ - LDBL_EXP_MASK < 0x8000 ? 15 : \ - LDBL_EXP_MASK < 0x10000 ? 16 : \ - LDBL_EXP_MASK < 0x20000 ? 17 : \ - LDBL_EXP_MASK < 0x40000 ? 18 : \ - LDBL_EXP_MASK < 0x80000 ? 19 : \ - LDBL_EXP_MASK < 0x100000 ? 20 : \ - LDBL_EXP_MASK < 0x200000 ? 21 : \ - LDBL_EXP_MASK < 0x400000 ? 22 : \ - LDBL_EXP_MASK < 0x800000 ? 23 : \ - LDBL_EXP_MASK < 0x1000000 ? 24 : \ - LDBL_EXP_MASK < 0x2000000 ? 25 : \ - LDBL_EXP_MASK < 0x4000000 ? 26 : \ - LDBL_EXP_MASK < 0x8000000 ? 27 : \ - LDBL_EXP_MASK < 0x10000000 ? 28 : \ - LDBL_EXP_MASK < 0x20000000 ? 29 : \ - LDBL_EXP_MASK < 0x40000000 ? 30 : \ - LDBL_EXP_MASK <= 0x7fffffff ? 31 : \ - 32) - -/* Number of bits used for a floating-point number: the mantissa (not - counting the "hidden bit", since it may or may not be explicit), the - exponent, and the sign. */ -#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1) -#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1) -#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1) - -/* Number of bytes used for a floating-point number. - This can be smaller than the 'sizeof'. For example, on i386 systems, - 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence - LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but - sizeof (long double) = 12 or = 16. */ -#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) -#define SIZEOF_DBL ((DBL_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. */ -typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1]; -typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1]; -typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1]; - -#endif /* _FLOATPLUS_H */ diff --git a/lib/gl/float.in.h b/lib/gl/float.in.h deleted file mode 100644 index c0ddaa518a..0000000000 --- a/lib/gl/float.in.h +++ /dev/null @@ -1,63 +0,0 @@ -/* A correct <float.h>. - - Copyright (C) 2007-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.1 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 _GL_FLOAT_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ - -#ifndef _GL_FLOAT_H -#define _GL_FLOAT_H - -/* 'long double' properties. */ -#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) -/* Number of mantissa units, in base FLT_RADIX. */ -# undef LDBL_MANT_DIG -# define LDBL_MANT_DIG 64 -/* Number of decimal digits that is sufficient for representing a number. */ -# undef LDBL_DIG -# define LDBL_DIG 18 -/* x-1 where x is the smallest representable number > 1. */ -# undef LDBL_EPSILON -# define LDBL_EPSILON 1.0842021724855044340E-19L -/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ -# undef LDBL_MAX_EXP -# define LDBL_MAX_EXP 16384 -/* Minimum positive normalized number. */ -# undef LDBL_MIN -# define LDBL_MIN 3.3621031431120935063E-4932L -/* Maximum representable finite number. */ -# undef LDBL_MAX -# define LDBL_MAX 1.1897314953572317650E+4932L -/* Minimum e such that 10^e is in the range of normalized numbers. */ -# undef LDBL_MIN_10_EXP -# define LDBL_MIN_10_EXP (-4931) -/* Maximum e such that 10^e is in the range of representable finite numbers. */ -# undef LDBL_MAX_10_EXP -# define LDBL_MAX_10_EXP 4932 -#endif - -#endif /* _GL_FLOAT_H */ -#endif /* _GL_FLOAT_H */ diff --git a/lib/gl/fseeko.c b/lib/gl/fseeko.c deleted file mode 100644 index 8e492c54be..0000000000 --- a/lib/gl/fseeko.c +++ /dev/null @@ -1,146 +0,0 @@ -/* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -/* Get off_t and lseek. */ -#include <unistd.h> - -#include "stdio-impl.h" - -int -fseeko (FILE *fp, off_t offset, int whence) -#undef fseeko -#if !HAVE_FSEEKO -# undef fseek -# define fseeko fseek -#endif -{ -#if LSEEK_PIPE_BROKEN - /* mingw gives bogus answers rather than failure on non-seekable files. */ - if (lseek (fileno (fp), 0, SEEK_CUR) == -1) - return EOF; -#endif - - /* These tests are based on fpurge.c. */ -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - if (fp->_IO_read_end == fp->_IO_read_ptr - && fp->_IO_write_ptr == fp->_IO_write_base - && fp->_IO_save_base == NULL) -#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ -# if defined __SL64 && defined __SCLE /* Cygwin */ - if ((fp->_flags & __SL64) == 0) - { - /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit - mode; but has an fseeko that requires 64-bit mode. */ - FILE *tmp = fopen ("/dev/null", "r"); - if (!tmp) - return -1; - fp->_flags |= __SL64; - fp->_seek64 = tmp->_seek64; - fclose (tmp); - } -# endif - if (fp_->_p == fp_->_bf._base - && fp_->_r == 0 - && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */ - ? fp_->_bf._size - : 0) - && fp_ub._base == NULL) -#elif defined __EMX__ /* emx+gcc */ - if (fp->_ptr == fp->_buffer - && fp->_rcount == 0 - && fp->_wcount == 0 - && fp->_ungetc_count == 0) -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ - if (fp_->_ptr == fp_->_base - && (fp_->_ptr == NULL || fp_->_cnt == 0)) -#elif defined __UCLIBC__ /* uClibc */ - if (((fp->__modeflags & __FLAG_WRITING) == 0 - || fp->__bufpos == fp->__bufstart) - && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0 - || fp->__bufpos == fp->__bufread)) -#elif defined __QNX__ /* QNX */ - if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend) - && fp->_Rback == fp->_Back + sizeof (fp->_Back) - && fp->_Rsave == NULL) -#elif defined __MINT__ /* Atari FreeMiNT */ - if (fp->__bufp == fp->__buffer - && fp->__get_limit == fp->__bufp - && fp->__put_limit == fp->__bufp - && !fp->__pushed_back) -#else - #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." -#endif - { - /* We get here when an fflush() call immediately preceded this one. We - know there are no buffers. - POSIX requires us to modify the file descriptor's position. - But we cannot position beyond end of file here. */ - off_t pos = - lseek (fileno (fp), - whence == SEEK_END && offset > 0 ? 0 : offset, - whence); - if (pos == -1) - { -#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ - fp_->_flags &= ~__SOFF; -#endif - return -1; - } - -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - fp->_flags &= ~_IO_EOF_SEEN; -#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ -# if defined __CYGWIN__ - /* fp_->_offset is typed as an integer. */ - fp_->_offset = pos; -# else - /* fp_->_offset is an fpos_t. */ - { - /* Use a union, since on NetBSD, the compilation flags - determine whether fpos_t is typedef'd to off_t or a struct - containing a single off_t member. */ - union - { - fpos_t f; - off_t o; - } u; - u.o = pos; - fp_->_offset = u.f; - } -# endif - fp_->_flags |= __SOFF; - fp_->_flags &= ~__SEOF; -#elif defined __EMX__ /* emx+gcc */ - fp->_flags &= ~_IOEOF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ - fp->_flag &= ~_IOEOF; -#elif defined __MINT__ /* Atari FreeMiNT */ - fp->__offset = pos; - fp->__eof = 0; -#endif - /* If we were not requested to position beyond end of file, we're - done. */ - if (!(whence == SEEK_END && offset > 0)) - return 0; - } - return fseeko (fp, offset, whence); -} diff --git a/lib/gl/ftello.c b/lib/gl/ftello.c deleted file mode 100644 index f4beeea881..0000000000 --- a/lib/gl/ftello.c +++ /dev/null @@ -1,77 +0,0 @@ -/* An ftello() function that works around platform bugs. - Copyright (C) 2007, 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.1 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> - -/* Get lseek. */ -#include <unistd.h> - -#include "stdio-impl.h" - -off_t -ftello (FILE *fp) -#undef ftello -#if !HAVE_FTELLO -# undef ftell -# define ftello ftell -#endif -{ -#if LSEEK_PIPE_BROKEN - /* mingw gives bogus answers rather than failure on non-seekable files. */ - if (lseek (fileno (fp), 0, SEEK_CUR) == -1) - return -1; -#endif - -#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */ - /* The Solaris stdio leaves the _IOREAD flag set after reading from a file - reaches EOF and the program then starts writing to the file. ftello - gets confused by this. */ - if (fp_->_flag & _IOWRT) - { - off_t pos; - - /* Call ftello nevertheless, for the side effects that it does on fp. */ - ftello (fp); - - /* Compute the file position ourselves. */ - pos = llseek (fileno (fp), (off_t) 0, SEEK_CUR); - if (pos >= 0) - { - if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL) - pos += fp_->_ptr - fp_->_base; - } - return pos; - } -#endif - -#if defined __SL64 && defined __SCLE /* Cygwin */ - if ((fp->_flags & __SL64) == 0) - { - /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit - mode; but has an ftello that requires 64-bit mode. */ - FILE *tmp = fopen ("/dev/null", "r"); - if (!tmp) - return -1; - fp->_flags |= __SL64; - fp->_seek64 = tmp->_seek64; - fclose (tmp); - } -#endif - return ftello (fp); -} diff --git a/lib/gl/gettext.h b/lib/gl/gettext.h deleted file mode 100644 index d743a2ba98..0000000000 --- a/lib/gl/gettext.h +++ /dev/null @@ -1,175 +0,0 @@ -/* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 - -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS - -/* Get declarations of GNU message catalog functions. */ -# include <libintl.h> - -/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by - the gettext() and ngettext() macros. This is an alternative to calling - textdomain(), and is useful for libraries. */ -# ifdef DEFAULT_TEXT_DOMAIN -# undef gettext -# define gettext(Msgid) \ - dgettext (DEFAULT_TEXT_DOMAIN, Msgid) -# undef ngettext -# define ngettext(Msgid1, Msgid2, N) \ - dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) -# endif - -#else - -/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which - chokes if dcgettext is defined as a macro. So include it now, to make - later inclusions of <locale.h> a NOP. We don't include <libintl.h> - as well because people using "gettext.h" will not include <libintl.h>, - and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> - is OK. */ -#if defined(__sun) -# include <locale.h> -#endif - -/* Many header files from the libstdc++ coming with g++ 3.3 or newer include - <libintl.h>, which chokes if dcgettext is defined as a macro. So include - it now, to make later inclusions of <libintl.h> a NOP. */ -#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) -# include <cstdlib> -# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H -# include <libintl.h> -# endif -#endif - -/* Disabled NLS. - The casts to 'const char *' serve the purpose of producing warnings - for invalid uses of the value returned from these functions. - On pre-ANSI systems without 'const', the config.h file is supposed to - contain "#define const". */ -# undef gettext -# define gettext(Msgid) ((const char *) (Msgid)) -# undef dgettext -# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) -# undef dcgettext -# define dcgettext(Domainname, Msgid, Category) \ - ((void) (Category), dgettext (Domainname, Msgid)) -# undef ngettext -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 \ - ? ((void) (Msgid2), (const char *) (Msgid1)) \ - : ((void) (Msgid1), (const char *) (Msgid2))) -# undef dngettext -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) -# undef dcngettext -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) -# undef textdomain -# define textdomain(Domainname) ((const char *) (Domainname)) -# undef bindtextdomain -# define bindtextdomain(Domainname, Dirname) \ - ((void) (Domainname), (const char *) (Dirname)) -# undef bind_textdomain_codeset -# define bind_textdomain_codeset(Domainname, Codeset) \ - ((void) (Domainname), (const char *) (Codeset)) - -#endif - -/* A pseudo function call that serves as a marker for the automated - extraction of messages, but does not call gettext(). The run-time - translation is done at a different place in the code. - The argument, String, should be a literal string. Concatenated strings - and other string expressions won't work. - The macro's expansion is not parenthesized, so that it is suitable as - initializer for static 'char[]' or 'const char[]' variables. */ -#define gettext_noop(String) String - -/* The separator between msgctxt and msgid in a .mo file. */ -#define GETTEXT_CONTEXT_GLUE "\004" - -/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a - MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be - short and rarely need to change. - The letter 'p' stands for 'particular' or 'special'. */ -#ifdef DEFAULT_TEXT_DOMAIN -# define pgettext(Msgctxt, Msgid) \ - pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#else -# define pgettext(Msgctxt, Msgid) \ - pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#endif -#define dpgettext(Domainname, Msgctxt, Msgid) \ - pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ - pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) -#ifdef DEFAULT_TEXT_DOMAIN -# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#else -# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#endif -#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ - npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -pgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - int category) -{ - const char *translation = dcgettext (domain, msg_ctxt_id, category); - if (translation == msg_ctxt_id) - return msgid; - else - return translation; -} - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -npgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) -{ - const char *translation = - dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); - if (translation == msg_ctxt_id || translation == msgid_plural) - return (n == 1 ? msgid : msgid_plural); - else - return translation; -} - -#endif /* _LIBGETTEXT_H */ diff --git a/lib/gl/lseek.c b/lib/gl/lseek.c deleted file mode 100644 index 601efa357f..0000000000 --- a/lib/gl/lseek.c +++ /dev/null @@ -1,62 +0,0 @@ -/* An lseek() function that detects pipes. - Copyright (C) 2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Windows platforms. */ -/* Get GetFileType. */ -# include <windows.h> -#else -# include <sys/stat.h> -#endif -#include <errno.h> - -#undef lseek - -off_t -rpl_lseek (int fd, off_t offset, int whence) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */ - HANDLE h = (HANDLE) _get_osfhandle (fd); - if (h == INVALID_HANDLE_VALUE) - { - errno = EBADF; - return -1; - } - if (GetFileType (h) != FILE_TYPE_DISK) - { - errno = ESPIPE; - return -1; - } -#else - /* BeOS lseek mistakenly succeeds on pipes... */ - struct stat statbuf; - if (fstat (fd, &statbuf) < 0) - return -1; - if (!S_ISREG (statbuf.st_mode)) - { - errno = ESPIPE; - return -1; - } -#endif - return lseek (fd, offset, whence); -} diff --git a/lib/gl/m4/00gnulib.m4 b/lib/gl/m4/00gnulib.m4 deleted file mode 100644 index 301469b31c..0000000000 --- a/lib/gl/m4/00gnulib.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# 00gnulib.m4 serial 2 -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. - -dnl This file must be named something that sorts before all other -dnl gnulib-provided .m4 files. It is needed until such time as we can -dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. - -# AC_DEFUN_ONCE([NAME], VALUE) -# ---------------------------- -# Define NAME to expand to VALUE on the first use (whether by direct -# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. -# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This -# definition is slower than the version in Autoconf 2.64, because it -# can only use interfaces that existed since 2.59; but it achieves the -# same effect. Quoting is necessary to avoid confusing Automake. -m4_version_prereq([2.63.263], [], -[m4_define([AC][_DEFUN_ONCE], - [AC][_DEFUN([$1], - [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], - [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl -[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) - -# gl_00GNULIB -# ----------- -# Witness macro that this file has been included. Needed to force -# Automake to include this file prior to all other gnulib .m4 files. -AC_DEFUN([gl_00GNULIB]) diff --git a/lib/gl/m4/alloca.m4 b/lib/gl/m4/alloca.m4 deleted file mode 100644 index 80d67aad77..0000000000 --- a/lib/gl/m4/alloca.m4 +++ /dev/null @@ -1,43 +0,0 @@ -# alloca.m4 serial 10 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, -dnl 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_ALLOCA], -[ - AC_REQUIRE([AC_FUNC_ALLOCA]) - if test $ac_cv_func_alloca_works = no; then - gl_PREREQ_ALLOCA - fi - - # Define an additional variable used in the Makefile substitution. - if test $ac_cv_working_alloca_h = yes; then - AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ - AC_EGREP_CPP([Need own alloca], [ -#if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca -#endif - ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) - ]) - if test $gl_cv_rpl_alloca = yes; then - dnl OK, alloca can be implemented through a compiler built-in. - AC_DEFINE([HAVE_ALLOCA], [1], - [Define to 1 if you have 'alloca' after including <alloca.h>, - a header that may be supplied by this distribution.]) - ALLOCA_H=alloca.h - else - dnl alloca exists as a library function, i.e. it is slow and probably - dnl a memory leak. Don't define HAVE_ALLOCA in this case. - ALLOCA_H= - fi - else - ALLOCA_H=alloca.h - fi - AC_SUBST([ALLOCA_H]) -]) - -# Prerequisites of lib/alloca.c. -# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. -AC_DEFUN([gl_PREREQ_ALLOCA], [:]) diff --git a/lib/gl/m4/asm-underscore.m4 b/lib/gl/m4/asm-underscore.m4 deleted file mode 100644 index 1736cc432a..0000000000 --- a/lib/gl/m4/asm-underscore.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# asm-underscore.m4 serial 1 -dnl Copyright (C) 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 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/lib/gl/m4/byteswap.m4 b/lib/gl/m4/byteswap.m4 deleted file mode 100644 index 2afd6a2a4e..0000000000 --- a/lib/gl/m4/byteswap.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# byteswap.m4 serial 3 -dnl Copyright (C) 2005, 2007, 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. - -dnl Written by Oskar Liljeblad. - -AC_DEFUN([gl_BYTESWAP], -[ - dnl Prerequisites of lib/byteswap.in.h. - AC_CHECK_HEADERS([byteswap.h], [ - BYTESWAP_H='' - ], [ - BYTESWAP_H='byteswap.h' - ]) - AC_SUBST([BYTESWAP_H]) -]) diff --git a/lib/gl/m4/codeset.m4 b/lib/gl/m4/codeset.m4 deleted file mode 100644 index f722b2e86a..0000000000 --- a/lib/gl/m4/codeset.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 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 From Bruno Haible. - -AC_DEFUN([AM_LANGINFO_CODESET], -[ - AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <langinfo.h>]], - [[char* cs = nl_langinfo(CODESET); return !cs;]])], - [am_cv_langinfo_codeset=yes], - [am_cv_langinfo_codeset=no]) - ]) - if test $am_cv_langinfo_codeset = yes; then - AC_DEFINE([HAVE_LANGINFO_CODESET], [1], - [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) - fi -]) diff --git a/lib/gl/m4/errno_h.m4 b/lib/gl/m4/errno_h.m4 deleted file mode 100644 index e4325ac660..0000000000 --- a/lib/gl/m4/errno_h.m4 +++ /dev/null @@ -1,118 +0,0 @@ -# errno_h.m4 serial 7 -dnl Copyright (C) 2004, 2006, 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. - -AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ - AC_EGREP_CPP([booboo],[ -#include <errno.h> -#if !defined ENOMSG -booboo -#endif -#if !defined EIDRM -booboo -#endif -#if !defined ENOLINK -booboo -#endif -#if !defined EPROTO -booboo -#endif -#if !defined EMULTIHOP -booboo -#endif -#if !defined EBADMSG -booboo -#endif -#if !defined EOVERFLOW -booboo -#endif -#if !defined ENOTSUP -booboo -#endif -#if !defined ESTALE -booboo -#endif -#if !defined EDQUOT -booboo -#endif -#if !defined ECANCELED -booboo -#endif - ], - [gl_cv_header_errno_h_complete=no], - [gl_cv_header_errno_h_complete=yes]) - ]) - if test $gl_cv_header_errno_h_complete = yes; then - ERRNO_H='' - else - gl_CHECK_NEXT_HEADERS([errno.h]) - ERRNO_H='errno.h' - fi - AC_SUBST([ERRNO_H]) - gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) - gl_REPLACE_ERRNO_VALUE([ENOLINK]) - gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) -]) - -# Assuming $1 = EOVERFLOW. -# The EOVERFLOW errno value ought to be defined in <errno.h>, according to -# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and -# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. -# Check for the value of EOVERFLOW. -# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. -AC_DEFUN([gl_REPLACE_ERRNO_VALUE], -[ - if test -n "$ERRNO_H"; then - AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ - AC_EGREP_CPP([yes],[ -#include <errno.h> -#ifdef ]$1[ -yes -#endif - ], - [gl_cv_header_errno_h_]$1[=yes], - [gl_cv_header_errno_h_]$1[=no]) - if test $gl_cv_header_errno_h_]$1[ = no; then - AC_EGREP_CPP([yes],[ -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -#ifdef ]$1[ -yes -#endif - ], [gl_cv_header_errno_h_]$1[=hidden]) - if test $gl_cv_header_errno_h_]$1[ = hidden; then - dnl The macro exists but is hidden. - dnl Define it to the same value. - AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> -#include <stdlib.h> -]) - fi - fi - ]) - case $gl_cv_header_errno_h_]$1[ in - yes | no) - ]$1[_HIDDEN=0; ]$1[_VALUE= - ;; - *) - ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" - ;; - esac - AC_SUBST($1[_HIDDEN]) - AC_SUBST($1[_VALUE]) - fi -]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff --git a/lib/gl/m4/extensions.m4 b/lib/gl/m4/extensions.m4 deleted file mode 100644 index 7d9458a8d6..0000000000 --- a/lib/gl/m4/extensions.m4 +++ /dev/null @@ -1,118 +0,0 @@ -# serial 9 -*- Autoconf -*- -# Enable extensions on systems that normally disable them. - -# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS -# Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly -# enough in this area it's likely we'll need to redefine -# AC_USE_SYSTEM_EXTENSIONS for quite some time. - -# If autoconf reports a warning -# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS -# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS -# the fix is -# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked -# but always AC_REQUIREd, -# 2) to ensure that for each occurrence of -# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -# or -# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -# the corresponding gnulib module description has 'extensions' among -# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS -# invocation occurs in gl_EARLY, not in gl_INIT. - -# AC_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -# Remember that #undef in AH_VERBATIM gets replaced with #define by -# AC_DEFINE. The goal here is to define all known feature-enabling -# macros, then, if reports of conflicts are made, disable macros that -# cause problems on some platforms (such as __EXTENSIONS__). -AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], -[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl -AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - - AC_REQUIRE([AC_CANONICAL_HOST]) - - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) - if test "$MINIX" = yes; then - AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other - things to work.]) - AC_DEFINE([_POSIX_1_SOURCE], [2], - [Define to 2 if the system does not provide POSIX.1 features - except with this defined.]) - AC_DEFINE([_MINIX], [1], - [Define to 1 if on MINIX.]) - fi - - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -]) - AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], - [ac_cv_safe_to_define___extensions__], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -# define __EXTENSIONS__ 1 - ]AC_INCLUDES_DEFAULT])], - [ac_cv_safe_to_define___extensions__=yes], - [ac_cv_safe_to_define___extensions__=no])]) - test $ac_cv_safe_to_define___extensions__ = yes && - AC_DEFINE([__EXTENSIONS__]) - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) - AC_DEFINE([_TANDEM_SOURCE]) -])# AC_USE_SYSTEM_EXTENSIONS - -# gl_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], -[ - dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. - dnl gnulib does not need it. But if it gets required by third-party macros - dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a - dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". - dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, - dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -]) diff --git a/lib/gl/m4/fcntl-o.m4 b/lib/gl/m4/fcntl-o.m4 deleted file mode 100644 index 46fad47021..0000000000 --- a/lib/gl/m4/fcntl-o.m4 +++ /dev/null @@ -1,112 +0,0 @@ -# fcntl-o.m4 serial 3 -dnl Copyright (C) 2006, 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. - -dnl Written by Paul Eggert. - -# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. -# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. -# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. -AC_DEFUN([gl_FCNTL_O_FLAGS], -[ - dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) - AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <sys/stat.h> - #include <unistd.h> - #include <fcntl.h> - #ifndef O_NOATIME - #define O_NOATIME 0 - #endif - #ifndef O_NOFOLLOW - #define O_NOFOLLOW 0 - #endif - static int const constants[] = - { - O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, - O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY - }; - ]], - [[ - int result = !constants; - { - static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0) - result |= 2; - else - { - int fd = open (sym, O_RDONLY | O_NOFOLLOW); - if (fd >= 0) - { - close (fd); - result |= 4; - } - } - unlink (sym); - } - { - static char const file[] = "confdefs.h"; - int fd = open (file, O_RDONLY | O_NOATIME); - if (fd < 0) - result |= 8; - else - { - struct stat st0; - if (fstat (fd, &st0) != 0) - result |= 16; - else - { - 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 result;]])], - [gl_cv_header_working_fcntl_h=yes], - [case $? in #( - 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac], - [gl_cv_header_working_fcntl_h=cross-compiling])]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], - [Define to 1 if O_NOATIME works.]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], - [Define to 1 if O_NOFOLLOW works.]) -]) diff --git a/lib/gl/m4/float_h.m4 b/lib/gl/m4/float_h.m4 deleted file mode 100644 index f6099db405..0000000000 --- a/lib/gl/m4/float_h.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# float_h.m4 serial 4 -dnl Copyright (C) 2007, 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_FLOAT_H], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - FLOAT_H= - case "$host_os" in - beos* | openbsd* | mirbsd*) - FLOAT_H=float.h - gl_CHECK_NEXT_HEADERS([float.h]) - ;; - esac - AC_SUBST([FLOAT_H]) -]) diff --git a/lib/gl/m4/fseeko.m4 b/lib/gl/m4/fseeko.m4 deleted file mode 100644 index b97df53377..0000000000 --- a/lib/gl/m4/fseeko.m4 +++ /dev/null @@ -1,50 +0,0 @@ -# fseeko.m4 serial 9 -dnl Copyright (C) 2007-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_FUNC_FSEEKO], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([gl_HAVE_FSEEKO]) - AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) - - if test $gl_cv_func_fseeko = no; then - HAVE_FSEEKO=0 - gl_REPLACE_FSEEKO - else - if test $gl_cv_var_stdin_large_offset = no; then - gl_REPLACE_FSEEKO - fi - fi -]) - -dnl Tests whether fseeko is available. -dnl Result is gl_cv_func_fseeko. -AC_DEFUN([gl_HAVE_FSEEKO], -[ - AC_REQUIRE([AC_PROG_CC]) - - dnl Persuade glibc <stdio.h> to declare fseeko(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko], - [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> -]], [fseeko (stdin, 0, 0);])], - [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no]) - ]) -]) - -AC_DEFUN([gl_REPLACE_FSEEKO], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([gl_HAVE_FSEEKO]) - if test $gl_cv_func_fseeko = yes; then - REPLACE_FSEEKO=1 - fi - AC_LIBOBJ([fseeko]) - dnl If we are also using the fseek module, then fseek needs replacing, too. - m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK]) -]) diff --git a/lib/gl/m4/ftello.m4 b/lib/gl/m4/ftello.m4 deleted file mode 100644 index 33201a0107..0000000000 --- a/lib/gl/m4/ftello.m4 +++ /dev/null @@ -1,130 +0,0 @@ -# ftello.m4 serial 8 -dnl Copyright (C) 2007-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_FUNC_FTELLO], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) - - dnl Persuade glibc <stdio.h> to declare ftello(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], - [ - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stdio.h>]], - [[ftello (stdin);]])], - [gl_cv_func_ftello=yes], - [gl_cv_func_ftello=no]) - ]) - if test $gl_cv_func_ftello = no; then - HAVE_FTELLO=0 - else - if test $gl_cv_var_stdin_large_offset = no; then - REPLACE_FTELLO=1 - else - dnl Detect bug on Solaris. - dnl ftell and ftello produce incorrect results after putc that followed a - dnl getc call that reached EOF on Solaris. This is because the _IOREAD - dnl flag does not get cleared in this case, even though _IOWRT gets set, - dnl and ftell and ftello look whether the _IOREAD flag is set. - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CACHE_CHECK([whether ftello works], - [gl_cv_func_ftello_works], - [ - dnl Initial guess, used when cross-compiling or when /dev/tty cannot - dnl be opened. -changequote(,)dnl - case "$host_os" in - # Guess no on Solaris. - solaris*) gl_cv_func_ftello_works="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_ftello_works="guessing yes" ;; - esac -changequote([,])dnl - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#define TESTFILE "conftest.tmp" -int -main (void) -{ - FILE *fp; - - /* Create a file with some contents. */ - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - return 70; - if (fwrite ("foogarsh", 1, 8, fp) < 8) - return 71; - if (fclose (fp)) - return 72; - - /* The file's contents is now "foogarsh". */ - - /* Try writing after reading to EOF. */ - fp = fopen (TESTFILE, "r+"); - if (fp == NULL) - return 73; - if (fseek (fp, -1, SEEK_END)) - return 74; - if (!(getc (fp) == 'h')) - return 1; - if (!(getc (fp) == EOF)) - return 2; - if (!(ftell (fp) == 8)) - return 3; - if (!(ftell (fp) == 8)) - return 4; - if (!(putc ('!', fp) == '!')) - return 5; - if (!(ftell (fp) == 9)) - return 6; - if (!(fclose (fp) == 0)) - return 7; - fp = fopen (TESTFILE, "r"); - if (fp == NULL) - return 75; - { - char buf[10]; - if (!(fread (buf, 1, 10, fp) == 9)) - return 10; - if (!(memcmp (buf, "foogarsh!", 9) == 0)) - return 11; - } - if (!(fclose (fp) == 0)) - return 12; - - /* The file's contents is now "foogarsh!". */ - - return 0; -}]])], - [gl_cv_func_ftello_works=yes], - [gl_cv_func_ftello_works=no], [:]) - ]) - case "$gl_cv_func_ftello_works" in - *yes) ;; - *) - REPLACE_FTELLO=1 - AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1], - [Define to 1 if the system's ftello function has the Solaris bug.]) - ;; - esac - fi - fi - if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then - gl_REPLACE_FTELLO - fi -]) - -AC_DEFUN([gl_REPLACE_FTELLO], -[ - AC_LIBOBJ([ftello]) -]) diff --git a/lib/gl/m4/func.m4 b/lib/gl/m4/func.m4 deleted file mode 100644 index 698c5281da..0000000000 --- a/lib/gl/m4/func.m4 +++ /dev/null @@ -1,20 +0,0 @@ -# func.m4 serial 2 -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. - -# Written by Simon Josefsson - -AC_DEFUN([gl_FUNC], -[ - AC_CACHE_CHECK([whether __func__ is available], [gl_cv_var_func], - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[const char *str = __func__;]])], - [gl_cv_var_func=yes], - [gl_cv_var_func=no])) - if test "$gl_cv_var_func" != yes; then - AC_DEFINE([__func__], ["<unknown function>"], - [Define as a replacement for the ISO C99 __func__ variable.]) - fi -]) diff --git a/lib/gl/m4/getpagesize.m4 b/lib/gl/m4/getpagesize.m4 deleted file mode 100644 index 313ad7fa26..0000000000 --- a/lib/gl/m4/getpagesize.m4 +++ /dev/null @@ -1,33 +0,0 @@ -# getpagesize.m4 serial 8 -dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation, -dnl 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_GETPAGESIZE], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_FUNCS([getpagesize]) - if test $ac_cv_func_getpagesize = no; then - HAVE_GETPAGESIZE=0 - AC_CHECK_HEADERS([OS.h]) - if test $ac_cv_header_OS_h = yes; then - HAVE_OS_H=1 - fi - AC_CHECK_HEADERS([sys/param.h]) - if test $ac_cv_header_sys_param_h = yes; then - HAVE_SYS_PARAM_H=1 - fi - fi - case "$host_os" in - mingw*) - REPLACE_GETPAGESIZE=1 - AC_LIBOBJ([getpagesize]) - ;; - esac - dnl Also check whether it's declared. - dnl mingw has getpagesize() in libgcc.a but doesn't declare it. - AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) -]) diff --git a/lib/gl/m4/gettext.m4 b/lib/gl/m4/gettext.m4 deleted file mode 100644 index 979c52c196..0000000000 --- a/lib/gl/m4/gettext.m4 +++ /dev/null @@ -1,401 +0,0 @@ -# gettext.m4 serial 64 (gettext-0.18.2) -dnl Copyright (C) 1995-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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010. - -dnl Macro to add for using GNU gettext. - -dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The -dnl default (if it is not specified or empty) is 'no-libtool'. -dnl INTLSYMBOL should be 'external' for packages with no intl directory, -dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. -dnl If INTLSYMBOL is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library -dnl $(top_builddir)/intl/libintl.a will be created. -dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. If NEEDSYMBOL is specified and is -dnl 'need-formatstring-macros', then GNU gettext implementations that don't -dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. -dnl INTLDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. -dnl -dnl The result of the configuration is one of three cases: -dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -dnl and used. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 2) GNU gettext has been found in the system's C library. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 3) No internationalization, always use English msgid. -dnl Catalog format: none -dnl Catalog extension: none -dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. -dnl The use of .gmo is historical (it was needed to avoid overwriting the -dnl GNU format catalogs when building on a platform with an X/Open gettext), -dnl but we keep it in order not to force irrelevant filename changes on the -dnl maintainers. -dnl -AC_DEFUN([AM_GNU_GETTEXT], -[ - dnl Argument checking. - ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , - [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -])])])])]) - ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], - [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) - ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , - [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT -])])])]) - define([gt_included_intl], - ifelse([$1], [external], - ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), - [yes])) - define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) - gt_NEEDS_INIT - AM_GNU_GETTEXT_NEED([$2]) - - AC_REQUIRE([AM_PO_SUBDIRS])dnl - ifelse(gt_included_intl, yes, [ - AC_REQUIRE([AM_INTL_SUBDIR])dnl - ]) - - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Sometimes libintl requires libiconv, so first search for libiconv. - dnl Ideally we would do this search only after the - dnl if test "$USE_NLS" = "yes"; then - dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then - dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT - dnl the configure script would need to contain the same shell code - dnl again, outside any 'if'. There are two solutions: - dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. - dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. - dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not - dnl documented, we avoid it. - ifelse(gt_included_intl, yes, , [ - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - ]) - - dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. - gt_INTL_MACOSX - - dnl Set USE_NLS. - AC_REQUIRE([AM_NLS]) - - ifelse(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - ]) - LIBINTL= - LTLIBINTL= - POSUB= - - dnl Add a version number to the cache macros. - case " $gt_needs " in - *" need-formatstring-macros "*) gt_api_version=3 ;; - *" need-ngettext "*) gt_api_version=2 ;; - *) gt_api_version=1 ;; - esac - gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" - gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - ifelse(gt_included_intl, yes, [ - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH([included-gettext], - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - ]) - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If GNU gettext is available we use this. Else we have - dnl to fall back to GNU NLS library. - - if test $gt_api_version -ge 3; then - gt_revision_test_code=' -#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -' - else - gt_revision_test_code= - fi - if test $gt_api_version -ge 2; then - gt_expression_test_code=' + * ngettext ("", "", 0)' - else - gt_expression_test_code= - fi - - AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <libintl.h> -$gt_revision_test_code -extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; - ]], - [[ -bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings - ]])], - [eval "$gt_func_gnugettext_libc=yes"], - [eval "$gt_func_gnugettext_libc=no"])]) - - if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then - dnl Sometimes libintl requires libiconv, so first search for libiconv. - ifelse(gt_included_intl, yes, , [ - AM_ICONV_LINK - ]) - dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL - dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) - dnl because that would add "-liconv" to LIBINTL and LTLIBINTL - dnl even if libiconv doesn't exist. - AC_LIB_LINKFLAGS_BODY([intl]) - AC_CACHE_CHECK([for GNU gettext in libintl], - [$gt_func_gnugettext_libintl], - [gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - dnl Now see whether libintl exists and does not depend on libiconv. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <libintl.h> -$gt_revision_test_code -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (const char *); - ]], - [[ -bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ]])], - [eval "$gt_func_gnugettext_libintl=yes"], - [eval "$gt_func_gnugettext_libintl=no"]) - dnl Now see whether libintl exists and depends on libiconv. - if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <libintl.h> -$gt_revision_test_code -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (const char *); - ]], - [[ -bindtextdomain ("", ""); -return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ]])], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - eval "$gt_func_gnugettext_libintl=yes" - ]) - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ - || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ - && test "$PACKAGE" != gettext-runtime \ - && test "$PACKAGE" != gettext-tools; }; then - gt_use_preinstalled_gnugettext=yes - else - dnl Reset the values set by searching for libintl. - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - ifelse(gt_included_intl, yes, [ - if test "$gt_use_preinstalled_gnugettext" != "yes"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on included GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - CATOBJEXT= - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions to use GNU gettext tools. - CATOBJEXT=.gmo - fi - ]) - - if test -n "$INTL_MACOSX_LIBS"; then - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Some extra flags are needed during linking. - LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" - LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" - fi - fi - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE([ENABLE_NLS], [1], - [Define to 1 if translation of program messages to the user's native language - is requested.]) - else - USE_NLS=no - fi - fi - - AC_MSG_CHECKING([whether to use NLS]) - AC_MSG_RESULT([$USE_NLS]) - if test "$USE_NLS" = "yes"; then - AC_MSG_CHECKING([where the gettext function comes from]) - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then - gt_source="external libintl" - else - gt_source="libc" - fi - else - gt_source="included intl directory" - fi - AC_MSG_RESULT([$gt_source]) - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then - AC_MSG_CHECKING([how to link with libintl]) - AC_MSG_RESULT([$LIBINTL]) - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) - fi - - dnl For backward compatibility. Some packages may be using this. - AC_DEFINE([HAVE_GETTEXT], [1], - [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE([HAVE_DCGETTEXT], [1], - [Define if the GNU dcgettext() function is already present or preinstalled.]) - fi - - dnl We need to process the po/ directory. - POSUB=po - fi - - ifelse(gt_included_intl, yes, [ - dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL - dnl to 'yes' because some of the testsuite requires it. - if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then - BUILD_INCLUDED_LIBINTL=yes - fi - - dnl Make all variables we use known to autoconf. - AC_SUBST([BUILD_INCLUDED_LIBINTL]) - AC_SUBST([USE_INCLUDED_LIBINTL]) - AC_SUBST([CATOBJEXT]) - - dnl For backward compatibility. Some configure.ins may be using this. - nls_cv_header_intl= - nls_cv_header_libgt= - - dnl For backward compatibility. Some Makefiles may be using this. - DATADIRNAME=share - AC_SUBST([DATADIRNAME]) - - dnl For backward compatibility. Some Makefiles may be using this. - INSTOBJEXT=.mo - AC_SUBST([INSTOBJEXT]) - - dnl For backward compatibility. Some Makefiles may be using this. - GENCAT=gencat - AC_SUBST([GENCAT]) - - dnl For backward compatibility. Some Makefiles may be using this. - INTLOBJS= - if test "$USE_INCLUDED_LIBINTL" = yes; then - INTLOBJS="\$(GETTOBJS)" - fi - AC_SUBST([INTLOBJS]) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) - ]) - - dnl For backward compatibility. Some Makefiles may be using this. - INTLLIBS="$LIBINTL" - AC_SUBST([INTLLIBS]) - - dnl Make all documented variables known to autoconf. - AC_SUBST([LIBINTL]) - AC_SUBST([LTLIBINTL]) - AC_SUBST([POSUB]) -]) - - -dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. -m4_define([gt_NEEDS_INIT], -[ - m4_divert_text([DEFAULTS], [gt_needs=]) - m4_define([gt_NEEDS_INIT], []) -]) - - -dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) -AC_DEFUN([AM_GNU_GETTEXT_NEED], -[ - m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) -]) - - -dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/lib/gl/m4/glibc2.m4 b/lib/gl/m4/glibc2.m4 deleted file mode 100644 index b92208a1c6..0000000000 --- a/lib/gl/m4/glibc2.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# glibc2.m4 serial 3 -dnl Copyright (C) 2000-2002, 2004, 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. - -# Test for the GNU C Library, version 2.0 or newer. -# From Bruno Haible. - -AC_DEFUN([gt_GLIBC2], - [ - AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], - [ac_cv_gnu_library_2], - [AC_EGREP_CPP([Lucky GNU user], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) && !defined __UCLIBC__ - Lucky GNU user - #endif -#endif - ], - [ac_cv_gnu_library_2=yes], - [ac_cv_gnu_library_2=no]) - ] - ) - AC_SUBST([GLIBC2]) - GLIBC2="$ac_cv_gnu_library_2" - ] -) diff --git a/lib/gl/m4/glibc21.m4 b/lib/gl/m4/glibc21.m4 deleted file mode 100644 index bd08b381e8..0000000000 --- a/lib/gl/m4/glibc21.m4 +++ /dev/null @@ -1,33 +0,0 @@ -# glibc21.m4 serial 5 -dnl Copyright (C) 2000-2002, 2004, 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. - -# Test for the GNU C Library, version 2.1 or newer, or uClibc. -# From Bruno Haible. - -AC_DEFUN([gl_GLIBC21], - [ - AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], - [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) - ] - ) - AC_SUBST([GLIBC21]) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) diff --git a/lib/gl/m4/gnulib-cache.m4 b/lib/gl/m4/gnulib-cache.m4 deleted file mode 100644 index 24590151e2..0000000000 --- a/lib/gl/m4/gnulib-cache.m4 +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# -# This file represents the specification of how gnulib-tool is used. -# It acts as a cache: It is written and read by gnulib-tool. -# In projects that use version control, this file is meant to be put under -# version control, like the configure.ac and various Makefile.am files. - - -# Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=liblgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext lib-msvc-compat lib-symbol-versions memmem-simple minmax netdb read-file snprintf sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf vsnprintf - -# Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_LOCAL_DIR([gl/override]) -gl_MODULES([ - byteswap - c-ctype - fseeko - func - gettext - lib-msvc-compat - lib-symbol-versions - memmem-simple - minmax - netdb - read-file - snprintf - sockets - socklen - stdint - strcase - strverscmp - sys_socket - sys_stat - time_r - unistd - vasprintf - vsnprintf -]) -gl_AVOID([alignof-tests lseek-tests]) -gl_SOURCE_BASE([gl]) -gl_M4_BASE([gl/m4]) -gl_PO_BASE([]) -gl_DOC_BASE([doc]) -gl_TESTS_BASE([gl/tests]) -gl_WITH_TESTS -gl_LIB([liblgnu]) -gl_LGPL([2]) -gl_MAKEFILE_NAME([]) -gl_LIBTOOL -gl_MACRO_PREFIX([lgl]) -gl_PO_DOMAIN([]) -gl_VC_FILES([false]) diff --git a/lib/gl/m4/gnulib-common.m4 b/lib/gl/m4/gnulib-common.m4 deleted file mode 100644 index d0c8b66287..0000000000 --- a/lib/gl/m4/gnulib-common.m4 +++ /dev/null @@ -1,214 +0,0 @@ -# gnulib-common.m4 serial 21 -dnl Copyright (C) 2007-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. - -# gl_COMMON -# is expanded unconditionally through gnulib-tool magic. -AC_DEFUN([gl_COMMON], [ - dnl Use AC_REQUIRE here, so that the code is expanded once only. - AC_REQUIRE([gl_00GNULIB]) - AC_REQUIRE([gl_COMMON_BODY]) -]) -AC_DEFUN([gl_COMMON_BODY], [ - AH_VERBATIM([isoc99_inline], -[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports - the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of - earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. - __APPLE_CC__ tests for the Apple compiler and its version. - __STDC_VERSION__ tests for the C99 mode. */ -#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ -# define __GNUC_STDC_INLINE__ 1 -#endif]) - AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED -]) - dnl Preparation for running test programs: - dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not - dnl to /dev/tty, so they can be redirected to log files. Such diagnostics - dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. - LIBC_FATAL_STDERR_=1 - export LIBC_FATAL_STDERR_ -]) - -# gl_MODULE_INDICATOR_CONDITION -# expands to a C preprocessor expression that evaluates to 1 or 0, depending -# whether a gnulib module that has been requested shall be considered present -# or not. -AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) - -# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) -# sets the shell variable that indicates the presence of the given module to -# a C preprocessor expression that will evaluate to 1. -AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], -[ - GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION -]) - -# gl_MODULE_INDICATOR([modulename]) -# defines a C macro indicating the presence of the given module -# in a location where it can be used. -# | Value | Value | -# | in lib/ | in tests/ | -# --------------------------------------------+---------+-----------+ -# Module present among main modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module present among tests-related modules: | 0 | 1 | -# --------------------------------------------+---------+-----------+ -# Module not present at all: | 0 | 0 | -# --------------------------------------------+---------+-----------+ -AC_DEFUN([gl_MODULE_INDICATOR], -[ - AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), - [gl_MODULE_INDICATOR_CONDITION], - [Define to a C preprocessor expression that evaluates to 1 or 0, - depending whether the gnulib module $1 shall be considered present.]) -]) - -# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) -# defines a C macro indicating the presence of the given module -# in lib or tests. This is useful to determine whether the module -# should be tested. -# | Value | Value | -# | in lib/ | in tests/ | -# --------------------------------------------+---------+-----------+ -# Module present among main modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module present among tests-related modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module not present at all: | 0 | 0 | -# --------------------------------------------+---------+-----------+ -AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], -[ - AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], - [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 -# is a backport of autoconf-2.59c's m4_foreach_w. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - -# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) -# ---------------------------------------------------- -# Backport of autoconf-2.63b's macro. -# Remove this macro when we can assume autoconf >= 2.64. -m4_ifndef([AS_VAR_IF], -[m4_define([AS_VAR_IF], -[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) - -# AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix -# for interoperability with automake-1.9.6 from autoconf-2.62. -# Remove this macro when we can assume autoconf >= 2.62 or -# autoconf >= 2.60 && automake >= 1.10. -m4_ifdef([AC_PROG_MKDIR_P], [ - dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. - m4_define([AC_PROG_MKDIR_P], - m4_defn([AC_PROG_MKDIR_P])[ - AC_SUBST([MKDIR_P])])], [ - dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. - AC_DEFUN_ONCE([AC_PROG_MKDIR_P], - [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])])]) - -# AC_C_RESTRICT -# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, -# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ -# works. -# This definition can be removed once autoconf >= 2.62 can be assumed. -m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ -AC_DEFUN([AC_C_RESTRICT], -[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], - [ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - }]], - [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], - [ac_cv_c_restrict=$ac_kw]) - test "$ac_cv_c_restrict" != no && break - done - ]) - AH_VERBATIM([restrict], -[/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict, even - though the corresponding Sun C compiler does, which causes - "#define restrict _Restrict" in the previous line. Perhaps some future - version of Sun C++ will work with _Restrict; if so, it'll probably - define __RESTRICT, just as Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -#endif]) - case $ac_cv_c_restrict in - restrict) ;; - no) AC_DEFINE([restrict], []) ;; - *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; - esac -]) -]) - -# gl_BIGENDIAN -# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. -# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some -# macros invoke AC_C_BIGENDIAN with arguments. -AC_DEFUN([gl_BIGENDIAN], -[ - AC_C_BIGENDIAN -]) - -# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) -# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not -# output a spurious "(cached)" mark in the midst of other configure output. -# This macro should be used instead of AC_CACHE_VAL when it is not surrounded -# by an AC_MSG_CHECKING/AC_MSG_RESULT pair. -AC_DEFUN([gl_CACHE_VAL_SILENT], -[ - saved_as_echo_n="$as_echo_n" - as_echo_n=':' - AC_CACHE_VAL([$1], [$2]) - as_echo_n="$saved_as_echo_n" -]) diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4 deleted file mode 100644 index 58358c567a..0000000000 --- a/lib/gl/m4/gnulib-comp.m4 +++ /dev/null @@ -1,593 +0,0 @@ -# DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# -# This file represents the compiled summary of the specification in -# gnulib-cache.m4. It lists the computed macro invocations that need -# to be invoked from configure.ac. -# In projects that use version control, this file can be treated like -# other built files. - - -# This macro should be invoked from ./configure.ac, in the section -# "Checks for programs", right after AC_PROG_CC, and certainly before -# any checks for libraries, header files, types and library functions. -AC_DEFUN([lgl_EARLY], -[ - m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace - m4_pattern_allow([^gl_ES$])dnl a valid locale name - m4_pattern_allow([^gl_LIBOBJS$])dnl a variable - m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable - AC_REQUIRE([AC_PROG_RANLIB]) - # Code from module alignof: - # Code from module alloca-opt: - # Code from module alloca-opt-tests: - # Code from module arg-nonnull: - # Code from module binary-io: - # Code from module binary-io-tests: - # Code from module byteswap: - # Code from module byteswap-tests: - # Code from module c++defs: - # Code from module c-ctype: - # Code from module c-ctype-tests: - # Code from module close-hook: - # Code from module errno: - # Code from module errno-tests: - # Code from module extensions: - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - # Code from module float: - # Code from module fseeko: - AC_REQUIRE([AC_FUNC_FSEEKO]) - # Code from module fseeko-tests: - # Code from module ftello: - AC_REQUIRE([AC_FUNC_FSEEKO]) - # Code from module ftello-tests: - # Code from module func: - # Code from module func-tests: - # Code from module getpagesize: - # Code from module gettext: - # Code from module gettext-h: - # Code from module havelib: - # Code from module include_next: - # Code from module intprops: - # Code from module lib-msvc-compat: - # Code from module lib-symbol-versions: - # Code from module lseek: - # Code from module malloc-posix: - # Code from module memchr: - # Code from module memchr-tests: - # Code from module memmem-simple: - # Code from module minmax: - # Code from module multiarch: - # Code from module netdb: - # Code from module netdb-tests: - # Code from module read-file: - # Code from module read-file-tests: - # Code from module realloc-posix: - # Code from module size_max: - # Code from module snprintf: - # Code from module snprintf-tests: - # Code from module socketlib: - # Code from module sockets: - # Code from module sockets-tests: - # Code from module socklen: - # Code from module stdbool: - # Code from module stdbool-tests: - # Code from module stddef: - # Code from module stddef-tests: - # Code from module stdint: - # Code from module stdint-tests: - # Code from module stdio: - # Code from module stdio-tests: - # Code from module stdlib: - # Code from module stdlib-tests: - # Code from module strcase: - # Code from module string: - # Code from module string-tests: - # Code from module strings: - # Code from module strings-tests: - # Code from module strverscmp: - # Code from module strverscmp-tests: - # Code from module sys_socket: - # Code from module sys_socket-tests: - # Code from module sys_stat: - # Code from module sys_stat-tests: - # Code from module time: - # Code from module time-tests: - # Code from module time_r: - # Code from module unistd: - # Code from module unistd-tests: - # Code from module vasnprintf: - # Code from module vasnprintf-tests: - # Code from module vasprintf: - # Code from module vasprintf-tests: - # Code from module verify: - # Code from module verify-tests: - # Code from module vsnprintf: - # Code from module vsnprintf-tests: - # Code from module warn-on-use: - # Code from module wchar: - # Code from module wchar-tests: - # Code from module xsize: -]) - -# This macro should be invoked from ./configure.ac, in the section -# "Check for header files, types and library functions". -AC_DEFUN([lgl_INIT], -[ - AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) - gl_cond_libtool=true - gl_m4_base='gl/m4' - m4_pushdef([AC_LIBOBJ], m4_defn([lgl_LIBOBJ])) - m4_pushdef([AC_REPLACE_FUNCS], m4_defn([lgl_REPLACE_FUNCS])) - m4_pushdef([AC_LIBSOURCES], m4_defn([lgl_LIBSOURCES])) - m4_pushdef([lgl_LIBSOURCES_LIST], []) - m4_pushdef([lgl_LIBSOURCES_DIR], []) - gl_COMMON - gl_source_base='gl' - # Code from module alignof: - # Code from module alloca-opt: - gl_FUNC_ALLOCA - # Code from module arg-nonnull: - # Code from module byteswap: - gl_BYTESWAP - # Code from module c++defs: - # Code from module c-ctype: - # Code from module close-hook: - # Code from module errno: - gl_HEADER_ERRNO_H - # Code from module extensions: - # Code from module float: - gl_FLOAT_H - # Code from module fseeko: - gl_FUNC_FSEEKO - gl_STDIO_MODULE_INDICATOR([fseeko]) - # Code from module ftello: - gl_FUNC_FTELLO - gl_STDIO_MODULE_INDICATOR([ftello]) - # Code from module func: - gl_FUNC - # Code from module gettext: - dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. - AM_GNU_GETTEXT_VERSION([0.18.1]) - # Code from module gettext-h: - AC_SUBST([LIBINTL]) - AC_SUBST([LTLIBINTL]) - # Code from module havelib: - # Code from module include_next: - # Code from module lib-msvc-compat: - gl_LD_OUTPUT_DEF - # Code from module lib-symbol-versions: - gl_LD_VERSION_SCRIPT - # Code from module lseek: - gl_FUNC_LSEEK - gl_UNISTD_MODULE_INDICATOR([lseek]) - # Code from module malloc-posix: - gl_FUNC_MALLOC_POSIX - gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - # Code from module memchr: - gl_FUNC_MEMCHR - gl_STRING_MODULE_INDICATOR([memchr]) - # Code from module memmem-simple: - gl_FUNC_MEMMEM_SIMPLE - gl_STRING_MODULE_INDICATOR([memmem]) - # Code from module minmax: - gl_MINMAX - # Code from module multiarch: - gl_MULTIARCH - # Code from module netdb: - gl_HEADER_NETDB - # Code from module read-file: - gl_FUNC_READ_FILE - # Code from module realloc-posix: - gl_FUNC_REALLOC_POSIX - gl_STDLIB_MODULE_INDICATOR([realloc-posix]) - # Code from module size_max: - gl_SIZE_MAX - # Code from module snprintf: - gl_FUNC_SNPRINTF - gl_STDIO_MODULE_INDICATOR([snprintf]) - # Code from module socketlib: - gl_SOCKETLIB - # Code from module sockets: - gl_SOCKETS - # Code from module socklen: - gl_TYPE_SOCKLEN_T - # Code from module stdbool: - AM_STDBOOL_H - # Code from module stddef: - gl_STDDEF_H - # Code from module stdint: - gl_STDINT_H - # Code from module stdio: - gl_STDIO_H - # Code from module stdlib: - gl_STDLIB_H - # Code from module strcase: - gl_STRCASE - # Code from module string: - gl_HEADER_STRING_H - # Code from module strings: - gl_HEADER_STRINGS_H - # Code from module strverscmp: - gl_FUNC_STRVERSCMP - gl_STRING_MODULE_INDICATOR([strverscmp]) - # Code from module sys_socket: - gl_HEADER_SYS_SOCKET - AC_PROG_MKDIR_P - # Code from module sys_stat: - gl_HEADER_SYS_STAT_H - AC_PROG_MKDIR_P - # Code from module time: - gl_HEADER_TIME_H - # Code from module time_r: - gl_TIME_R - gl_TIME_MODULE_INDICATOR([time_r]) - # Code from module unistd: - gl_UNISTD_H - # Code from module vasnprintf: - gl_FUNC_VASNPRINTF - # Code from module vasprintf: - gl_FUNC_VASPRINTF - gl_STDIO_MODULE_INDICATOR([vasprintf]) - m4_ifdef([AM_XGETTEXT_OPTION], - [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) - AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) - # Code from module verify: - # Code from module vsnprintf: - gl_FUNC_VSNPRINTF - gl_STDIO_MODULE_INDICATOR([vsnprintf]) - # Code from module warn-on-use: - # Code from module wchar: - gl_WCHAR_H - # Code from module xsize: - gl_XSIZE - # End of code from modules - m4_ifval(lgl_LIBSOURCES_LIST, [ - m4_syscmd([test ! -d ]m4_defn([lgl_LIBSOURCES_DIR])[ || - for gl_file in ]lgl_LIBSOURCES_LIST[ ; do - if test ! -r ]m4_defn([lgl_LIBSOURCES_DIR])[/$gl_file ; then - echo "missing file ]m4_defn([lgl_LIBSOURCES_DIR])[/$gl_file" >&2 - exit 1 - fi - done])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) - m4_popdef([lgl_LIBSOURCES_DIR]) - m4_popdef([lgl_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) - m4_popdef([AC_REPLACE_FUNCS]) - m4_popdef([AC_LIBOBJ]) - AC_CONFIG_COMMANDS_PRE([ - lgl_libobjs= - lgl_ltlibobjs= - if test -n "$lgl_LIBOBJS"; then - # Remove the extension. - sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $lgl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do - lgl_libobjs="$lgl_libobjs $i.$ac_objext" - lgl_ltlibobjs="$lgl_ltlibobjs $i.lo" - done - fi - AC_SUBST([lgl_LIBOBJS], [$lgl_libobjs]) - AC_SUBST([lgl_LTLIBOBJS], [$lgl_ltlibobjs]) - ]) - gltests_libdeps= - gltests_ltlibdeps= - m4_pushdef([AC_LIBOBJ], m4_defn([lgltests_LIBOBJ])) - m4_pushdef([AC_REPLACE_FUNCS], m4_defn([lgltests_REPLACE_FUNCS])) - m4_pushdef([AC_LIBSOURCES], m4_defn([lgltests_LIBSOURCES])) - m4_pushdef([lgltests_LIBSOURCES_LIST], []) - m4_pushdef([lgltests_LIBSOURCES_DIR], []) - gl_COMMON - gl_source_base='gl/tests' -changequote(,)dnl - lgltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS -changequote([, ])dnl - AC_SUBST([lgltests_WITNESS]) - gl_module_indicator_condition=$lgltests_WITNESS - m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) - gl_FUNC_UNGETC_WORKS - gl_FUNC_UNGETC_WORKS - gl_FUNC_GETPAGESIZE - gl_UNISTD_MODULE_INDICATOR([getpagesize]) - dnl Check for prerequisites for memory fence checks. - gl_FUNC_MMAP_ANON - AC_CHECK_HEADERS_ONCE([sys/mman.h]) - AC_CHECK_FUNCS_ONCE([mprotect]) - gt_TYPE_WCHAR_T - gt_TYPE_WINT_T - AC_CHECK_FUNCS_ONCE([shutdown]) - m4_popdef([gl_MODULE_INDICATOR_CONDITION]) - m4_ifval(lgltests_LIBSOURCES_LIST, [ - m4_syscmd([test ! -d ]m4_defn([lgltests_LIBSOURCES_DIR])[ || - for gl_file in ]lgltests_LIBSOURCES_LIST[ ; do - if test ! -r ]m4_defn([lgltests_LIBSOURCES_DIR])[/$gl_file ; then - echo "missing file ]m4_defn([lgltests_LIBSOURCES_DIR])[/$gl_file" >&2 - exit 1 - fi - done])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) - m4_popdef([lgltests_LIBSOURCES_DIR]) - m4_popdef([lgltests_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) - m4_popdef([AC_REPLACE_FUNCS]) - m4_popdef([AC_LIBOBJ]) - AC_CONFIG_COMMANDS_PRE([ - lgltests_libobjs= - lgltests_ltlibobjs= - if test -n "$lgltests_LIBOBJS"; then - # Remove the extension. - sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $lgltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do - lgltests_libobjs="$lgltests_libobjs $i.$ac_objext" - lgltests_ltlibobjs="$lgltests_ltlibobjs $i.lo" - done - fi - AC_SUBST([lgltests_LIBOBJS], [$lgltests_libobjs]) - AC_SUBST([lgltests_LTLIBOBJS], [$lgltests_ltlibobjs]) - ]) - LIBTESTS_LIBDEPS="$gltests_libdeps" - AC_SUBST([LIBTESTS_LIBDEPS]) -]) - -# Like AC_LIBOBJ, except that the module name goes -# into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_LIBOBJ], [ - AS_LITERAL_IF([$1], [lgl_LIBSOURCES([$1.c])])dnl - lgl_LIBOBJS="$lgl_LIBOBJS $1.$ac_objext" -]) - -# Like AC_REPLACE_FUNCS, except that the module name goes -# into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_REPLACE_FUNCS], [ - m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl - AC_CHECK_FUNCS([$1], , [lgl_LIBOBJ($ac_func)]) -]) - -# Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parameterization, -# and alloca is special cased (for the alloca-opt module). -# We could also entirely rely on EXTRA_lib..._SOURCES. -AC_DEFUN([lgl_LIBSOURCES], [ - m4_foreach([_gl_NAME], [$1], [ - m4_if(_gl_NAME, [alloca.c], [], [ - m4_define([lgl_LIBSOURCES_DIR], [gl]) - m4_append([lgl_LIBSOURCES_LIST], _gl_NAME, [ ]) - ]) - ]) -]) - -# Like AC_LIBOBJ, except that the module name goes -# into lgltests_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgltests_LIBOBJ], [ - AS_LITERAL_IF([$1], [lgltests_LIBSOURCES([$1.c])])dnl - lgltests_LIBOBJS="$lgltests_LIBOBJS $1.$ac_objext" -]) - -# Like AC_REPLACE_FUNCS, except that the module name goes -# into lgltests_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgltests_REPLACE_FUNCS], [ - m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl - AC_CHECK_FUNCS([$1], , [lgltests_LIBOBJ($ac_func)]) -]) - -# Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parameterization, -# and alloca is special cased (for the alloca-opt module). -# We could also entirely rely on EXTRA_lib..._SOURCES. -AC_DEFUN([lgltests_LIBSOURCES], [ - m4_foreach([_gl_NAME], [$1], [ - m4_if(_gl_NAME, [alloca.c], [], [ - m4_define([lgltests_LIBSOURCES_DIR], [gl/tests]) - m4_append([lgltests_LIBSOURCES_LIST], _gl_NAME, [ ]) - ]) - ]) -]) - -# This macro records the list of files which have been installed by -# gnulib-tool and may be removed by future gnulib-tool invocations. -AC_DEFUN([lgl_FILE_LIST], [ - build-aux/arg-nonnull.h - build-aux/c++defs.h - build-aux/config.rpath - build-aux/warn-on-use.h - lib/alignof.h - lib/alloca.in.h - lib/asnprintf.c - lib/asprintf.c - lib/byteswap.in.h - lib/c-ctype.c - lib/c-ctype.h - lib/close-hook.c - lib/close-hook.h - lib/errno.in.h - lib/float+.h - lib/float.in.h - lib/fseeko.c - lib/ftello.c - lib/gettext.h - lib/lseek.c - lib/malloc.c - lib/memchr.c - lib/memchr.valgrind - lib/memmem.c - lib/minmax.h - lib/netdb.in.h - lib/printf-args.c - lib/printf-args.h - lib/printf-parse.c - lib/printf-parse.h - lib/read-file.c - lib/read-file.h - lib/realloc.c - lib/size_max.h - lib/snprintf.c - lib/sockets.c - lib/sockets.h - lib/stdbool.in.h - lib/stddef.in.h - lib/stdint.in.h - lib/stdio-impl.h - lib/stdio-write.c - lib/stdio.in.h - lib/stdlib.in.h - lib/str-two-way.h - lib/strcasecmp.c - lib/string.in.h - lib/strings.in.h - lib/strncasecmp.c - lib/strverscmp.c - lib/sys_socket.in.h - lib/sys_stat.in.h - lib/time.in.h - lib/time_r.c - lib/unistd.in.h - lib/vasnprintf.c - lib/vasnprintf.h - lib/vasprintf.c - lib/verify.h - lib/vsnprintf.c - lib/w32sock.h - lib/wchar.in.h - lib/xsize.h - m4/00gnulib.m4 - m4/alloca.m4 - m4/asm-underscore.m4 - m4/byteswap.m4 - m4/codeset.m4 - m4/errno_h.m4 - m4/extensions.m4 - m4/fcntl-o.m4 - m4/float_h.m4 - m4/fseeko.m4 - m4/ftello.m4 - m4/func.m4 - m4/getpagesize.m4 - m4/gettext.m4 - m4/glibc2.m4 - m4/glibc21.m4 - m4/gnulib-common.m4 - m4/iconv.m4 - m4/include_next.m4 - m4/intdiv0.m4 - m4/intl.m4 - m4/intldir.m4 - m4/intlmacosx.m4 - m4/intmax.m4 - m4/intmax_t.m4 - m4/inttypes-pri.m4 - m4/inttypes_h.m4 - m4/lcmessage.m4 - m4/ld-output-def.m4 - m4/ld-version-script.m4 - m4/lib-ld.m4 - m4/lib-link.m4 - m4/lib-prefix.m4 - m4/lock.m4 - m4/longlong.m4 - m4/lseek.m4 - m4/malloc.m4 - m4/memchr.m4 - m4/memmem.m4 - m4/minmax.m4 - m4/mmap-anon.m4 - m4/multiarch.m4 - m4/netdb_h.m4 - m4/nls.m4 - m4/po.m4 - m4/printf-posix.m4 - m4/printf.m4 - m4/progtest.m4 - m4/read-file.m4 - m4/realloc.m4 - m4/size_max.m4 - m4/snprintf.m4 - m4/socketlib.m4 - m4/sockets.m4 - m4/socklen.m4 - m4/sockpfaf.m4 - m4/stdbool.m4 - m4/stddef_h.m4 - m4/stdint.m4 - m4/stdint_h.m4 - m4/stdio_h.m4 - m4/stdlib_h.m4 - m4/strcase.m4 - m4/string_h.m4 - m4/strings_h.m4 - m4/strverscmp.m4 - m4/sys_socket_h.m4 - m4/sys_stat_h.m4 - m4/threadlib.m4 - m4/time_h.m4 - m4/time_r.m4 - m4/uintmax_t.m4 - m4/ungetc.m4 - m4/unistd_h.m4 - m4/vasnprintf.m4 - m4/vasprintf.m4 - m4/visibility.m4 - m4/vsnprintf.m4 - m4/warn-on-use.m4 - m4/wchar_h.m4 - m4/wchar_t.m4 - m4/wint_t.m4 - m4/xsize.m4 - tests/init.sh - tests/macros.h - tests/signature.h - tests/test-alloca-opt.c - tests/test-binary-io.c - tests/test-binary-io.sh - tests/test-byteswap.c - tests/test-c-ctype.c - tests/test-errno.c - tests/test-fseeko.c - tests/test-fseeko.sh - tests/test-fseeko2.sh - tests/test-ftello.c - tests/test-ftello.sh - tests/test-ftello2.sh - tests/test-ftello3.c - tests/test-func.c - tests/test-memchr.c - tests/test-netdb.c - tests/test-read-file.c - tests/test-snprintf.c - tests/test-sockets.c - tests/test-stdbool.c - tests/test-stddef.c - tests/test-stdint.c - tests/test-stdio.c - tests/test-stdlib.c - tests/test-string.c - tests/test-strings.c - tests/test-strverscmp.c - tests/test-sys_socket.c - tests/test-sys_stat.c - tests/test-sys_wait.h - tests/test-time.c - tests/test-unistd.c - tests/test-vasnprintf.c - tests/test-vasprintf.c - tests/test-verify.c - tests/test-verify.sh - tests/test-vsnprintf.c - tests/test-wchar.c - tests/zerosize-ptr.h - tests=lib/binary-io.h - tests=lib/dummy.c - tests=lib/getpagesize.c - tests=lib/intprops.h -]) diff --git a/lib/gl/m4/gnulib-tool.m4 b/lib/gl/m4/gnulib-tool.m4 deleted file mode 100644 index 69e7733b99..0000000000 --- a/lib/gl/m4/gnulib-tool.m4 +++ /dev/null @@ -1,57 +0,0 @@ -# gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 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. - -dnl The following macros need not be invoked explicitly. -dnl Invoking them does nothing except to declare default arguments -dnl for "gnulib-tool --import". - -dnl Usage: gl_LOCAL_DIR([DIR]) -AC_DEFUN([gl_LOCAL_DIR], []) - -dnl Usage: gl_MODULES([module1 module2 ...]) -AC_DEFUN([gl_MODULES], []) - -dnl Usage: gl_AVOID([module1 module2 ...]) -AC_DEFUN([gl_AVOID], []) - -dnl Usage: gl_SOURCE_BASE([DIR]) -AC_DEFUN([gl_SOURCE_BASE], []) - -dnl Usage: gl_M4_BASE([DIR]) -AC_DEFUN([gl_M4_BASE], []) - -dnl Usage: gl_PO_BASE([DIR]) -AC_DEFUN([gl_PO_BASE], []) - -dnl Usage: gl_DOC_BASE([DIR]) -AC_DEFUN([gl_DOC_BASE], []) - -dnl Usage: gl_TESTS_BASE([DIR]) -AC_DEFUN([gl_TESTS_BASE], []) - -dnl Usage: gl_WITH_TESTS -AC_DEFUN([gl_WITH_TESTS], []) - -dnl Usage: gl_LIB([LIBNAME]) -AC_DEFUN([gl_LIB], []) - -dnl Usage: gl_LGPL or gl_LGPL([VERSION]) -AC_DEFUN([gl_LGPL], []) - -dnl Usage: gl_MAKEFILE_NAME([FILENAME]) -AC_DEFUN([gl_MAKEFILE_NAME], []) - -dnl Usage: gl_LIBTOOL -AC_DEFUN([gl_LIBTOOL], []) - -dnl Usage: gl_MACRO_PREFIX([PREFIX]) -AC_DEFUN([gl_MACRO_PREFIX], []) - -dnl Usage: gl_PO_DOMAIN([DOMAIN]) -AC_DEFUN([gl_PO_DOMAIN], []) - -dnl Usage: gl_VC_FILES([BOOLEAN]) -AC_DEFUN([gl_VC_FILES], []) diff --git a/lib/gl/m4/iconv.m4 b/lib/gl/m4/iconv.m4 deleted file mode 100644 index 006c90780a..0000000000 --- a/lib/gl/m4/iconv.m4 +++ /dev/null @@ -1,268 +0,0 @@ -# iconv.m4 serial 17 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-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 From Bruno Haible. - -AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([iconv]) -]) - -AC_DEFUN([AM_ICONV_LINK], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - - AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <stdlib.h> -#include <iconv.h> - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_func_iconv=yes]) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <stdlib.h> -#include <iconv.h> - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_lib_iconv=yes] - [am_cv_func_iconv=yes]) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, - dnl Solaris 10. - am_save_LIBS="$LIBS" - if test $am_cv_lib_iconv = yes; then - LIBS="$LIBS $LIBICONV" - fi - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <iconv.h> -#include <string.h> -int main () -{ - int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ - { - iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); - if (cd_utf8_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\342\202\254"; /* EURO SIGN */ - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_utf8_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 1; - iconv_close (cd_utf8_to_88591); - } - } - /* Test against Solaris 10 bug: Failures are not distinguishable from - successful returns. */ - { - iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); - if (cd_ascii_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\263"; - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_ascii_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 2; - iconv_close (cd_ascii_to_88591); - } - } - /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304"; - static char buf[2] = { (char)0xDE, (char)0xAD }; - const char *inptr = input; - size_t inbytesleft = 1; - char *outptr = buf; - size_t outbytesleft = 1; - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - result |= 4; - iconv_close (cd_88591_to_utf8); - } - } -#if 0 /* This bug could be worked around by the caller. */ - /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char buf[50]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if ((int)res > 0) - result |= 8; - iconv_close (cd_88591_to_utf8); - } - } -#endif - /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is - provided. */ - if (/* Try standardized names. */ - iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) - /* Try IRIX, OSF/1 names. */ - && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) - /* Try AIX names. */ - && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) - /* Try HP-UX names. */ - && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - result |= 16; - return result; -}]])], - [am_cv_func_iconv_works=yes], - [am_cv_func_iconv_works=no], - [ -changequote(,)dnl - case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac -changequote([,])dnl - ]) - LIBS="$am_save_LIBS" - ]) - case "$am_cv_func_iconv_works" in - *no) am_func_iconv=no am_cv_lib_iconv=no ;; - *) am_func_iconv=yes ;; - esac - else - am_func_iconv=no am_cv_lib_iconv=no - fi - if test "$am_func_iconv" = yes; then - AC_DEFINE([HAVE_ICONV], [1], - [Define if you have the iconv() function and it works.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST([LIBICONV]) - AC_SUBST([LTLIBICONV]) -]) - -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like -dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". -dnl This is tricky because of the way 'aclocal' is implemented: -dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. -dnl Otherwise aclocal's initial scan pass would miss the macro definition. -dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. -dnl Otherwise aclocal would emit many "Use of uninitialized value $1" -dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <stdlib.h> -#include <iconv.h> -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], - [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 -]) diff --git a/lib/gl/m4/include_next.m4 b/lib/gl/m4/include_next.m4 deleted file mode 100644 index e37eb0567d..0000000000 --- a/lib/gl/m4/include_next.m4 +++ /dev/null @@ -1,217 +0,0 @@ -# include_next.m4 serial 16 -dnl Copyright (C) 2006-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 From Paul Eggert and Derek Price. - -dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. -dnl -dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to -dnl 'include' otherwise. -dnl -dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler -dnl supports it in the special case that it is the first include directive in -dnl the given file, or to 'include' otherwise. -dnl -dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, -dnl so as to avoid GCC warnings when the gcc option -pedantic is used. -dnl '#pragma GCC system_header' has the same effect as if the file was found -dnl through the include search path specified with '-isystem' options (as -dnl opposed to the search path specified with '-I' options). Namely, gcc -dnl does not warn about some things, and on some systems (Solaris and Interix) -dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side -dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead -dnl of plain '__STDC__'. -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_LANG_PREPROC_REQUIRE() - AC_CACHE_CHECK([whether the preprocessor supports include_next], - [gl_cv_have_include_next], - [rm -rf conftestd1a conftestd1b conftestd2 - mkdir conftestd1a conftestd1b conftestd2 - dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on - dnl AIX 6.1 support include_next when used as first preprocessor directive - dnl in a file, but not when preceded by another include directive. Check - dnl for this bug by including <stdio.h>. - dnl Additionally, with this same compiler, include_next is a no-op when - dnl used in a header file that was included by specifying its absolute - dnl file name. Despite these two bugs, include_next is used in the - dnl compiler's <math.h>. By virtue of the second bug, we need to use - dnl include_next as well in this case. - cat <<EOF > conftestd1a/conftest.h -#define DEFINED_IN_CONFTESTD1 -#include_next <conftest.h> -#ifdef DEFINED_IN_CONFTESTD2 -int foo; -#else -#error "include_next doesn't work" -#endif -EOF - cat <<EOF > conftestd1b/conftest.h -#define DEFINED_IN_CONFTESTD1 -#include <stdio.h> -#include_next <conftest.h> -#ifdef DEFINED_IN_CONFTESTD2 -int foo; -#else -#error "include_next doesn't work" -#endif -EOF - cat <<EOF > conftestd2/conftest.h -#ifndef DEFINED_IN_CONFTESTD1 -#error "include_next test doesn't work" -#endif -#define DEFINED_IN_CONFTESTD2 -EOF - gl_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" -dnl We intentionally avoid using AC_LANG_SOURCE here. - AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], - [gl_cv_have_include_next=yes], - [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" - AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], - [gl_cv_have_include_next=buggy], - [gl_cv_have_include_next=no]) - ]) - CPPFLAGS="$gl_save_CPPFLAGS" - rm -rf conftestd1a conftestd1b conftestd2 - ]) - PRAGMA_SYSTEM_HEADER= - if test $gl_cv_have_include_next = yes; then - INCLUDE_NEXT=include_next - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next - if test -n "$GCC"; then - PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' - fi - else - if test $gl_cv_have_include_next = buggy; then - INCLUDE_NEXT=include - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next - else - INCLUDE_NEXT=include - INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include - fi - fi - AC_SUBST([INCLUDE_NEXT]) - AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) - 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 ...) -# ------------------------------------------ -# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be -# '<foo.h>'; otherwise define it to be -# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. -# Also, if #include_next works as first preprocessing directive in a file, -# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to -# be -# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. -# That way, a header file with the following line: -# #@INCLUDE_NEXT@ @NEXT_FOO_H@ -# or -# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ -# behaves (after sed substitution) as if it contained -# #include_next <foo.h> -# even if the compiler does not support include_next. -# The three "///" are to pacify Sun C 5.8, which otherwise would say -# "warning: #include of /usr/include/... may be non-portable". -# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. -# Note: This macro assumes that the header file is not empty after -# preprocessing, i.e. it does not only define preprocessor macros but also -# provides some type/enum definitions or function/variable declarations. -AC_DEFUN([gl_CHECK_NEXT_HEADERS], -[ - AC_REQUIRE([gl_INCLUDE_NEXT]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADERS_ONCE([$1]) - - m4_foreach_w([gl_HEADER_NAME], [$1], - [AS_VAR_PUSHDEF([gl_next_header], - [gl_cv_next_]m4_defn([gl_HEADER_NAME])) - if test $gl_cv_have_include_next = yes; then - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - else - AC_CACHE_CHECK( - [absolute name of <]m4_defn([gl_HEADER_NAME])[>], - m4_defn([gl_next_header]), - [AS_VAR_PUSHDEF([gl_header_exists], - [ac_cv_header_]m4_defn([gl_HEADER_NAME])) - if test AS_VAR_GET(gl_header_exists) = yes; then - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - dnl AIX "xlc -E" and "cc -E" omit #line directives for header files - dnl that contain only a #include of other header files and no - dnl non-comment tokens of their own. This leads to a failure to - dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> - dnl and others. The workaround is to force preservation of comments - dnl through option -C. This ensures all necessary #line directives - dnl are present. GCC supports option -C as well. - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - dnl eval is necessary to expand gl_absname_cpp. - dnl Ultrix and Pyramid sh refuse to redirect output of eval, - dnl so use subshell. - AS_VAR_SET([gl_next_header], - ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) - else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - fi - AS_VAR_POPDEF([gl_header_exists])]) - fi - AC_SUBST( - AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), - [AS_VAR_GET([gl_next_header])]) - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'gl_HEADER_NAME'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) - fi - AC_SUBST( - AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), - [$gl_next_as_first_directive]) - AS_VAR_POPDEF([gl_next_header])]) -]) - -# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; -# this fallback is safe for all earlier autoconf versions. -m4_define_default([AC_LANG_DEFINES_PROVIDED]) diff --git a/lib/gl/m4/intdiv0.m4 b/lib/gl/m4/intdiv0.m4 deleted file mode 100644 index 562882defe..0000000000 --- a/lib/gl/m4/intdiv0.m4 +++ /dev/null @@ -1,87 +0,0 @@ -# intdiv0.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2002, 2007-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 From Bruno Haible. - -AC_DEFUN([gt_INTDIV0], -[ - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - - AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], - gt_cv_int_divbyzero_sigfpe, - [ - gt_cv_int_divbyzero_sigfpe= -changequote(,)dnl - case "$host_os" in - macos* | darwin[6-9]* | darwin[1-9][0-9]*) - # On MacOS X 10.2 or newer, just assume the same as when cross- - # compiling. If we were to perform the real test, 1 Crash Report - # dialog window would pop up. - case "$host_cpu" in - i[34567]86 | x86_64) - gt_cv_int_divbyzero_sigfpe="guessing yes" ;; - esac - ;; - esac -changequote([,])dnl - if test -z "$gt_cv_int_divbyzero_sigfpe"; then - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdlib.h> -#include <signal.h> - -static void -sigfpe_handler (int sig) -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () -{ - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (2); -} -]])], - [gt_cv_int_divbyzero_sigfpe=yes], - [gt_cv_int_divbyzero_sigfpe=no], - [ - # Guess based on the CPU. -changequote(,)dnl - case "$host_cpu" in - alpha* | i[34567]86 | x86_64 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac -changequote([,])dnl - ]) - fi - ]) - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac - AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value], - [Define if integer division by zero raises signal SIGFPE.]) -]) diff --git a/lib/gl/m4/intl.m4 b/lib/gl/m4/intl.m4 deleted file mode 100644 index d84bc4a9b4..0000000000 --- a/lib/gl/m4/intl.m4 +++ /dev/null @@ -1,300 +0,0 @@ -# intl.m4 serial 17b -dnl Copyright (C) 1995-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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009. - -AC_PREREQ([2.53]) - -dnl Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -AC_DEFUN([AM_INTL_SUBDIR], -[ - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([gt_GLIBC2])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([gl_VISIBILITY])dnl - AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl - AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl - AC_REQUIRE([gt_TYPE_WCHAR_T])dnl - AC_REQUIRE([gt_TYPE_WINT_T])dnl - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gt_TYPE_INTMAX_T]) - AC_REQUIRE([gt_PRINTF_POSIX]) - AC_REQUIRE([gl_GLIBC21])dnl - AC_REQUIRE([gl_XSIZE])dnl - AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl - AC_REQUIRE([gt_INTL_MACOSX])dnl - - dnl Support for automake's --enable-silent-rules. - case "$enable_silent_rules" in - yes) INTL_DEFAULT_VERBOSITY=0;; - no) INTL_DEFAULT_VERBOSITY=1;; - *) INTL_DEFAULT_VERBOSITY=1;; - esac - AC_SUBST([INTL_DEFAULT_VERBOSITY]) - - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], - [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) - ]) - AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) - AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ - snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) - - dnl Use the _snprintf function only if it is declared (because on NetBSD it - dnl is defined as a weak alias of snprintf; we prefer to use the latter). - gt_CHECK_DECL(_snprintf, [#include <stdio.h>]) - gt_CHECK_DECL(_snwprintf, [#include <stdio.h>]) - - dnl Use the *_unlocked functions only if they are declared. - dnl (because some of them were defined without being declared in Solaris - dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built - dnl on Solaris 2.5.1 to run on Solaris 2.6). - dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. - gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>]) - - case $gt_cv_func_printf_posix in - *yes) HAVE_POSIX_PRINTF=1 ;; - *) HAVE_POSIX_PRINTF=0 ;; - esac - AC_SUBST([HAVE_POSIX_PRINTF]) - if test "$ac_cv_func_asprintf" = yes; then - HAVE_ASPRINTF=1 - else - HAVE_ASPRINTF=0 - fi - AC_SUBST([HAVE_ASPRINTF]) - if test "$ac_cv_func_snprintf" = yes; then - HAVE_SNPRINTF=1 - else - HAVE_SNPRINTF=0 - fi - AC_SUBST([HAVE_SNPRINTF]) - if test "$ac_cv_func_newlocale" = yes; then - HAVE_NEWLOCALE=1 - else - HAVE_NEWLOCALE=0 - fi - AC_SUBST([HAVE_NEWLOCALE]) - if test "$ac_cv_func_wprintf" = yes; then - HAVE_WPRINTF=1 - else - HAVE_WPRINTF=0 - fi - AC_SUBST([HAVE_WPRINTF]) - - AM_LANGINFO_CODESET - gt_LC_MESSAGES - - dnl Compilation on mingw and Cygwin needs special Makefile rules, because - dnl 1. when we install a shared library, we must arrange to export - dnl auxiliary pointer variables for every exported variable, - dnl 2. when we install a shared library and a static library simultaneously, - dnl the include file specifies __declspec(dllimport) and therefore we - dnl must arrange to define the auxiliary pointer variables for the - dnl exported variables _also_ in the static library. - if test "$enable_shared" = yes; then - case "$host_os" in - mingw* | cygwin*) is_woe32dll=yes ;; - *) is_woe32dll=no ;; - esac - else - is_woe32dll=no - fi - WOE32DLL=$is_woe32dll - AC_SUBST([WOE32DLL]) - - dnl On mingw and Cygwin, we can activate special Makefile rules which add - dnl version information to the shared libraries and executables. - case "$host_os" in - mingw* | cygwin*) is_woe32=yes ;; - *) is_woe32=no ;; - esac - WOE32=$is_woe32 - AC_SUBST([WOE32]) - if test $WOE32 = yes; then - dnl Check for a program that compiles Windows resource files. - AC_CHECK_TOOL([WINDRES], [windres]) - fi - - dnl Determine whether when creating a library, "-lc" should be passed to - dnl libtool or not. On many platforms, it is required for the libtool option - dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool - dnl in the *.la files - makes it impossible to create multithreaded programs, - dnl because libtool also reorders the -lc to come before the -pthread, and - dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>. - case "$host_os" in - hpux*) LTLIBC="" ;; - *) LTLIBC="-lc" ;; - esac - AC_SUBST([LTLIBC]) - - dnl Rename some macros and functions used for locking. - AH_BOTTOM([ -#define __libc_lock_t gl_lock_t -#define __libc_lock_define gl_lock_define -#define __libc_lock_define_initialized gl_lock_define_initialized -#define __libc_lock_init gl_lock_init -#define __libc_lock_lock gl_lock_lock -#define __libc_lock_unlock gl_lock_unlock -#define __libc_lock_recursive_t gl_recursive_lock_t -#define __libc_lock_define_recursive gl_recursive_lock_define -#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized -#define __libc_lock_init_recursive gl_recursive_lock_init -#define __libc_lock_lock_recursive gl_recursive_lock_lock -#define __libc_lock_unlock_recursive gl_recursive_lock_unlock -#define glthread_in_use libintl_thread_in_use -#define glthread_lock_init_func libintl_lock_init_func -#define glthread_lock_lock_func libintl_lock_lock_func -#define glthread_lock_unlock_func libintl_lock_unlock_func -#define glthread_lock_destroy_func libintl_lock_destroy_func -#define glthread_rwlock_init_multithreaded libintl_rwlock_init_multithreaded -#define glthread_rwlock_init_func libintl_rwlock_init_func -#define glthread_rwlock_rdlock_multithreaded libintl_rwlock_rdlock_multithreaded -#define glthread_rwlock_rdlock_func libintl_rwlock_rdlock_func -#define glthread_rwlock_wrlock_multithreaded libintl_rwlock_wrlock_multithreaded -#define glthread_rwlock_wrlock_func libintl_rwlock_wrlock_func -#define glthread_rwlock_unlock_multithreaded libintl_rwlock_unlock_multithreaded -#define glthread_rwlock_unlock_func libintl_rwlock_unlock_func -#define glthread_rwlock_destroy_multithreaded libintl_rwlock_destroy_multithreaded -#define glthread_rwlock_destroy_func libintl_rwlock_destroy_func -#define glthread_recursive_lock_init_multithreaded libintl_recursive_lock_init_multithreaded -#define glthread_recursive_lock_init_func libintl_recursive_lock_init_func -#define glthread_recursive_lock_lock_multithreaded libintl_recursive_lock_lock_multithreaded -#define glthread_recursive_lock_lock_func libintl_recursive_lock_lock_func -#define glthread_recursive_lock_unlock_multithreaded libintl_recursive_lock_unlock_multithreaded -#define glthread_recursive_lock_unlock_func libintl_recursive_lock_unlock_func -#define glthread_recursive_lock_destroy_multithreaded libintl_recursive_lock_destroy_multithreaded -#define glthread_recursive_lock_destroy_func libintl_recursive_lock_destroy_func -#define glthread_once_func libintl_once_func -#define glthread_once_singlethreaded libintl_once_singlethreaded -#define glthread_once_multithreaded libintl_once_multithreaded -]) -]) - - -dnl Checks for the core files of the intl subdirectory: -dnl dcigettext.c -dnl eval-plural.h -dnl explodename.c -dnl finddomain.c -dnl gettextP.h -dnl gmo.h -dnl hash-string.h hash-string.c -dnl l10nflist.c -dnl libgnuintl.h.in (except the *printf stuff) -dnl loadinfo.h -dnl loadmsgcat.c -dnl localealias.c -dnl log.c -dnl plural-exp.h plural-exp.c -dnl plural.y -dnl Used by libglocale. -AC_DEFUN([gt_INTL_SUBDIR_CORE], -[ - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([gt_INTDIV0])dnl - AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl - AC_REQUIRE([gt_INTTYPES_PRI])dnl - AC_REQUIRE([gl_LOCK])dnl - - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]], - [[]])], - [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], - [Define to 1 if the compiler understands __builtin_expect.])]) - - AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \ - stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \ - argz_stringify argz_next __fsetlocking]) - - dnl Use the *_unlocked functions only if they are declared. - dnl (because some of them were defined without being declared in Solaris - dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built - dnl on Solaris 2.5.1 to run on Solaris 2.6). - dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. - gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>]) - gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>]) - - AM_ICONV - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi -]) - - -dnl gt_CHECK_DECL(FUNC, INCLUDES) -dnl Check whether a function is declared. -AC_DEFUN([gt_CHECK_DECL], -[ - AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[$2]], - [[ -#ifndef $1 - char *p = (char *) $1; -#endif - ]])], - [ac_cv_have_decl_$1=yes], - [ac_cv_have_decl_$1=no])]) - if test $ac_cv_have_decl_$1 = yes; then - gt_value=1 - else - gt_value=0 - fi - AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], - [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) -]) diff --git a/lib/gl/m4/intldir.m4 b/lib/gl/m4/intldir.m4 deleted file mode 100644 index ebae76d361..0000000000 --- a/lib/gl/m4/intldir.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# intldir.m4 serial 2 (gettext-0.18) -dnl Copyright (C) 2006, 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. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -AC_PREREQ([2.52]) - -dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory. -AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], []) diff --git a/lib/gl/m4/intlmacosx.m4 b/lib/gl/m4/intlmacosx.m4 deleted file mode 100644 index f0f7c98726..0000000000 --- a/lib/gl/m4/intlmacosx.m4 +++ /dev/null @@ -1,56 +0,0 @@ -# intlmacosx.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2004-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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Checks for special options needed on MacOS X. -dnl Defines INTL_MACOSX_LIBS. -AC_DEFUN([gt_INTL_MACOSX], -[ - dnl Check for API introduced in MacOS X 10.2. - AC_CACHE_CHECK([for CFPreferencesCopyAppValue], - [gt_cv_func_CFPreferencesCopyAppValue], - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <CoreFoundation/CFPreferences.h>]], - [[CFPreferencesCopyAppValue(NULL, NULL)]])], - [gt_cv_func_CFPreferencesCopyAppValue=yes], - [gt_cv_func_CFPreferencesCopyAppValue=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then - AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], - [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) - fi - dnl Check for API introduced in MacOS X 10.3. - AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <CoreFoundation/CFLocale.h>]], - [[CFLocaleCopyCurrent();]])], - [gt_cv_func_CFLocaleCopyCurrent=yes], - [gt_cv_func_CFLocaleCopyCurrent=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], - [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) - fi - INTL_MACOSX_LIBS= - if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then - INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" - fi - AC_SUBST([INTL_MACOSX_LIBS]) -]) diff --git a/lib/gl/m4/intmax.m4 b/lib/gl/m4/intmax.m4 deleted file mode 100644 index 2c0f2afe59..0000000000 --- a/lib/gl/m4/intmax.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# intmax.m4 serial 6 (gettext-0.18.2) -dnl Copyright (C) 2002-2005, 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 From Bruno Haible. -dnl Test whether the system has the 'intmax_t' type, but don't attempt to -dnl find a replacement if it is lacking. - -AC_DEFUN([gt_TYPE_INTMAX_T], -[ - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <stddef.h> -#include <stdlib.h> -#if HAVE_STDINT_H_WITH_UINTMAX -#include <stdint.h> -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include <inttypes.h> -#endif - ]], - [[intmax_t x = -1; - return !x;]])], - [gt_cv_c_intmax_t=yes], - [gt_cv_c_intmax_t=no])]) - if test $gt_cv_c_intmax_t = yes; then - AC_DEFINE([HAVE_INTMAX_T], [1], - [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) - fi -]) diff --git a/lib/gl/m4/intmax_t.m4 b/lib/gl/m4/intmax_t.m4 deleted file mode 100644 index 493e4a9328..0000000000 --- a/lib/gl/m4/intmax_t.m4 +++ /dev/null @@ -1,67 +0,0 @@ -# intmax_t.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, -dnl Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -AC_PREREQ([2.53]) - -# Define intmax_t to 'long' or 'long long' -# if it is not already defined in <stdint.h> or <inttypes.h>. - -AC_DEFUN([gl_AC_TYPE_INTMAX_T], -[ - dnl For simplicity, we assume that a header file defines 'intmax_t' if and - dnl only if it defines 'uintmax_t'. - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long' \ - || ac_type='long' - AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], - [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) - else - AC_DEFINE([HAVE_INTMAX_T], [1], - [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) - fi -]) - -dnl An alternative would be to explicitly test for 'intmax_t'. - -AC_DEFUN([gt_AC_TYPE_INTMAX_T], -[ - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <stddef.h> -#include <stdlib.h> -#if HAVE_STDINT_H_WITH_UINTMAX -#include <stdint.h> -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include <inttypes.h> -#endif - ]], - [[intmax_t x = -1; return !x;]])], - [gt_cv_c_intmax_t=yes], - [gt_cv_c_intmax_t=no])]) - if test $gt_cv_c_intmax_t = yes; then - AC_DEFINE([HAVE_INTMAX_T], [1], - [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) - else - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long' \ - || ac_type='long' - AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], - [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) - fi -]) diff --git a/lib/gl/m4/inttypes-pri.m4 b/lib/gl/m4/inttypes-pri.m4 deleted file mode 100644 index ee96bcd978..0000000000 --- a/lib/gl/m4/inttypes-pri.m4 +++ /dev/null @@ -1,42 +0,0 @@ -# inttypes-pri.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1997-2002, 2006, 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 From Bruno Haible. - -AC_PREREQ([2.53]) - -# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* -# macros to non-string values. This is the case on AIX 4.3.3. - -AC_DEFUN([gt_INTTYPES_PRI], -[ - AC_CHECK_HEADERS([inttypes.h]) - if test $ac_cv_header_inttypes_h = yes; then - AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], - [gt_cv_inttypes_pri_broken], - [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <inttypes.h> -#ifdef PRId32 -char *p = PRId32; -#endif - ]], - [[]])], - [gt_cv_inttypes_pri_broken=no], - [gt_cv_inttypes_pri_broken=yes]) - ]) - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then - AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], - [Define if <inttypes.h> exists and defines unusable PRI* macros.]) - PRI_MACROS_BROKEN=1 - else - PRI_MACROS_BROKEN=0 - fi - AC_SUBST([PRI_MACROS_BROKEN]) -]) diff --git a/lib/gl/m4/inttypes_h.m4 b/lib/gl/m4/inttypes_h.m4 deleted file mode 100644 index 9d8f926926..0000000000 --- a/lib/gl/m4/inttypes_h.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# inttypes_h.m4 serial 10 -dnl Copyright (C) 1997-2004, 2006, 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 From Paul Eggert. - -# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, -# doesn't clash with <sys/types.h>, and declares uintmax_t. - -AC_DEFUN([gl_AC_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <sys/types.h> -#include <inttypes.h> - ]], - [[uintmax_t i = (uintmax_t) -1; return !i;]])], - [gl_cv_header_inttypes_h=yes], - [gl_cv_header_inttypes_h=no])]) - if test $gl_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], - [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, - and declares uintmax_t. ]) - fi -]) diff --git a/lib/gl/m4/lcmessage.m4 b/lib/gl/m4/lcmessage.m4 deleted file mode 100644 index 232da73b69..0000000000 --- a/lib/gl/m4/lcmessage.m4 +++ /dev/null @@ -1,35 +0,0 @@ -# lcmessage.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, -dnl 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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1995. - -# Check whether LC_MESSAGES is available in <locale.h>. - -AC_DEFUN([gt_LC_MESSAGES], -[ - AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <locale.h>]], - [[return LC_MESSAGES]])], - [gt_cv_val_LC_MESSAGES=yes], - [gt_cv_val_LC_MESSAGES=no])]) - if test $gt_cv_val_LC_MESSAGES = yes; then - AC_DEFINE([HAVE_LC_MESSAGES], [1], - [Define if your <locale.h> file defines LC_MESSAGES.]) - fi -]) diff --git a/lib/gl/m4/ld-output-def.m4 b/lib/gl/m4/ld-output-def.m4 deleted file mode 100644 index 2dc6bf5205..0000000000 --- a/lib/gl/m4/ld-output-def.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# ld-output-def.m4 serial 2 -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. - -dnl From Simon Josefsson - -# gl_LD_OUTPUT_DEF() -# ------------- -# Check if linker supports -Wl,--output-def and define automake -# conditional HAVE_LD_OUTPUT_DEF if it is. -AC_DEFUN([gl_LD_OUTPUT_DEF], -[ - AC_CACHE_CHECK([if gcc/ld supports -Wl,--output-def], - [gl_cv_ld_output_def], - [if test "$enable_shared" = no; then - gl_cv_ld_output_def="not needed, shared libraries are disabled" - else - gl_ldflags_save=$LDFLAGS - LDFLAGS="-Wl,--output-def,conftest.def" - AC_LINK_IFELSE([AC_LANG_PROGRAM([])], - [gl_cv_ld_output_def=yes], - [gl_cv_ld_output_def=no]) - rm -f conftest.def - LDFLAGS="$gl_ldflags_save" - fi]) - AM_CONDITIONAL([HAVE_LD_OUTPUT_DEF], test "x$gl_cv_ld_output_def" = "xyes") -]) diff --git a/lib/gl/m4/ld-version-script.m4 b/lib/gl/m4/ld-version-script.m4 deleted file mode 100644 index 8fd8c8995c..0000000000 --- a/lib/gl/m4/ld-version-script.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# ld-version-script.m4 serial 2 -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. - -dnl From Simon Josefsson - -# FIXME: The test below returns a false positive for mingw -# cross-compiles, 'local:' statements does not reduce number of -# exported symbols in a DLL. Use --disable-ld-version-script to work -# around the problem. - -# gl_LD_VERSION_SCRIPT -# -------------------- -# Check if LD supports linker scripts, and define automake conditional -# HAVE_LD_VERSION_SCRIPT if so. -AC_DEFUN([gl_LD_VERSION_SCRIPT], -[ - AC_ARG_ENABLE([ld-version-script], - AS_HELP_STRING([--enable-ld-version-script], - [enable linker version script (default is enabled when possible)]), - [have_ld_version_script=$enableval], []) - if test -z "$have_ld_version_script"; then - AC_MSG_CHECKING([if LD -Wl,--version-script works]) - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" - cat > conftest.map <<EOF -VERS_1 { - global: sym; -}; - -VERS_2 { - global: sym; -} VERS_1; -EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) - rm -f conftest.map - LDFLAGS="$save_LDFLAGS" - AC_MSG_RESULT($have_ld_version_script) - fi - AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") -]) diff --git a/lib/gl/m4/lib-ld.m4 b/lib/gl/m4/lib-ld.m4 deleted file mode 100644 index 294db72e13..0000000000 --- a/lib/gl/m4/lib-ld.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 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. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - acl_cv_prog_gnu_ld=yes ;; -*) - acl_cv_prog_gnu_ld=no ;; -esac]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH([gnu-ld], -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT([$LD]) -else - AC_MSG_RESULT([no]) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/lib/gl/m4/lib-link.m4 b/lib/gl/m4/lib-link.m4 deleted file mode 100644 index 2ea9d6d073..0000000000 --- a/lib/gl/m4/lib-link.m4 +++ /dev/null @@ -1,775 +0,0 @@ -# lib-link.m4 serial 25 (gettext-0.18.2) -dnl Copyright (C) 2001-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 From Bruno Haible. - -AC_PREREQ([2.54]) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - popdef([NAME]) - popdef([Name]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. The missing-message -dnl defaults to 'no' and may contain additional hints for the user. -dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} -dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, - dnl because these -l options might require -L options that are present in - dnl LIBS. -l options benefit only from the -L options listed before it. - dnl Otherwise, add it to the front of LIBS, because it may be a static - dnl library that depends on another static library that is present in LIBS. - dnl Static libraries benefit only from the static libraries listed after - dnl it. - case " $LIB[]NAME" in - *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; - *) LIBS="$LIB[]NAME $LIBS" ;; - esac - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[$3]], [[$4]])], - [ac_cv_lib[]Name=yes], - [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - LIB[]NAME[]_PREFIX= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - popdef([NAME]) - popdef([Name]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl acl_libext, -dnl acl_shlibext, -dnl acl_hardcode_libdir_flag_spec, -dnl acl_hardcode_libdir_separator, -dnl acl_hardcode_direct, -dnl acl_hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([P_A_C_K]) - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) diff --git a/lib/gl/m4/lib-prefix.m4 b/lib/gl/m4/lib-prefix.m4 deleted file mode 100644 index 1601ceaefd..0000000000 --- a/lib/gl/m4/lib-prefix.m4 +++ /dev/null @@ -1,224 +0,0 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 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 From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>. - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -]) diff --git a/lib/gl/m4/lock.m4 b/lib/gl/m4/lock.m4 deleted file mode 100644 index f71c66459e..0000000000 --- a/lib/gl/m4/lock.m4 +++ /dev/null @@ -1,41 +0,0 @@ -# lock.m4 serial 11 (gettext-0.18.2) -dnl Copyright (C) 2005-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 From Bruno Haible. - -AC_DEFUN([gl_LOCK], -[ - AC_REQUIRE([gl_THREADLIB]) - if test "$gl_threads_api" = posix; then - # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the - # pthread_rwlock_* functions. - AC_CHECK_TYPE([pthread_rwlock_t], - [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], - [Define if the POSIX multithreading library has read/write locks.])], - [], - [#include <pthread.h>]) - # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM( - [[#include <pthread.h>]], - [[ -#if __FreeBSD__ == 4 -error "No, in FreeBSD 4.0 recursive mutexes actually don't work." -#else -int x = (int)PTHREAD_MUTEX_RECURSIVE; -return !x; -#endif - ]])], - [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], - [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) - fi - gl_PREREQ_LOCK -]) - -# Prerequisites of lib/lock.c. -AC_DEFUN([gl_PREREQ_LOCK], [ - AC_REQUIRE([AC_C_INLINE]) -]) diff --git a/lib/gl/m4/longlong.m4 b/lib/gl/m4/longlong.m4 deleted file mode 100644 index cca3c1a90f..0000000000 --- a/lib/gl/m4/longlong.m4 +++ /dev/null @@ -1,106 +0,0 @@ -# longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 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. - -dnl From Paul Eggert. - -# Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. - -# Note: If the type 'long long int' exists but is only 32 bits large -# (as on some very old compilers), HAVE_LONG_LONG_INT will not be -# defined. In this case you can treat 'long long int' like 'long int'. - -AC_DEFUN([AC_TYPE_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug isn't important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include <limits.h> - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [ac_cv_type_long_long_int=yes], - [ac_cv_type_long_long_int=no], - [ac_cv_type_long_long_int=yes])], - [ac_cv_type_long_long_int=no])]) - if test $ac_cv_type_long_long_int = yes; then - AC_DEFINE([HAVE_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `long long int'.]) - fi -]) - -# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. - -# Note: If the type 'unsigned long long int' exists but is only 32 bits -# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT -# will not be defined. In this case you can treat 'unsigned long long int' -# like 'unsigned long int'. - -AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for unsigned long long int], - [ac_cv_type_unsigned_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [ac_cv_type_unsigned_long_long_int=yes], - [ac_cv_type_unsigned_long_long_int=no])]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `unsigned long long int'.]) - fi -]) - -# Expands to a C program that can be used to test for simultaneous support -# of 'long long' and 'unsigned long long'. We don't want to say that -# 'long long' is available if 'unsigned long long' is not, or vice versa, -# because too many programs rely on the symmetry between signed and unsigned -# integer types (excluding 'bool'). -AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], -[ - AC_LANG_PROGRAM( - [[/* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63;]], - [[/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull));]]) -]) diff --git a/lib/gl/m4/lseek.m4 b/lib/gl/m4/lseek.m4 deleted file mode 100644 index b0612c7e17..0000000000 --- a/lib/gl/m4/lseek.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# lseek.m4 serial 6 -dnl Copyright (C) 2007, 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_FUNC_LSEEK], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([AC_PROG_CC]) - AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], - [if test $cross_compiling = no; then - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include <sys/types.h> /* for off_t */ -#include <stdio.h> /* for SEEK_CUR */ -#include <unistd.h>]], [[ - /* Exit with success only if stdin is seekable. */ - return lseek (0, (off_t)0, SEEK_CUR) < 0; -]])], - [if test -s conftest$ac_exeext \ - && ./conftest$ac_exeext < conftest.$ac_ext \ - && test 1 = "`echo hi \ - | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then - gl_cv_func_lseek_pipe=yes - else - gl_cv_func_lseek_pipe=no - fi], - [gl_cv_func_lseek_pipe=no]) - else - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__ -/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */ - Choke me. -#endif]])], - [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) - fi]) - if test $gl_cv_func_lseek_pipe = no; then - gl_REPLACE_LSEEK - fi -]) - -AC_DEFUN([gl_REPLACE_LSEEK], -[ - AC_LIBOBJ([lseek]) - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - REPLACE_LSEEK=1 - AC_DEFINE([LSEEK_PIPE_BROKEN], [1], - [Define to 1 if lseek does not detect pipes.]) -]) diff --git a/lib/gl/m4/malloc.m4 b/lib/gl/m4/malloc.m4 deleted file mode 100644 index 7a749254a1..0000000000 --- a/lib/gl/m4/malloc.m4 +++ /dev/null @@ -1,66 +0,0 @@ -# malloc.m4 serial 12 -dnl Copyright (C) 2007, 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. - -# gl_FUNC_MALLOC_GNU -# ------------------ -# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if -# it is not. -AC_DEFUN([gl_FUNC_MALLOC_GNU], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. - _AC_FUNC_MALLOC_IF( - [AC_DEFINE([HAVE_MALLOC_GNU], [1], - [Define to 1 if your system has a GNU libc compatible 'malloc' - function, and to 0 otherwise.])], - [AC_DEFINE([HAVE_MALLOC_GNU], [0]) - gl_REPLACE_MALLOC - ]) -]) - -# gl_FUNC_MALLOC_POSIX -# -------------------- -# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it -# fails), and replace malloc if it is not. -AC_DEFUN([gl_FUNC_MALLOC_POSIX], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix = yes; then - AC_DEFINE([HAVE_MALLOC_POSIX], [1], - [Define if the 'malloc' function is POSIX compliant.]) - else - gl_REPLACE_MALLOC - fi -]) - -# Test whether malloc, realloc, calloc are POSIX compliant, -# Set gl_cv_func_malloc_posix to yes or no accordingly. -AC_DEFUN([gl_CHECK_MALLOC_POSIX], -[ - AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], - [gl_cv_func_malloc_posix], - [ - dnl It is too dangerous to try to allocate a large amount of memory: - dnl some systems go to their knees when you do that. So assume that - dnl all Unix implementations of the function are POSIX compliant. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[]], - [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - choke me - #endif - ]])], - [gl_cv_func_malloc_posix=yes], - [gl_cv_func_malloc_posix=no]) - ]) -]) - -AC_DEFUN([gl_REPLACE_MALLOC], -[ - AC_LIBOBJ([malloc]) - REPLACE_MALLOC=1 -]) diff --git a/lib/gl/m4/memchr.m4 b/lib/gl/m4/memchr.m4 deleted file mode 100644 index 46db9fb654..0000000000 --- a/lib/gl/m4/memchr.m4 +++ /dev/null @@ -1,88 +0,0 @@ -# memchr.m4 serial 10 -dnl Copyright (C) 2002-2004, 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_ONCE([gl_FUNC_MEMCHR], -[ - dnl Check for prerequisites for memory fence checks. - gl_FUNC_MMAP_ANON - AC_CHECK_HEADERS_ONCE([sys/mman.h]) - AC_CHECK_FUNCS_ONCE([mprotect]) - - dnl These days, we assume memchr is present. But just in case... - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([memchr]) - if test $ac_cv_func_memchr = yes; then - # Detect platform-specific bugs in some versions of glibc: - # memchr should not dereference anything with length 0 - # http://bugzilla.redhat.com/499689 - # memchr should not dereference overestimated length after a match - # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 - # Assume that memchr works on platforms that lack mprotect. - AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <string.h> -#if HAVE_SYS_MMAN_H -# include <fcntl.h> -# include <unistd.h> -# include <sys/types.h> -# include <sys/mman.h> -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif -]], [[ - int result = 0; - char *fence = NULL; -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; - } -#endif - if (fence) - { - if (memchr (fence, 0, 0)) - result |= 1; - strcpy (fence - 9, "12345678"); - if (memchr (fence - 9, 0, 79) != fence - 1) - result |= 2; - if (memchr (fence - 1, 0, 3) != fence - 1) - result |= 4; - } - return result; -]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], - [dnl Be pessimistic for now. - gl_cv_func_memchr_works="guessing no"])]) - if test "$gl_cv_func_memchr_works" != yes; then - REPLACE_MEMCHR=1 - fi - else - HAVE_MEMCHR=0 - fi - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then - AC_LIBOBJ([memchr]) - gl_PREREQ_MEMCHR - fi -]) - -# Prerequisites of lib/memchr.c. -AC_DEFUN([gl_PREREQ_MEMCHR], [ - AC_CHECK_HEADERS([bp-sym.h]) -]) diff --git a/lib/gl/m4/memmem.m4 b/lib/gl/m4/memmem.m4 deleted file mode 100644 index 7df132e102..0000000000 --- a/lib/gl/m4/memmem.m4 +++ /dev/null @@ -1,131 +0,0 @@ -# memmem.m4 serial 20 -dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software -dnl 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 Check that memmem is present. -AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], -[ - dnl Persuade glibc <string.h> to declare memmem(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([memmem]) - AC_CHECK_DECLS_ONCE([memmem]) - if test $ac_cv_have_decl_memmem = no; then - HAVE_DECL_MEMMEM=0 - else - dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. - AC_CACHE_CHECK([whether memmem works], - [gl_cv_func_memmem_works_always], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <string.h> /* for memmem */ -#define P "_EF_BF_BD" -#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P -#define NEEDLE P P P P P -]], [[return !!memmem (HAYSTACK, strlen (HAYSTACK), NEEDLE, strlen (NEEDLE)); - ]])], - [gl_cv_func_memmem_works_always=yes], - [gl_cv_func_memmem_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it - dnl works on all other platforms, even if it is not linear. - AC_EGREP_CPP([Lucky user], - [ -#ifdef __GNU_LIBRARY__ - #include <features.h> - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ - Lucky user - #endif -#elif defined __CYGWIN__ - #include <cygwin/version.h> - #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) - Lucky user - #endif -#else - Lucky user -#endif - ], - [gl_cv_func_memmem_works_always=yes], - [gl_cv_func_memmem_works_always="guessing no"]) - ]) - ]) - if test "$gl_cv_func_memmem_works_always" != yes; then - REPLACE_MEMMEM=1 - AC_LIBOBJ([memmem]) - fi - fi - gl_PREREQ_MEMMEM -]) # gl_FUNC_MEMMEM_SIMPLE - -dnl Additionally, check that memmem is efficient and handles empty needles. -AC_DEFUN([gl_FUNC_MEMMEM], -[ - AC_REQUIRE([gl_FUNC_MEMMEM_SIMPLE]) - if test $HAVE_DECL_MEMMEM = 1 && test $REPLACE_MEMMEM = 0; then - AC_CACHE_CHECK([whether memmem works in linear time], - [gl_cv_func_memmem_works_fast], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <signal.h> /* for signal */ -#include <string.h> /* for memmem */ -#include <stdlib.h> /* for malloc */ -#include <unistd.h> /* for alarm */ -static void quit (int sig) { exit (sig + 128); } -]], [[ - int result = 0; - size_t m = 1000000; - char *haystack = (char *) malloc (2 * m + 1); - char *needle = (char *) malloc (m + 1); - /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack memmem. */ - signal (SIGALRM, quit); - alarm (5); - /* Check for quadratic performance. */ - if (haystack && needle) - { - memset (haystack, 'A', 2 * m); - haystack[2 * m] = 'B'; - memset (needle, 'A', m); - needle[m] = 'B'; - if (!memmem (haystack, 2 * m + 1, needle, m + 1)) - result |= 1; - } - /* Check for empty needle behavior. */ - if (!memmem ("a", 1, 0, 0)) - result |= 2; - return result; - ]])], - [gl_cv_func_memmem_works_fast=yes], [gl_cv_func_memmem_works_fast=no], - [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a - dnl bug-free memmem that works in linear time. - AC_EGREP_CPP([Lucky user], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ - Lucky user - #endif -#endif -#ifdef __CYGWIN__ - #include <cygwin/version.h> - #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) - Lucky user - #endif -#endif - ], - [gl_cv_func_memmem_works_fast=yes], - [gl_cv_func_memmem_works_fast="guessing no"]) - ]) - ]) - if test "$gl_cv_func_memmem_works_fast" != yes; then - REPLACE_MEMMEM=1 - AC_LIBOBJ([memmem]) - fi - fi -]) # gl_FUNC_MEMMEM - -# Prerequisites of lib/memmem.c. -AC_DEFUN([gl_PREREQ_MEMMEM], [:]) diff --git a/lib/gl/m4/minmax.m4 b/lib/gl/m4/minmax.m4 deleted file mode 100644 index a5c42dea0f..0000000000 --- a/lib/gl/m4/minmax.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# minmax.m4 serial 4 -dnl Copyright (C) 2005, 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_PREREQ([2.53]) - -AC_DEFUN([gl_MINMAX], -[ - AC_REQUIRE([gl_PREREQ_MINMAX]) -]) - -# Prerequisites of lib/minmax.h. -AC_DEFUN([gl_PREREQ_MINMAX], -[ - gl_MINMAX_IN_HEADER([limits.h]) - gl_MINMAX_IN_HEADER([sys/param.h]) -]) - -dnl gl_MINMAX_IN_HEADER(HEADER) -dnl The parameter has to be a literal header name; it cannot be macro, -dnl nor a shell variable. (Because autoheader collects only AC_DEFINE -dnl invocations with a literal macro name.) -AC_DEFUN([gl_MINMAX_IN_HEADER], -[ - m4_pushdef([header], AS_TR_SH([$1])) - m4_pushdef([HEADER], AS_TR_CPP([$1])) - AC_CACHE_CHECK([whether <$1> defines MIN and MAX], - [gl_cv_minmax_in_]header, - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <$1> - int x = MIN (42, 17);]], - [[]])], - [gl_cv_minmax_in_]header[=yes], - [gl_cv_minmax_in_]header[=no])]) - if test $gl_cv_minmax_in_[]header = yes; then - AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, - [Define to 1 if <$1> defines the MIN and MAX macros.]) - fi - m4_popdef([HEADER]) - m4_popdef([header]) -]) diff --git a/lib/gl/m4/mmap-anon.m4 b/lib/gl/m4/mmap-anon.m4 deleted file mode 100644 index e20fc3c670..0000000000 --- a/lib/gl/m4/mmap-anon.m4 +++ /dev/null @@ -1,55 +0,0 @@ -# mmap-anon.m4 serial 9 -dnl Copyright (C) 2005, 2007, 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. - -# Detect how mmap can be used to create anonymous (not file-backed) memory -# mappings. -# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS -# and MAP_ANON exist and have the same value. -# - On HP-UX, only MAP_ANONYMOUS exists. -# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. -# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be -# used. - -AC_DEFUN([gl_FUNC_MMAP_ANON], -[ - dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it - # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is - # irrelevant for anonymous mappings. - AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) - - # Try to allow MAP_ANONYMOUS. - gl_have_mmap_anonymous=no - if test $gl_have_mmap = yes; then - AC_MSG_CHECKING([for MAP_ANONYMOUS]) - AC_EGREP_CPP([I cant identify this map.], [ -#include <sys/mman.h> -#ifdef MAP_ANONYMOUS - I cant identify this map. -#endif -], - [gl_have_mmap_anonymous=yes]) - if test $gl_have_mmap_anonymous != yes; then - AC_EGREP_CPP([I cant identify this map.], [ -#include <sys/mman.h> -#ifdef MAP_ANON - I cant identify this map. -#endif -], - [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], - [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) - gl_have_mmap_anonymous=yes]) - fi - AC_MSG_RESULT([$gl_have_mmap_anonymous]) - if test $gl_have_mmap_anonymous = yes; then - AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], - [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including - config.h and <sys/mman.h>.]) - fi - fi -]) diff --git a/lib/gl/m4/multiarch.m4 b/lib/gl/m4/multiarch.m4 deleted file mode 100644 index 389bd2bbaa..0000000000 --- a/lib/gl/m4/multiarch.m4 +++ /dev/null @@ -1,65 +0,0 @@ -# multiarch.m4 serial 5 -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. - -# Determine whether the compiler is or may be producing universal binaries. -# -# On MacOS X 10.5 and later systems, the user can create libraries and -# executables that work on multiple system types--known as "fat" or -# "universal" binaries--by specifying multiple '-arch' options to the -# compiler but only a single '-arch' option to the preprocessor. Like -# this: -# -# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ -# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ -# CPP="gcc -E" CXXCPP="g++ -E" -# -# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the -# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. - -AC_DEFUN_ONCE([gl_MULTIARCH], -[ - dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. - gl_cv_c_multiarch=no - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - ]])], - [ - dnl Check for potential -arch flags. It is not universal unless - dnl there are at least two -arch flags with different values. - arch= - prev= - for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if test -n "$prev"; then - case $word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$arch" || test "$arch" = "$word"; then - arch="$word" - else - gl_cv_c_multiarch=yes - fi - ;; - esac - prev= - else - if test "x$word" = "x-arch"; then - prev=arch - fi - fi - done - ]) - if test $gl_cv_c_multiarch = yes; then - AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1], - [Define if the compiler is building for multiple architectures of Apple platforms at once.]) - APPLE_UNIVERSAL_BUILD=1 - else - APPLE_UNIVERSAL_BUILD=0 - fi - AC_SUBST([APPLE_UNIVERSAL_BUILD]) -]) diff --git a/lib/gl/m4/netdb_h.m4 b/lib/gl/m4/netdb_h.m4 deleted file mode 100644 index c870fb61b9..0000000000 --- a/lib/gl/m4/netdb_h.m4 +++ /dev/null @@ -1,41 +0,0 @@ -# netdb_h.m4 serial 9 -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_HEADER_NETDB], -[ - AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - AC_CHECK_HEADERS_ONCE([netdb.h]) - gl_CHECK_NEXT_HEADERS([netdb.h]) - if test $ac_cv_header_netdb_h = yes; then - HAVE_NETDB_H=1 - else - HAVE_NETDB_H=0 - fi - AC_SUBST([HAVE_NETDB_H]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <netdb.h>]], - [getaddrinfo freeaddrinfo gai_strerror getnameinfo]) -]) - -AC_DEFUN([gl_NETDB_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_NETDB_H_DEFAULTS], -[ - GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO]) - HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO]) - HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR]) - HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) - HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) -]) diff --git a/lib/gl/m4/nls.m4 b/lib/gl/m4/nls.m4 deleted file mode 100644 index 003704c4b9..0000000000 --- a/lib/gl/m4/nls.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# nls.m4 serial 5 (gettext-0.18) -dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, -dnl 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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. - -AC_PREREQ([2.50]) - -AC_DEFUN([AM_NLS], -[ - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE([nls], - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT([$USE_NLS]) - AC_SUBST([USE_NLS]) -]) diff --git a/lib/gl/m4/po.m4 b/lib/gl/m4/po.m4 deleted file mode 100644 index 47f36a41a0..0000000000 --- a/lib/gl/m4/po.m4 +++ /dev/null @@ -1,449 +0,0 @@ -# po.m4 serial 17 (gettext-0.18) -dnl Copyright (C) 1995-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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. - -AC_PREREQ([2.50]) - -dnl Checks for all prerequisites of the po subdirectory. -AC_DEFUN([AM_PO_SUBDIRS], -[ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - AC_REQUIRE([AM_NLS])dnl - - dnl Release version of the gettext macros. This is used to ensure that - dnl the gettext macros and po/Makefile.in.in are in sync. - AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. - dnl The second test excludes FreeBSD msgfmt. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) - - dnl Test whether it is GNU msgfmt >= 0.15. -changequote(,)dnl - case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in - '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; - *) MSGFMT_015=$MSGFMT ;; - esac -changequote([,])dnl - AC_SUBST([MSGFMT_015]) -changequote(,)dnl - case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in - '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; - *) GMSGFMT_015=$GMSGFMT ;; - esac -changequote([,])dnl - AC_SUBST([GMSGFMT_015]) - - dnl Search for GNU xgettext 0.12 or newer in the PATH. - dnl The first test excludes Solaris xgettext and early GNU xgettext versions. - dnl The second test excludes FreeBSD xgettext. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - - dnl Test whether it is GNU xgettext >= 0.15. -changequote(,)dnl - case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in - '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; - *) XGETTEXT_015=$XGETTEXT ;; - esac -changequote([,])dnl - AC_SUBST([XGETTEXT_015]) - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) - - dnl Installation directories. - dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we - dnl have to define it here, so that it can be used in po/Makefile. - test -n "$localedir" || localedir='${datadir}/locale' - AC_SUBST([localedir]) - - dnl Support for AM_XGETTEXT_OPTION. - test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= - AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) - - AC_CONFIG_COMMANDS([po-directories], [[ - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - # Treat a directory as a PO directory if and only if it has a - # POTFILES.in file. This allows packages to have multiple PO - # directories under different names or in different locations. - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - POMAKEFILEDEPS="POTFILES.in" - # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$OBSOLETE_ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake < 1.5. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - # Hide the ALL_LINGUAS assigment from automake < 1.5. - eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi - # Compute POFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) - # Compute UPDATEPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) - # Compute DUMMYPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) - # Compute GMOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - UPDATEPOFILES= - DUMMYPOFILES= - GMOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done]], - [# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it - # from automake < 1.5. - eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) -]) - -dnl Postprocesses a Makefile in a directory containing PO files. -AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], -[ - # When this code is run, in config.status, two variables have already been - # set: - # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, - # - LINGUAS is the value of the environment variable LINGUAS at configure - # time. - -changequote(,)dnl - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - # Find a way to echo strings without interpreting backslash. - if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then - gt_echo='echo' - else - if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then - gt_echo='printf %s\n' - else - echo_func () { - cat <<EOT -$* -EOT - } - gt_echo='echo_func' - fi - fi - - # A sed script that extracts the value of VARIABLE from a Makefile. - sed_x_variable=' -# Test if the hold space is empty. -x -s/P/P/ -x -ta -# Yes it was empty. Look if we have the expected variable definition. -/^[ ]*VARIABLE[ ]*=/{ - # Seen the first line of the variable definition. - s/^[ ]*VARIABLE[ ]*=// - ba -} -bd -:a -# Here we are processing a line from the variable definition. -# Remove comment, more precisely replace it with a space. -s/#.*$/ / -# See if the line ends in a backslash. -tb -:b -s/\\$// -# Print the line, without the trailing backslash. -p -tc -# There was no trailing backslash. The end of the variable definition is -# reached. Clear the hold space. -s/^.*$// -x -bd -:c -# A trailing backslash means that the variable definition continues in the -# next line. Put a nonempty string into the hold space to indicate this. -s/^.*$/P/ -x -:d -' -changequote([,])dnl - - # Set POTFILES to the value of the Makefile variable POTFILES. - sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'` - POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"` - # Compute POTFILES_DEPS as - # $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) - POTFILES_DEPS= - for file in $POTFILES; do - POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file" - done - POMAKEFILEDEPS="" - - if test -n "$OBSOLETE_ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. - sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` - ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` - fi - # Hide the ALL_LINGUAS assigment from automake < 1.5. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - # Compute POFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) - # Compute UPDATEPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) - # Compute DUMMYPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) - # Compute GMOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) - # Compute PROPERTIESFILES - # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) - # Compute CLASSFILES - # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) - # Compute QMFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) - # Compute MSGFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg) - # Compute RESOURCESDLLFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll) - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - UPDATEPOFILES= - DUMMYPOFILES= - GMOFILES= - PROPERTIESFILES= - CLASSFILES= - QMFILES= - MSGFILES= - RESOURCESDLLFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" - CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" - QMFILES="$QMFILES $srcdirpre$lang.qm" - frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" - frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` - RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - JAVACATALOGS= - QTCATALOGS= - TCLCATALOGS= - CSHARPCATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties" - QTCATALOGS="$QTCATALOGS $lang.qm" - frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg" - frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` - CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll" - done - fi - - sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" - if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then - # Add dependencies that cannot be formulated as a simple suffix rule. - for lang in $ALL_LINGUAS; do - frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - cat >> "$ac_file.tmp" <<EOF -$frobbedlang.msg: $lang.po - @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ - \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } -EOF - done - fi - if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then - # Add dependencies that cannot be formulated as a simple suffix rule. - for lang in $ALL_LINGUAS; do - frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` - cat >> "$ac_file.tmp" <<EOF -$frobbedlang/\$(DOMAIN).resources.dll: $lang.po - @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ - \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } -EOF - done - fi - if test -n "$POMAKEFILEDEPS"; then - cat >> "$ac_file.tmp" <<EOF -Makefile: $POMAKEFILEDEPS -EOF - fi - mv "$ac_file.tmp" "$ac_file" -]) - -dnl Initializes the accumulator used by AM_XGETTEXT_OPTION. -AC_DEFUN([AM_XGETTEXT_OPTION_INIT], -[ - XGETTEXT_EXTRA_OPTIONS= -]) - -dnl Registers an option to be passed to xgettext in the po subdirectory. -AC_DEFUN([AM_XGETTEXT_OPTION], -[ - AC_REQUIRE([AM_XGETTEXT_OPTION_INIT]) - XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" -]) diff --git a/lib/gl/m4/printf-posix.m4 b/lib/gl/m4/printf-posix.m4 deleted file mode 100644 index 2dc52a4862..0000000000 --- a/lib/gl/m4/printf-posix.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# printf-posix.m4 serial 6 (gettext-0.18.2) -dnl Copyright (C) 2003, 2007, 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. - -dnl From Bruno Haible. -dnl Test whether the printf() function supports POSIX/XSI format strings with -dnl positions. - -AC_DEFUN([gt_PRINTF_POSIX], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], - gt_cv_func_printf_posix, - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -static char buf[100]; -int main () -{ - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); -}]])], - [gt_cv_func_printf_posix=yes], - [gt_cv_func_printf_posix=no], - [ - AC_EGREP_CPP([notposix], [ -#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ - notposix -#endif - ], - [gt_cv_func_printf_posix="guessing no"], - [gt_cv_func_printf_posix="guessing yes"]) - ]) - ]) - case $gt_cv_func_printf_posix in - *yes) - AC_DEFINE([HAVE_POSIX_PRINTF], [1], - [Define if your printf() function supports format strings with positions.]) - ;; - esac -]) diff --git a/lib/gl/m4/printf.m4 b/lib/gl/m4/printf.m4 deleted file mode 100644 index 6d1cbfe209..0000000000 --- a/lib/gl/m4/printf.m4 +++ /dev/null @@ -1,1470 +0,0 @@ -# printf.m4 serial 40 -dnl Copyright (C) 2003, 2007-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 Test whether the *printf family of functions supports the 'j', 'z', 't', -dnl 'L' size specifiers. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_sizes_c99. - -AC_DEFUN([gl_PRINTF_SIZES_C99], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports size specifiers as in C99], - [gl_cv_func_printf_sizes_c99], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#if HAVE_STDINT_H_WITH_UINTMAX -# include <stdint.h> -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -# include <inttypes.h> -#endif -static char buf[100]; -int main () -{ - int result = 0; -#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX - buf[0] = '\0'; - if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 - || strcmp (buf, "12345671 33") != 0) - result |= 1; -#endif - buf[0] = '\0'; - if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 - || strcmp (buf, "12345672 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 - || strcmp (buf, "12345673 33") != 0) - result |= 4; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 - || strcmp (buf, "1.5 33") != 0) - result |= 8; - return result; -}]])], - [gl_cv_func_printf_sizes_c99=yes], - [gl_cv_func_printf_sizes_c99=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; - darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_printf_sizes_c99="guessing no";; - openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; - solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_sizes_c99="guessing no";; - netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_sizes_c99="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports 'long double' -dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_long_double. - -AC_DEFUN([gl_PRINTF_LONG_DOUBLE], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports 'long double' arguments], - [gl_cv_func_printf_long_double], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[10000]; -int main () -{ - int result = 0; - buf[0] = '\0'; - if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000 33") != 0) - result |= 1; - buf[0] = '\0'; - if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000e+00 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.75 33") != 0) - result |= 4; - return result; -}]])], - [gl_cv_func_printf_long_double=yes], - [gl_cv_func_printf_long_double=no], - [ -changequote(,)dnl - case "$host_os" in - beos*) gl_cv_func_printf_long_double="guessing no";; - mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; - *) gl_cv_func_printf_long_double="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports infinite and NaN -dnl 'double' arguments and negative zero arguments in the %f, %e, %g -dnl directives. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_infinite. - -AC_DEFUN([gl_PRINTF_INFINITE], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], - [gl_cv_func_printf_infinite], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} -static int -have_minus_zero () -{ - static double plus_zero = 0.0; - double minus_zero = - plus_zero; - return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; -} -static char buf[10000]; -static double zero = 0.0; -int main () -{ - int result = 0; - if (sprintf (buf, "%f", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%e", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - if (sprintf (buf, "%g", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - /* This test fails on HP-UX 10.20. */ - if (have_minus_zero ()) - if (sprintf (buf, "%g", - zero) < 0 - || strcmp (buf, "-0") != 0) - result |= 64; - return result; -}]])], - [gl_cv_func_printf_infinite=yes], - [gl_cv_func_printf_infinite=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; - darwin*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; - hpux*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite="guessing no";; - netbsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_infinite="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports infinite and NaN -dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_infinite_long_double. - -AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], -[ - AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gl_BIGENDIAN]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - dnl The user can set or unset the variable gl_printf_safe to indicate - dnl that he wishes a safe handling of non-IEEE-754 'long double' values. - if test -n "$gl_printf_safe"; then - AC_DEFINE([CHECK_PRINTF_SAFE], [1], - [Define if you wish *printf() functions that have a safe handling of - non-IEEE-754 'long double' values.]) - fi - case "$gl_cv_func_printf_long_double" in - *yes) - AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], - [gl_cv_func_printf_infinite_long_double], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -]GL_NOCRASH[ -#include <float.h> -#include <stdio.h> -#include <string.h> -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} -static char buf[10000]; -static long double zeroL = 0.0L; -int main () -{ - int result = 0; - nocrash_init(); - if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - 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_)) -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } - { - /* Signalling NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } - { /* Pseudo-NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 4; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 4; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 4; - } - { /* Pseudo-Infinity. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - } - { /* Pseudo-Zero. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 16; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 16; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 16; - } - { /* Unnormalized number. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - } - { /* Pseudo-Denormal. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 64; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 64; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 64; - } -#endif - return result; -}]])], - [gl_cv_func_printf_infinite_long_double=yes], - [gl_cv_func_printf_infinite_long_double=no], - [ -changequote(,)dnl - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; - *) - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; - hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite_long_double="guessing no";; - esac - ;; - esac -changequote([,])dnl - ]) - ]) - ;; - *) - gl_cv_func_printf_infinite_long_double="irrelevant" - ;; - esac -]) - -dnl Test whether the *printf family of functions supports the 'a' and 'A' -dnl conversion specifier for hexadecimal output of floating-point numbers. -dnl (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_directive_a. - -AC_DEFUN([gl_PRINTF_DIRECTIVE_A], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], - [gl_cv_func_printf_directive_a], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - int result = 0; - if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.922p+1 33") != 0 - && strcmp (buf, "0x3.244p+0 33") != 0 - && strcmp (buf, "0x6.488p-1 33") != 0 - && strcmp (buf, "0xc.91p-2 33") != 0)) - result |= 1; - if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "-0X1.922P+1 33") != 0 - && strcmp (buf, "-0X3.244P+0 33") != 0 - && strcmp (buf, "-0X6.488P-1 33") != 0 - && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 6.1 bug: it doesn't round. */ - if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.83p+0 33") != 0 - && strcmp (buf, "0x3.05p-1 33") != 0 - && strcmp (buf, "0x6.0ap-2 33") != 0 - && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a FreeBSD 6.1 bug. See - <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 - || buf[0] == '0') - result |= 8; - /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ - if (sprintf (buf, "%.1a", 1.999) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 16; - /* 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>. */ - if (sprintf (buf, "%.1La", 1.999L) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 32; - return result; -}]])], - [gl_cv_func_printf_directive_a=yes], - [gl_cv_func_printf_directive_a=no], - [ - case "$host_os" in - # Guess yes on glibc >= 2.5 systems. - *-gnu*) - AC_EGREP_CPP([BZ2908], [ - #include <features.h> - #ifdef __GNU_LIBRARY__ - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ - BZ2908 - #endif - #endif - ], - [gl_cv_func_printf_directive_a="guessing yes"], - [gl_cv_func_printf_directive_a="guessing no"]) - ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_a="guessing no";; - esac - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports the %F format -dnl directive. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_directive_f. - -AC_DEFUN([gl_PRINTF_DIRECTIVE_F], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the 'F' directive], - [gl_cv_func_printf_directive_f], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - int result = 0; - if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 - || strcmp (buf, "1234567.000000 33") != 0) - result |= 1; - if (sprintf (buf, "%F", 1.0 / 0.0) < 0 - || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - result |= 2; - /* This catches a Cygwin 1.5.x bug. */ - if (sprintf (buf, "%.F", 1234.0) < 0 - || strcmp (buf, "1234") != 0) - result |= 4; - return result; -}]])], - [gl_cv_func_printf_directive_f=yes], - [gl_cv_func_printf_directive_f=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; - darwin*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; - solaris*) gl_cv_func_printf_directive_f="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_f="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports the %n format -dnl directive. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_printf_directive_n. - -AC_DEFUN([gl_PRINTF_DIRECTIVE_N], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the 'n' directive], - [gl_cv_func_printf_directive_n], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 - || strcmp (buf, "123 ") != 0 - || count != 4) - return 1; - return 0; -}]])], - [gl_cv_func_printf_directive_n=yes], - [gl_cv_func_printf_directive_n=no], - [ -changequote(,)dnl - case "$host_os" in - *) gl_cv_func_printf_directive_n="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports the %ls format -dnl directive and in particular, when a precision is specified, whether -dnl the functions stop converting the wide string argument when the number -dnl of bytes that have been produced by this conversion equals or exceeds -dnl the precision. -dnl Result is gl_cv_func_printf_directive_ls. - -AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the 'ls' directive], - [gl_cv_func_printf_directive_ls], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -#include <string.h> -int main () -{ - int result = 0; - char buf[100]; - /* Test whether %ls works at all. - This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on - Cygwin 1.5. */ - { - static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "abc") != 0) - result |= 1; - } - /* 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. */ - { - static const wchar_t wstring[] = { 'a', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "a") != 0) - result |= 2; - } - /* Test whether precisions in %ls are supported as specified in ISO C 99 - section 7.19.6.1: - "If a precision is specified, no more than that many bytes are written - (including shift sequences, if any), and the array shall contain a - null wide character if, to equal the multibyte character sequence - length given by the precision, the function would need to access a - wide character one past the end of the array." - This test fails on Solaris 10. */ - { - static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%.2ls", wstring) < 0 - || strcmp (buf, "ab") != 0) - result |= 8; - } - return result; -}]])], - [gl_cv_func_printf_directive_ls=yes], - [gl_cv_func_printf_directive_ls=no], - [ -changequote(,)dnl - case "$host_os" in - openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - *) gl_cv_func_printf_directive_ls="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports POSIX/XSI format -dnl strings with positions. (POSIX:2001) -dnl Result is gl_cv_func_printf_positions. - -AC_DEFUN([gl_PRINTF_POSITIONS], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], - [gl_cv_func_printf_positions], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -static char buf[100]; -int main () -{ - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); -}]])], - [gl_cv_func_printf_positions=yes], - [gl_cv_func_printf_positions=no], - [ -changequote(,)dnl - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports POSIX/XSI format -dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) -dnl Result is gl_cv_func_printf_flag_grouping. - -AC_DEFUN([gl_PRINTF_FLAG_GROUPING], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the grouping flag], - [gl_cv_func_printf_flag_grouping], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - if (sprintf (buf, "%'d %d", 1234567, 99) < 0 - || buf[strlen (buf) - 1] != '9') - return 1; - return 0; -}]])], - [gl_cv_func_printf_flag_grouping=yes], - [gl_cv_func_printf_flag_grouping=no], - [ -changequote(,)dnl - case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports the - flag correctly. -dnl (ISO C99.) See -dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html> -dnl Result is gl_cv_func_printf_flag_leftadjust. - -AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], - [gl_cv_func_printf_flag_leftadjust], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - /* Check that a '-' flag is not annihilated by a negative width. */ - if (sprintf (buf, "a%-*sc", -3, "b") < 0 - || strcmp (buf, "ab c") != 0) - return 1; - return 0; -}]])], - [gl_cv_func_printf_flag_leftadjust=yes], - [gl_cv_func_printf_flag_leftadjust=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on HP-UX 11. - hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess no on HP-UX 10 and older. - hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; - # Guess yes otherwise. - *) gl_cv_func_printf_flag_leftadjust="guessing yes";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions supports padding of non-finite -dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See -dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> -dnl Result is gl_cv_func_printf_flag_zero. - -AC_DEFUN([gl_PRINTF_FLAG_ZERO], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports the zero flag correctly], - [gl_cv_func_printf_flag_zero], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 - || (strcmp (buf, " inf") != 0 - && strcmp (buf, " infinity") != 0)) - return 1; - return 0; -}]])], - [gl_cv_func_printf_flag_zero=yes], - [gl_cv_func_printf_flag_zero=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_flag_zero="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -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 floating-point or pointer output. On Solaris 10/x86, precisions larger -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. - -AC_DEFUN([gl_PRINTF_PRECISION], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf supports large precisions], - [gl_cv_func_printf_precision], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[5000]; -int main () -{ - int result = 0; -#ifdef __BEOS__ - /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ - return 1; -#endif - if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) - result |= 1; - 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=no], - [ -changequote(,)dnl - case "$host_os" in - # 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" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the *printf family of functions recovers gracefully in case -dnl of an out-of-memory condition, or whether it crashes the entire program. -dnl Result is gl_cv_func_printf_enomem. - -AC_DEFUN([gl_PRINTF_ENOMEM], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gl_MULTIARCH]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether printf survives out-of-memory conditions], - [gl_cv_func_printf_enomem], - [ - gl_cv_func_printf_enomem="guessing no" - if test "$cross_compiling" = no; then - if test $APPLE_UNIVERSAL_BUILD = 0; then - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -]GL_NOCRASH[ -changequote(,)dnl -#include <stdio.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <errno.h> -int main() -{ - struct rlimit limit; - int ret; - nocrash_init (); - /* Some printf implementations allocate temporary space with malloc. */ - /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ -#ifdef RLIMIT_DATA - if (getrlimit (RLIMIT_DATA, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_DATA, &limit) < 0) - return 77; -#endif - /* On Linux systems, malloc() is limited by RLIMIT_AS. */ -#ifdef RLIMIT_AS - if (getrlimit (RLIMIT_AS, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_AS, &limit) < 0) - return 77; -#endif - /* Some printf implementations allocate temporary space on the stack. */ -#ifdef RLIMIT_STACK - if (getrlimit (RLIMIT_STACK, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_STACK, &limit) < 0) - return 77; -#endif - ret = printf ("%.5000000f", 1.0); - return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); -} -changequote([,])dnl - ])]) - if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - (./conftest - result=$? - if test $result != 0 && test $result != 77; then result=1; fi - exit $result - ) >/dev/null 2>/dev/null - case $? in - 0) gl_cv_func_printf_enomem="yes" ;; - 77) gl_cv_func_printf_enomem="guessing no" ;; - *) gl_cv_func_printf_enomem="no" ;; - esac - else - gl_cv_func_printf_enomem="guessing no" - fi - rm -fr conftest* - else - dnl A universal build on Apple MacOS X platforms. - dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. - dnl But we need a configuration result that is valid in both modes. - gl_cv_func_printf_enomem="guessing no" - fi - fi - if test "$gl_cv_func_printf_enomem" = "guessing no"; then -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Solaris. - solaris*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on AIX. - aix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on HP-UX/hppa. - hpux*) case "$host_cpu" in - hppa*) gl_cv_func_printf_enomem="guessing yes";; - *) gl_cv_func_printf_enomem="guessing no";; - esac - ;; - # Guess yes on IRIX. - irix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on OSF/1. - osf*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Haiku. - haiku*) gl_cv_func_printf_enomem="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_enomem="guessing no";; - esac -changequote([,])dnl - fi - ]) -]) - -dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) -dnl Result is ac_cv_func_snprintf. - -AC_DEFUN([gl_SNPRINTF_PRESENCE], -[ - AC_CHECK_FUNCS_ONCE([snprintf]) -]) - -dnl Test whether the string produced by the snprintf function is always NUL -dnl terminated. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_snprintf_truncation_c99. - -AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether snprintf truncates the result as in C99], - [gl_cv_func_snprintf_truncation_c99], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - strcpy (buf, "ABCDEF"); - snprintf (buf, 3, "%d %d", 4567, 89); - if (memcmp (buf, "45\0DEF", 6) != 0) - return 1; - return 0; -}]])], - [gl_cv_func_snprintf_truncation_c99=yes], - [gl_cv_func_snprintf_truncation_c99=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; - hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_truncation_c99="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the return value of the snprintf function is the number -dnl of bytes (excluding the terminating NUL) that would have been produced -dnl if the buffer had been large enough. (ISO C99, POSIX:2001) -dnl For example, this test program fails on IRIX 6.5: -dnl --------------------------------------------------------------------- -dnl #include <stdio.h> -dnl int main() -dnl { -dnl static char buf[8]; -dnl int retval = snprintf (buf, 3, "%d", 12345); -dnl return retval >= 0 && retval < 3; -dnl } -dnl --------------------------------------------------------------------- -dnl Result is gl_cv_func_snprintf_retval_c99. - -AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], - [gl_cv_func_snprintf_retval_c99], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char buf[100]; -int main () -{ - strcpy (buf, "ABCDEF"); - if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) - return 1; - return 0; -}]])], - [gl_cv_func_snprintf_retval_c99=yes], - [gl_cv_func_snprintf_retval_c99=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; - darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_retval_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; - solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; - aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_retval_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_retval_c99="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the snprintf function supports the %n format directive -dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) -dnl Result is gl_cv_func_snprintf_directive_n. - -AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], - [gl_cv_func_snprintf_directive_n], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#include <string.h> -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); - if (count != 6) - return 1; - return 0; -}]])], - [gl_cv_func_snprintf_directive_n=yes], - [gl_cv_func_snprintf_directive_n=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; - darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; - solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; - aix*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - osf*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_directive_n="guessing no";; - netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_directive_n="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_directive_n="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl Test whether the snprintf function, when passed a size = 1, writes any -dnl output without bounds in this case, behaving like sprintf. This is the -dnl case on Linux libc5. -dnl Result is gl_cv_func_snprintf_size1. - -AC_DEFUN([gl_SNPRINTF_SIZE1], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_CACHE_CHECK([whether snprintf respects a size of 1], - [gl_cv_func_snprintf_size1], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - snprintf (buf, 1, "%d", 12345); - return buf[1] != 'E'; -}]])], - [gl_cv_func_snprintf_size1=yes], - [gl_cv_func_snprintf_size1=no], - [gl_cv_func_snprintf_size1="guessing yes"]) - ]) -]) - -dnl Test whether the vsnprintf function, when passed a zero size, produces no -dnl output. (ISO C99, POSIX:2001) -dnl For example, snprintf nevertheless writes a NUL byte in this case -dnl on OSF/1 5.1: -dnl --------------------------------------------------------------------- -dnl #include <stdio.h> -dnl int main() -dnl { -dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; -dnl snprintf (buf, 0, "%d", 12345); -dnl return buf[0] != 'D'; -dnl } -dnl --------------------------------------------------------------------- -dnl And vsnprintf writes any output without bounds in this case, behaving like -dnl vsprintf, on HP-UX 11 and OSF/1 5.1: -dnl --------------------------------------------------------------------- -dnl #include <stdarg.h> -dnl #include <stdio.h> -dnl static int my_snprintf (char *buf, int size, const char *format, ...) -dnl { -dnl va_list args; -dnl int ret; -dnl va_start (args, format); -dnl ret = vsnprintf (buf, size, format, args); -dnl va_end (args); -dnl return ret; -dnl } -dnl int main() -dnl { -dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; -dnl my_snprintf (buf, 0, "%d", 12345); -dnl return buf[0] != 'D'; -dnl } -dnl --------------------------------------------------------------------- -dnl Result is gl_cv_func_vsnprintf_zerosize_c99. - -AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], - [gl_cv_func_vsnprintf_zerosize_c99], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdarg.h> -#include <stdio.h> -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -int main() -{ - static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - my_snprintf (buf, 0, "%d", 12345); - return buf[0] != 'D'; -}]])], - [gl_cv_func_vsnprintf_zerosize_c99=yes], - [gl_cv_func_vsnprintf_zerosize_c99=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on mingw. - mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - esac -changequote([,])dnl - ]) - ]) -]) - -dnl The results of these tests on various platforms are: -dnl -dnl 1 = gl_PRINTF_SIZES_C99 -dnl 2 = gl_PRINTF_LONG_DOUBLE -dnl 3 = gl_PRINTF_INFINITE -dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE -dnl 5 = gl_PRINTF_DIRECTIVE_A -dnl 6 = gl_PRINTF_DIRECTIVE_F -dnl 7 = gl_PRINTF_DIRECTIVE_N -dnl 8 = gl_PRINTF_DIRECTIVE_LS -dnl 9 = gl_PRINTF_POSITIONS -dnl 10 = gl_PRINTF_FLAG_GROUPING -dnl 11 = gl_PRINTF_FLAG_LEFTADJUST -dnl 12 = gl_PRINTF_FLAG_ZERO -dnl 13 = gl_PRINTF_PRECISION -dnl 14 = gl_PRINTF_ENOMEM -dnl 15 = gl_SNPRINTF_PRESENCE -dnl 16 = gl_SNPRINTF_TRUNCATION_C99 -dnl 17 = gl_SNPRINTF_RETVAL_C99 -dnl 18 = gl_SNPRINTF_DIRECTIVE_N -dnl 19 = gl_SNPRINTF_SIZE1 -dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 -dnl -dnl 1 = checking whether printf supports size specifiers as in C99... -dnl 2 = checking whether printf supports 'long double' arguments... -dnl 3 = checking whether printf supports infinite 'double' arguments... -dnl 4 = checking whether printf supports infinite 'long double' arguments... -dnl 5 = checking whether printf supports the 'a' and 'A' directives... -dnl 6 = checking whether printf supports the 'F' directive... -dnl 7 = checking whether printf supports the 'n' directive... -dnl 8 = checking whether printf supports the 'ls' directive... -dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... -dnl 10 = checking whether printf supports the grouping flag... -dnl 11 = checking whether printf supports the left-adjust flag correctly... -dnl 12 = checking whether printf supports the zero flag correctly... -dnl 13 = checking whether printf supports large precisions... -dnl 14 = checking whether printf survives out-of-memory conditions... -dnl 15 = checking for snprintf... -dnl 16 = checking whether snprintf truncates the result as in C99... -dnl 17 = checking whether snprintf returns a byte count as in C99... -dnl 18 = checking whether snprintf fully supports the 'n' directive... -dnl 19 = checking whether snprintf respects a size of 1... -dnl 20 = checking whether vsnprintf respects a zero size as in C99... -dnl -dnl . = yes, # = no. -dnl -dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . -dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . -dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . -dnl MacOS X 10.5.8 . . . # # . . . . . . # . . . . . . . . -dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . -dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . -dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . -dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . -dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . -dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . . -dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . -dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . -dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # -dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . . -dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . -dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . -dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # -dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # -dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . -dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # -dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # -dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . -dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? -dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . -dnl Haiku . . . # # # . # . . . . . ? . . . . . . -dnl BeOS # # . # # # . ? # . ? . # ? . . . . . . -dnl mingw # # # # # # . . # # . # # ? . # # # . . diff --git a/lib/gl/m4/progtest.m4 b/lib/gl/m4/progtest.m4 deleted file mode 100644 index 9ffa5c0202..0000000000 --- a/lib/gl/m4/progtest.m4 +++ /dev/null @@ -1,91 +0,0 @@ -# progtest.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2005, 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 -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper <drepper@cygnus.com>, 1996. - -AC_PREREQ([2.50]) - -# Search path for a program which passes the given test. - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN([AM_PATH_PROG_WITH_TEST], -[ -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -# Find out how to test for executable files. Don't use a zero-byte file, -# as systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL([ac_cv_path_$1], -[case "[$]$1" in - [[\\/]]* | ?:[[\\/]]*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in ifelse([$5], , $PATH, [$5]); do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$][$1]) -else - AC_MSG_RESULT([no]) -fi -AC_SUBST([$1])dnl -]) diff --git a/lib/gl/m4/read-file.m4 b/lib/gl/m4/read-file.m4 deleted file mode 100644 index 35a3a4817f..0000000000 --- a/lib/gl/m4/read-file.m4 +++ /dev/null @@ -1,15 +0,0 @@ -# read-file.m4 serial 2 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software -dnl Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_FUNC_READ_FILE], -[ - AC_LIBOBJ([read-file]) - gl_PREREQ_READ_FILE -]) - -# Prerequisites of lib/read-file.c. -AC_DEFUN([gl_PREREQ_READ_FILE], [:]) diff --git a/lib/gl/m4/realloc.m4 b/lib/gl/m4/realloc.m4 deleted file mode 100644 index 01c1234f7e..0000000000 --- a/lib/gl/m4/realloc.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# realloc.m4 serial 11 -dnl Copyright (C) 2007, 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. - -# gl_FUNC_REALLOC_GNU -# ------------------- -# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace -# realloc if it is not. -AC_DEFUN([gl_FUNC_REALLOC_GNU], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - dnl _AC_FUNC_REALLOC_IF is defined in Autoconf. - _AC_FUNC_REALLOC_IF( - [AC_DEFINE([HAVE_REALLOC_GNU], [1], - [Define to 1 if your system has a GNU libc compatible 'realloc' - function, and to 0 otherwise.])], - [AC_DEFINE([HAVE_REALLOC_GNU], [0]) - gl_REPLACE_REALLOC - ]) -])# gl_FUNC_REALLOC_GNU - -# gl_FUNC_REALLOC_POSIX -# --------------------- -# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it -# fails), and replace realloc if it is not. -AC_DEFUN([gl_FUNC_REALLOC_POSIX], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix = yes; then - AC_DEFINE([HAVE_REALLOC_POSIX], [1], - [Define if the 'realloc' function is POSIX compliant.]) - else - gl_REPLACE_REALLOC - fi -]) - -AC_DEFUN([gl_REPLACE_REALLOC], -[ - AC_LIBOBJ([realloc]) - REPLACE_REALLOC=1 -]) diff --git a/lib/gl/m4/size_max.m4 b/lib/gl/m4/size_max.m4 deleted file mode 100644 index f3b1a9dfb2..0000000000 --- a/lib/gl/m4/size_max.m4 +++ /dev/null @@ -1,79 +0,0 @@ -# size_max.m4 serial 10 -dnl Copyright (C) 2003, 2005-2006, 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 From Bruno Haible. - -AC_DEFUN([gl_SIZE_MAX], -[ - AC_CHECK_HEADERS([stdint.h]) - dnl First test whether the system already has SIZE_MAX. - AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ - gl_cv_size_max= - AC_EGREP_CPP([Found it], [ -#include <limits.h> -#if HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef SIZE_MAX -Found it -#endif -], [gl_cv_size_max=yes]) - if test -z "$gl_cv_size_max"; then - dnl Define it ourselves. Here we assume that the type 'size_t' is not wider - dnl than the type 'unsigned long'. Try hard to find a definition that can - dnl be used in a preprocessor #if, i.e. doesn't contain a cast. - AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], - [#include <stddef.h> -#include <limits.h>], [size_t_bits_minus_1=]) - AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], - [#include <stddef.h>], [fits_in_uint=]) - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - dnl Even though SIZE_MAX fits in an unsigned int, it must be of type - dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stddef.h> - extern size_t foo; - extern unsigned long foo; - ]], - [[]])], - [fits_in_uint=0]) - fi - dnl We cannot use 'expr' to simplify this expression, because 'expr' - dnl works only with 'long' integers in the host environment, while we - dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. - if test $fits_in_uint = 1; then - gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - dnl Shouldn't happen, but who knows... - gl_cv_size_max='((size_t)~(size_t)0)' - fi - fi - ]) - if test "$gl_cv_size_max" != yes; then - AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], - [Define as the maximum value of type 'size_t', if the system doesn't define it.]) - fi - dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after - dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with - dnl #define by AC_DEFINE_UNQUOTED. - AH_VERBATIM([SIZE_MAX], -[/* Define as the maximum value of type 'size_t', if the system doesn't define - it. */ -#ifndef SIZE_MAX -# undef SIZE_MAX -#endif]) -]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff --git a/lib/gl/m4/snprintf.m4 b/lib/gl/m4/snprintf.m4 deleted file mode 100644 index 522b107b12..0000000000 --- a/lib/gl/m4/snprintf.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# snprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-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_FUNC_SNPRINTF], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_cv_func_snprintf_usable=no - AC_CHECK_FUNCS([snprintf]) - if test $ac_cv_func_snprintf = yes; then - gl_SNPRINTF_SIZE1 - case "$gl_cv_func_snprintf_size1" in - *yes) - gl_cv_func_snprintf_usable=yes - ;; - esac - fi - if test $gl_cv_func_snprintf_usable = no; then - gl_REPLACE_SNPRINTF - fi - AC_CHECK_DECLS_ONCE([snprintf]) - if test $ac_cv_have_decl_snprintf = no; then - HAVE_DECL_SNPRINTF=0 - fi -]) - -AC_DEFUN([gl_REPLACE_SNPRINTF], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_LIBOBJ([snprintf]) - if test $ac_cv_func_snprintf = yes; then - REPLACE_SNPRINTF=1 - fi - gl_PREREQ_SNPRINTF -]) - -# Prerequisites of lib/snprintf.c. -AC_DEFUN([gl_PREREQ_SNPRINTF], [:]) diff --git a/lib/gl/m4/socketlib.m4 b/lib/gl/m4/socketlib.m4 deleted file mode 100644 index 7bf02b5aee..0000000000 --- a/lib/gl/m4/socketlib.m4 +++ /dev/null @@ -1,86 +0,0 @@ -# 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]) -]) diff --git a/lib/gl/m4/sockets.m4 b/lib/gl/m4/sockets.m4 deleted file mode 100644 index ba9a563d8e..0000000000 --- a/lib/gl/m4/sockets.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# 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], [ - : -]) diff --git a/lib/gl/m4/socklen.m4 b/lib/gl/m4/socklen.m4 deleted file mode 100644 index d0d6baab55..0000000000 --- a/lib/gl/m4/socklen.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# socklen.m4 serial 8 -dnl Copyright (C) 2005, 2006, 2007, 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. - -dnl From Albert Chin, Windows fixes from Simon Josefsson. - -dnl Check for socklen_t: historically on BSD it is an int, and in -dnl POSIX 1g it is a type of its own, but some platforms use different -dnl types for the argument to getsockopt, getpeername, etc.: -dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS. -dnl So we have to test to find something that will work. - -dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's sys_socket.in.h, which -dnl all users of this module should include. Cygwin must not include -dnl ws2tcpip.h. -AC_DEFUN([gl_TYPE_SOCKLEN_T], - [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl - AC_CHECK_TYPE([socklen_t], , - [AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([gl_cv_socklen_t_equiv], - [# Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - gl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t "unsigned int" "long int" "unsigned long int"; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <sys/socket.h> - - int getpeername (int, $arg2 *, $t *);]], - [[$t len; - getpeername (0, 0, &len);]])], - [gl_cv_socklen_t_equiv="$t"]) - test "$gl_cv_socklen_t_equiv" != "" && break - done - test "$gl_cv_socklen_t_equiv" != "" && break - done - ]) - if test "$gl_cv_socklen_t_equiv" = ""; then - AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) - fi - AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) - AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], - [type to use in place of socklen_t if not defined])], - [#include <sys/types.h> - #if HAVE_SYS_SOCKET_H - # include <sys/socket.h> - #elif HAVE_WS2TCPIP_H - # include <ws2tcpip.h> - #endif])]) diff --git a/lib/gl/m4/sockpfaf.m4 b/lib/gl/m4/sockpfaf.m4 deleted file mode 100644 index 8806705ae2..0000000000 --- a/lib/gl/m4/sockpfaf.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# sockpfaf.m4 serial 7 -dnl Copyright (C) 2004, 2006, 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. - -dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) -dnl and some common address families (AF_INET, AF_INET6, ...). -dnl This test assumes that a system supports an address family if and only if -dnl it supports the corresponding protocol family. - -dnl From Bruno Haible. - -AC_DEFUN([gl_SOCKET_FAMILIES], -[ - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - AC_CHECK_HEADERS_ONCE([netinet/in.h]) - - AC_MSG_CHECKING([for IPv4 sockets]) - AC_CACHE_VAL([gl_cv_socket_ipv4], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif]], -[[int x = AF_INET; struct in_addr y; struct sockaddr_in z; - if (&x && &y && &z) return 0;]])], - gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) - AC_MSG_RESULT([$gl_cv_socket_ipv4]) - if test $gl_cv_socket_ipv4 = yes; then - AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) - fi - - AC_MSG_CHECKING([for IPv6 sockets]) - AC_CACHE_VAL([gl_cv_socket_ipv6], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif]], -[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; - if (&x && &y && &z) return 0;]])], - gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) - AC_MSG_RESULT([$gl_cv_socket_ipv6]) - if test $gl_cv_socket_ipv6 = yes; then - AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) - fi -]) diff --git a/lib/gl/m4/stdbool.m4 b/lib/gl/m4/stdbool.m4 deleted file mode 100644 index 1efe59ea1c..0000000000 --- a/lib/gl/m4/stdbool.m4 +++ /dev/null @@ -1,103 +0,0 @@ -# Check for stdbool.h that conforms to C99. - -dnl Copyright (C) 2002-2006, 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. - -#serial 3 - -# Prepare for substituting <stdbool.h> if it is not supported. - -AC_DEFUN([AM_STDBOOL_H], -[ - AC_REQUIRE([AC_HEADER_STDBOOL]) - - # Define two additional variables used in the Makefile substitution. - - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' - else - STDBOOL_H='stdbool.h' - fi - AC_SUBST([STDBOOL_H]) - - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 - else - HAVE__BOOL=0 - fi - AC_SUBST([HAVE__BOOL]) -]) - -# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. -AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) - -# This version of the macro is needed in autoconf <= 2.67. Autoconf has -# it built in since 2.60, but we want the tweaks from the 2.68 version -# to avoid rejecting xlc and clang due to relying on extensions. - -AC_DEFUN([AC_HEADER_STDBOOL], - [AC_CACHE_CHECK([for stdbool.h that conforms to C99], - [ac_cv_header_stdbool_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - ]], - [[ - bool e = &s; - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - ]])], - [ac_cv_header_stdbool_h=yes], - [ac_cv_header_stdbool_h=no])]) - AC_CHECK_TYPES([_Bool]) - if test $ac_cv_header_stdbool_h = yes; then - AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) - fi]) diff --git a/lib/gl/m4/stddef_h.m4 b/lib/gl/m4/stddef_h.m4 deleted file mode 100644 index c3ae569431..0000000000 --- a/lib/gl/m4/stddef_h.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 2 -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_STDDEF_H], -[ - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - if test $gt_cv_c_wchar_t = no; then - HAVE_WCHAR_T=0 - STDDEF_H=stddef.h - fi - AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], - [gl_cv_decl_null_works], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> - int test[2 * (sizeof NULL == sizeof (void *)) -1]; -]])], - [gl_cv_decl_null_works=yes], - [gl_cv_decl_null_works=no])]) - if test $gl_cv_decl_null_works = no; then - REPLACE_NULL=1 - STDDEF_H=stddef.h - fi - if test -n "$STDDEF_H"; then - gl_CHECK_NEXT_HEADERS([stddef.h]) - fi -]) - -AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_STDDEF_H_DEFAULTS], -[ - dnl Assume proper GNU behavior unless another module says otherwise. - REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) - HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) - STDDEF_H=''; AC_SUBST([STDDEF_H]) -]) diff --git a/lib/gl/m4/stdint.m4 b/lib/gl/m4/stdint.m4 deleted file mode 100644 index 7fe28362fc..0000000000 --- a/lib/gl/m4/stdint.m4 +++ /dev/null @@ -1,472 +0,0 @@ -# stdint.m4 serial 36 -dnl Copyright (C) 2001-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 From Paul Eggert and Bruno Haible. -dnl Test whether <stdint.h> is supported or must be substituted. - -AC_DEFUN([gl_STDINT_H], -[ - AC_PREREQ([2.59])dnl - - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then - HAVE_LONG_LONG_INT=1 - else - HAVE_LONG_LONG_INT=0 - fi - AC_SUBST([HAVE_LONG_LONG_INT]) - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - HAVE_UNSIGNED_LONG_LONG_INT=1 - else - HAVE_UNSIGNED_LONG_LONG_INT=0 - fi - AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) - - dnl Check for <inttypes.h>. - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. - if test $ac_cv_header_inttypes_h = yes; then - HAVE_INTTYPES_H=1 - else - HAVE_INTTYPES_H=0 - fi - AC_SUBST([HAVE_INTTYPES_H]) - - dnl Check for <sys/types.h>. - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. - if test $ac_cv_header_sys_types_h = yes; then - HAVE_SYS_TYPES_H=1 - else - HAVE_SYS_TYPES_H=0 - fi - AC_SUBST([HAVE_SYS_TYPES_H]) - - gl_CHECK_NEXT_HEADERS([stdint.h]) - if test $ac_cv_header_stdint_h = yes; then - HAVE_STDINT_H=1 - else - HAVE_STDINT_H=0 - fi - AC_SUBST([HAVE_STDINT_H]) - - dnl Now see whether we need a substitute <stdint.h>. - if test $ac_cv_header_stdint_h = yes; then - AC_CACHE_CHECK([whether stdint.h conforms to C99], - [gl_cv_header_working_stdint_h], - [gl_cv_header_working_stdint_h=no - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include <stdint.h> -/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ -#if !(defined WCHAR_MIN && defined WCHAR_MAX) -#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" -#endif -] -gl_STDINT_INCLUDES -[ -#ifdef INT8_MAX -int8_t a1 = INT8_MAX; -int8_t a1min = INT8_MIN; -#endif -#ifdef INT16_MAX -int16_t a2 = INT16_MAX; -int16_t a2min = INT16_MIN; -#endif -#ifdef INT32_MAX -int32_t a3 = INT32_MAX; -int32_t a3min = INT32_MIN; -#endif -#ifdef INT64_MAX -int64_t a4 = INT64_MAX; -int64_t a4min = INT64_MIN; -#endif -#ifdef UINT8_MAX -uint8_t b1 = UINT8_MAX; -#else -typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; -#endif -#ifdef UINT16_MAX -uint16_t b2 = UINT16_MAX; -#endif -#ifdef UINT32_MAX -uint32_t b3 = UINT32_MAX; -#endif -#ifdef UINT64_MAX -uint64_t b4 = UINT64_MAX; -#endif -int_least8_t c1 = INT8_C (0x7f); -int_least8_t c1max = INT_LEAST8_MAX; -int_least8_t c1min = INT_LEAST8_MIN; -int_least16_t c2 = INT16_C (0x7fff); -int_least16_t c2max = INT_LEAST16_MAX; -int_least16_t c2min = INT_LEAST16_MIN; -int_least32_t c3 = INT32_C (0x7fffffff); -int_least32_t c3max = INT_LEAST32_MAX; -int_least32_t c3min = INT_LEAST32_MIN; -int_least64_t c4 = INT64_C (0x7fffffffffffffff); -int_least64_t c4max = INT_LEAST64_MAX; -int_least64_t c4min = INT_LEAST64_MIN; -uint_least8_t d1 = UINT8_C (0xff); -uint_least8_t d1max = UINT_LEAST8_MAX; -uint_least16_t d2 = UINT16_C (0xffff); -uint_least16_t d2max = UINT_LEAST16_MAX; -uint_least32_t d3 = UINT32_C (0xffffffff); -uint_least32_t d3max = UINT_LEAST32_MAX; -uint_least64_t d4 = UINT64_C (0xffffffffffffffff); -uint_least64_t d4max = UINT_LEAST64_MAX; -int_fast8_t e1 = INT_FAST8_MAX; -int_fast8_t e1min = INT_FAST8_MIN; -int_fast16_t e2 = INT_FAST16_MAX; -int_fast16_t e2min = INT_FAST16_MIN; -int_fast32_t e3 = INT_FAST32_MAX; -int_fast32_t e3min = INT_FAST32_MIN; -int_fast64_t e4 = INT_FAST64_MAX; -int_fast64_t e4min = INT_FAST64_MIN; -uint_fast8_t f1 = UINT_FAST8_MAX; -uint_fast16_t f2 = UINT_FAST16_MAX; -uint_fast32_t f3 = UINT_FAST32_MAX; -uint_fast64_t f4 = UINT_FAST64_MAX; -#ifdef INTPTR_MAX -intptr_t g = INTPTR_MAX; -intptr_t gmin = INTPTR_MIN; -#endif -#ifdef UINTPTR_MAX -uintptr_t h = UINTPTR_MAX; -#endif -intmax_t i = INTMAX_MAX; -uintmax_t j = UINTMAX_MAX; - -#include <limits.h> /* for CHAR_BIT */ -#define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -#define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) -struct s { - int check_PTRDIFF: - PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) - && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) - ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ - int check_SIG_ATOMIC: - SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) - && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) - ? 1 : -1; - int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; - int check_WCHAR: - WCHAR_MIN == TYPE_MINIMUM (wchar_t) - && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) - ? 1 : -1; - /* Detect bug in mingw. */ - int check_WINT: - WINT_MIN == TYPE_MINIMUM (wint_t) - && WINT_MAX == TYPE_MAXIMUM (wint_t) - ? 1 : -1; - - /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ - int check_UINT8_C: - (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; - int check_UINT16_C: - (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; - - /* Detect bugs in OpenBSD 3.9 stdint.h. */ -#ifdef UINT8_MAX - int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; -#endif -#ifdef UINT16_MAX - int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; -#endif -#ifdef UINT32_MAX - int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; -#endif -#ifdef UINT64_MAX - int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; -#endif - int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; - int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; - int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; - int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; - int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; - int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; - int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; - int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; - int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; - int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; - int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; -}; - ]])], - [dnl Determine whether the various *_MIN, *_MAX macros are usable - dnl in preprocessor expression. We could do it by compiling a test - dnl program for each of these macros. It is faster to run a program - dnl that inspects the macro expansion. - dnl This detects a bug on HP-UX 11.23/ia64. - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include <stdint.h> -] -gl_STDINT_INCLUDES -[ -#include <stdio.h> -#include <string.h> -#define MVAL(macro) MVAL1(macro) -#define MVAL1(expression) #expression -static const char *macro_values[] = - { -#ifdef INT8_MAX - MVAL (INT8_MAX), -#endif -#ifdef INT16_MAX - MVAL (INT16_MAX), -#endif -#ifdef INT32_MAX - MVAL (INT32_MAX), -#endif -#ifdef INT64_MAX - MVAL (INT64_MAX), -#endif -#ifdef UINT8_MAX - MVAL (UINT8_MAX), -#endif -#ifdef UINT16_MAX - MVAL (UINT16_MAX), -#endif -#ifdef UINT32_MAX - MVAL (UINT32_MAX), -#endif -#ifdef UINT64_MAX - MVAL (UINT64_MAX), -#endif - NULL - }; -]], [[ - const char **mv; - for (mv = macro_values; *mv != NULL; mv++) - { - const char *value = *mv; - /* Test whether it looks like a cast expression. */ - if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 - || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 - || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 - || strncmp (value, "((int)"/*)*/, 6) == 0 - || strncmp (value, "((signed short)"/*)*/, 15) == 0 - || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return mv - macro_values + 1; - } - return 0; -]])], - [gl_cv_header_working_stdint_h=yes], - [], - [dnl When cross-compiling, assume it works. - gl_cv_header_working_stdint_h=yes - ]) - ]) - ]) - fi - if test "$gl_cv_header_working_stdint_h" = yes; then - STDINT_H= - else - dnl Check for <sys/inttypes.h>, and for - dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). - AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - else - HAVE_SYS_INTTYPES_H=0 - fi - AC_SUBST([HAVE_SYS_INTTYPES_H]) - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - else - HAVE_SYS_BITYPES_H=0 - fi - AC_SUBST([HAVE_SYS_BITYPES_H]) - - dnl Check for <wchar.h> (missing in Linux uClibc when built without wide - dnl character support). - AC_CHECK_HEADERS_ONCE([wchar.h]) - - gl_STDINT_TYPE_PROPERTIES - STDINT_H=stdint.h - fi - AC_SUBST([STDINT_H]) -]) - -dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) -dnl Determine the size of each of the given types in bits. -AC_DEFUN([gl_STDINT_BITSIZEOF], -[ - dnl Use a shell loop, to avoid bloating configure, and - dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into - dnl config.h.in, - dnl - extra AC_SUBST calls, so that the right substitutions are made. - m4_foreach_w([gltype], [$1], - [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), - [Define to the number of bits in type ']gltype['.])]) - for gltype in $1 ; do - AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], - [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], - [$2 -#include <limits.h>], [result=unknown]) - eval gl_cv_bitsizeof_${gltype}=\$result - ]) - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, - dnl do a syntax check even on unused #if conditions and give an error - dnl on valid C code like this: - dnl #if 0 - dnl # if > 32 - dnl # endif - dnl #endif - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) - eval BITSIZEOF_${GLTYPE}=\$result - done - m4_foreach_w([gltype], [$1], - [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) -]) - -dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) -dnl Determine the signedness of each of the given types. -dnl Define HAVE_SIGNED_TYPE if type is signed. -AC_DEFUN([gl_CHECK_TYPES_SIGNED], -[ - dnl Use a shell loop, to avoid bloating configure, and - dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into - dnl config.h.in, - dnl - extra AC_SUBST calls, so that the right substitutions are made. - m4_foreach_w([gltype], [$1], - [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), - [Define to 1 if ']gltype[' is a signed integer type.])]) - for gltype in $1 ; do - AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([$2[ - int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], - result=yes, result=no) - eval gl_cv_type_${gltype}_signed=\$result - ]) - eval result=\$gl_cv_type_${gltype}_signed - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - if test "$result" = yes; then - AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) - eval HAVE_SIGNED_${GLTYPE}=1 - else - eval HAVE_SIGNED_${GLTYPE}=0 - fi - done - m4_foreach_w([gltype], [$1], - [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) -]) - -dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) -dnl Determine the suffix to use for integer constants of the given types. -dnl Define t_SUFFIX for each such type. -AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], -[ - dnl Use a shell loop, to avoid bloating configure, and - dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into - dnl config.h.in, - dnl - extra AC_SUBST calls, so that the right substitutions are made. - m4_foreach_w([gltype], [$1], - [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], - [Define to l, ll, u, ul, ull, etc., as suitable for - constants of type ']gltype['.])]) - for gltype in $1 ; do - AC_CACHE_CHECK([for $gltype integer literal suffix], - [gl_cv_type_${gltype}_suffix], - [eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([$2[ - extern $gltype foo; - extern $gltype1 foo;]])], - [eval gl_cv_type_${gltype}_suffix=\$glsuf]) - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done]) - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) - done - m4_foreach_w([gltype], [$1], - [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) -]) - -dnl gl_STDINT_INCLUDES -AC_DEFUN([gl_STDINT_INCLUDES], -[[ - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif -]]) - -dnl gl_STDINT_TYPE_PROPERTIES -dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t -dnl of interest to stdint.in.h. -AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], -[ - AC_REQUIRE([gl_MULTIARCH]) - if test $APPLE_UNIVERSAL_BUILD = 0; then - gl_STDINT_BITSIZEOF([ptrdiff_t size_t], - [gl_STDINT_INCLUDES]) - fi - gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], - [gl_STDINT_INCLUDES]) - gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], - [gl_STDINT_INCLUDES]) - gl_cv_type_ptrdiff_t_signed=yes - gl_cv_type_size_t_signed=no - if test $APPLE_UNIVERSAL_BUILD = 0; then - gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], - [gl_STDINT_INCLUDES]) - fi - gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], - [gl_STDINT_INCLUDES]) -]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) - -# Hey Emacs! -# Local Variables: -# indent-tabs-mode: nil -# End: diff --git a/lib/gl/m4/stdint_h.m4 b/lib/gl/m4/stdint_h.m4 deleted file mode 100644 index 670c0cc2bf..0000000000 --- a/lib/gl/m4/stdint_h.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# stdint_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 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 From Paul Eggert. - -# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, -# doesn't clash with <sys/types.h>, and declares uintmax_t. - -AC_DEFUN([gl_AC_HEADER_STDINT_H], -[ - AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <stdint.h>]], - [[uintmax_t i = (uintmax_t) -1; return !i;]])], - [gl_cv_header_stdint_h=yes], - [gl_cv_header_stdint_h=no])]) - if test $gl_cv_header_stdint_h = yes; then - AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], - [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, - and declares uintmax_t. ]) - fi -]) diff --git a/lib/gl/m4/stdio_h.m4 b/lib/gl/m4/stdio_h.m4 deleted file mode 100644 index f5650cdeab..0000000000 --- a/lib/gl/m4/stdio_h.m4 +++ /dev/null @@ -1,159 +0,0 @@ -# stdio_h.m4 serial 31 -dnl Copyright (C) 2007-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_STDIO_H], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) - gl_CHECK_NEXT_HEADERS([stdio.h]) - dnl No need to create extra modules for these functions. Everyone who uses - dnl <stdio.h> likely needs them. - GNULIB_FPRINTF=1 - GNULIB_PRINTF=1 - GNULIB_VFPRINTF=1 - GNULIB_VPRINTF=1 - GNULIB_FPUTC=1 - GNULIB_PUTC=1 - GNULIB_PUTCHAR=1 - GNULIB_FPUTS=1 - GNULIB_PUTS=1 - GNULIB_FWRITE=1 - dnl This ifdef is just an optimization, to avoid performing a configure - dnl check whose result is not used. It does not make the test of - dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. - m4_ifdef([gl_SIGNAL_SIGPIPE], [ - gl_SIGNAL_SIGPIPE - if test $gl_cv_header_signal_h_SIGPIPE != yes; then - REPLACE_STDIO_WRITE_FUNCS=1 - AC_LIBOBJ([stdio-write]) - fi - ]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use, and which is not - dnl guaranteed by C89. - gl_WARN_ON_USE_PREPARE([[#include <stdio.h> - ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat - snprintf tmpfile vdprintf vsnprintf]) -]) - -AC_DEFUN([gl_STDIO_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_STDIO_H_DEFAULTS], -[ - GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) - GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) - GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) - GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) - GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) - GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) - GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) - GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) - GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) - GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) - GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) - GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) - GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) - GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) - GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) - GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) - GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) - GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) - GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) - GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) - GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) - GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) - GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) - GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) - GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) - GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) - GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) - GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) - GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) - GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) - GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) - GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) - GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) - GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) - GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) - GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) - GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) - GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) - GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) - GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) - GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) - HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) - HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) - HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) - HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) - HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) - HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) - HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) - HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) - HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) - HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) - HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) - REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) - REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) - REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) - REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) - REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) - REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) - REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) - REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) - REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) - REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) - REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) - REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) - REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) - REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) - REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) - REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) - REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) - REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) - REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) - REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) - REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) - REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) - REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) - REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) - REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) - REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) - REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) - REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) - 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/lib/gl/m4/stdlib_h.m4 b/lib/gl/m4/stdlib_h.m4 deleted file mode 100644 index e4697ce213..0000000000 --- a/lib/gl/m4/stdlib_h.m4 +++ /dev/null @@ -1,113 +0,0 @@ -# stdlib_h.m4 serial 31 -dnl Copyright (C) 2007-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_STDLIB_H], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([stdlib.h]) - AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) - if test $ac_cv_header_random_h = yes; then - HAVE_RANDOM_H=1 - else - HAVE_RANDOM_H=0 - fi - AC_SUBST([HAVE_RANDOM_H]) - AC_CHECK_TYPES([struct random_data], - [], [HAVE_STRUCT_RANDOM_DATA=0], - [[#include <stdlib.h> - #if HAVE_RANDOM_H - # include <random.h> - #endif - ]]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use, and which is not - dnl guaranteed by C89. - gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> -#if HAVE_SYS_LOADAVG_H -# include <sys/loadavg.h> -#endif -#if HAVE_RANDOM_H -# include <random.h> -#endif - ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp - mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r - setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt - unsetenv]) -]) - -AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_STDLIB_H_DEFAULTS], -[ - GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) - GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) - GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) - GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) - GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) - GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) - GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) - GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) - GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) - GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) - GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) - GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) - GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) - GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) - GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) - GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) - GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) - GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) - GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) - GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) - GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) - GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) - GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) - GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) - GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) - GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) - HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) - HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) - HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) - HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) - HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) - HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) - HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) - HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) - HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) - HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) - HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) - HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) - HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) - HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) - HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) - HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) - HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) - HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) - HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) - HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) - HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) - HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) - 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_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) - REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) - REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) - REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) - REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) - REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) - REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) -]) diff --git a/lib/gl/m4/strcase.m4 b/lib/gl/m4/strcase.m4 deleted file mode 100644 index 33de423a02..0000000000 --- a/lib/gl/m4/strcase.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# strcase.m4 serial 10 -dnl Copyright (C) 2002, 2005-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_STRCASE], -[ - gl_FUNC_STRCASECMP - gl_FUNC_STRNCASECMP -]) - -AC_DEFUN([gl_FUNC_STRCASECMP], -[ - AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - AC_REPLACE_FUNCS([strcasecmp]) - if test $ac_cv_func_strcasecmp = no; then - HAVE_STRCASECMP=0 - gl_PREREQ_STRCASECMP - fi -]) - -AC_DEFUN([gl_FUNC_STRNCASECMP], -[ - AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - AC_REPLACE_FUNCS([strncasecmp]) - if test $ac_cv_func_strncasecmp = no; then - gl_PREREQ_STRNCASECMP - fi - AC_CHECK_DECLS([strncasecmp]) - if test $ac_cv_have_decl_strncasecmp = no; then - HAVE_DECL_STRNCASECMP=0 - fi -]) - -# Prerequisites of lib/strcasecmp.c. -AC_DEFUN([gl_PREREQ_STRCASECMP], [ - : -]) - -# Prerequisites of lib/strncasecmp.c. -AC_DEFUN([gl_PREREQ_STRNCASECMP], [ - : -]) diff --git a/lib/gl/m4/string_h.m4 b/lib/gl/m4/string_h.m4 deleted file mode 100644 index 5844b2d660..0000000000 --- a/lib/gl/m4/string_h.m4 +++ /dev/null @@ -1,115 +0,0 @@ -# Configure a GNU-like replacement for <string.h>. - -# Copyright (C) 2007-2010 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. - -# serial 18 - -# Written by Paul Eggert. - -AC_DEFUN([gl_HEADER_STRING_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_STRING_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_STRING_H_BODY], -[ - AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([string.h]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use, and which is not - dnl guaranteed by C89. - gl_WARN_ON_USE_PREPARE([[#include <string.h> - ]], - [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup - strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r - strsignal strverscmp]) -]) - -AC_DEFUN([gl_STRING_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], -[ - GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) - GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) - GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) - GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) - GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) - GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) - GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) - GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) - GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) - GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) - GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) - GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) - GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) - GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) - GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) - GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) - GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) - GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) - GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) - GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) - GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) - GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) - GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) - GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) - GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) - GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) - GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) - GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) - GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) - GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) - GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) - GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) - GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) - GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) - HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) - HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) - HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) - HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) - HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) - HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) - HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) - HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) - HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) - HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) - HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) - HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) - HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) - HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) - 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_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) - REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) - REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) - REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) - REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) - REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) - REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) - REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) - REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) - REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) - REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) - REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) - REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) - REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) - UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) -]) diff --git a/lib/gl/m4/strings_h.m4 b/lib/gl/m4/strings_h.m4 deleted file mode 100644 index 4374c7cbe3..0000000000 --- a/lib/gl/m4/strings_h.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# Configure a replacement for <string.h>. -# serial 3 - -# Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_HEADER_STRINGS_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_STRINGS_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_STRINGS_H_BODY], -[ - AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([strings.h]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <strings.h> - ]], [strcasecmp strncasecmp]) -]) - -AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], -[ - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) - HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) -]) diff --git a/lib/gl/m4/strverscmp.m4 b/lib/gl/m4/strverscmp.m4 deleted file mode 100644 index 59e0950f18..0000000000 --- a/lib/gl/m4/strverscmp.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# strverscmp.m4 serial 7 -dnl Copyright (C) 2002, 2005-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_FUNC_STRVERSCMP], -[ - dnl Persuade glibc <string.h> to declare strverscmp(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([strverscmp]) - if test $ac_cv_func_strverscmp = no; then - gl_PREREQ_STRVERSCMP - HAVE_STRVERSCMP=0 - fi -]) - -# Prerequisites of lib/strverscmp.c. -AC_DEFUN([gl_PREREQ_STRVERSCMP], [ - : -]) diff --git a/lib/gl/m4/sys_socket_h.m4 b/lib/gl/m4/sys_socket_h.m4 deleted file mode 100644 index c7627cb94e..0000000000 --- a/lib/gl/m4/sys_socket_h.m4 +++ /dev/null @@ -1,169 +0,0 @@ -# sys_socket_h.m4 serial 20 -dnl Copyright (C) 2005-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 From Simon Josefsson. - -AC_DEFUN([gl_HEADER_SYS_SOCKET], -[ - AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) - - AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], - [gl_cv_header_sys_socket_h_selfcontained], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])], - [gl_cv_header_sys_socket_h_selfcontained=yes], - [gl_cv_header_sys_socket_h_selfcontained=no]) - ]) - if test $gl_cv_header_sys_socket_h_selfcontained = yes; then - dnl If the shutdown function exists, <sys/socket.h> should define - dnl SHUT_RD, SHUT_WR, SHUT_RDWR. - AC_CHECK_FUNCS([shutdown]) - if test $ac_cv_func_shutdown = yes; then - AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros], - [gl_cv_header_sys_socket_h_shut], - [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <sys/socket.h>]], - [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], - [gl_cv_header_sys_socket_h_shut=yes], - [gl_cv_header_sys_socket_h_shut=no]) - ]) - if test $gl_cv_header_sys_socket_h_shut = no; then - SYS_SOCKET_H='sys/socket.h' - fi - fi - fi - # We need to check for ws2tcpip.h now. - gl_PREREQ_SYS_H_SOCKET - AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_WS2TCPIP_H -#include <ws2tcpip.h> -#endif -]) - if test $ac_cv_type_struct_sockaddr_storage = no; then - HAVE_STRUCT_SOCKADDR_STORAGE=0 - fi - if test $ac_cv_type_sa_family_t = no; then - HAVE_SA_FAMILY_T=0 - 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 - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[ -/* Some systems require prerequisite headers. */ -#include <sys/types.h> -#include <sys/socket.h> - ]], [socket connect accept bind getpeername getsockname getsockopt - listen recv send recvfrom sendto setsockopt shutdown accept4]) -]) - -AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], -[ - dnl Check prerequisites of the <sys/socket.h> replacement. - gl_CHECK_NEXT_HEADERS([sys/socket.h]) - if test $ac_cv_header_sys_socket_h = yes; then - HAVE_SYS_SOCKET_H=1 - HAVE_WS2TCPIP_H=0 - else - HAVE_SYS_SOCKET_H=0 - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([ws2tcpip.h]) - if test $ac_cv_header_ws2tcpip_h = yes; then - HAVE_WS2TCPIP_H=1 - else - HAVE_WS2TCPIP_H=0 - fi - fi - AC_SUBST([HAVE_SYS_SOCKET_H]) - AC_SUBST([HAVE_WS2TCPIP_H]) -]) - -# Common prerequisites of the <sys/socket.h> replacement and of the -# <sys/select.h> replacement. -# Sets and substitutes HAVE_WINSOCK2_H. -AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], -[ - m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) - m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) - AC_CHECK_HEADERS_ONCE([sys/socket.h]) - if test $ac_cv_header_sys_socket_h != yes; then - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([winsock2.h]) - fi - if test "$ac_cv_header_winsock2_h" = yes; then - HAVE_WINSOCK2_H=1 - UNISTD_H_HAVE_WINSOCK2_H=1 - SYS_IOCTL_H_HAVE_WINSOCK2_H=1 - else - HAVE_WINSOCK2_H=0 - fi - AC_SUBST([HAVE_WINSOCK2_H]) -]) - -AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], -[ - GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) - GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) - GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) - GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) - GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) - GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) - GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) - GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) - GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) - GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) - GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) - GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) - GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) - GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) - GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) - 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_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) -]) diff --git a/lib/gl/m4/sys_stat_h.m4 b/lib/gl/m4/sys_stat_h.m4 deleted file mode 100644 index 7181c253b9..0000000000 --- a/lib/gl/m4/sys_stat_h.m4 +++ /dev/null @@ -1,82 +0,0 @@ -# sys_stat_h.m4 serial 24 -*- Autoconf -*- -dnl Copyright (C) 2006-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 From Eric Blake. -dnl Provide a GNU-like <sys/stat.h>. - -AC_DEFUN([gl_HEADER_SYS_STAT_H], -[ - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - - dnl For the mkdir substitute. - AC_REQUIRE([AC_C_INLINE]) - - dnl Check for broken stat macros. - AC_REQUIRE([AC_HEADER_STAT]) - - gl_CHECK_NEXT_HEADERS([sys/stat.h]) - - dnl Define types that are supposed to be defined in <sys/types.h> or - dnl <sys/stat.h>. - AC_CHECK_TYPE([nlink_t], [], - [AC_DEFINE([nlink_t], [int], - [Define to the type of st_nlink in struct stat, or a supertype.])], - [#include <sys/types.h> - #include <sys/stat.h>]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> - ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat - mknod mknodat stat utimensat]) -]) # gl_HEADER_SYS_STAT_H - -AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) - GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) - GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) - GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) - GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) - GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) - GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) - GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) - GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) - GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) - GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) - GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) - HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) - HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) - HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) - HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) - HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) - HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) - HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) - HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) - HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) - HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) - REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) - REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) - REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) - REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) - REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) - REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) - REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) - REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) - REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) -]) diff --git a/lib/gl/m4/threadlib.m4 b/lib/gl/m4/threadlib.m4 deleted file mode 100644 index 423c17c768..0000000000 --- a/lib/gl/m4/threadlib.m4 +++ /dev/null @@ -1,369 +0,0 @@ -# threadlib.m4 serial 8 (gettext-0.18.2) -dnl Copyright (C) 2005-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 From Bruno Haible. - -dnl gl_THREADLIB -dnl ------------ -dnl Tests for a multithreading library to be used. -dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO -dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the -dnl default is 'no', otherwise it is system dependent. In both cases, the user -dnl can change the choice through the options --enable-threads=choice or -dnl --disable-threads. -dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, -dnl USE_PTH_THREADS, USE_WIN32_THREADS -dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use -dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with -dnl libtool). -dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for -dnl programs that really need multithread functionality. The difference -dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak -dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". -dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for -dnl multithread-safe programs. - -AC_DEFUN([gl_THREADLIB_EARLY], -[ - AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) -]) - -dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once. - -AC_DEFUN([gl_THREADLIB_EARLY_BODY], -[ - dnl Ordering constraints: This macro modifies CPPFLAGS in a way that - dnl influences the result of the autoconf tests that test for *_unlocked - dnl declarations, on AIX 5 at least. Therefore it must come early. - AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl - AC_BEFORE([$0], [gl_ARGP])dnl - - AC_REQUIRE([AC_CANONICAL_HOST]) - dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) - dnl Check for multithreading. - m4_ifdef([gl_THREADLIB_DEFAULT_NO], - [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], - [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) - AC_ARG_ENABLE([threads], -AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ -AC_HELP_STRING([--disable-threads], [build without multithread safety])]), - [gl_use_threads=$enableval], - [if test -n "$gl_use_threads_default"; then - gl_use_threads="$gl_use_threads_default" - else -changequote(,)dnl - case "$host_os" in - dnl Disable multithreading by default on OSF/1, because it interferes - dnl with fork()/exec(): When msgexec is linked with -lpthread, its - dnl child process gets an endless segmentation fault inside execvp(). - dnl Disable multithreading by default on Cygwin 1.5.x, because it has - dnl bugs that lead to endless loops or crashes. See - dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. - osf*) gl_use_threads=no ;; - cygwin*) - case `uname -r` in - 1.[0-5].*) gl_use_threads=no ;; - *) gl_use_threads=yes ;; - esac - ;; - *) gl_use_threads=yes ;; - esac -changequote([,])dnl - fi - ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # For using <pthread.h>: - case "$host_os" in - osf*) - # On OSF/1, the compiler needs the flag -D_REENTRANT so that it - # groks <pthread.h>. cc also understands the flag -pthread, but - # we don't use it because 1. gcc-2.95 doesn't understand -pthread, - # 2. putting a flag into CPPFLAGS that has an effect on the linker - # causes the AC_LINK_IFELSE test below to succeed unexpectedly, - # leading to wrong values of LIBTHREAD and LTLIBTHREAD. - CPPFLAGS="$CPPFLAGS -D_REENTRANT" - ;; - esac - # Some systems optimize for single-threaded programs by default, and - # need special flags to disable these optimizations. For example, the - # definition of 'errno' in <errno.h>. - case "$host_os" in - aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; - solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; - esac - fi -]) - -dnl The guts of gl_THREADLIB. Needs to be expanded only once. - -AC_DEFUN([gl_THREADLIB_BODY], -[ - AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) - gl_threads_api=none - LIBTHREAD= - LTLIBTHREAD= - LIBMULTITHREAD= - LTLIBMULTITHREAD= - if test "$gl_use_threads" != no; then - dnl Check whether the compiler and linker support weak declarations. - AC_CACHE_CHECK([whether imported symbols can be declared weak], - [gl_cv_have_weak], - [gl_cv_have_weak=no - dnl First, test whether the compiler accepts it syntactically. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[extern void xyzzy (); -#pragma weak xyzzy]], - [[xyzzy();]])], - [gl_cv_have_weak=maybe]) - if test $gl_cv_have_weak = maybe; then - dnl Second, test whether it actually works. On Cygwin 1.7.2, with - dnl gcc 4.3, symbols declared weak always evaluate to the address 0. - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#pragma weak fputs -int main () -{ - return (fputs == NULL); -}]])], - [gl_cv_have_weak=yes], - [gl_cv_have_weak=no], - [dnl When cross-compiling, assume that only ELF platforms support - dnl weak symbols. - AC_EGREP_CPP([Extensible Linking Format], - [#ifdef __ELF__ - Extensible Linking Format - #endif - ], - [gl_cv_have_weak="guessing yes"], - [gl_cv_have_weak="guessing no"]) - ]) - fi - ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. - AC_CHECK_HEADER([pthread.h], - [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - gl_have_pthread= - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <pthread.h>]], - [[pthread_mutex_lock((pthread_mutex_t*)0); - pthread_mutexattr_init((pthread_mutexattr_t*)0);]])], - [gl_have_pthread=yes]) - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test -n "$gl_have_pthread"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - AC_CHECK_LIB([pthread], [pthread_kill], - [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - case "$host_os" in - solaris* | hpux*) - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - esac - ]) - else - # Some library is needed. Try libpthread and libc_r. - AC_CHECK_LIB([pthread], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) - if test -z "$gl_have_pthread"; then - # For FreeBSD 4. - AC_CHECK_LIB([c_r], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r - LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) - fi - fi - if test -n "$gl_have_pthread"; then - gl_threads_api=posix - AC_DEFINE([USE_POSIX_THREADS], [1], - [Define if the POSIX multithreading library can be used.]) - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], - [Define if references to the POSIX multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - fi - fi - fi - if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then - gl_have_solaristhread= - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <thread.h> -#include <synch.h> - ]], - [[thr_self();]])], - [gl_have_solaristhread=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_solaristhread"; then - gl_threads_api=solaris - LIBTHREAD=-lthread - LTLIBTHREAD=-lthread - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_SOLARIS_THREADS], [1], - [Define if the old Solaris multithreading library can be used.]) - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], - [Define if references to the old Solaris multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - fi - fi - if test "$gl_use_threads" = pth; then - gl_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_LINKFLAGS([pth]) - gl_have_pth= - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBPTH" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])], - [gl_have_pth=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_pth"; then - gl_threads_api=pth - LIBTHREAD="$LIBPTH" - LTLIBTHREAD="$LTLIBPTH" - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_PTH_THREADS], [1], - [Define if the GNU Pth multithreading library can be used.]) - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_PTH_THREADS_WEAK], [1], - [Define if references to the GNU Pth multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - else - CPPFLAGS="$gl_save_CPPFLAGS" - fi - fi - if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then - if { case "$host_os" in - mingw*) true;; - *) false;; - esac - }; then - gl_threads_api=win32 - AC_DEFINE([USE_WIN32_THREADS], [1], - [Define if the Win32 multithreading API can be used.]) - fi - fi - fi - fi - AC_MSG_CHECKING([for multithread API to use]) - AC_MSG_RESULT([$gl_threads_api]) - AC_SUBST([LIBTHREAD]) - AC_SUBST([LTLIBTHREAD]) - AC_SUBST([LIBMULTITHREAD]) - AC_SUBST([LTLIBMULTITHREAD]) -]) - -AC_DEFUN([gl_THREADLIB], -[ - AC_REQUIRE([gl_THREADLIB_EARLY]) - AC_REQUIRE([gl_THREADLIB_BODY]) -]) - - -dnl gl_DISABLE_THREADS -dnl ------------------ -dnl Sets the gl_THREADLIB default so that threads are not used by default. -dnl The user can still override it at installation time, by using the -dnl configure option '--enable-threads'. - -AC_DEFUN([gl_DISABLE_THREADS], [ - m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) -]) - - -dnl Survey of platforms: -dnl -dnl Platform Available Compiler Supports test-lock -dnl flavours option weak result -dnl --------------- --------- --------- -------- --------- -dnl Linux 2.4/glibc posix -lpthread Y OK -dnl -dnl GNU Hurd/glibc posix -dnl -dnl FreeBSD 5.3 posix -lc_r Y -dnl posix -lkse ? Y -dnl posix -lpthread ? Y -dnl posix -lthr Y -dnl -dnl FreeBSD 5.2 posix -lc_r Y -dnl posix -lkse Y -dnl posix -lthr Y -dnl -dnl FreeBSD 4.0,4.10 posix -lc_r Y OK -dnl -dnl NetBSD 1.6 -- -dnl -dnl OpenBSD 3.4 posix -lpthread Y OK -dnl -dnl MacOS X 10.[123] posix -lpthread Y OK -dnl -dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK -dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK -dnl -dnl HP-UX 11 posix -lpthread N (cc) OK -dnl Y (gcc) -dnl -dnl IRIX 6.5 posix -lpthread Y 0.5 -dnl -dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK -dnl -dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK -dnl -lpthread (gcc) Y -dnl -dnl Cygwin posix -lpthread Y OK -dnl -dnl Any of the above pth -lpth 0.0 -dnl -dnl Mingw win32 N OK -dnl -dnl BeOS 5 -- -dnl -dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is -dnl turned off: -dnl OK if all three tests terminate OK, -dnl 0.5 if the first test terminates OK but the second one loops endlessly, -dnl 0.0 if the first test already loops endlessly. diff --git a/lib/gl/m4/time_h.m4 b/lib/gl/m4/time_h.m4 deleted file mode 100644 index a45a10a9ee..0000000000 --- a/lib/gl/m4/time_h.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# Configure a more-standard replacement for <time.h>. - -# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. - -# serial 2 - -# 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. - -# Written by Paul Eggert and Jim Meyering. - -AC_DEFUN([gl_HEADER_TIME_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_TIME_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_TIME_H_BODY], -[ - AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([time.h]) - AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) -]) - -dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared -dnl in time.h, sys/time.h, or pthread.h. - -AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], -[ - AC_CHECK_HEADERS_ONCE([sys/time.h]) - AC_CACHE_CHECK([for struct timespec in <time.h>], - [gl_cv_sys_struct_timespec_in_time_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <time.h> - ]], - [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], - [gl_cv_sys_struct_timespec_in_time_h=yes], - [gl_cv_sys_struct_timespec_in_time_h=no])]) - - TIME_H_DEFINES_STRUCT_TIMESPEC=0 - SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 - PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 - if test $gl_cv_sys_struct_timespec_in_time_h = yes; then - TIME_H_DEFINES_STRUCT_TIMESPEC=1 - else - AC_CACHE_CHECK([for struct timespec in <sys/time.h>], - [gl_cv_sys_struct_timespec_in_sys_time_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/time.h> - ]], - [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], - [gl_cv_sys_struct_timespec_in_sys_time_h=yes], - [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) - if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then - SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 - else - AC_CACHE_CHECK([for struct timespec in <pthread.h>], - [gl_cv_sys_struct_timespec_in_pthread_h], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <pthread.h> - ]], - [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], - [gl_cv_sys_struct_timespec_in_pthread_h=yes], - [gl_cv_sys_struct_timespec_in_pthread_h=no])]) - if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then - PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 - fi - fi - fi - AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) - AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) - AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) -]) - -AC_DEFUN([gl_TIME_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], -[ - GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) - GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) - GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) - GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) - GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R]) - HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) - HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) - HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) - dnl If another module says to replace or to not replace, do that. - dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; - dnl this lets maintainers check for portability. - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) - REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) - REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) -]) diff --git a/lib/gl/m4/time_r.m4 b/lib/gl/m4/time_r.m4 deleted file mode 100644 index 9e82d39ffb..0000000000 --- a/lib/gl/m4/time_r.m4 +++ /dev/null @@ -1,54 +0,0 @@ -dnl Reentrant time functions: localtime_r, gmtime_r. - -dnl Copyright (C) 2003, 2006-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 Written by Paul Eggert. - -AC_DEFUN([gl_TIME_R], -[ - dnl Persuade glibc and Solaris <time.h> to declare localtime_r. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - AC_REQUIRE([AC_C_RESTRICT]) - - AC_CHECK_FUNCS_ONCE([localtime_r]) - if test $ac_cv_func_localtime_r = yes; then - AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], - [gl_cv_time_r_posix], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <time.h>]], - [[/* We don't need to append 'restrict's to the argument types, - even though the POSIX signature has the 'restrict's, - since C99 says they can't affect type compatibility. */ - struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; - if (ptr) return 0; - /* Check the return type is a pointer. - On HP-UX 10 it is 'int'. */ - *localtime_r (0, 0);]]) - ], - [gl_cv_time_r_posix=yes], - [gl_cv_time_r_posix=no]) - ]) - if test $gl_cv_time_r_posix = yes; then - REPLACE_LOCALTIME_R=0 - else - REPLACE_LOCALTIME_R=1 - fi - else - HAVE_LOCALTIME_R=0 - fi - if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then - AC_LIBOBJ([time_r]) - gl_PREREQ_TIME_R - fi -]) - -# Prerequisites of lib/time_r.c. -AC_DEFUN([gl_PREREQ_TIME_R], [ - : -]) diff --git a/lib/gl/m4/uintmax_t.m4 b/lib/gl/m4/uintmax_t.m4 deleted file mode 100644 index 03b51bcfe3..0000000000 --- a/lib/gl/m4/uintmax_t.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# uintmax_t.m4 serial 12 -dnl Copyright (C) 1997-2004, 2007-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 From Paul Eggert. - -AC_PREREQ([2.13]) - -# Define uintmax_t to 'unsigned long' or 'unsigned long long' -# if it is not already defined in <stdint.h> or <inttypes.h>. - -AC_DEFUN([gl_AC_TYPE_UINTMAX_T], -[ - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - test $ac_cv_type_unsigned_long_long_int = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], - [Define to unsigned long or unsigned long long - if <stdint.h> and <inttypes.h> don't define.]) - else - AC_DEFINE([HAVE_UINTMAX_T], [1], - [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.]) - fi -]) diff --git a/lib/gl/m4/ungetc.m4 b/lib/gl/m4/ungetc.m4 deleted file mode 100644 index 68ccf88349..0000000000 --- a/lib/gl/m4/ungetc.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# ungetc.m4 serial 2 -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_ONCE([gl_FUNC_UNGETC_WORKS], -[ - AC_REQUIRE([AC_PROG_CC]) - - AC_CACHE_CHECK([whether ungetc works on arbitrary bytes], - [gl_cv_func_ungetc_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <stdio.h> - ]], [FILE *f; - if (!(f = fopen ("conftest.tmp", "w+"))) return 1; - if (fputs ("abc", f) < 0) return 2; - rewind (f); - if (fgetc (f) != 'a') return 3; - if (fgetc (f) != 'b') return 4; - if (ungetc ('d', f) != 'd') return 5; - if (ftell (f) != 1) return 6; - if (fgetc (f) != 'd') return 7; - if (ftell (f) != 2) return 8; - if (fseek (f, 0, SEEK_CUR) != 0) return 9; - if (ftell (f) != 2) return 10; - if (fgetc (f) != 'c') return 11; - fclose (f); remove ("conftest.tmp");])], - [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], - [gl_cv_func_ungetc_works='guessing no']) - ]) - if test "$gl_cv_func_ungetc_works" != yes; then - AC_DEFINE([FUNC_UNGETC_BROKEN], [1], - [Define to 1 if ungetc is broken when used on arbitrary bytes.]) - fi -]) diff --git a/lib/gl/m4/unistd_h.m4 b/lib/gl/m4/unistd_h.m4 deleted file mode 100644 index e2f7f2bf45..0000000000 --- a/lib/gl/m4/unistd_h.m4 +++ /dev/null @@ -1,160 +0,0 @@ -# unistd_h.m4 serial 48 -dnl Copyright (C) 2006-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 Written by Simon Josefsson, Bruno Haible. - -AC_DEFUN([gl_UNISTD_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) - - gl_CHECK_NEXT_HEADERS([unistd.h]) - - AC_CHECK_HEADERS_ONCE([unistd.h]) - if test $ac_cv_header_unistd_h = yes; then - HAVE_UNISTD_H=1 - else - HAVE_UNISTD_H=0 - fi - AC_SUBST([HAVE_UNISTD_H]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <unistd.h> -/* Some systems declare various items in the wrong headers. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <fcntl.h> -# include <stdio.h> -# include <stdlib.h> -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include <io.h> -# endif -#endif - ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat - fsync ftruncate getcwd getdomainname getdtablesize getgroups - gethostname getlogin getlogin_r getpagesize getusershell setusershell - endusershell lchown link linkat lseek pipe2 pread pwrite readlink - readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat - usleep]) -]) - -AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_UNISTD_H_DEFAULTS], -[ - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) - GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) - GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) - GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) - GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) - GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) - GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) - GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) - GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) - GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) - GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) - GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) - GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) - GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) - GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) - GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) - GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) - GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) - GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) - GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) - GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) - GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) - GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) - GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) - GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) - GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) - GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) - GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) - GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) - GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) - GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) - GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) - GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) - GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) - GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) - GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) - HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) - HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) - HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) - HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) - HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) - HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) - HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) - HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) - HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) - HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) - HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) - HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) - HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) - HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) - HAVE_LINK=1; AC_SUBST([HAVE_LINK]) - HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) - HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) - HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) - HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) - HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) - HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) - HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) - HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) - HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) - HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) - HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) - HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) - 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_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) - HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) - HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) - HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) - REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) - REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) - REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) - REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) - REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) - REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) - REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) - REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) - REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) - REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) - REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) - REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) - REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) - REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) - REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) - REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) - REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) - REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) - REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) - REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) - REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) - REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) - REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) - REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) - UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) - UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; - AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) -]) diff --git a/lib/gl/m4/vasnprintf.m4 b/lib/gl/m4/vasnprintf.m4 deleted file mode 100644 index 9c04520242..0000000000 --- a/lib/gl/m4/vasnprintf.m4 +++ /dev/null @@ -1,289 +0,0 @@ -# vasnprintf.m4 serial 32 -dnl Copyright (C) 2002-2004, 2006-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_FUNC_VASNPRINTF], -[ - AC_CHECK_FUNCS_ONCE([vasnprintf]) - if test $ac_cv_func_vasnprintf = no; then - gl_REPLACE_VASNPRINTF - fi -]) - -AC_DEFUN([gl_REPLACE_VASNPRINTF], -[ - AC_CHECK_FUNCS_ONCE([vasnprintf]) - AC_LIBOBJ([vasnprintf]) - AC_LIBOBJ([printf-args]) - AC_LIBOBJ([printf-parse]) - AC_LIBOBJ([asnprintf]) - if test $ac_cv_func_vasnprintf = yes; then - AC_DEFINE([REPLACE_VASNPRINTF], [1], - [Define if vasnprintf exists but is overridden by gnulib.]) - fi - gl_PREREQ_PRINTF_ARGS - gl_PREREQ_PRINTF_PARSE - gl_PREREQ_VASNPRINTF - gl_PREREQ_ASNPRINTF -]) - -# Prequisites of lib/printf-args.h, lib/printf-args.c. -AC_DEFUN([gl_PREREQ_PRINTF_ARGS], -[ - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) -]) - -# Prequisites of lib/printf-parse.h, lib/printf-parse.c. -AC_DEFUN([gl_PREREQ_PRINTF_PARSE], -[ - AC_REQUIRE([gl_FEATURES_H]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) - AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], - [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) - ]) - AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) -]) - -# Prerequisites of lib/vasnprintf.c. -AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], -[ - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) - AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) - dnl Use the _snprintf function only if it is declared (because on NetBSD it - dnl is defined as a weak alias of snprintf; we prefer to use the latter). - AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) - dnl We can avoid a lot of code by assuming that snprintf's return value - dnl conforms to ISO C99. So check that. - AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) - case "$gl_cv_func_snprintf_retval_c99" in - *yes) - AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1], - [Define if the return value of the snprintf function is the number of - of bytes (excluding the terminating NUL) that would have been produced - if the buffer had been large enough.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' -# arguments. -AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], -[ - AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) - case "$gl_cv_func_printf_long_double" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - 'long double' arguments.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' -# arguments. -AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], -[ - AC_REQUIRE([gl_PRINTF_INFINITE]) - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - infinite 'double' arguments.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' -# arguments. -AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], -[ - AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) - dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if - dnl NEED_PRINTF_LONG_DOUBLE is already set. - AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - infinite 'long double' arguments.]) - ;; - esac - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. -AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], -[ - AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], - [Define if the vasnprintf implementation needs special code for - the 'a' and 'A' directives.]) - AC_CHECK_FUNCS([nl_langinfo]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. -AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], -[ - AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1], - [Define if the vasnprintf implementation needs special code for - the 'F' directive.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive. -AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], -[ - AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) - case "$gl_cv_func_printf_directive_ls" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1], - [Define if the vasnprintf implementation needs special code for - the 'ls' directive.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. -AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], -[ - AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], - [Define if the vasnprintf implementation needs special code for the - ' flag.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. -AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], -[ - AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) - case "$gl_cv_func_printf_flag_leftadjust" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1], - [Define if the vasnprintf implementation needs special code for the - '-' flag.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. -AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], -[ - AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1], - [Define if the vasnprintf implementation needs special code for the - 0 flag.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. -AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], -[ - AC_REQUIRE([gl_PRINTF_PRECISION]) - case "$gl_cv_func_printf_precision" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1], - [Define if the vasnprintf implementation needs special code for - supporting large precisions without arbitrary bounds.]) - AC_DEFINE([NEED_PRINTF_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - 'double' arguments.]) - AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - 'long double' arguments.]) - ;; - esac -]) - -# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory -# conditions. -AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], -[ - AC_REQUIRE([gl_PRINTF_ENOMEM]) - case "$gl_cv_func_printf_enomem" in - *yes) - ;; - *) - AC_DEFINE([NEED_PRINTF_ENOMEM], [1], - [Define if the vasnprintf implementation needs special code for - surviving out-of-memory conditions.]) - AC_DEFINE([NEED_PRINTF_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - 'double' arguments.]) - AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], - [Define if the vasnprintf implementation needs special code for - 'long double' arguments.]) - ;; - esac -]) - -# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. -AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], -[ - AC_REQUIRE([gl_PREREQ_VASNPRINTF]) - gl_PREREQ_VASNPRINTF_LONG_DOUBLE - gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE - gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE - gl_PREREQ_VASNPRINTF_DIRECTIVE_A - gl_PREREQ_VASNPRINTF_DIRECTIVE_F - gl_PREREQ_VASNPRINTF_DIRECTIVE_LS - gl_PREREQ_VASNPRINTF_FLAG_GROUPING - gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST - gl_PREREQ_VASNPRINTF_FLAG_ZERO - gl_PREREQ_VASNPRINTF_PRECISION - gl_PREREQ_VASNPRINTF_ENOMEM -]) - -# Prerequisites of lib/asnprintf.c. -AC_DEFUN([gl_PREREQ_ASNPRINTF], -[ -]) diff --git a/lib/gl/m4/vasprintf.m4 b/lib/gl/m4/vasprintf.m4 deleted file mode 100644 index b142bc0ff1..0000000000 --- a/lib/gl/m4/vasprintf.m4 +++ /dev/null @@ -1,46 +0,0 @@ -# vasprintf.m4 serial 6 -dnl Copyright (C) 2002-2003, 2006-2007, 2009-2010 Free Software Foundation, -dnl 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_VASPRINTF], -[ - AC_CHECK_FUNCS([vasprintf]) - if test $ac_cv_func_vasprintf = no; then - gl_REPLACE_VASPRINTF - fi -]) - -AC_DEFUN([gl_REPLACE_VASPRINTF], -[ - AC_LIBOBJ([vasprintf]) - AC_LIBOBJ([asprintf]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - if test $ac_cv_func_vasprintf = yes; then - REPLACE_VASPRINTF=1 - else - HAVE_VASPRINTF=0 - fi - gl_PREREQ_VASPRINTF_H - gl_PREREQ_VASPRINTF - gl_PREREQ_ASPRINTF -]) - -# Prerequisites of the vasprintf portion of lib/stdio.h. -AC_DEFUN([gl_PREREQ_VASPRINTF_H], -[ - dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -]) - -# Prerequisites of lib/vasprintf.c. -AC_DEFUN([gl_PREREQ_VASPRINTF], -[ -]) - -# Prerequisites of lib/asprintf.c. -AC_DEFUN([gl_PREREQ_ASPRINTF], -[ -]) diff --git a/lib/gl/m4/visibility.m4 b/lib/gl/m4/visibility.m4 deleted file mode 100644 index 19cd8f3d3e..0000000000 --- a/lib/gl/m4/visibility.m4 +++ /dev/null @@ -1,77 +0,0 @@ -# visibility.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2005, 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 From Bruno Haible. - -dnl Tests whether the compiler supports the command-line option -dnl -fvisibility=hidden and the function and variable attributes -dnl __attribute__((__visibility__("hidden"))) and -dnl __attribute__((__visibility__("default"))). -dnl Does *not* test for __visibility__("protected") - which has tricky -dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on -dnl MacOS X. -dnl Does *not* test for __visibility__("internal") - which has processor -dnl dependent semantics. -dnl Does *not* test for #pragma GCC visibility push(hidden) - which is -dnl "really only recommended for legacy code". -dnl Set the variable CFLAG_VISIBILITY. -dnl Defines and sets the variable HAVE_VISIBILITY. - -AC_DEFUN([gl_VISIBILITY], -[ - AC_REQUIRE([AC_PROG_CC]) - CFLAG_VISIBILITY= - HAVE_VISIBILITY=0 - if test -n "$GCC"; then - dnl First, check whether -Werror can be added to the command line, or - dnl whether it leads to an error because of some other option that the - dnl user has put into $CC $CFLAGS $CPPFLAGS. - AC_MSG_CHECKING([whether the -Werror option is usable]) - AC_CACHE_VAL([gl_cv_cc_vis_werror], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_vis_werror=yes], - [gl_cv_cc_vis_werror=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_vis_werror]) - dnl Now check whether visibility declarations are supported. - AC_MSG_CHECKING([for simple visibility declarations]) - AC_CACHE_VAL([gl_cv_cc_visibility], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - dnl We use the option -Werror and a function dummyfunc, because on some - dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning - dnl "visibility attribute not supported in this configuration; ignored" - dnl at the first function definition in every compilation unit, and we - dnl don't want to use the option in this case. - if test $gl_cv_cc_vis_werror = yes; then - CFLAGS="$CFLAGS -Werror" - fi - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; - extern __attribute__((__visibility__("default"))) int exportedvar; - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); - void dummyfunc (void) {} - ]], - [[]])], - [gl_cv_cc_visibility=yes], - [gl_cv_cc_visibility=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_visibility]) - if test $gl_cv_cc_visibility = yes; then - CFLAG_VISIBILITY="-fvisibility=hidden" - HAVE_VISIBILITY=1 - fi - fi - AC_SUBST([CFLAG_VISIBILITY]) - AC_SUBST([HAVE_VISIBILITY]) - AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], - [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) -]) diff --git a/lib/gl/m4/vsnprintf.m4 b/lib/gl/m4/vsnprintf.m4 deleted file mode 100644 index ed189c2388..0000000000 --- a/lib/gl/m4/vsnprintf.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# vsnprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-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_FUNC_VSNPRINTF], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_cv_func_vsnprintf_usable=no - AC_CHECK_FUNCS([vsnprintf]) - if test $ac_cv_func_vsnprintf = yes; then - gl_SNPRINTF_SIZE1 - case "$gl_cv_func_snprintf_size1" in - *yes) - gl_cv_func_vsnprintf_usable=yes - ;; - esac - fi - if test $gl_cv_func_vsnprintf_usable = no; then - gl_REPLACE_VSNPRINTF - fi - AC_CHECK_DECLS_ONCE([vsnprintf]) - if test $ac_cv_have_decl_vsnprintf = no; then - HAVE_DECL_VSNPRINTF=0 - fi -]) - -AC_DEFUN([gl_REPLACE_VSNPRINTF], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_LIBOBJ([vsnprintf]) - if test $ac_cv_func_vsnprintf = yes; then - REPLACE_VSNPRINTF=1 - fi - gl_PREREQ_VSNPRINTF -]) - -# Prerequisites of lib/vsnprintf.c. -AC_DEFUN([gl_PREREQ_VSNPRINTF], [:]) diff --git a/lib/gl/m4/warn-on-use.m4 b/lib/gl/m4/warn-on-use.m4 deleted file mode 100644 index 42daae87b8..0000000000 --- a/lib/gl/m4/warn-on-use.m4 +++ /dev/null @@ -1,45 +0,0 @@ -# warn-on-use.m4 serial 2 -dnl Copyright (C) 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. - -# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) -# --------------------------------------- -# For each whitespace-separated element in the list of NAMES, define -# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES -# even after being undefined as a macro. -# -# See warn-on-use.h for some hints on how to poison function names, as -# well as ideas on poisoning global variables and macros. NAMES may -# include global variables, but remember that only functions work with -# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single -# header, but if the replacement header pulls in other headers because -# some systems declare functions in the wrong header, then INCLUDES -# should do likewise. -# -# If you assume C89, then it is generally safe to assume declarations -# for functions declared in that standard (such as gets) without -# needing gl_WARN_ON_USE_PREPARE. -AC_DEFUN([gl_WARN_ON_USE_PREPARE], -[ - m4_foreach_w([gl_decl], [$2], - [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), - [Define to 1 if ]m4_defn([gl_decl])[ is declared even after - undefining macros.])])dnl - for gl_func in m4_flatten([$2]); do - AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl - AC_CACHE_CHECK([whether $gl_func is declared without a macro], - gl_Symbol, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], -[@%:@undef $gl_func - (void) $gl_func;])], - [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) - AS_VAR_IF(gl_Symbol, [yes], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) - dnl shortcut - if the raw declaration exists, then set a cache - dnl variable to allow skipping any later AC_CHECK_DECL efforts - eval ac_cv_have_decl_$gl_func=yes]) - AS_VAR_POPDEF([gl_Symbol])dnl - done -]) diff --git a/lib/gl/m4/wchar_h.m4 b/lib/gl/m4/wchar_h.m4 deleted file mode 100644 index 8c8fad96df..0000000000 --- a/lib/gl/m4/wchar_h.m4 +++ /dev/null @@ -1,154 +0,0 @@ -dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. - -dnl Copyright (C) 2007-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 Written by Eric Blake. - -# wchar_h.m4 serial 35 - -AC_DEFUN([gl_WCHAR_H], -[ - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) - dnl Prepare for creating substitute <wchar.h>. - dnl Check for <wchar.h> (missing in Linux uClibc when built without wide - dnl character support). - dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. - AC_CHECK_HEADERS_ONCE([wchar.h]) - gl_CHECK_NEXT_HEADERS([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]) - - AC_REQUIRE([gl_FEATURES_H]) - - AC_REQUIRE([gt_TYPE_WINT_T]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi - AC_SUBST([HAVE_WINT_T]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[ -/* Some systems require additional headers. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> -#endif -#include <wchar.h> - ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb - wcsrtombs wcsnrtombs wcwidth]) -]) - -dnl Check whether <wchar.h> is usable at all. -AC_DEFUN([gl_WCHAR_H_INLINE_OK], -[ - dnl Test whether <wchar.h> suffers due to the transition from '__inline' to - dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> - dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, - dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and - dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. - AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], - [gl_cv_header_wchar_h_correct_inline], - [gl_cv_header_wchar_h_correct_inline=yes - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod -#include <wchar.h> -extern int zero (void); -int main () { return zero(); } -]])]) - if AC_TRY_EVAL([ac_compile]); then - mv conftest.$ac_objext conftest1.$ac_objext - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod -#include <wchar.h> -int zero (void) { return 0; } -]])]) - if AC_TRY_EVAL([ac_compile]); then - mv conftest.$ac_objext conftest2.$ac_objext - if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then - : - else - gl_cv_header_wchar_h_correct_inline=no - fi - fi - fi - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext - ]) - if test $gl_cv_header_wchar_h_correct_inline = no; then - AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). -This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in -C99 mode. You have four options: - - Add the flag -fgnu89-inline to CC and reconfigure, or - - Fix your include files, using parts of - <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or - - Use a gcc version older than 4.3, or - - Don't use the flags -std=c99 or -std=gnu99. -Configuration aborted.]) - fi -]) - -dnl Unconditionally enables the replacement of <wchar.h>. -AC_DEFUN([gl_REPLACE_WCHAR_H], -[ - dnl This is a no-op, because <wchar.h> is always overridden. - : -]) - -AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) -]) - -AC_DEFUN([gl_WCHAR_H_DEFAULTS], -[ - GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) - GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) - GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) - GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) - GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) - GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) - GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) - GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) - GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) - GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) - GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) - HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) - HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) - HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) - HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) - HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) - HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) - HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) - HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) - HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) - HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) - REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) - REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) - REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) - REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) - REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) - REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) - REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) - REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) - REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) - REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) - REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) - REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) -]) diff --git a/lib/gl/m4/wchar_t.m4 b/lib/gl/m4/wchar_t.m4 deleted file mode 100644 index a133e6ad58..0000000000 --- a/lib/gl/m4/wchar_t.m4 +++ /dev/null @@ -1,24 +0,0 @@ -# wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 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 From Bruno Haible. -dnl Test whether <stddef.h> has the 'wchar_t' type. -dnl Prerequisite: AC_PROG_CC - -AC_DEFUN([gt_TYPE_WCHAR_T], -[ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stddef.h> - wchar_t foo = (wchar_t)'\0';]], - [[]])], - [gt_cv_c_wchar_t=yes], - [gt_cv_c_wchar_t=no])]) - if test $gt_cv_c_wchar_t = yes; then - AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) - fi -]) diff --git a/lib/gl/m4/wint_t.m4 b/lib/gl/m4/wint_t.m4 deleted file mode 100644 index 58ef865565..0000000000 --- a/lib/gl/m4/wint_t.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# wint_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2003, 2007-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 From Bruno Haible. -dnl Test whether <wchar.h> has the 'wint_t' type. -dnl Prerequisite: AC_PROG_CC - -AC_DEFUN([gt_TYPE_WINT_T], -[ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> - wint_t foo = (wchar_t)'\0';]], - [[]])], - [gt_cv_c_wint_t=yes], - [gt_cv_c_wint_t=no])]) - if test $gt_cv_c_wint_t = yes; then - AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) - fi -]) diff --git a/lib/gl/m4/xsize.m4 b/lib/gl/m4/xsize.m4 deleted file mode 100644 index b653693a30..0000000000 --- a/lib/gl/m4/xsize.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# xsize.m4 serial 4 -dnl Copyright (C) 2003-2004, 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. - -AC_DEFUN([gl_XSIZE], -[ - dnl Prerequisites of lib/xsize.h. - AC_REQUIRE([gl_SIZE_MAX]) - AC_REQUIRE([AC_C_INLINE]) - AC_CHECK_HEADERS([stdint.h]) -]) diff --git a/lib/gl/malloc.c b/lib/gl/malloc.c deleted file mode 100644 index 02ca9f7c84..0000000000 --- a/lib/gl/malloc.c +++ /dev/null @@ -1,60 +0,0 @@ -/* malloc() function that is glibc compatible. - - Copyright (C) 1997-1998, 2006-2007, 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.1, 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 Jim Meyering and Bruno Haible */ - -#include <config.h> -/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ -#ifdef malloc -# define NEED_MALLOC_GNU 1 -# undef malloc -/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ -#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU -# define NEED_MALLOC_GNU 1 -#endif - -/* Specification. */ -#include <stdlib.h> - -#include <errno.h> - -/* Call the system's malloc below. */ -#undef malloc - -/* Allocate an N-byte block of memory from the heap. - If N is zero, allocate a 1-byte block. */ - -void * -rpl_malloc (size_t n) -{ - void *result; - -#if NEED_MALLOC_GNU - if (n == 0) - n = 1; -#endif - - result = malloc (n); - -#if !HAVE_MALLOC_POSIX - if (result == NULL) - errno = ENOMEM; -#endif - - return result; -} diff --git a/lib/gl/memchr.c b/lib/gl/memchr.c deleted file mode 100644 index b0af681bae..0000000000 --- a/lib/gl/memchr.c +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010 - Free Software Foundation, Inc. - - Based on strlen implementation by Torbjorn Granlund (tege@sics.se), - with help from Dan Sahlin (dan@sics.se) and - commentary by Jim Blandy (jimb@ai.mit.edu); - adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), - and implemented by Roland McGrath (roland@ai.mit.edu). - -NOTE: The canonical source of this file is maintained with the GNU C Library. -Bugs can be reported to bug-glibc@prep.ai.mit.edu. - -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.1 of the License, or 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 _LIBC -# include <config.h> -#endif - -#include <string.h> - -#include <stddef.h> - -#if defined _LIBC -# include <memcopy.h> -#else -# define reg_char char -#endif - -#include <limits.h> - -#if HAVE_BP_SYM_H || defined _LIBC -# include <bp-sym.h> -#else -# define BP_SYM(sym) sym -#endif - -#undef __memchr -#ifdef _LIBC -# undef memchr -#endif - -#ifndef weak_alias -# define __memchr memchr -#endif - -/* Search no more than N bytes of S for C. */ -void * -__memchr (void const *s, int c_in, size_t n) -{ - /* On 32-bit hardware, choosing longword to be a 32-bit unsigned - long instead of a 64-bit uintmax_t tends to give better - performance. On 64-bit hardware, unsigned long is generally 64 - bits already. Change this typedef to experiment with - performance. */ - typedef unsigned long int longword; - - const unsigned char *char_ptr; - const longword *longword_ptr; - longword repeated_one; - longword repeated_c; - unsigned reg_char c; - - c = (unsigned char) c_in; - - /* Handle the first few bytes by reading one byte at a time. - Do this until CHAR_PTR is aligned on a longword boundary. */ - for (char_ptr = (const unsigned char *) s; - n > 0 && (size_t) char_ptr % sizeof (longword) != 0; - --n, ++char_ptr) - if (*char_ptr == c) - return (void *) char_ptr; - - longword_ptr = (const longword *) char_ptr; - - /* All these elucidatory comments refer to 4-byte longwords, - but the theory applies equally well to any size longwords. */ - - /* Compute auxiliary longword values: - repeated_one is a value which has a 1 in every byte. - repeated_c has c in every byte. */ - repeated_one = 0x01010101; - repeated_c = c | (c << 8); - repeated_c |= repeated_c << 16; - if (0xffffffffU < (longword) -1) - { - repeated_one |= repeated_one << 31 << 1; - repeated_c |= repeated_c << 31 << 1; - if (8 < sizeof (longword)) - { - size_t i; - - for (i = 64; i < sizeof (longword) * 8; i *= 2) - { - repeated_one |= repeated_one << i; - repeated_c |= repeated_c << i; - } - } - } - - /* Instead of the traditional loop which tests each byte, we will test a - longword at a time. The tricky part is testing if *any of the four* - bytes in the longword in question are equal to c. We first use an xor - with repeated_c. This reduces the task to testing whether *any of the - four* bytes in longword1 is zero. - - We compute tmp = - ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). - That is, we perform the following operations: - 1. Subtract repeated_one. - 2. & ~longword1. - 3. & a mask consisting of 0x80 in every byte. - Consider what happens in each byte: - - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, - and step 3 transforms it into 0x80. A carry can also be propagated - to more significant bytes. - - If a byte of longword1 is nonzero, let its lowest 1 bit be at - position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, - the byte ends in a single bit of value 0 and k bits of value 1. - After step 2, the result is just k bits of value 1: 2^k - 1. After - step 3, the result is 0. And no carry is produced. - So, if longword1 has only non-zero bytes, tmp is zero. - Whereas if longword1 has a zero byte, call j the position of the least - significant zero byte. Then the result has a zero at positions 0, ..., - j-1 and a 0x80 at position j. We cannot predict the result at the more - significant bytes (positions j+1..3), but it does not matter since we - already have a non-zero bit at position 8*j+7. - - So, the test whether any byte in longword1 is zero is equivalent to - testing whether tmp is nonzero. */ - - while (n >= sizeof (longword)) - { - longword longword1 = *longword_ptr ^ repeated_c; - - if ((((longword1 - repeated_one) & ~longword1) - & (repeated_one << 7)) != 0) - break; - longword_ptr++; - n -= sizeof (longword); - } - - char_ptr = (const unsigned char *) longword_ptr; - - /* At this point, we know that either n < sizeof (longword), or one of the - sizeof (longword) bytes starting at char_ptr is == c. On little-endian - machines, we could determine the first such byte without any further - memory accesses, just by looking at the tmp result from the last loop - iteration. But this does not work on big-endian machines. Choose code - that works in both cases. */ - - for (; n > 0; --n, ++char_ptr) - { - if (*char_ptr == c) - return (void *) char_ptr; - } - - return NULL; -} -#ifdef weak_alias -weak_alias (__memchr, BP_SYM (memchr)) -#endif diff --git a/lib/gl/memchr.valgrind b/lib/gl/memchr.valgrind deleted file mode 100644 index 60f247e10d..0000000000 --- a/lib/gl/memchr.valgrind +++ /dev/null @@ -1,14 +0,0 @@ -# Suppress a valgrind message about use of uninitialized memory in memchr(). -# POSIX states that when the character is found, memchr must not read extra -# bytes in an overestimated length (for example, where memchr is used to -# implement strnlen). However, we use a safe word read to provide a speedup. -{ - memchr-value4 - Memcheck:Value4 - fun:rpl_memchr -} -{ - memchr-value8 - Memcheck:Value8 - fun:rpl_memchr -} diff --git a/lib/gl/memmem.c b/lib/gl/memmem.c deleted file mode 100644 index 544ed45551..0000000000 --- a/lib/gl/memmem.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2004, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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.1, 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. */ - -/* This particular implementation was written by Eric Blake, 2008. */ - -#ifndef _LIBC -# include <config.h> -#endif - -/* Specification of memmem. */ -#include <string.h> - -#ifndef _LIBC -# define __builtin_expect(expr, val) (expr) -#endif - -#define RETURN_TYPE void * -#define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l)) -#include "str-two-way.h" - -/* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK - if NEEDLE_LEN is 0, otherwise NULL if NEEDLE is not found in - HAYSTACK. */ -void * -memmem (const void *haystack_start, size_t haystack_len, - const void *needle_start, size_t needle_len) -{ - /* Abstract memory is considered to be an array of 'unsigned char' values, - not an array of 'char' values. See ISO C 99 section 6.2.6.1. */ - const unsigned char *haystack = (const unsigned char *) haystack_start; - const unsigned char *needle = (const unsigned char *) needle_start; - - if (needle_len == 0) - /* The first occurrence of the empty string is deemed to occur at - the beginning of the string. */ - return (void *) haystack; - - /* Sanity check, otherwise the loop might search through the whole - memory. */ - if (__builtin_expect (haystack_len < needle_len, 0)) - return NULL; - - /* Use optimizations in memchr when possible, to reduce the search - size of haystack using a linear algorithm with a smaller - coefficient. However, avoid memchr for long needles, since we - can often achieve sublinear performance. */ - if (needle_len < LONG_NEEDLE_THRESHOLD) - { - haystack = memchr (haystack, *needle, haystack_len); - if (!haystack || __builtin_expect (needle_len == 1, 0)) - return (void *) haystack; - haystack_len -= haystack - (const unsigned char *) haystack_start; - if (haystack_len < needle_len) - return NULL; - return two_way_short_needle (haystack, haystack_len, needle, needle_len); - } - else - return two_way_long_needle (haystack, haystack_len, needle, needle_len); -} - -#undef LONG_NEEDLE_THRESHOLD diff --git a/lib/gl/minmax.h b/lib/gl/minmax.h deleted file mode 100644 index 76a683daa5..0000000000 --- a/lib/gl/minmax.h +++ /dev/null @@ -1,61 +0,0 @@ -/* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _MINMAX_H -#define _MINMAX_H - -/* Note: MIN, MAX are also defined in <sys/param.h> on some systems - (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about - MIN, MAX macro redefinitions on some systems; the workaround is to - #include this file as the last one among the #include list. */ - -/* Before we define the following symbols we get the <limits.h> file - since otherwise we get redefinitions on some systems if <limits.h> is - included after this file. Likewise for <sys/param.h>. - If more than one of these system headers define MIN and MAX, pick just - one of the headers (because the definitions most likely are the same). */ -#if HAVE_MINMAX_IN_LIMITS_H -# include <limits.h> -#elif HAVE_MINMAX_IN_SYS_PARAM_H -# include <sys/param.h> -#endif - -/* Note: MIN and MAX should be used with two arguments of the - same type. They might not return the minimum and maximum of their two - arguments, if the arguments have different types or have unusual - floating-point values. For example, on a typical host with 32-bit 'int', - 64-bit 'long long', and 64-bit IEEE 754 'double' types: - - MAX (-1, 2147483648) returns 4294967295. - MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. - MAX (NaN, 0.0) returns 0.0. - MAX (+0.0, -0.0) returns -0.0. - - and in each case the answer is in some sense bogus. */ - -/* MAX(a,b) returns the maximum of A and B. */ -#ifndef MAX -# define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -/* MIN(a,b) returns the minimum of A and B. */ -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - -#endif /* _MINMAX_H */ diff --git a/lib/gl/netdb.in.h b/lib/gl/netdb.in.h deleted file mode 100644 index 4f6fef31f1..0000000000 --- a/lib/gl/netdb.in.h +++ /dev/null @@ -1,221 +0,0 @@ -/* Provide a netdb.h header file for systems lacking it (read: MinGW). - Copyright (C) 2008-2010 Free Software Foundation, Inc. - Written by Simon Josefsson. - - 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.1, 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. */ - -/* This file is supposed to be used on platforms that lack <netdb.h>. - It is intended to provide definitions and prototypes needed by an - application. */ - -#ifndef _GL_NETDB_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if @HAVE_NETDB_H@ - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_NETDB_H@ - -#endif - -#ifndef _GL_NETDB_H -#define _GL_NETDB_H - -/* Get netdb.h definitions such as struct hostent for MinGW. */ -#include <sys/socket.h> - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* Declarations for a platform that lacks <netdb.h>, or where it is - incomplete. */ - -#if @GNULIB_GETADDRINFO@ - -# if !@HAVE_STRUCT_ADDRINFO@ - -/* Structure to contain information about address of a service provider. */ -struct addrinfo -{ - int ai_flags; /* Input flags. */ - int ai_family; /* Protocol family for socket. */ - int ai_socktype; /* Socket type. */ - int ai_protocol; /* Protocol for socket. */ - socklen_t ai_addrlen; /* Length of socket address. */ - struct sockaddr *ai_addr; /* Socket address for socket. */ - char *ai_canonname; /* Canonical name for service location. */ - struct addrinfo *ai_next; /* Pointer to next in list. */ -}; -# endif - -/* Possible values for `ai_flags' field in `addrinfo' structure. */ -# ifndef AI_PASSIVE -# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ -# endif -# ifndef AI_CANONNAME -# define AI_CANONNAME 0x0002 /* Request for canonical name. */ -# endif -# ifndef AI_NUMERICSERV -# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ -# endif - -# if 0 -# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ -# endif - -/* These symbolic constants are required to be present by POSIX, but - our getaddrinfo replacement doesn't use them (yet). Setting them - to 0 on systems that doesn't have them avoids causing problems for - system getaddrinfo implementations that would be confused by - unknown values. */ -# ifndef AI_V4MAPPED -# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */ -# endif -# ifndef AI_ALL -# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ -# endif -# ifndef AI_ADDRCONFIG -# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose - returned address type. */ -# endif - -/* Error values for `getaddrinfo' function. */ -# ifndef EAI_BADFLAGS -# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ -# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ -# define EAI_AGAIN -3 /* Temporary failure in name resolution. */ -# define EAI_FAIL -4 /* Non-recoverable failure in name res. */ -# define EAI_NODATA -5 /* No address associated with NAME. */ -# define EAI_FAMILY -6 /* `ai_family' not supported. */ -# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ -# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ -# define EAI_MEMORY -10 /* Memory allocation failure. */ -# endif - -/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least - FreeBSD, which does define EAI_BADFLAGS) have removed the definition - in favor of EAI_NONAME. */ -# if !defined EAI_NODATA && defined EAI_NONAME -# define EAI_NODATA EAI_NONAME -# endif - -# ifndef EAI_OVERFLOW -/* Not defined on mingw32 and Haiku. */ -# define EAI_OVERFLOW -12 /* Argument buffer overflow. */ -# endif -# ifndef EAI_ADDRFAMILY -/* Not defined on mingw32. */ -# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ -# endif -# ifndef EAI_SYSTEM -/* Not defined on mingw32. */ -# define EAI_SYSTEM -11 /* System error returned in `errno'. */ -# endif - -# if 0 -/* The commented out definitions below are not yet implemented in the - GNULIB getaddrinfo() replacement, so are not yet needed. - - If they are restored, be sure to protect the definitions with #ifndef. */ -# ifndef EAI_INPROGRESS -# define EAI_INPROGRESS -100 /* Processing request in progress. */ -# define EAI_CANCELED -101 /* Request canceled. */ -# define EAI_NOTCANCELED -102 /* Request not canceled. */ -# define EAI_ALLDONE -103 /* All requests done. */ -# define EAI_INTR -104 /* Interrupted by a signal. */ -# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ -# endif -# endif - -# if !@HAVE_DECL_GETADDRINFO@ -/* Translate name of a service location and/or a service name to set of - socket addresses. - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ -extern int getaddrinfo (const char *restrict nodename, - const char *restrict servname, - const struct addrinfo *restrict hints, - struct addrinfo **restrict res) - _GL_ARG_NONNULL ((4)); -# endif - -# if !@HAVE_DECL_FREEADDRINFO@ -/* Free `addrinfo' structure AI including associated storage. - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ -extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1)); -# endif - -# if !@HAVE_DECL_GAI_STRERROR@ -/* Convert error return from getaddrinfo() to a string. - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */ -extern const char *gai_strerror (int ecode); -# endif - -# if !@HAVE_DECL_GETNAMEINFO@ -/* Convert socket address to printable node and service names. - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */ -extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen, - char *restrict node, socklen_t nodelen, - char *restrict service, socklen_t servicelen, - int flags) - _GL_ARG_NONNULL ((1)); -# endif - -/* Possible flags for getnameinfo. */ -# ifndef NI_NUMERICHOST -# define NI_NUMERICHOST 1 -# endif -# ifndef NI_NUMERICSERV -# define NI_NUMERICSERV 2 -# endif - -#elif defined GNULIB_POSIXCHECK - -# undef getaddrinfo -# if HAVE_RAW_DECL_GETADDRINFO -_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - " - "use gnulib module getaddrinfo for portability"); -# endif - -# undef freeaddrinfo -# if HAVE_RAW_DECL_FREEADDRINFO -_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - " - "use gnulib module getaddrinfo for portability"); -# endif - -# undef gai_strerror -# if HAVE_RAW_DECL_GAI_STRERROR -_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - " - "use gnulib module getaddrinfo for portability"); -# endif - -# undef getnameinfo -# if HAVE_RAW_DECL_GETNAMEINFO -_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - " - "use gnulib module getaddrinfo for portability"); -# endif - -#endif - -#endif /* _GL_NETDB_H */ -#endif /* _GL_NETDB_H */ diff --git a/lib/gl/override/lib/gc-libgcrypt.c.diff b/lib/gl/override/lib/gc-libgcrypt.c.diff deleted file mode 100644 index a92198c8cc..0000000000 --- a/lib/gl/override/lib/gc-libgcrypt.c.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- lgl/gc-libgcrypt.c.orig 2008-05-05 13:26:28.000000000 +0200 -+++ lgl/gc-libgcrypt.c 2008-05-05 13:26:43.000000000 +0200 -@@ -145,7 +145,7 @@ - gcryalg = GCRY_CIPHER_RFC2268_40; - break; - --#ifdef HAVE_CAMELLIA -+#ifdef ENABLE_CAMELLIA - case GC_CAMELLIA128: - gcryalg = GCRY_CIPHER_CAMELLIA128; - break; -@@ -294,9 +294,11 @@ - gcryalg = GCRY_MD_SHA512; - break; - -+#ifdef ENABLE_CAMELLIA - case GC_SHA224: - gcryalg = GCRY_MD_SHA224; - break; -+#endif - - case GC_RMD160: - gcryalg = GCRY_MD_RMD160; -@@ -397,9 +399,11 @@ - len = GC_SHA512_DIGEST_SIZE; - break; - -+#ifdef ENABLE_CAMELLIA - case GC_SHA224: - len = GC_SHA224_DIGEST_SIZE; - break; -+#endif - - default: - return 0; diff --git a/lib/gl/override/lib/gettext.h.diff b/lib/gl/override/lib/gettext.h.diff deleted file mode 100644 index ae7f6a8107..0000000000 --- a/lib/gl/override/lib/gettext.h.diff +++ /dev/null @@ -1,112 +0,0 @@ ---- lib/gl/gettext.h.orig 2010-01-26 15:38:07.000000000 +0100 -+++ lib/gl/gettext.h 2010-01-26 15:38:14.000000000 +0100 -@@ -172,109 +172,4 @@ - return translation; - } - --/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID -- can be arbitrary expressions. But for string literals these macros are -- less efficient than those above. */ -- --#include <string.h> -- --#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ -- (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ -- /* || __STDC_VERSION__ >= 199901L */ ) -- --#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS --#include <stdlib.h> --#endif -- --#define pgettext_expr(Msgctxt, Msgid) \ -- dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) --#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ -- dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) -- --#ifdef __GNUC__ --__inline --#else --#ifdef __cplusplus --inline --#endif --#endif --static const char * --dcpgettext_expr (const char *domain, -- const char *msgctxt, const char *msgid, -- int category) --{ -- size_t msgctxt_len = strlen (msgctxt) + 1; -- size_t msgid_len = strlen (msgid) + 1; -- const char *translation; --#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -- char msg_ctxt_id[msgctxt_len + msgid_len]; --#else -- char buf[1024]; -- char *msg_ctxt_id = -- (msgctxt_len + msgid_len <= sizeof (buf) -- ? buf -- : (char *) malloc (msgctxt_len + msgid_len)); -- if (msg_ctxt_id != NULL) --#endif -- { -- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); -- msg_ctxt_id[msgctxt_len - 1] = '\004'; -- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); -- translation = dcgettext (domain, msg_ctxt_id, category); --#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -- if (msg_ctxt_id != buf) -- free (msg_ctxt_id); --#endif -- if (translation != msg_ctxt_id) -- return translation; -- } -- return msgid; --} -- --#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ -- dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) --#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ -- dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) -- --#ifdef __GNUC__ --__inline --#else --#ifdef __cplusplus --inline --#endif --#endif --static const char * --dcnpgettext_expr (const char *domain, -- const char *msgctxt, const char *msgid, -- const char *msgid_plural, unsigned long int n, -- int category) --{ -- size_t msgctxt_len = strlen (msgctxt) + 1; -- size_t msgid_len = strlen (msgid) + 1; -- const char *translation; --#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -- char msg_ctxt_id[msgctxt_len + msgid_len]; --#else -- char buf[1024]; -- char *msg_ctxt_id = -- (msgctxt_len + msgid_len <= sizeof (buf) -- ? buf -- : (char *) malloc (msgctxt_len + msgid_len)); -- if (msg_ctxt_id != NULL) --#endif -- { -- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); -- msg_ctxt_id[msgctxt_len - 1] = '\004'; -- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); -- translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); --#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -- if (msg_ctxt_id != buf) -- free (msg_ctxt_id); --#endif -- if (!(translation == msg_ctxt_id || translation == msgid_plural)) -- return translation; -- } -- return (n == 1 ? msgid : msgid_plural); --} -- - #endif /* _LIBGETTEXT_H */ diff --git a/lib/gl/printf-args.c b/lib/gl/printf-args.c deleted file mode 100644 index b37cae2004..0000000000 --- a/lib/gl/printf-args.c +++ /dev/null @@ -1,188 +0,0 @@ -/* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 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.1, 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. */ - -/* This file can be parametrized with the following macros: - ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. - PRINTF_FETCHARGS Name of the function to be defined. - STATIC Set to 'static' to declare the function static. */ - -#ifndef PRINTF_FETCHARGS -# include <config.h> -#endif - -/* Specification. */ -#ifndef PRINTF_FETCHARGS -# include "printf-args.h" -#endif - -#ifdef STATIC -STATIC -#endif -int -PRINTF_FETCHARGS (va_list args, arguments *a) -{ - size_t i; - argument *ap; - - for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) - switch (ap->type) - { - case TYPE_SCHAR: - ap->a.a_schar = va_arg (args, /*signed char*/ int); - break; - case TYPE_UCHAR: - ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); - break; - case TYPE_SHORT: - ap->a.a_short = va_arg (args, /*short*/ int); - break; - case TYPE_USHORT: - ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); - break; - case TYPE_INT: - ap->a.a_int = va_arg (args, int); - break; - case TYPE_UINT: - ap->a.a_uint = va_arg (args, unsigned int); - break; - case TYPE_LONGINT: - ap->a.a_longint = va_arg (args, long int); - break; - case TYPE_ULONGINT: - ap->a.a_ulongint = va_arg (args, unsigned long int); - break; -#if HAVE_LONG_LONG_INT - case TYPE_LONGLONGINT: - ap->a.a_longlongint = va_arg (args, long long int); - break; - case TYPE_ULONGLONGINT: - ap->a.a_ulonglongint = va_arg (args, unsigned long long int); - break; -#endif - case TYPE_DOUBLE: - ap->a.a_double = va_arg (args, double); - break; - case TYPE_LONGDOUBLE: - ap->a.a_longdouble = va_arg (args, long double); - break; - case TYPE_CHAR: - ap->a.a_char = va_arg (args, int); - break; -#if HAVE_WINT_T - case TYPE_WIDE_CHAR: - /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by - default argument promotions", this is not the case in mingw32, - where wint_t is 'unsigned short'. */ - ap->a.a_wide_char = - (sizeof (wint_t) < sizeof (int) - ? (wint_t) va_arg (args, int) - : va_arg (args, wint_t)); - break; -#endif - case TYPE_STRING: - ap->a.a_string = va_arg (args, const char *); - /* A null pointer is an invalid argument for "%s", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_string == NULL) - ap->a.a_string = "(NULL)"; - break; -#if HAVE_WCHAR_T - case TYPE_WIDE_STRING: - ap->a.a_wide_string = va_arg (args, const wchar_t *); - /* A null pointer is an invalid argument for "%ls", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_wide_string == NULL) - { - static const wchar_t wide_null_string[] = - { - (wchar_t)'(', - (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', - (wchar_t)')', - (wchar_t)0 - }; - ap->a.a_wide_string = wide_null_string; - } - break; -#endif - case TYPE_POINTER: - ap->a.a_pointer = va_arg (args, void *); - break; - case TYPE_COUNT_SCHAR_POINTER: - ap->a.a_count_schar_pointer = va_arg (args, signed char *); - break; - case TYPE_COUNT_SHORT_POINTER: - ap->a.a_count_short_pointer = va_arg (args, short *); - break; - case TYPE_COUNT_INT_POINTER: - ap->a.a_count_int_pointer = va_arg (args, int *); - break; - case TYPE_COUNT_LONGINT_POINTER: - ap->a.a_count_longint_pointer = va_arg (args, long int *); - break; -#if HAVE_LONG_LONG_INT - case TYPE_COUNT_LONGLONGINT_POINTER: - ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); - break; -#endif -#if ENABLE_UNISTDIO - /* The unistdio extensions. */ - case TYPE_U8_STRING: - ap->a.a_u8_string = va_arg (args, const uint8_t *); - /* A null pointer is an invalid argument for "%U", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u8_string == NULL) - { - static const uint8_t u8_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u8_string = u8_null_string; - } - break; - case TYPE_U16_STRING: - ap->a.a_u16_string = va_arg (args, const uint16_t *); - /* A null pointer is an invalid argument for "%lU", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u16_string == NULL) - { - static const uint16_t u16_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u16_string = u16_null_string; - } - break; - case TYPE_U32_STRING: - ap->a.a_u32_string = va_arg (args, const uint32_t *); - /* A null pointer is an invalid argument for "%llU", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u32_string == NULL) - { - static const uint32_t u32_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u32_string = u32_null_string; - } - break; -#endif - default: - /* Unknown type. */ - return -1; - } - return 0; -} diff --git a/lib/gl/printf-args.h b/lib/gl/printf-args.h deleted file mode 100644 index fcdee85c0d..0000000000 --- a/lib/gl/printf-args.h +++ /dev/null @@ -1,155 +0,0 @@ -/* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _PRINTF_ARGS_H -#define _PRINTF_ARGS_H - -/* This file can be parametrized with the following macros: - ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. - PRINTF_FETCHARGS Name of the function to be declared. - STATIC Set to 'static' to declare the function static. */ - -/* Default parameters. */ -#ifndef PRINTF_FETCHARGS -# define PRINTF_FETCHARGS printf_fetchargs -#endif - -/* Get size_t. */ -#include <stddef.h> - -/* Get wchar_t. */ -#if HAVE_WCHAR_T -# include <stddef.h> -#endif - -/* Get wint_t. */ -#if HAVE_WINT_T -# include <wchar.h> -#endif - -/* Get va_list. */ -#include <stdarg.h> - - -/* Argument types */ -typedef enum -{ - TYPE_NONE, - TYPE_SCHAR, - TYPE_UCHAR, - TYPE_SHORT, - TYPE_USHORT, - TYPE_INT, - TYPE_UINT, - TYPE_LONGINT, - TYPE_ULONGINT, -#if HAVE_LONG_LONG_INT - TYPE_LONGLONGINT, - TYPE_ULONGLONGINT, -#endif - TYPE_DOUBLE, - TYPE_LONGDOUBLE, - TYPE_CHAR, -#if HAVE_WINT_T - TYPE_WIDE_CHAR, -#endif - TYPE_STRING, -#if HAVE_WCHAR_T - TYPE_WIDE_STRING, -#endif - TYPE_POINTER, - TYPE_COUNT_SCHAR_POINTER, - TYPE_COUNT_SHORT_POINTER, - TYPE_COUNT_INT_POINTER, - TYPE_COUNT_LONGINT_POINTER -#if HAVE_LONG_LONG_INT -, TYPE_COUNT_LONGLONGINT_POINTER -#endif -#if ENABLE_UNISTDIO - /* The unistdio extensions. */ -, TYPE_U8_STRING -, TYPE_U16_STRING -, TYPE_U32_STRING -#endif -} arg_type; - -/* Polymorphic argument */ -typedef struct -{ - arg_type type; - union - { - signed char a_schar; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long int a_longint; - unsigned long int a_ulongint; -#if HAVE_LONG_LONG_INT - long long int a_longlongint; - unsigned long long int a_ulonglongint; -#endif - float a_float; - double a_double; - long double a_longdouble; - int a_char; -#if HAVE_WINT_T - wint_t a_wide_char; -#endif - const char* a_string; -#if HAVE_WCHAR_T - const wchar_t* a_wide_string; -#endif - void* a_pointer; - signed char * a_count_schar_pointer; - short * a_count_short_pointer; - int * a_count_int_pointer; - long int * a_count_longint_pointer; -#if HAVE_LONG_LONG_INT - long long int * a_count_longlongint_pointer; -#endif -#if ENABLE_UNISTDIO - /* The unistdio extensions. */ - const uint8_t * a_u8_string; - const uint16_t * a_u16_string; - const uint32_t * a_u32_string; -#endif - } - a; -} -argument; - -typedef struct -{ - size_t count; - argument *arg; -} -arguments; - - -/* Fetch the arguments, putting them into a. */ -#ifdef STATIC -STATIC -#else -extern -#endif -int PRINTF_FETCHARGS (va_list args, arguments *a); - -#endif /* _PRINTF_ARGS_H */ diff --git a/lib/gl/printf-parse.c b/lib/gl/printf-parse.c deleted file mode 100644 index 2b8cc7b7d1..0000000000 --- a/lib/gl/printf-parse.c +++ /dev/null @@ -1,634 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-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.1, 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. */ - -/* This file can be parametrized with the following macros: - CHAR_T The element type of the format string. - CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters - in the format string are ASCII. - DIRECTIVE Structure denoting a format directive. - Depends on CHAR_T. - DIRECTIVES Structure denoting the set of format directives of a - format string. Depends on CHAR_T. - PRINTF_PARSE Function that parses a format string. - Depends on CHAR_T. - STATIC Set to 'static' to declare the function static. - ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ - -#ifndef PRINTF_PARSE -# include <config.h> -#endif - -/* Specification. */ -#ifndef PRINTF_PARSE -# include "printf-parse.h" -#endif - -/* Default parameters. */ -#ifndef PRINTF_PARSE -# define PRINTF_PARSE printf_parse -# define CHAR_T char -# define DIRECTIVE char_directive -# define DIRECTIVES char_directives -#endif - -/* Get size_t, NULL. */ -#include <stddef.h> - -/* Get intmax_t. */ -#if defined IN_LIBINTL || defined IN_LIBASPRINTF -# if HAVE_STDINT_H_WITH_UINTMAX -# include <stdint.h> -# endif -# if HAVE_INTTYPES_H_WITH_UINTMAX -# include <inttypes.h> -# endif -#else -# include <stdint.h> -#endif - -/* malloc(), realloc(), free(). */ -#include <stdlib.h> - -/* errno. */ -#include <errno.h> - -/* Checked size_t computations. */ -#include "xsize.h" - -#if CHAR_T_ONLY_ASCII -/* c_isascii(). */ -# include "c-ctype.h" -#endif - -#ifdef STATIC -STATIC -#endif -int -PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) -{ - const CHAR_T *cp = format; /* pointer into format */ - size_t arg_posn = 0; /* number of regular arguments consumed */ - size_t d_allocated; /* allocated elements of d->dir */ - size_t a_allocated; /* allocated elements of a->arg */ - size_t max_width_length = 0; - size_t max_precision_length = 0; - - d->count = 0; - d_allocated = 1; - d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); - if (d->dir == NULL) - /* Out of memory. */ - goto out_of_memory_1; - - a->count = 0; - a_allocated = 0; - a->arg = NULL; - -#define REGISTER_ARG(_index_,_type_) \ - { \ - size_t n = (_index_); \ - if (n >= a_allocated) \ - { \ - size_t memory_size; \ - argument *memory; \ - \ - a_allocated = xtimes (a_allocated, 2); \ - if (a_allocated <= n) \ - a_allocated = xsum (n, 1); \ - memory_size = xtimes (a_allocated, sizeof (argument)); \ - if (size_overflow_p (memory_size)) \ - /* Overflow, would lead to out of memory. */ \ - goto out_of_memory; \ - memory = (argument *) (a->arg \ - ? realloc (a->arg, memory_size) \ - : malloc (memory_size)); \ - if (memory == NULL) \ - /* Out of memory. */ \ - goto out_of_memory; \ - a->arg = memory; \ - } \ - while (a->count <= n) \ - a->arg[a->count++].type = TYPE_NONE; \ - if (a->arg[n].type == TYPE_NONE) \ - a->arg[n].type = (_type_); \ - else if (a->arg[n].type != (_type_)) \ - /* Ambiguous type for positional argument. */ \ - goto error; \ - } - - while (*cp != '\0') - { - CHAR_T c = *cp++; - if (c == '%') - { - size_t arg_index = ARG_NONE; - DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ - - /* Initialize the next directive. */ - dp->dir_start = cp - 1; - dp->flags = 0; - dp->width_start = NULL; - dp->width_end = NULL; - dp->width_arg_index = ARG_NONE; - dp->precision_start = NULL; - dp->precision_end = NULL; - dp->precision_arg_index = ARG_NONE; - dp->arg_index = ARG_NONE; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory later. */ - goto error; - arg_index = n - 1; - cp = np + 1; - } - } - - /* Read the flags. */ - for (;;) - { - if (*cp == '\'') - { - dp->flags |= FLAG_GROUP; - cp++; - } - else if (*cp == '-') - { - dp->flags |= FLAG_LEFT; - cp++; - } - else if (*cp == '+') - { - dp->flags |= FLAG_SHOWSIGN; - cp++; - } - else if (*cp == ' ') - { - dp->flags |= FLAG_SPACE; - cp++; - } - else if (*cp == '#') - { - dp->flags |= FLAG_ALT; - cp++; - } - else if (*cp == '0') - { - dp->flags |= FLAG_ZERO; - cp++; - } -#if __GLIBC__ >= 2 && !defined __UCLIBC__ - else if (*cp == 'I') - { - dp->flags |= FLAG_LOCALIZED; - cp++; - } -#endif - else - break; - } - - /* Parse the field width. */ - if (*cp == '*') - { - dp->width_start = cp; - cp++; - dp->width_end = cp; - if (max_width_length < 1) - max_width_length = 1; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory later. */ - goto error; - dp->width_arg_index = n - 1; - cp = np + 1; - } - } - if (dp->width_arg_index == ARG_NONE) - { - dp->width_arg_index = arg_posn++; - if (dp->width_arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->width_arg_index, TYPE_INT); - } - else if (*cp >= '0' && *cp <= '9') - { - size_t width_length; - - dp->width_start = cp; - for (; *cp >= '0' && *cp <= '9'; cp++) - ; - dp->width_end = cp; - width_length = dp->width_end - dp->width_start; - if (max_width_length < width_length) - max_width_length = width_length; - } - - /* Parse the precision. */ - if (*cp == '.') - { - cp++; - if (*cp == '*') - { - dp->precision_start = cp - 1; - cp++; - dp->precision_end = cp; - if (max_precision_length < 2) - max_precision_length = 2; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory - later. */ - goto error; - dp->precision_arg_index = n - 1; - cp = np + 1; - } - } - if (dp->precision_arg_index == ARG_NONE) - { - dp->precision_arg_index = arg_posn++; - if (dp->precision_arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->precision_arg_index, TYPE_INT); - } - else - { - size_t precision_length; - - dp->precision_start = cp - 1; - for (; *cp >= '0' && *cp <= '9'; cp++) - ; - dp->precision_end = cp; - precision_length = dp->precision_end - dp->precision_start; - if (max_precision_length < precision_length) - max_precision_length = precision_length; - } - } - - { - arg_type type; - - /* Parse argument type/size specifiers. */ - { - int flags = 0; - - for (;;) - { - if (*cp == 'h') - { - flags |= (1 << (flags & 1)); - cp++; - } - else if (*cp == 'L') - { - flags |= 4; - cp++; - } - else if (*cp == 'l') - { - flags += 8; - cp++; - } - else if (*cp == 'j') - { - if (sizeof (intmax_t) > sizeof (long)) - { - /* intmax_t = long long */ - flags += 16; - } - else if (sizeof (intmax_t) > sizeof (int)) - { - /* intmax_t = long */ - flags += 8; - } - cp++; - } - else if (*cp == 'z' || *cp == 'Z') - { - /* 'z' is standardized in ISO C 99, but glibc uses 'Z' - because the warning facility in gcc-2.95.2 understands - only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ - if (sizeof (size_t) > sizeof (long)) - { - /* size_t = long long */ - flags += 16; - } - else if (sizeof (size_t) > sizeof (int)) - { - /* size_t = long */ - flags += 8; - } - cp++; - } - else if (*cp == 't') - { - if (sizeof (ptrdiff_t) > sizeof (long)) - { - /* ptrdiff_t = long long */ - flags += 16; - } - else if (sizeof (ptrdiff_t) > sizeof (int)) - { - /* ptrdiff_t = long */ - flags += 8; - } - cp++; - } -#if defined __APPLE__ && defined __MACH__ - /* On MacOS X 10.3, PRIdMAX is defined as "qd". - We cannot change it to "lld" because PRIdMAX must also - be understood by the system's printf routines. */ - else if (*cp == 'q') - { - if (64 / 8 > sizeof (long)) - { - /* int64_t = long long */ - flags += 16; - } - else - { - /* int64_t = long */ - flags += 8; - } - cp++; - } -#endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On native Win32, PRIdMAX is defined as "I64d". - We cannot change it to "lld" because PRIdMAX must also - be understood by the system's printf routines. */ - else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') - { - if (64 / 8 > sizeof (long)) - { - /* __int64 = long long */ - flags += 16; - } - else - { - /* __int64 = long */ - flags += 8; - } - cp += 3; - } -#endif - else - break; - } - - /* Read the conversion character. */ - c = *cp++; - switch (c) - { - case 'd': case 'i': -#if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_LONGLONGINT; - else -#endif - /* If 'long long' exists and is the same as 'long', we parse - "lld" into TYPE_LONGINT. */ - if (flags >= 8) - type = TYPE_LONGINT; - else if (flags & 2) - type = TYPE_SCHAR; - else if (flags & 1) - type = TYPE_SHORT; - else - type = TYPE_INT; - break; - case 'o': case 'u': case 'x': case 'X': -#if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_ULONGLONGINT; - else -#endif - /* If 'unsigned long long' exists and is the same as - 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ - if (flags >= 8) - type = TYPE_ULONGINT; - else if (flags & 2) - type = TYPE_UCHAR; - else if (flags & 1) - type = TYPE_USHORT; - else - type = TYPE_UINT; - break; - case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': - case 'a': case 'A': - if (flags >= 16 || (flags & 4)) - type = TYPE_LONGDOUBLE; - else - type = TYPE_DOUBLE; - break; - case 'c': - if (flags >= 8) -#if HAVE_WINT_T - type = TYPE_WIDE_CHAR; -#else - goto error; -#endif - else - type = TYPE_CHAR; - break; -#if HAVE_WINT_T - case 'C': - type = TYPE_WIDE_CHAR; - c = 'c'; - break; -#endif - case 's': - if (flags >= 8) -#if HAVE_WCHAR_T - type = TYPE_WIDE_STRING; -#else - goto error; -#endif - else - type = TYPE_STRING; - break; -#if HAVE_WCHAR_T - case 'S': - type = TYPE_WIDE_STRING; - c = 's'; - break; -#endif - case 'p': - type = TYPE_POINTER; - break; - case 'n': -#if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_COUNT_LONGLONGINT_POINTER; - else -#endif - /* If 'long long' exists and is the same as 'long', we parse - "lln" into TYPE_COUNT_LONGINT_POINTER. */ - if (flags >= 8) - type = TYPE_COUNT_LONGINT_POINTER; - else if (flags & 2) - type = TYPE_COUNT_SCHAR_POINTER; - else if (flags & 1) - type = TYPE_COUNT_SHORT_POINTER; - else - type = TYPE_COUNT_INT_POINTER; - break; -#if ENABLE_UNISTDIO - /* The unistdio extensions. */ - case 'U': - if (flags >= 16) - type = TYPE_U32_STRING; - else if (flags >= 8) - type = TYPE_U16_STRING; - else - type = TYPE_U8_STRING; - break; -#endif - case '%': - type = TYPE_NONE; - break; - default: - /* Unknown conversion character. */ - goto error; - } - } - - if (type != TYPE_NONE) - { - dp->arg_index = arg_index; - if (dp->arg_index == ARG_NONE) - { - dp->arg_index = arg_posn++; - if (dp->arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->arg_index, type); - } - dp->conversion = c; - dp->dir_end = cp; - } - - d->count++; - if (d->count >= d_allocated) - { - size_t memory_size; - DIRECTIVE *memory; - - d_allocated = xtimes (d_allocated, 2); - memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); - if (size_overflow_p (memory_size)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - memory = (DIRECTIVE *) realloc (d->dir, memory_size); - if (memory == NULL) - /* Out of memory. */ - goto out_of_memory; - d->dir = memory; - } - } -#if CHAR_T_ONLY_ASCII - else if (!c_isascii (c)) - { - /* Non-ASCII character. Not supported. */ - goto error; - } -#endif - } - d->dir[d->count].dir_start = cp; - - d->max_width_length = max_width_length; - d->max_precision_length = max_precision_length; - return 0; - -error: - if (a->arg) - free (a->arg); - if (d->dir) - free (d->dir); - errno = EINVAL; - return -1; - -out_of_memory: - if (a->arg) - free (a->arg); - if (d->dir) - free (d->dir); -out_of_memory_1: - errno = ENOMEM; - return -1; -} - -#undef PRINTF_PARSE -#undef DIRECTIVES -#undef DIRECTIVE -#undef CHAR_T_ONLY_ASCII -#undef CHAR_T diff --git a/lib/gl/printf-parse.h b/lib/gl/printf-parse.h deleted file mode 100644 index 853cc4770d..0000000000 --- a/lib/gl/printf-parse.h +++ /dev/null @@ -1,187 +0,0 @@ -/* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _PRINTF_PARSE_H -#define _PRINTF_PARSE_H - -/* This file can be parametrized with the following macros: - ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. - STATIC Set to 'static' to declare the function static. */ - -#if HAVE_FEATURES_H -# include <features.h> /* for __GLIBC__, __UCLIBC__ */ -#endif - -#include "printf-args.h" - - -/* Flags */ -#define FLAG_GROUP 1 /* ' flag */ -#define FLAG_LEFT 2 /* - flag */ -#define FLAG_SHOWSIGN 4 /* + flag */ -#define FLAG_SPACE 8 /* space flag */ -#define FLAG_ALT 16 /* # flag */ -#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. */ -#define ARG_NONE (~(size_t)0) - -/* xxx_directive: A parsed directive. - xxx_directives: A parsed format string. */ - -/* A parsed directive. */ -typedef struct -{ - const char* dir_start; - const char* dir_end; - int flags; - const char* width_start; - const char* width_end; - size_t width_arg_index; - const char* precision_start; - const char* precision_end; - size_t precision_arg_index; - char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ - size_t arg_index; -} -char_directive; - -/* A parsed format string. */ -typedef struct -{ - size_t count; - char_directive *dir; - size_t max_width_length; - size_t max_precision_length; -} -char_directives; - -#if ENABLE_UNISTDIO - -/* A parsed directive. */ -typedef struct -{ - const uint8_t* dir_start; - const uint8_t* dir_end; - int flags; - const uint8_t* width_start; - const uint8_t* width_end; - size_t width_arg_index; - const uint8_t* precision_start; - const uint8_t* precision_end; - size_t precision_arg_index; - uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ - size_t arg_index; -} -u8_directive; - -/* A parsed format string. */ -typedef struct -{ - size_t count; - u8_directive *dir; - size_t max_width_length; - size_t max_precision_length; -} -u8_directives; - -/* A parsed directive. */ -typedef struct -{ - const uint16_t* dir_start; - const uint16_t* dir_end; - int flags; - const uint16_t* width_start; - const uint16_t* width_end; - size_t width_arg_index; - const uint16_t* precision_start; - const uint16_t* precision_end; - size_t precision_arg_index; - uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ - size_t arg_index; -} -u16_directive; - -/* A parsed format string. */ -typedef struct -{ - size_t count; - u16_directive *dir; - size_t max_width_length; - size_t max_precision_length; -} -u16_directives; - -/* A parsed directive. */ -typedef struct -{ - const uint32_t* dir_start; - const uint32_t* dir_end; - int flags; - const uint32_t* width_start; - const uint32_t* width_end; - size_t width_arg_index; - const uint32_t* precision_start; - const uint32_t* precision_end; - size_t precision_arg_index; - uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ - size_t arg_index; -} -u32_directive; - -/* A parsed format string. */ -typedef struct -{ - size_t count; - u32_directive *dir; - size_t max_width_length; - size_t max_precision_length; -} -u32_directives; - -#endif - - -/* Parses the format string. Fills in the number N of directives, and fills - in directives[0], ..., directives[N-1], and sets directives[N].dir_start - to the end of the format string. Also fills in the arg_type fields of the - arguments and the needed count of arguments. */ -#if ENABLE_UNISTDIO -extern int - ulc_printf_parse (const char *format, char_directives *d, arguments *a); -extern int - u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); -extern int - u16_printf_parse (const uint16_t *format, u16_directives *d, - arguments *a); -extern int - u32_printf_parse (const uint32_t *format, u32_directives *d, - arguments *a); -#else -# ifdef STATIC -STATIC -# else -extern -# endif -int printf_parse (const char *format, char_directives *d, arguments *a); -#endif - -#endif /* _PRINTF_PARSE_H */ diff --git a/lib/gl/read-file.c b/lib/gl/read-file.c deleted file mode 100644 index 38b26e47c8..0000000000 --- a/lib/gl/read-file.c +++ /dev/null @@ -1,194 +0,0 @@ -/* read-file.c -- read file contents into a string - Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. - Written by Simon Josefsson and Bruno Haible. - - 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -#include "read-file.h" - -/* Get fstat. */ -#include <sys/stat.h> - -/* Get ftello. */ -#include <stdio.h> - -/* Get SIZE_MAX. */ -#include <stdint.h> - -/* Get malloc, realloc, free. */ -#include <stdlib.h> - -/* Get errno. */ -#include <errno.h> - -/* Read a STREAM and return a newly allocated string with the content, - and set *LENGTH to the length of the string. The string is - zero-terminated, but the terminating zero byte is not counted in - *LENGTH. On errors, *LENGTH is undefined, errno preserves the - values set by system functions (if any), and NULL is returned. */ -char * -fread_file (FILE * stream, size_t * length) -{ - char *buf = NULL; - size_t alloc = 0; - - /* For a regular file, allocate a buffer that has exactly the right - size. This avoids the need to do dynamic reallocations later. */ - { - struct stat st; - - if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode)) - { - off_t pos = ftello (stream); - - if (pos >= 0 && pos < st.st_size) - { - off_t alloc_off = st.st_size - pos; - - if (SIZE_MAX <= alloc_off) - { - errno = ENOMEM; - return NULL; - } - - alloc = alloc_off + 1; - - buf = malloc (alloc); - if (!buf) - /* errno is ENOMEM. */ - return NULL; - } - } - } - - { - size_t size = 0; /* number of bytes read so far */ - int save_errno; - - for (;;) - { - size_t count; - size_t requested; - - if (size + BUFSIZ + 1 > alloc) - { - char *new_buf; - size_t new_alloc = alloc + alloc / 2; - - /* Check against overflow. */ - if (new_alloc < alloc) - { - save_errno = ENOMEM; - break; - } - - alloc = new_alloc; - if (alloc < size + BUFSIZ + 1) - alloc = size + BUFSIZ + 1; - - new_buf = realloc (buf, alloc); - if (!new_buf) - { - save_errno = errno; - break; - } - - buf = new_buf; - } - - requested = alloc - size - 1; - count = fread (buf + size, 1, requested, stream); - size += count; - - if (count != requested) - { - save_errno = errno; - if (ferror (stream)) - break; - - /* Shrink the allocated memory if possible. */ - if (size + 1 < alloc) - { - char *smaller_buf = realloc (buf, size + 1); - if (smaller_buf != NULL) - buf = smaller_buf; - } - - buf[size] = '\0'; - *length = size; - return buf; - } - } - - free (buf); - errno = save_errno; - return NULL; - } -} - -static char * -internal_read_file (const char *filename, size_t * length, const char *mode) -{ - FILE *stream = fopen (filename, mode); - char *out; - int save_errno; - - if (!stream) - return NULL; - - out = fread_file (stream, length); - - save_errno = errno; - - if (fclose (stream) != 0) - { - if (out) - { - save_errno = errno; - free (out); - } - errno = save_errno; - return NULL; - } - - return out; -} - -/* Open and read the contents of FILENAME, and return a newly - allocated string with the content, and set *LENGTH to the length of - the string. The string is zero-terminated, but the terminating - zero byte is not counted in *LENGTH. On errors, *LENGTH is - undefined, errno preserves the values set by system functions (if - any), and NULL is returned. */ -char * -read_file (const char *filename, size_t * length) -{ - return internal_read_file (filename, length, "r"); -} - -/* Open (on non-POSIX systems, in binary mode) and read the contents - of FILENAME, and return a newly allocated string with the content, - and set LENGTH to the length of the string. The string is - zero-terminated, but the terminating zero byte is not counted in - the LENGTH variable. On errors, *LENGTH is undefined, errno - preserves the values set by system functions (if any), and NULL is - returned. */ -char * -read_binary_file (const char *filename, size_t * length) -{ - return internal_read_file (filename, length, "rb"); -} diff --git a/lib/gl/read-file.h b/lib/gl/read-file.h deleted file mode 100644 index 465c3d1f78..0000000000 --- a/lib/gl/read-file.h +++ /dev/null @@ -1,34 +0,0 @@ -/* read-file.h -- read file contents into a string - Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. - Written by Simon Josefsson. - - 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef READ_FILE_H -#define READ_FILE_H - -/* Get size_t. */ -#include <stddef.h> - -/* Get FILE. */ -#include <stdio.h> - -extern char *fread_file (FILE * stream, size_t * length); - -extern char *read_file (const char *filename, size_t * length); - -extern char *read_binary_file (const char *filename, size_t * length); - -#endif /* READ_FILE_H */ diff --git a/lib/gl/realloc.c b/lib/gl/realloc.c deleted file mode 100644 index 2201385a6f..0000000000 --- a/lib/gl/realloc.c +++ /dev/null @@ -1,91 +0,0 @@ -/* realloc() function that is glibc compatible. - - Copyright (C) 1997, 2003-2004, 2006-2007, 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.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* written by Jim Meyering and Bruno Haible */ - -#include <config.h> - -/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ -#ifdef realloc -# define NEED_REALLOC_GNU 1 -/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */ -#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU -# define NEED_REALLOC_GNU 1 -#endif - -/* Infer the properties of the system's malloc function. - The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ -#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU -# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 -#endif - -/* Below we want to call the system's malloc and realloc. - Undefine the symbols here so that including <stdlib.h> provides a - declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */ -#undef malloc -#undef realloc - -/* Specification. */ -#include <stdlib.h> - -#include <errno.h> - -/* Below we want to call the system's malloc and realloc. - Undefine the symbols, if they were defined by gnulib's <stdlib.h> - replacement. */ -#undef malloc -#undef realloc - -/* Change the size of an allocated block of memory P to N bytes, - with error checking. If N is zero, change it to 1. If P is NULL, - use malloc. */ - -void * -rpl_realloc (void *p, size_t n) -{ - void *result; - -#if NEED_REALLOC_GNU - if (n == 0) - { - n = 1; - - /* In theory realloc might fail, so don't rely on it to free. */ - free (p); - p = NULL; - } -#endif - - if (p == NULL) - { -#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE - if (n == 0) - n = 1; -#endif - result = malloc (n); - } - else - result = realloc (p, n); - -#if !HAVE_REALLOC_POSIX - if (result == NULL) - errno = ENOMEM; -#endif - - return result; -} diff --git a/lib/gl/size_max.h b/lib/gl/size_max.h deleted file mode 100644 index cc99ee3f3d..0000000000 --- a/lib/gl/size_max.h +++ /dev/null @@ -1,31 +0,0 @@ -/* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. - Written by Simon Josefsson. - - 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef GNULIB_SIZE_MAX_H -#define GNULIB_SIZE_MAX_H - -/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ -# include <limits.h> -/* Get SIZE_MAX declaration on systems like glibc 2. */ -# if HAVE_STDINT_H -# include <stdint.h> -# endif -/* On systems where these include files don't define it, SIZE_MAX is defined - in config.h. */ - -#endif /* GNULIB_SIZE_MAX_H */ diff --git a/lib/gl/snprintf.c b/lib/gl/snprintf.c deleted file mode 100644 index d9207a8e6e..0000000000 --- a/lib/gl/snprintf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. - Written by Simon Josefsson and Paul Eggert. - - 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> -#include <limits.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "vasnprintf.h" - -/* Print formatted output to string STR. Similar to sprintf, but - additional length SIZE limit how much is written into STR. Returns - string length of formatted string (which may be larger than SIZE). - STR may be NULL, in which case nothing will be written. On error, - return a negative value. */ -int -snprintf (char *str, size_t size, const char *format, ...) -{ - char *output; - size_t len; - size_t lenbuf = size; - va_list args; - - va_start (args, format); - output = vasnprintf (str, &lenbuf, format, args); - len = lenbuf; - va_end (args); - - if (!output) - return -1; - - if (output != str) - { - if (size) - { - size_t pruned_len = (len < size ? len : size - 1); - memcpy (str, output, pruned_len); - str[pruned_len] = '\0'; - } - - free (output); - } - - if (INT_MAX < len) - { - errno = EOVERFLOW; - return -1; - } - - return len; -} diff --git a/lib/gl/sockets.c b/lib/gl/sockets.c deleted file mode 100644 index 113dc17dcb..0000000000 --- a/lib/gl/sockets.c +++ /dev/null @@ -1,118 +0,0 @@ -/* 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 2.1 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; -} diff --git a/lib/gl/sockets.h b/lib/gl/sockets.h deleted file mode 100644 index 0bcbd9f70c..0000000000 --- a/lib/gl/sockets.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 2.1 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 */ diff --git a/lib/gl/stdbool.in.h b/lib/gl/stdbool.in.h deleted file mode 100644 index 88b3520041..0000000000 --- a/lib/gl/stdbool.in.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. - - 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_STDBOOL_H -#define _GL_STDBOOL_H - -/* ISO C 99 <stdbool.h> for platforms that lack it. */ - -/* Usage suggestions: - - Programs that use <stdbool.h> should be aware of some limitations - and standards compliance issues. - - Standards compliance: - - - <stdbool.h> must be #included before 'bool', 'false', 'true' - can be used. - - - You cannot assume that sizeof (bool) == 1. - - - Programs should not undefine the macros bool, true, and false, - as C99 lists that as an "obsolescent feature". - - Limitations of this substitute, when used in a C89 environment: - - - <stdbool.h> must be #included before the '_Bool' type can be used. - - - You cannot assume that _Bool is a typedef; it might be a macro. - - - Bit-fields of type 'bool' are not supported. Portable code - should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. - - - In C99, casts and automatic conversions to '_Bool' or 'bool' are - performed in such a way that every nonzero value gets converted - to 'true', and zero gets converted to 'false'. This doesn't work - with this substitute. With this substitute, only the values 0 and 1 - give the expected result when converted to _Bool' or 'bool'. - - - C99 allows the use of (_Bool)0.0 in constant expressions, but - this substitute cannot always provide this property. - - Also, it is suggested that programs use 'bool' rather than '_Bool'; - this isn't required, but 'bool' is more common. */ - - -/* 7.16. Boolean type and values */ - -/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same - definitions below, but temporarily we have to #undef them. */ -#if defined __BEOS__ && !defined __HAIKU__ -# include <OS.h> /* defines bool but not _Bool */ -# undef false -# undef true -#endif - -/* For the sake of symbolic names in gdb, we define true and false as - enum constants, not only as macros. - It is tempting to write - typedef enum { false = 0, true = 1 } _Bool; - so that gdb prints values of type 'bool' symbolically. But if we do - this, values of type '_Bool' may promote to 'int' or 'unsigned int' - (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' - (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the - enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) - /* A compiler known to have 'bool'. */ - /* If the compiler already has both 'bool' and '_Bool', we can assume they - are the same types. */ -# if !@HAVE__BOOL@ -typedef bool _Bool; -# endif -#else -# if !defined __GNUC__ - /* If @HAVE__BOOL@: - Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when - the built-in _Bool type is used. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - Similar bugs are likely with other compilers as well; this file - wouldn't be used if <stdbool.h> was working. - So we override the _Bool type. - If !@HAVE__BOOL@: - Need to define _Bool ourselves. As 'signed char' or as an enum type? - Use of a typedef, with SunPRO C, leads to a stupid - "warning: _Bool is a keyword in ISO C99". - Use of an enum type, with IRIX cc, leads to a stupid - "warning(1185): enumerated type mixed with another type". - Even the existence of an enum type, without a typedef, - "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. - The only benefit of the enum, debuggability, is not important - with these compilers. So use 'signed char' and no enum. */ -# define _Bool signed char -# else - /* With this compiler, trust the _Bool type if the compiler has it. */ -# if !@HAVE__BOOL@ -typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; -# endif -# endif -#endif -#define bool _Bool - -/* The other macros must be usable in preprocessor directives. */ -#define false 0 -#define true 1 -#define __bool_true_false_are_defined 1 - -#endif /* _GL_STDBOOL_H */ diff --git a/lib/gl/stddef.in.h b/lib/gl/stddef.in.h deleted file mode 100644 index 4f25aeeb08..0000000000 --- a/lib/gl/stddef.in.h +++ /dev/null @@ -1,87 +0,0 @@ -/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - - 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.1, 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 Eric Blake. */ - -/* - * POSIX 2008 <stddef.h> for platforms that have issues. - * <http://www.opengroup.org/susv3xbd/stddef.h.html> - */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined __need_wchar_t || defined __need_size_t \ - || defined __need_ptrdiff_t || defined __need_NULL \ - || defined __need_wint_t -/* Special invocation convention inside gcc header files. In - particular, gcc provides a version of <stddef.h> that blindly - redefines NULL even when __need_wint_t was defined, even though - wint_t is not normally provided by <stddef.h>. Hence, we must - remember if special invocation has ever been used to obtain wint_t, - in which case we need to clean up NULL yet again. */ - -# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) -# ifdef __need_wint_t -# undef _GL_STDDEF_H -# define _GL_STDDEF_WINT_T -# endif -# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ -# endif - -#else -/* Normal invocation convention. */ - -# ifndef _GL_STDDEF_H - -/* The include_next requires a split double-inclusion guard. */ - -# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ - -# ifndef _GL_STDDEF_H -# define _GL_STDDEF_H - -/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ -#if @REPLACE_NULL@ -# undef NULL -# ifdef __cplusplus - /* ISO C++ says that the macro NULL must expand to an integer constant - expression, hence '((void *) 0)' is not allowed in C++. */ -# if __GNUG__ >= 3 - /* GNU C++ has a __null macro that behaves like an integer ('int' or - 'long') but has the same size as a pointer. Use that, to avoid - warnings. */ -# define NULL __null -# else -# define NULL 0L -# endif -# else -# define NULL ((void *) 0) -# endif -#endif - -/* Some platforms lack wchar_t. */ -#if !@HAVE_WCHAR_T@ -# define wchar_t int -#endif - -# endif /* _GL_STDDEF_H */ -# endif /* _GL_STDDEF_H */ -#endif /* __need_XXX */ diff --git a/lib/gl/stdint.in.h b/lib/gl/stdint.in.h deleted file mode 100644 index 6fafca4ff4..0000000000 --- a/lib/gl/stdint.in.h +++ /dev/null @@ -1,581 +0,0 @@ -/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc. - Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. - This file is part of gnulib. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, 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. */ - -/* - * ISO C 99 <stdint.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/stdint.h.html> - */ - -#ifndef _GL_STDINT_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* When including a system file that in turn includes <inttypes.h>, - use the system <inttypes.h>, not our substitute. This avoids - problems with (for example) VMS, whose <sys/bitypes.h> includes - <inttypes.h>. */ -#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - -/* Get those types that are already defined in other system include - files, so that we can "#define int8_t signed char" below without - worrying about a later system include file containing a "typedef - signed char int8_t;" that will get messed up by our macro. Our - macros should all be consistent with the system versions, except - for the "fast" types and macros, which we recommend against using - in public interfaces due to compiler differences. */ - -#if @HAVE_STDINT_H@ -# if defined __sgi && ! defined __c99 - /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users - with "This header file is to be used only for c99 mode compilations" - diagnostics. */ -# define __STDINT_H__ -# endif - /* Other systems may have an incomplete or buggy <stdint.h>. - Include it before <inttypes.h>, since any "#include <stdint.h>" - in <inttypes.h> would reinclude us, skipping our contents because - _GL_STDINT_H is defined. - The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_STDINT_H@ -#endif - -#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H -#define _GL_STDINT_H - -/* <sys/types.h> defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). - AIX 5.2 <sys/types.h> isn't needed and causes troubles. - MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but - relies on the system <stdint.h> definitions, so include - <sys/types.h> after @NEXT_STDINT_H@. */ -#if @HAVE_SYS_TYPES_H@ && ! defined _AIX -# include <sys/types.h> -#endif - -/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ -#include <limits.h> - -#if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - <inttypes.h> also defines intptr_t and uintptr_t. */ -# include <inttypes.h> -#elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ -# include <sys/inttypes.h> -#endif - -#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by <sys/types.h>. */ -# include <sys/bitypes.h> -#endif - -#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - -/* Minimum and maximum values for a integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - -#define _STDINT_MIN(signed, bits, zero) \ - ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) - -#define _STDINT_MAX(signed, bits, zero) \ - ((signed) \ - ? ~ _STDINT_MIN (signed, bits, zero) \ - : /* The expression for the unsigned case. The subtraction of (signed) \ - is a nop in the unsigned case and avoids "signed integer overflow" \ - warnings in the signed case. */ \ - ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) - -/* 7.18.1.1. Exact-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - -#undef int8_t -#undef uint8_t -typedef signed char gl_int8_t; -typedef unsigned char gl_uint8_t; -#define int8_t gl_int8_t -#define uint8_t gl_uint8_t - -#undef int16_t -#undef uint16_t -typedef short int gl_int16_t; -typedef unsigned short int gl_uint16_t; -#define int16_t gl_int16_t -#define uint16_t gl_uint16_t - -#undef int32_t -#undef uint32_t -typedef int gl_int32_t; -typedef unsigned int gl_uint32_t; -#define int32_t gl_int32_t -#define uint32_t gl_uint32_t - -/* 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 - types, since otherwise it breaks platforms like Tandem/NSK. */ -# if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t -typedef long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif defined _MSC_VER -# undef int64_t -typedef __int64 gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif @HAVE_LONG_LONG_INT@ -# undef int64_t -typedef long long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# endif -#endif - -#if UINT64_MAX -# define GL_UINT64_T -#else -# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t -typedef unsigned long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -# elif defined _MSC_VER -# undef uint64_t -typedef unsigned __int64 gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t -typedef unsigned long long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -# endif -#endif - -/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ -#define _UINT8_T -#define _UINT32_T -#define _UINT64_T - - -/* 7.18.1.2. Minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - -#undef int_least8_t -#undef uint_least8_t -#undef int_least16_t -#undef uint_least16_t -#undef int_least32_t -#undef uint_least32_t -#undef int_least64_t -#undef uint_least64_t -#define int_least8_t int8_t -#define uint_least8_t uint8_t -#define int_least16_t int16_t -#define uint_least16_t uint16_t -#define int_least32_t int32_t -#define uint_least32_t uint32_t -#ifdef GL_INT64_T -# define int_least64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_least64_t uint64_t -#endif - -/* 7.18.1.3. Fastest minimum-width integer types */ - -/* Note: Other <stdint.h> substitutes may define these types differently. - It is not recommended to use these types in public header files. */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. Assume that 'long int' - is fast enough for all narrower integers. */ - -#undef int_fast8_t -#undef uint_fast8_t -#undef int_fast16_t -#undef uint_fast16_t -#undef int_fast32_t -#undef uint_fast32_t -#undef int_fast64_t -#undef uint_fast64_t -typedef long int gl_int_fast8_t; -typedef unsigned long int gl_uint_fast8_t; -typedef long int gl_int_fast16_t; -typedef unsigned long int gl_uint_fast16_t; -typedef long int gl_int_fast32_t; -typedef unsigned long int gl_uint_fast32_t; -#define int_fast8_t gl_int_fast8_t -#define uint_fast8_t gl_uint_fast8_t -#define int_fast16_t gl_int_fast16_t -#define uint_fast16_t gl_uint_fast16_t -#define int_fast32_t gl_int_fast32_t -#define uint_fast32_t gl_uint_fast32_t -#ifdef GL_INT64_T -# define int_fast64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_fast64_t uint64_t -#endif - -/* 7.18.1.4. Integer types capable of holding object pointers */ - -#undef intptr_t -#undef uintptr_t -typedef long int gl_intptr_t; -typedef unsigned long int gl_uintptr_t; -#define intptr_t gl_intptr_t -#define uintptr_t gl_uintptr_t - -/* 7.18.1.5. Greatest-width integer types */ - -/* Note: These types are compiler dependent. It may be unwise to use them in - public header files. */ - -#undef intmax_t -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -typedef long long int gl_intmax_t; -# define intmax_t gl_intmax_t -#elif defined GL_INT64_T -# define intmax_t int64_t -#else -typedef long int gl_intmax_t; -# define intmax_t gl_intmax_t -#endif - -#undef uintmax_t -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -typedef unsigned long long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t -#elif defined GL_UINT64_T -# define uintmax_t uint64_t -#else -typedef unsigned long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t -#endif - -/* Verify that intmax_t and uintmax_t have the same size. Too much code - breaks if this is not the case. If this check fails, the reason is likely - to be found in the autoconf macros. */ -typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - ? 1 : -1]; - -/* 7.18.2. Limits of specified-width integer types */ - -#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS - -/* 7.18.2.1. Limits of exact-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - -#undef INT8_MIN -#undef INT8_MAX -#undef UINT8_MAX -#define INT8_MIN (~ INT8_MAX) -#define INT8_MAX 127 -#define UINT8_MAX 255 - -#undef INT16_MIN -#undef INT16_MAX -#undef UINT16_MAX -#define INT16_MIN (~ INT16_MAX) -#define INT16_MAX 32767 -#define UINT16_MAX 65535 - -#undef INT32_MIN -#undef INT32_MAX -#undef UINT32_MAX -#define INT32_MIN (~ INT32_MAX) -#define INT32_MAX 2147483647 -#define UINT32_MAX 4294967295U - -#if defined GL_INT64_T && ! defined INT64_MAX -/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ -# define INT64_MIN (- INTMAX_C (1) << 63) -# define INT64_MAX INTMAX_C (9223372036854775807) -#endif - -#if defined GL_UINT64_T && ! defined UINT64_MAX -# define UINT64_MAX UINTMAX_C (18446744073709551615) -#endif - -/* 7.18.2.2. Limits of minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - -#undef INT_LEAST8_MIN -#undef INT_LEAST8_MAX -#undef UINT_LEAST8_MAX -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define UINT_LEAST8_MAX UINT8_MAX - -#undef INT_LEAST16_MIN -#undef INT_LEAST16_MAX -#undef UINT_LEAST16_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define UINT_LEAST16_MAX UINT16_MAX - -#undef INT_LEAST32_MIN -#undef INT_LEAST32_MAX -#undef UINT_LEAST32_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define UINT_LEAST32_MAX UINT32_MAX - -#undef INT_LEAST64_MIN -#undef INT_LEAST64_MAX -#ifdef GL_INT64_T -# define INT_LEAST64_MIN INT64_MIN -# define INT_LEAST64_MAX INT64_MAX -#endif - -#undef UINT_LEAST64_MAX -#ifdef GL_UINT64_T -# define UINT_LEAST64_MAX UINT64_MAX -#endif - -/* 7.18.2.3. Limits of fastest minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - -#undef INT_FAST8_MIN -#undef INT_FAST8_MAX -#undef UINT_FAST8_MAX -#define INT_FAST8_MIN LONG_MIN -#define INT_FAST8_MAX LONG_MAX -#define UINT_FAST8_MAX ULONG_MAX - -#undef INT_FAST16_MIN -#undef INT_FAST16_MAX -#undef UINT_FAST16_MAX -#define INT_FAST16_MIN LONG_MIN -#define INT_FAST16_MAX LONG_MAX -#define UINT_FAST16_MAX ULONG_MAX - -#undef INT_FAST32_MIN -#undef INT_FAST32_MAX -#undef UINT_FAST32_MAX -#define INT_FAST32_MIN LONG_MIN -#define INT_FAST32_MAX LONG_MAX -#define UINT_FAST32_MAX ULONG_MAX - -#undef INT_FAST64_MIN -#undef INT_FAST64_MAX -#ifdef GL_INT64_T -# define INT_FAST64_MIN INT64_MIN -# define INT_FAST64_MAX INT64_MAX -#endif - -#undef UINT_FAST64_MAX -#ifdef GL_UINT64_T -# define UINT_FAST64_MAX UINT64_MAX -#endif - -/* 7.18.2.4. Limits of integer types capable of holding object pointers */ - -#undef INTPTR_MIN -#undef INTPTR_MAX -#undef UINTPTR_MAX -#define INTPTR_MIN LONG_MIN -#define INTPTR_MAX LONG_MAX -#define UINTPTR_MAX ULONG_MAX - -/* 7.18.2.5. Limits of greatest-width integer types */ - -#undef INTMAX_MIN -#undef INTMAX_MAX -#ifdef INT64_MAX -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX -#else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX -#endif - -#undef UINTMAX_MAX -#ifdef UINT64_MAX -# define UINTMAX_MAX UINT64_MAX -#else -# define UINTMAX_MAX UINT32_MAX -#endif - -/* 7.18.3. Limits of other integer types */ - -/* ptrdiff_t limits */ -#undef PTRDIFF_MIN -#undef PTRDIFF_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -# else -# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -# endif -#else -# define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -# define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -#endif - -/* sig_atomic_t limits */ -#undef SIG_ATOMIC_MIN -#undef SIG_ATOMIC_MAX -#define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) -#define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - -/* size_t limit */ -#undef SIZE_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -# else -# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -# endif -#else -# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) -#endif - -/* wchar_t limits */ -/* Get WCHAR_MIN, WCHAR_MAX. - This include is not on the top, above, because on OSF/1 4.0 we have a - sequence of nested includes - <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes - <stdint.h> and assumes its types are already defined. */ -#if ! (defined WCHAR_MIN && defined WCHAR_MAX) -# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -# include <wchar.h> -# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -#endif -#undef WCHAR_MIN -#undef WCHAR_MAX -#define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) -#define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - -/* wint_t limits */ -#undef WINT_MIN -#undef WINT_MAX -#define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -#define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - -#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ - -/* 7.18.4. Macros for integer constants */ - -#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS - -/* 7.18.4.1. Macros for minimum-width integer constants */ -/* According to ISO C 99 Technical Corrigendum 1 */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - -#undef INT8_C -#undef UINT8_C -#define INT8_C(x) x -#define UINT8_C(x) x - -#undef INT16_C -#undef UINT16_C -#define INT16_C(x) x -#define UINT16_C(x) x - -#undef INT32_C -#undef UINT32_C -#define INT32_C(x) x -#define UINT32_C(x) x ## U - -#undef INT64_C -#undef UINT64_C -#if LONG_MAX >> 31 >> 31 == 1 -# define INT64_C(x) x##L -#elif defined _MSC_VER -# define INT64_C(x) x##i64 -#elif @HAVE_LONG_LONG_INT@ -# define INT64_C(x) x##LL -#endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# define UINT64_C(x) x##UL -#elif defined _MSC_VER -# define UINT64_C(x) x##ui64 -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# define UINT64_C(x) x##ULL -#endif - -/* 7.18.4.2. Macros for greatest-width integer constants */ - -#undef INTMAX_C -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define INTMAX_C(x) x##LL -#elif defined GL_INT64_T -# define INTMAX_C(x) INT64_C(x) -#else -# define INTMAX_C(x) x##L -#endif - -#undef UINTMAX_C -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define UINTMAX_C(x) x##ULL -#elif defined GL_UINT64_T -# define UINTMAX_C(x) UINT64_C(x) -#else -# define UINTMAX_C(x) x##UL -#endif - -#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ - -#endif /* _GL_STDINT_H */ -#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff --git a/lib/gl/stdio-impl.h b/lib/gl/stdio-impl.h deleted file mode 100644 index 7a64fa839c..0000000000 --- a/lib/gl/stdio-impl.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Implementation details of FILE streams. - Copyright (C) 2007-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 2.1 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/>. */ - -/* Many stdio implementations have the same logic and therefore can share - the same implementation of stdio extension API, except that some fields - have different naming conventions, or their access requires some casts. */ - - -/* BSD stdio derived implementations. */ - -#if defined __NetBSD__ /* NetBSD */ -/* Get __NetBSD_Version__. */ -# include <sys/param.h> -#endif - -#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ - -# if defined __DragonFly__ /* DragonFly */ - /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ -# define fp_ ((struct { struct __FILE_public pub; \ - struct { unsigned char *_base; int _size; } _bf; \ - void *cookie; \ - void *_close; \ - void *_read; \ - void *_seek; \ - void *_write; \ - struct { unsigned char *_base; int _size; } _ub; \ - int _ur; \ - unsigned char _ubuf[3]; \ - unsigned char _nbuf[1]; \ - struct { unsigned char *_base; int _size; } _lb; \ - int _blksize; \ - fpos_t _offset; \ - /* More fields, not relevant here. */ \ - } *) fp) - /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ -# define _p pub._p -# define _flags pub._flags -# define _r pub._r -# define _w pub._w -# else -# define fp_ fp -# endif - -# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */ - /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> - and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ - struct __sfileext - { - struct __sbuf _ub; /* ungetc buffer */ - /* More fields, not relevant here. */ - }; -# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub -# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */ -# define fp_ub fp_->_ub -# endif - -# define HASUB(fp) (fp_ub._base != NULL) - -#endif - - -/* SystemV derived implementations. */ - -#if defined _IOERR - -# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ -# define fp_ ((struct { unsigned char *_ptr; \ - unsigned char *_base; \ - unsigned char *_end; \ - long _cnt; \ - int _file; \ - unsigned int _flag; \ - } *) fp) -# else -# define fp_ fp -# endif - -# if defined _SCO_DS /* OpenServer */ -# define _cnt __cnt -# define _ptr __ptr -# define _base __base -# define _flag __flag -# endif - -#endif diff --git a/lib/gl/stdio-write.c b/lib/gl/stdio-write.c deleted file mode 100644 index 2db98c37fa..0000000000 --- a/lib/gl/stdio-write.c +++ /dev/null @@ -1,148 +0,0 @@ -/* POSIX compatible FILE stream write function. - Copyright (C) 2008-2010 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 2.1 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/gl/stdio.in.h b/lib/gl/stdio.in.h deleted file mode 100644 index b219d46f24..0000000000 --- a/lib/gl/stdio.in.h +++ /dev/null @@ -1,1080 +0,0 @@ -/* A GNU-like <stdio.h>. - - Copyright (C) 2004, 2007-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.1, 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. */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined __need_FILE || defined __need___FILE -/* Special invocation convention inside glibc header files. */ - -#@INCLUDE_NEXT@ @NEXT_STDIO_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_STDIO_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STDIO_H@ - -#ifndef _GL_STDIO_H -#define _GL_STDIO_H - -/* Get va_list. Needed on many systems, including glibc 2.8. */ -#include <stdarg.h> - -#include <stddef.h> - -/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */ -#include <sys/types.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 - 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 -#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 definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* Macros for stringification. */ -#define _GL_STDIO_STRINGIZE(token) #token -#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) - - -#if @GNULIB_DPRINTF@ -# if @REPLACE_DPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define dprintf rpl_dprintf -# endif -_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); -# else -# if !@HAVE_DPRINTF@ -_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); -# endif -_GL_CXXALIASWARN (dprintf); -#elif defined GNULIB_POSIXCHECK -# undef dprintf -# if HAVE_RAW_DECL_DPRINTF -_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " - "use gnulib module dprintf for portability"); -# endif -#endif - -#if @GNULIB_FCLOSE@ -/* Close STREAM and its underlying file descriptor. */ -# if @REPLACE_FCLOSE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define fclose rpl_fclose -# endif -_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); -# else -_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); -# endif -_GL_CXXALIASWARN (fclose); -#elif defined GNULIB_POSIXCHECK -# undef fclose -/* Assume fclose is always declared. */ -_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " - "use gnulib module fclose for portable POSIX compliance"); -#endif - -#if @GNULIB_FFLUSH@ -/* Flush all pending data on STREAM according to POSIX rules. Both - output and seekable input streams are supported. - Note! LOSS OF DATA can occur if fflush is applied on an input stream - that is _not_seekable_ or on an update stream that is _not_seekable_ - and in which the most recent operation was input. Seekability can - be tested with lseek(fileno(fp),0,SEEK_CUR). */ -# if @REPLACE_FFLUSH@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define fflush rpl_fflush -# endif -_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); -_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); -# else -_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); -# endif -_GL_CXXALIASWARN (fflush); -#elif defined GNULIB_POSIXCHECK -# undef fflush -/* Assume fflush is always declared. */ -_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " - "use gnulib module fflush for portable POSIX compliance"); -#endif - -/* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning. Assume it is - always declared, since it is required by C89. */ -#undef gets -_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); - -#if @GNULIB_FOPEN@ -# if @REPLACE_FOPEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fopen -# define fopen rpl_fopen -# endif -_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); -# else -_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); -# endif -_GL_CXXALIASWARN (fopen); -#elif defined GNULIB_POSIXCHECK -# undef fopen -/* Assume fopen is always declared. */ -_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " - "use gnulib module fopen for portability"); -#endif - -#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ -# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ - || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define fprintf rpl_fprintf -# endif -# define GNULIB_overrides_fprintf 1 -_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); -# else -_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); -# endif -_GL_CXXALIASWARN (fprintf); -#endif -#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_fprintf -# undef fprintf -# endif -/* Assume fprintf is always declared. */ -_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " - "use gnulib module fprintf-posix for portable " - "POSIX compliance"); -#endif - -#if @GNULIB_FPURGE@ -/* Discard all pending buffered I/O data on STREAM. - STREAM must not be wide-character oriented. - When discarding pending output, the file position is set back to where it - was before the write calls. When discarding pending input, the file - position is advanced to match the end of the previously read input. - Return 0 if successful. Upon error, return -1 and set errno. */ -# if @REPLACE_FPURGE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define fpurge rpl_fpurge -# endif -_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); -# else -# if !@HAVE_DECL_FPURGE@ -_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); -# endif -_GL_CXXALIASWARN (fpurge); -#elif defined GNULIB_POSIXCHECK -# undef fpurge -# if HAVE_RAW_DECL_FPURGE -_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " - "use gnulib module fpurge for portability"); -# endif -#endif - -#if @GNULIB_FPUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fputc -# define fputc rpl_fputc -# endif -_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); -# else -_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); -# endif -_GL_CXXALIASWARN (fputc); -#endif - -#if @GNULIB_FPUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fputs -# define fputs rpl_fputs -# endif -_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); -# else -_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); -# endif -_GL_CXXALIASWARN (fputs); -#endif - -#if @GNULIB_FREOPEN@ -# if @REPLACE_FREOPEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef freopen -# define freopen rpl_freopen -# endif -_GL_FUNCDECL_RPL (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream) - _GL_ARG_NONNULL ((2, 3))); -_GL_CXXALIAS_RPL (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream)); -# else -_GL_CXXALIAS_SYS (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream)); -# endif -_GL_CXXALIASWARN (freopen); -#elif defined GNULIB_POSIXCHECK -# undef freopen -/* Assume freopen is always declared. */ -_GL_WARN_ON_USE (freopen, - "freopen on Win32 platforms is not POSIX compatible - " - "use gnulib module freopen for portability"); -#endif - - -/* Set up the following warnings, based on which modules are in use. - GNU Coding Standards discourage the use of fseek, since it imposes - an arbitrary limitation on some 32-bit hosts. Remember that the - fseek module depends on the fseeko module, so we only have three - cases to consider: - - 1. The developer is not using either module. Issue a warning under - GNULIB_POSIXCHECK for both functions, to remind them that both - functions have bugs on some systems. _GL_NO_LARGE_FILES has no - impact on this warning. - - 2. The developer is using both modules. They may be unaware of the - arbitrary limitations of fseek, so issue a warning under - GNULIB_POSIXCHECK. On the other hand, they may be using both - modules intentionally, so the developer can define - _GL_NO_LARGE_FILES in the compilation units where the use of fseek - is safe, to silence the warning. - - 3. The developer is using the fseeko module, but not fseek. Gnulib - guarantees that fseek will still work around platform bugs in that - case, but we presume that the developer is aware of the pitfalls of - fseek and was trying to avoid it, so issue a warning even when - GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be - defined to silence the warning in particular compilation units. - In C++ compilations with GNULIB_NAMESPACE, in order to avoid that - fseek gets defined as a macro, it is recommended that the developer - uses the fseek module, even if he is not calling the fseek function. - - Most gnulib clients that perform stream operations should fall into - category 3. */ - -#if @GNULIB_FSEEK@ -# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES -# define _GL_FSEEK_WARN /* Category 2, above. */ -# undef fseek -# endif -# if @REPLACE_FSEEK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fseek -# define fseek rpl_fseek -# endif -_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); -# else -_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); -# endif -_GL_CXXALIASWARN (fseek); -#endif - -#if @GNULIB_FSEEKO@ -# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES -# define _GL_FSEEK_WARN /* Category 3, above. */ -# undef fseek -# endif -# if @REPLACE_FSEEKO@ -/* Provide an fseeko function that is aware of a preceding fflush(), and which - detects pipes. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fseeko -# define fseeko rpl_fseeko -# endif -_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); -# else -# if ! @HAVE_FSEEKO@ -_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); -# endif -_GL_CXXALIASWARN (fseeko); -# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@ - /* Provide an fseek function that is consistent with fseeko. */ - /* In order to avoid that fseek gets defined as a macro here, the - developer can request the 'fseek' module. */ -# undef fseek -# define fseek rpl_fseek -static inline int _GL_ARG_NONNULL ((1)) -rpl_fseek (FILE *fp, long offset, int whence) -{ -# if @REPLACE_FSEEKO@ - return rpl_fseeko (fp, offset, whence); -# else - return fseeko (fp, offset, whence); -# endif -} -# endif -#elif defined GNULIB_POSIXCHECK -# define _GL_FSEEK_WARN /* Category 1, above. */ -# undef fseek -# undef fseeko -# if HAVE_RAW_DECL_FSEEKO -_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " - "use gnulib module fseeko for portability"); -# endif -#endif - -#ifdef _GL_FSEEK_WARN -# undef _GL_FSEEK_WARN -/* Here, either fseek is undefined (but C89 guarantees that it is - declared), or it is defined as rpl_fseek (declared above). */ -_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " - "on 32-bit platforms - " - "use fseeko function for handling of large files"); -#endif - - -/* ftell, ftello. See the comments on fseek/fseeko. */ - -#if @GNULIB_FTELL@ -# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES -# define _GL_FTELL_WARN /* Category 2, above. */ -# undef ftell -# endif -# if @REPLACE_FTELL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef ftell -# define ftell rpl_ftell -# endif -_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); -# else -_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); -# endif -_GL_CXXALIASWARN (ftell); -#endif - -#if @GNULIB_FTELLO@ -# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES -# define _GL_FTELL_WARN /* Category 3, above. */ -# undef ftell -# endif -# if @REPLACE_FTELLO@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef ftello -# define ftello rpl_ftello -# endif -_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); -# else -# if ! @HAVE_FTELLO@ -_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); -# endif -_GL_CXXALIASWARN (ftello); -# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@ - /* Provide an ftell function that is consistent with ftello. */ - /* In order to avoid that ftell gets defined as a macro here, the - developer can request the 'ftell' module. */ -# undef ftell -# define ftell rpl_ftell -static inline long _GL_ARG_NONNULL ((1)) -rpl_ftell (FILE *f) -{ -# if @REPLACE_FTELLO@ - return rpl_ftello (f); -# else - return ftello (f); -# endif -} -# endif -#elif defined GNULIB_POSIXCHECK -# define _GL_FTELL_WARN /* Category 1, above. */ -# undef ftell -# undef ftello -# if HAVE_RAW_DECL_FTELLO -_GL_WARN_ON_USE (ftello, "ftello is unportable - " - "use gnulib module ftello for portability"); -# endif -#endif - -#ifdef _GL_FTELL_WARN -# undef _GL_FTELL_WARN -/* Here, either ftell is undefined (but C89 guarantees that it is - declared), or it is defined as rpl_ftell (declared above). */ -_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " - "on 32-bit platforms - " - "use ftello function for handling of large files"); -#endif - - -#if @GNULIB_FWRITE@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fwrite -# define fwrite rpl_fwrite -# endif -_GL_FUNCDECL_RPL (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream) - _GL_ARG_NONNULL ((1, 4))); -_GL_CXXALIAS_RPL (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream)); -# else -_GL_CXXALIAS_SYS (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream)); -# endif -_GL_CXXALIASWARN (fwrite); -#endif - -#if @GNULIB_GETDELIM@ -/* Read input, up to (and including) the next occurrence of DELIMITER, from - STREAM, store it in *LINEPTR (and NUL-terminate it). - *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE - bytes of space. It is realloc'd as necessary. - Return the number of bytes read and stored at *LINEPTR (not including the - NUL terminator), or -1 on error or EOF. */ -# if @REPLACE_GETDELIM@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getdelim -# define getdelim rpl_getdelim -# endif -_GL_FUNCDECL_RPL (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream) - _GL_ARG_NONNULL ((1, 2, 4))); -_GL_CXXALIAS_RPL (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream)); -# else -# if !@HAVE_DECL_GETDELIM@ -_GL_FUNCDECL_SYS (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream) - _GL_ARG_NONNULL ((1, 2, 4))); -# endif -_GL_CXXALIAS_SYS (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream)); -# endif -_GL_CXXALIASWARN (getdelim); -#elif defined GNULIB_POSIXCHECK -# undef getdelim -# if HAVE_RAW_DECL_GETDELIM -_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " - "use gnulib module getdelim for portability"); -# endif -#endif - -#if @GNULIB_GETLINE@ -/* Read a line, up to (and including) the next newline, from STREAM, store it - in *LINEPTR (and NUL-terminate it). - *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE - bytes of space. It is realloc'd as necessary. - Return the number of bytes read and stored at *LINEPTR (not including the - NUL terminator), or -1 on error or EOF. */ -# if @REPLACE_GETLINE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getline -# define getline rpl_getline -# endif -_GL_FUNCDECL_RPL (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream) - _GL_ARG_NONNULL ((1, 2, 3))); -_GL_CXXALIAS_RPL (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream)); -# else -# if !@HAVE_DECL_GETLINE@ -_GL_FUNCDECL_SYS (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream) - _GL_ARG_NONNULL ((1, 2, 3))); -# endif -_GL_CXXALIAS_SYS (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream)); -# endif -# if @HAVE_DECL_GETLINE@ -_GL_CXXALIASWARN (getline); -# endif -#elif defined GNULIB_POSIXCHECK -# undef getline -# if HAVE_RAW_DECL_GETLINE -_GL_WARN_ON_USE (getline, "getline is unportable - " - "use gnulib module getline for portability"); -# endif -#endif - -#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ -struct obstack; -/* Grow an obstack with formatted output. Return the number of - bytes added to OBS. No trailing nul byte is added, and the - object should be closed with obstack_finish before use. Upon - memory allocation error, call obstack_alloc_failed_handler. Upon - other error, return -1. */ -# if @REPLACE_OBSTACK_PRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define obstack_printf rpl_obstack_printf -# endif -_GL_FUNCDECL_RPL (obstack_printf, int, - (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (obstack_printf, int, - (struct obstack *obs, const char *format, ...)); -# else -# if !@HAVE_DECL_OBSTACK_PRINTF@ -_GL_FUNCDECL_SYS (obstack_printf, int, - (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (obstack_printf, int, - (struct obstack *obs, const char *format, ...)); -# endif -_GL_CXXALIASWARN (obstack_printf); -# if @REPLACE_OBSTACK_PRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define obstack_vprintf rpl_obstack_vprintf -# endif -_GL_FUNCDECL_RPL (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args)); -# else -# if !@HAVE_DECL_OBSTACK_PRINTF@ -_GL_FUNCDECL_SYS (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (obstack_vprintf); -#endif - -#if @GNULIB_PERROR@ -/* Print a message to standard error, describing the value of ERRNO, - (if STRING is not NULL and not empty) prefixed with STRING and ": ", - and terminated with a newline. */ -# if @REPLACE_PERROR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define perror rpl_perror -# endif -_GL_FUNCDECL_RPL (perror, void, (const char *string)); -_GL_CXXALIAS_RPL (perror, void, (const char *string)); -# else -_GL_CXXALIAS_SYS (perror, void, (const char *string)); -# endif -_GL_CXXALIASWARN (perror); -#elif defined GNULIB_POSIXCHECK -# undef perror -/* Assume perror is always declared. */ -_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " - "use gnulib module perror for portability"); -#endif - -#if @GNULIB_POPEN@ -# if @REPLACE_POPEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef popen -# define popen rpl_popen -# endif -_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); -# else -_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); -# endif -_GL_CXXALIASWARN (popen); -#elif defined GNULIB_POSIXCHECK -# undef popen -# if HAVE_RAW_DECL_POPEN -_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " - "use gnulib module popen or pipe for more portability"); -# endif -#endif - -#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ -# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ - || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) -# if defined __GNUC__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -/* Don't break __attribute__((format(printf,M,N))). */ -# define printf __printf__ -# endif -_GL_FUNCDECL_RPL_1 (__printf__, int, - (const char *format, ...) - __asm__ (@ASM_SYMBOL_PREFIX@ - _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) - __attribute__ ((__format__ (__printf__, 1, 2))) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); -# else -_GL_FUNCDECL_RPL (printf, int, - (const char *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); -# endif -# define GNULIB_overrides_printf 1 -# else -_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); -# endif -_GL_CXXALIASWARN (printf); -#endif -#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_printf -# undef printf -# endif -/* Assume printf is always declared. */ -_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " - "use gnulib module printf-posix for portable " - "POSIX compliance"); -#endif - -#if @GNULIB_PUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef putc -# define putc rpl_fputc -# endif -_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); -# else -_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); -# endif -_GL_CXXALIASWARN (putc); -#endif - -#if @GNULIB_PUTCHAR@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef putchar -# define putchar rpl_putchar -# endif -_GL_FUNCDECL_RPL (putchar, int, (int c)); -_GL_CXXALIAS_RPL (putchar, int, (int c)); -# else -_GL_CXXALIAS_SYS (putchar, int, (int c)); -# endif -_GL_CXXALIASWARN (putchar); -#endif - -#if @GNULIB_PUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef puts -# define puts rpl_puts -# endif -_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (puts, int, (const char *string)); -# else -_GL_CXXALIAS_SYS (puts, int, (const char *string)); -# endif -_GL_CXXALIASWARN (puts); -#endif - -#if @GNULIB_REMOVE@ -# if @REPLACE_REMOVE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef remove -# define remove rpl_remove -# endif -_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (remove, int, (const char *name)); -# else -_GL_CXXALIAS_SYS (remove, int, (const char *name)); -# endif -_GL_CXXALIASWARN (remove); -#elif defined GNULIB_POSIXCHECK -# undef remove -/* Assume remove is always declared. */ -_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " - "use gnulib module remove for more portability"); -#endif - -#if @GNULIB_RENAME@ -# if @REPLACE_RENAME@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef rename -# define rename rpl_rename -# endif -_GL_FUNCDECL_RPL (rename, int, - (const char *old_filename, const char *new_filename) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (rename, int, - (const char *old_filename, const char *new_filename)); -# else -_GL_CXXALIAS_SYS (rename, int, - (const char *old_filename, const char *new_filename)); -# endif -_GL_CXXALIASWARN (rename); -#elif defined GNULIB_POSIXCHECK -# undef rename -/* Assume rename is always declared. */ -_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " - "use gnulib module rename for more portability"); -#endif - -#if @GNULIB_RENAMEAT@ -# if @REPLACE_RENAMEAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef renameat -# define renameat rpl_renameat -# endif -_GL_FUNCDECL_RPL (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2) - _GL_ARG_NONNULL ((2, 4))); -_GL_CXXALIAS_RPL (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2)); -# else -# if !@HAVE_RENAMEAT@ -_GL_FUNCDECL_SYS (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2) - _GL_ARG_NONNULL ((2, 4))); -# endif -_GL_CXXALIAS_SYS (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2)); -# endif -_GL_CXXALIASWARN (renameat); -#elif defined GNULIB_POSIXCHECK -# undef renameat -# if HAVE_RAW_DECL_RENAMEAT -_GL_WARN_ON_USE (renameat, "renameat is not portable - " - "use gnulib module renameat for portability"); -# endif -#endif - -#if @GNULIB_SNPRINTF@ -# if @REPLACE_SNPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define snprintf rpl_snprintf -# endif -_GL_FUNCDECL_RPL (snprintf, int, - (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) - _GL_ARG_NONNULL ((3))); -_GL_CXXALIAS_RPL (snprintf, int, - (char *str, size_t size, const char *format, ...)); -# else -# if !@HAVE_DECL_SNPRINTF@ -_GL_FUNCDECL_SYS (snprintf, int, - (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) - _GL_ARG_NONNULL ((3))); -# endif -_GL_CXXALIAS_SYS (snprintf, int, - (char *str, size_t size, const char *format, ...)); -# endif -_GL_CXXALIASWARN (snprintf); -#elif defined GNULIB_POSIXCHECK -# undef snprintf -# if HAVE_RAW_DECL_SNPRINTF -_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " - "use gnulib module snprintf for portability"); -# endif -#endif - -/* Some people would argue that sprintf should be handled like gets - (for example, OpenBSD issues a link warning for both functions), - since both can cause security holes due to buffer overruns. - However, we believe that sprintf can be used safely, and is more - efficient than snprintf in those safe cases; and as proof of our - belief, we use sprintf in several gnulib modules. So this header - intentionally avoids adding a warning to sprintf except when - GNULIB_POSIXCHECK is defined. */ - -#if @GNULIB_SPRINTF_POSIX@ -# if @REPLACE_SPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define sprintf rpl_sprintf -# endif -_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); -# else -_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); -# endif -_GL_CXXALIASWARN (sprintf); -#elif defined GNULIB_POSIXCHECK -# undef sprintf -/* Assume sprintf is always declared. */ -_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " - "use gnulib module sprintf-posix for portable " - "POSIX compliance"); -#endif - -#if @GNULIB_TMPFILE@ -# if @REPLACE_TMPFILE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define tmpfile rpl_tmpfile -# endif -_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); -_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); -# else -_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); -# endif -_GL_CXXALIASWARN (tmpfile); -#elif defined GNULIB_POSIXCHECK -# undef tmpfile -# if HAVE_RAW_DECL_TMPFILE -_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " - "use gnulib module tmpfile for portability"); -# endif -#endif - -#if @GNULIB_VASPRINTF@ -/* Write formatted output to a string dynamically allocated with malloc(). - If the memory allocation succeeds, store the address of the string in - *RESULT and return the number of resulting bytes, excluding the trailing - NUL. Upon memory allocation error, or some other error, return -1. */ -# if @REPLACE_VASPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define asprintf rpl_asprintf -# endif -_GL_FUNCDECL_RPL (asprintf, int, - (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (asprintf, int, - (char **result, const char *format, ...)); -# else -# if !@HAVE_VASPRINTF@ -_GL_FUNCDECL_SYS (asprintf, int, - (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (asprintf, int, - (char **result, const char *format, ...)); -# endif -_GL_CXXALIASWARN (asprintf); -# if @REPLACE_VASPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vasprintf rpl_vasprintf -# endif -_GL_FUNCDECL_RPL (vasprintf, int, - (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (vasprintf, int, - (char **result, const char *format, va_list args)); -# else -# if !@HAVE_VASPRINTF@ -_GL_FUNCDECL_SYS (vasprintf, int, - (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (vasprintf, int, - (char **result, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vasprintf); -#endif - -#if @GNULIB_VDPRINTF@ -# if @REPLACE_VDPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vdprintf rpl_vdprintf -# endif -_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); -# else -# if !@HAVE_VDPRINTF@ -_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((2))); -# endif -/* Need to cast, because on Solaris, the third parameter will likely be - __va_list args. */ -_GL_CXXALIAS_SYS_CAST (vdprintf, int, - (int fd, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vdprintf); -#elif defined GNULIB_POSIXCHECK -# undef vdprintf -# if HAVE_RAW_DECL_VDPRINTF -_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " - "use gnulib module vdprintf for portability"); -# endif -#endif - -#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ -# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ - || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vfprintf rpl_vfprintf -# endif -# define GNULIB_overrides_vfprintf 1 -_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); -# else -/* Need to cast, because on Solaris, the third parameter is - __va_list args - and GCC's fixincludes did not change this to __gnuc_va_list. */ -_GL_CXXALIAS_SYS_CAST (vfprintf, int, - (FILE *fp, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vfprintf); -#endif -#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vfprintf -# undef vfprintf -# endif -/* Assume vfprintf is always declared. */ -_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " - "use gnulib module vfprintf-posix for portable " - "POSIX compliance"); -#endif - -#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ -# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ - || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vprintf rpl_vprintf -# endif -# define GNULIB_overrides_vprintf 1 -_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 1, 0))) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); -# else -/* Need to cast, because on Solaris, the second parameter is - __va_list args - and GCC's fixincludes did not change this to __gnuc_va_list. */ -_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vprintf); -#endif -#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vprintf -# undef vprintf -# endif -/* Assume vprintf is always declared. */ -_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " - "use gnulib module vprintf-posix for portable " - "POSIX compliance"); -#endif - -#if @GNULIB_VSNPRINTF@ -# if @REPLACE_VSNPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vsnprintf rpl_vsnprintf -# endif -_GL_FUNCDECL_RPL (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) - _GL_ARG_NONNULL ((3))); -_GL_CXXALIAS_RPL (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args)); -# else -# if !@HAVE_DECL_VSNPRINTF@ -_GL_FUNCDECL_SYS (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) - _GL_ARG_NONNULL ((3))); -# endif -_GL_CXXALIAS_SYS (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vsnprintf); -#elif defined GNULIB_POSIXCHECK -# undef vsnprintf -# if HAVE_RAW_DECL_VSNPRINTF -_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " - "use gnulib module vsnprintf for portability"); -# endif -#endif - -#if @GNULIB_VSPRINTF_POSIX@ -# if @REPLACE_VSPRINTF@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define vsprintf rpl_vsprintf -# endif -_GL_FUNCDECL_RPL (vsprintf, int, - (char *str, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (vsprintf, int, - (char *str, const char *format, va_list args)); -# else -/* Need to cast, because on Solaris, the third parameter is - __va_list args - and GCC's fixincludes did not change this to __gnuc_va_list. */ -_GL_CXXALIAS_SYS_CAST (vsprintf, int, - (char *str, const char *format, va_list args)); -# endif -_GL_CXXALIASWARN (vsprintf); -#elif defined GNULIB_POSIXCHECK -# undef vsprintf -/* Assume vsprintf is always declared. */ -_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " - "use gnulib module vsprintf-posix for portable " - "POSIX compliance"); -#endif - - -#endif /* _GL_STDIO_H */ -#endif /* _GL_STDIO_H */ -#endif diff --git a/lib/gl/stdlib.in.h b/lib/gl/stdlib.in.h deleted file mode 100644 index 9c7cad93a8..0000000000 --- a/lib/gl/stdlib.in.h +++ /dev/null @@ -1,722 +0,0 @@ -/* A GNU-like <stdlib.h>. - - Copyright (C) 1995, 2001-2004, 2006-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.1 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 __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined __need_malloc_and_calloc -/* Special invocation convention inside glibc header files. */ - -#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_STDLIB_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ - -#ifndef _GL_STDLIB_H -#define _GL_STDLIB_H - -/* NetBSD 5.0 mis-defines NULL. */ -#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>. */ -#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ -# include <sys/loadavg.h> -#endif - -/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included - from <stdlib.h> if _REENTRANT is defined. Include it always. */ -#if @HAVE_RANDOM_H@ -# include <random.h> -#endif - -#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \ - || defined GNULIB_POSIXCHECK -# include <stdint.h> -#endif - -#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 -{ - int32_t *fptr; /* Front pointer. */ - int32_t *rptr; /* Rear pointer. */ - int32_t *state; /* Array of state values. */ - int rand_type; /* Type of random number generator. */ - int rand_deg; /* Degree of random number generator. */ - int rand_sep; /* Distance between front and rear. */ - int32_t *end_ptr; /* Pointer behind state table. */ -}; -# define GNULIB_defined_struct_random_data 1 -# endif -#endif - -#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ -/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ -/* But avoid namespace pollution on glibc systems and native Windows. */ -# include <unistd.h> -#endif - -#ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(Spec) /* empty */ -# endif -#endif - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere - with proper operation of xargs. */ -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#elif EXIT_FAILURE != 1 -# undef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif - - -#if @GNULIB__EXIT@ -/* Terminate the current process with the given return code, without running - the 'atexit' handlers. */ -# if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__))); -# endif -_GL_CXXALIAS_SYS (_Exit, void, (int status)); -_GL_CXXALIASWARN (_Exit); -#elif defined GNULIB_POSIXCHECK -# undef _Exit -# if HAVE_RAW_DECL__EXIT -_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " - "use gnulib module _Exit for portability"); -# endif -#endif - - -#if @GNULIB_ATOLL@ -/* Parse a signed decimal integer. - Returns the value of the integer. Errors are not detected. */ -# if !@HAVE_ATOLL@ -_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); -_GL_CXXALIASWARN (atoll); -#elif defined GNULIB_POSIXCHECK -# undef atoll -# if HAVE_RAW_DECL_ATOLL -_GL_WARN_ON_USE (atoll, "atoll is unportable - " - "use gnulib module atoll for portability"); -# endif -#endif - -#if @GNULIB_CALLOC_POSIX@ -# if @REPLACE_CALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef calloc -# define calloc rpl_calloc -# endif -_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); -_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); -# else -_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); -# endif -_GL_CXXALIASWARN (calloc); -#elif defined GNULIB_POSIXCHECK -# undef calloc -/* Assume calloc is always declared. */ -_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " - "use gnulib module calloc-posix for portability"); -#endif - -#if @GNULIB_CANONICALIZE_FILE_NAME@ -# if @REPLACE_CANONICALIZE_FILE_NAME@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define canonicalize_file_name rpl_canonicalize_file_name -# endif -_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); -# else -# if !@HAVE_CANONICALIZE_FILE_NAME@ -_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); -# endif -_GL_CXXALIASWARN (canonicalize_file_name); -#elif defined GNULIB_POSIXCHECK -# undef canonicalize_file_name -# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME -_GL_WARN_ON_USE (canonicalize_file_name, - "canonicalize_file_name is unportable - " - "use gnulib module canonicalize-lgpl for portability"); -# endif -#endif - -#if @GNULIB_GETLOADAVG@ -/* Store max(NELEM,3) load average numbers in LOADAVG[]. - The three numbers are the load average of the last 1 minute, the last 5 - minutes, and the last 15 minutes, respectively. - LOADAVG is an array of NELEM numbers. */ -# if !@HAVE_DECL_GETLOADAVG@ -_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); -_GL_CXXALIASWARN (getloadavg); -#elif defined GNULIB_POSIXCHECK -# undef getloadavg -# if HAVE_RAW_DECL_GETLOADAVG -_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " - "use gnulib module getloadavg for portability"); -# endif -#endif - -#if @GNULIB_GETSUBOPT@ -/* Assuming *OPTIONP is a comma separated list of elements of the form - "token" or "token=value", getsubopt parses the first of these elements. - If the first element refers to a "token" that is member of the given - NULL-terminated array of tokens: - - It replaces the comma with a NUL byte, updates *OPTIONP to point past - the first option and the comma, sets *VALUEP to the value of the - element (or NULL if it doesn't contain an "=" sign), - - It returns the index of the "token" in the given array of tokens. - Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. - For more details see the POSIX:2001 specification. - http://www.opengroup.org/susv3xsh/getsubopt.html */ -# if !@HAVE_GETSUBOPT@ -_GL_FUNCDECL_SYS (getsubopt, int, - (char **optionp, char *const *tokens, char **valuep) - _GL_ARG_NONNULL ((1, 2, 3))); -# endif -_GL_CXXALIAS_SYS (getsubopt, int, - (char **optionp, char *const *tokens, char **valuep)); -_GL_CXXALIASWARN (getsubopt); -#elif defined GNULIB_POSIXCHECK -# undef getsubopt -# if HAVE_RAW_DECL_GETSUBOPT -_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " - "use gnulib module getsubopt for portability"); -# endif -#endif - -#if @GNULIB_GRANTPT@ -/* Change the ownership and access permission of the slave side of the - pseudo-terminal whose master side is specified by FD. */ -# if !@HAVE_GRANTPT@ -_GL_FUNCDECL_SYS (grantpt, int, (int fd)); -# endif -_GL_CXXALIAS_SYS (grantpt, int, (int fd)); -_GL_CXXALIASWARN (grantpt); -#elif defined GNULIB_POSIXCHECK -# undef grantpt -# if HAVE_RAW_DECL_GRANTPT -_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " - "use gnulib module grantpt for portability"); -# endif -#endif - -#if @GNULIB_MALLOC_POSIX@ -# if @REPLACE_MALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef malloc -# define malloc rpl_malloc -# endif -_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); -_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); -# else -_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); -# endif -_GL_CXXALIASWARN (malloc); -#elif defined GNULIB_POSIXCHECK -# undef malloc -/* Assume malloc is always declared. */ -_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " - "use gnulib module malloc-posix for portability"); -#endif - -#if @GNULIB_MKDTEMP@ -/* Create a unique temporary directory from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the directory name unique. - Returns TEMPLATE, or a null pointer if it cannot get a unique name. - The directory is created mode 700. */ -# if !@HAVE_MKDTEMP@ -_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); -_GL_CXXALIASWARN (mkdtemp); -#elif defined GNULIB_POSIXCHECK -# undef mkdtemp -# if HAVE_RAW_DECL_MKDTEMP -_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " - "use gnulib module mkdtemp for portability"); -# endif -#endif - -#if @GNULIB_MKOSTEMP@ -/* Create a unique temporary file from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) - and O_TEXT, O_BINARY (defined in "binary-io.h"). - The file is then created, with the specified flags, ensuring it didn't exist - before. - The file is created read-write (mask at least 0600 & ~umask), but it may be - world-readable and world-writable (mask 0666 & ~umask), depending on the - implementation. - Returns the open file descriptor if successful, otherwise -1 and errno - set. */ -# if !@HAVE_MKOSTEMP@ -_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); -_GL_CXXALIASWARN (mkostemp); -#elif defined GNULIB_POSIXCHECK -# undef mkostemp -# if HAVE_RAW_DECL_MKOSTEMP -_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " - "use gnulib module mkostemp for portability"); -# endif -#endif - -#if @GNULIB_MKOSTEMPS@ -/* Create a unique temporary file from TEMPLATE. - The last six characters of TEMPLATE before a suffix of length - SUFFIXLEN must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) - and O_TEXT, O_BINARY (defined in "binary-io.h"). - The file is then created, with the specified flags, ensuring it didn't exist - before. - The file is created read-write (mask at least 0600 & ~umask), but it may be - world-readable and world-writable (mask 0666 & ~umask), depending on the - implementation. - Returns the open file descriptor if successful, otherwise -1 and errno - set. */ -# if !@HAVE_MKOSTEMPS@ -_GL_FUNCDECL_SYS (mkostemps, int, - (char * /*template*/, int /*suffixlen*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkostemps, int, - (char * /*template*/, int /*suffixlen*/, int /*flags*/)); -_GL_CXXALIASWARN (mkostemps); -#elif defined GNULIB_POSIXCHECK -# undef mkostemps -# if HAVE_RAW_DECL_MKOSTEMPS -_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " - "use gnulib module mkostemps for portability"); -# endif -#endif - -#if @GNULIB_MKSTEMP@ -/* Create a unique temporary file from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - The file is then created, ensuring it didn't exist before. - The file is created read-write (mask at least 0600 & ~umask), but it may be - world-readable and world-writable (mask 0666 & ~umask), depending on the - implementation. - Returns the open file descriptor if successful, otherwise -1 and errno - set. */ -# if @REPLACE_MKSTEMP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mkstemp rpl_mkstemp -# endif -_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); -# else -# if ! @HAVE_MKSTEMP@ -_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); -# endif -_GL_CXXALIASWARN (mkstemp); -#elif defined GNULIB_POSIXCHECK -# undef mkstemp -# if HAVE_RAW_DECL_MKSTEMP -_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " - "use gnulib module mkstemp for portability"); -# endif -#endif - -#if @GNULIB_MKSTEMPS@ -/* Create a unique temporary file from TEMPLATE. - The last six characters of TEMPLATE prior to a suffix of length - SUFFIXLEN must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - The file is then created, ensuring it didn't exist before. - The file is created read-write (mask at least 0600 & ~umask), but it may be - world-readable and world-writable (mask 0666 & ~umask), depending on the - implementation. - Returns the open file descriptor if successful, otherwise -1 and errno - set. */ -# if !@HAVE_MKSTEMPS@ -_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); -_GL_CXXALIASWARN (mkstemps); -#elif defined GNULIB_POSIXCHECK -# undef mkstemps -# if HAVE_RAW_DECL_MKSTEMPS -_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " - "use gnulib module mkstemps for portability"); -# endif -#endif - -#if @GNULIB_PTSNAME@ -/* Return the pathname of the pseudo-terminal slave associated with - the master FD is open on, or NULL on errors. */ -# if !@HAVE_PTSNAME@ -_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); -# endif -_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); -_GL_CXXALIASWARN (ptsname); -#elif defined GNULIB_POSIXCHECK -# undef ptsname -# if HAVE_RAW_DECL_PTSNAME -_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " - "use gnulib module ptsname for portability"); -# endif -#endif - -#if @GNULIB_PUTENV@ -# if @REPLACE_PUTENV@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef putenv -# define putenv rpl_putenv -# endif -_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (putenv, int, (char *string)); -# else -_GL_CXXALIAS_SYS (putenv, int, (char *string)); -# endif -_GL_CXXALIASWARN (putenv); -#endif - - -#if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ -# ifndef RAND_MAX -# define RAND_MAX 2147483647 -# endif -# endif -#endif - -#if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ -_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); -_GL_CXXALIASWARN (random_r); -#elif defined GNULIB_POSIXCHECK -# undef random_r -# if HAVE_RAW_DECL_RANDOM_R -_GL_WARN_ON_USE (random_r, "random_r is unportable - " - "use gnulib module random_r for portability"); -# endif -#endif - -#if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ -_GL_FUNCDECL_SYS (srandom_r, int, - (unsigned int seed, struct random_data *rand_state) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (srandom_r, int, - (unsigned int seed, struct random_data *rand_state)); -_GL_CXXALIASWARN (srandom_r); -#elif defined GNULIB_POSIXCHECK -# undef srandom_r -# if HAVE_RAW_DECL_SRANDOM_R -_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " - "use gnulib module random_r for portability"); -# endif -#endif - -#if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ -_GL_FUNCDECL_SYS (initstate_r, int, - (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state) - _GL_ARG_NONNULL ((2, 4))); -# endif -_GL_CXXALIAS_SYS (initstate_r, int, - (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state)); -_GL_CXXALIASWARN (initstate_r); -#elif defined GNULIB_POSIXCHECK -# undef initstate_r -# if HAVE_RAW_DECL_INITSTATE_R -_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " - "use gnulib module random_r for portability"); -# endif -#endif - -#if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ -_GL_FUNCDECL_SYS (setstate_r, int, - (char *arg_state, struct random_data *rand_state) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (setstate_r, int, - (char *arg_state, struct random_data *rand_state)); -_GL_CXXALIASWARN (setstate_r); -#elif defined GNULIB_POSIXCHECK -# undef setstate_r -# if HAVE_RAW_DECL_SETSTATE_R -_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " - "use gnulib module random_r for portability"); -# endif -#endif - - -#if @GNULIB_REALLOC_POSIX@ -# if @REPLACE_REALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef realloc -# define realloc rpl_realloc -# endif -_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); -_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); -# else -_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); -# endif -_GL_CXXALIASWARN (realloc); -#elif defined GNULIB_POSIXCHECK -# undef realloc -/* Assume realloc is always declared. */ -_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " - "use gnulib module realloc-posix for portability"); -#endif - -#if @GNULIB_REALPATH@ -# if @REPLACE_REALPATH@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define realpath rpl_realpath -# endif -_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); -# else -# if !@HAVE_REALPATH@ -_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); -# endif -_GL_CXXALIASWARN (realpath); -#elif defined GNULIB_POSIXCHECK -# undef realpath -# if HAVE_RAW_DECL_REALPATH -_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " - "canonicalize or canonicalize-lgpl for portability"); -# endif -#endif - -#if @GNULIB_RPMATCH@ -/* Test a user response to a question. - Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ -# if !@HAVE_RPMATCH@ -_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); -_GL_CXXALIASWARN (rpmatch); -#elif defined GNULIB_POSIXCHECK -# undef rpmatch -# if HAVE_RAW_DECL_RPMATCH -_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " - "use gnulib module rpmatch for portability"); -# endif -#endif - -#if @GNULIB_SETENV@ -/* Set NAME to VALUE in the environment. - If REPLACE is nonzero, overwrite an existing value. */ -# if @REPLACE_SETENV@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef setenv -# define setenv rpl_setenv -# endif -_GL_FUNCDECL_RPL (setenv, int, - (const char *name, const char *value, int replace) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (setenv, int, - (const char *name, const char *value, int replace)); -# else -# if !@HAVE_SETENV@ -_GL_FUNCDECL_SYS (setenv, int, - (const char *name, const char *value, int replace) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (setenv, int, - (const char *name, const char *value, int replace)); -# endif -_GL_CXXALIASWARN (setenv); -#elif defined GNULIB_POSIXCHECK -# undef setenv -# if HAVE_RAW_DECL_SETENV -_GL_WARN_ON_USE (setenv, "setenv is unportable - " - "use gnulib module setenv for portability"); -# endif -#endif - -#if @GNULIB_STRTOD@ - /* Parse a double from STRING, updating ENDP if appropriate. */ -# if @REPLACE_STRTOD@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define strtod rpl_strtod -# endif -_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); -# else -# if !@HAVE_STRTOD@ -_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); -# endif -_GL_CXXALIASWARN (strtod); -#elif defined GNULIB_POSIXCHECK -# undef strtod -# if HAVE_RAW_DECL_STRTOD -_GL_WARN_ON_USE (strtod, "strtod is unportable - " - "use gnulib module strtod for portability"); -# endif -#endif - -#if @GNULIB_STRTOLL@ -/* Parse a signed integer whose textual representation starts at STRING. - The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, - it may be decimal or octal (with prefix "0") or hexadecimal (with prefix - "0x"). - If ENDPTR is not NULL, the address of the first byte after the integer is - stored in *ENDPTR. - Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set - to ERANGE. */ -# if !@HAVE_STRTOLL@ -_GL_FUNCDECL_SYS (strtoll, long long, - (const char *string, char **endptr, int base) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strtoll, long long, - (const char *string, char **endptr, int base)); -_GL_CXXALIASWARN (strtoll); -#elif defined GNULIB_POSIXCHECK -# undef strtoll -# if HAVE_RAW_DECL_STRTOLL -_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " - "use gnulib module strtoll for portability"); -# endif -#endif - -#if @GNULIB_STRTOULL@ -/* Parse an unsigned integer whose textual representation starts at STRING. - The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, - it may be decimal or octal (with prefix "0") or hexadecimal (with prefix - "0x"). - If ENDPTR is not NULL, the address of the first byte after the integer is - stored in *ENDPTR. - Upon overflow, the return value is ULLONG_MAX, and errno is set to - ERANGE. */ -# if !@HAVE_STRTOULL@ -_GL_FUNCDECL_SYS (strtoull, unsigned long long, - (const char *string, char **endptr, int base) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strtoull, unsigned long long, - (const char *string, char **endptr, int base)); -_GL_CXXALIASWARN (strtoull); -#elif defined GNULIB_POSIXCHECK -# undef strtoull -# if HAVE_RAW_DECL_STRTOULL -_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " - "use gnulib module strtoull for portability"); -# endif -#endif - -#if @GNULIB_UNLOCKPT@ -/* Unlock the slave side of the pseudo-terminal whose master side is specified - by FD, so that it can be opened. */ -# if !@HAVE_UNLOCKPT@ -_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); -# endif -_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); -_GL_CXXALIASWARN (unlockpt); -#elif defined GNULIB_POSIXCHECK -# undef unlockpt -# if HAVE_RAW_DECL_UNLOCKPT -_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " - "use gnulib module unlockpt for portability"); -# endif -#endif - -#if @GNULIB_UNSETENV@ -/* Remove the variable NAME from the environment. */ -# if @REPLACE_UNSETENV@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef unsetenv -# define unsetenv rpl_unsetenv -# endif -_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); -# else -# if !@HAVE_UNSETENV@ -_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); -# endif -_GL_CXXALIASWARN (unsetenv); -#elif defined GNULIB_POSIXCHECK -# undef unsetenv -# if HAVE_RAW_DECL_UNSETENV -_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " - "use gnulib module unsetenv for portability"); -# endif -#endif - - -#endif /* _GL_STDLIB_H */ -#endif /* _GL_STDLIB_H */ -#endif diff --git a/lib/gl/str-two-way.h b/lib/gl/str-two-way.h deleted file mode 100644 index 830edc6734..0000000000 --- a/lib/gl/str-two-way.h +++ /dev/null @@ -1,450 +0,0 @@ -/* Byte-wise substring search, using the Two-Way algorithm. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Eric Blake <ebb9@byu.net>, 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 2.1, 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. */ - -/* Before including this file, you need to include <config.h> and - <string.h>, and define: - RESULT_TYPE A macro that expands to the return type. - AVAILABLE(h, h_l, j, n_l) - A macro that returns nonzero if there are - at least N_L bytes left starting at H[J]. - H is 'unsigned char *', H_L, J, and N_L - are 'size_t'; H_L is an lvalue. For - NUL-terminated searches, H_L can be - modified each iteration to avoid having - to compute the end of H up front. - - For case-insensitivity, you may optionally define: - CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L - characters of P1 and P2 are equal. - CANON_ELEMENT(c) A macro that canonicalizes an element right after - it has been fetched from one of the two strings. - The argument is an 'unsigned char'; the result - must be an 'unsigned char' as well. - - This file undefines the macros documented above, and defines - LONG_NEEDLE_THRESHOLD. -*/ - -#include <limits.h> -#include <stdint.h> - -/* We use the Two-Way string matching algorithm, which guarantees - linear complexity with constant space. Additionally, for long - needles, we also use a bad character shift table similar to the - Boyer-Moore algorithm to achieve improved (potentially sub-linear) - performance. - - See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260 - and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm -*/ - -/* Point at which computing a bad-byte shift table is likely to be - worthwhile. Small needles should not compute a table, since it - adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a - speedup no greater than a factor of NEEDLE_LEN. The larger the - needle, the better the potential performance gain. On the other - hand, on non-POSIX systems with CHAR_BIT larger than eight, the - memory required for the table is prohibitive. */ -#if CHAR_BIT < 10 -# define LONG_NEEDLE_THRESHOLD 32U -#else -# define LONG_NEEDLE_THRESHOLD SIZE_MAX -#endif - -#ifndef MAX -# define MAX(a, b) ((a < b) ? (b) : (a)) -#endif - -#ifndef CANON_ELEMENT -# define CANON_ELEMENT(c) c -#endif -#ifndef CMP_FUNC -# define CMP_FUNC memcmp -#endif - -/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN. - Return the index of the first byte in the right half, and set - *PERIOD to the global period of the right half. - - The global period of a string is the smallest index (possibly its - length) at which all remaining bytes in the string are repetitions - of the prefix (the last repetition may be a subset of the prefix). - - When NEEDLE is factored into two halves, a local period is the - length of the smallest word that shares a suffix with the left half - and shares a prefix with the right half. All factorizations of a - non-empty NEEDLE have a local period of at least 1 and no greater - than NEEDLE_LEN. - - A critical factorization has the property that the local period - equals the global period. All strings have at least one critical - factorization with the left half smaller than the global period. - And while some strings have more than one critical factorization, - it is provable that with an ordered alphabet, at least one of the - critical factorizations corresponds to a maximal suffix. - - Given an ordered alphabet, a critical factorization can be computed - in linear time, with 2 * NEEDLE_LEN comparisons, by computing the - shorter of two ordered maximal suffixes. The ordered maximal - suffixes are determined by lexicographic comparison while tracking - periodicity. */ -static size_t -critical_factorization (const unsigned char *needle, size_t needle_len, - size_t *period) -{ - /* Index of last byte of left half. */ - size_t max_suffix, max_suffix_rev; - size_t j; /* Index into NEEDLE for current candidate suffix. */ - size_t k; /* Offset into current period. */ - size_t p; /* Intermediate period. */ - unsigned char a, b; /* Current comparison bytes. */ - - /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered - out 0-length needles. */ - if (needle_len < 3) - { - *period = 1; - return needle_len - 1; - } - - /* Invariants: - 1 <= j < NEEDLE_LEN - 1 - 0 <= max_suffix{,_rev} < j - min(max_suffix, max_suffix_rev) < global period of NEEDLE - 1 <= p <= global period of NEEDLE - p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j] - 1 <= k <= p - */ - - /* Perform lexicographic search. */ - max_suffix = 0; - j = k = p = 1; - while (j + k < needle_len) - { - a = CANON_ELEMENT (needle[j + k]); - b = CANON_ELEMENT (needle[max_suffix + k]); - if (a < b) - { - /* Suffix is smaller, period is entire prefix so far. */ - j += k; - k = 1; - p = j - max_suffix; - } - else if (a == b) - { - /* Advance through repetition of the current period. */ - if (k != p) - ++k; - else - { - j += p; - k = 1; - } - } - else /* b < a */ - { - /* Suffix is larger, start over from current location. */ - max_suffix = j++; - k = p = 1; - } - } - *period = p; - - /* Perform reverse lexicographic search. */ - max_suffix_rev = 0; - j = k = p = 1; - while (j + k < needle_len) - { - a = CANON_ELEMENT (needle[j + k]); - b = CANON_ELEMENT (needle[max_suffix_rev + k]); - if (b < a) - { - /* Suffix is smaller, period is entire prefix so far. */ - j += k; - k = 1; - p = j - max_suffix_rev; - } - else if (a == b) - { - /* Advance through repetition of the current period. */ - if (k != p) - ++k; - else - { - j += p; - k = 1; - } - } - else /* a < b */ - { - /* Suffix is larger, start over from current location. */ - max_suffix_rev = j++; - k = p = 1; - } - } - - /* Choose the shorter suffix. Return the index of the first byte of - the right half, rather than the last byte of the left half. - - For some examples, 'banana' has two critical factorizations, both - exposed by the two lexicographic extreme suffixes of 'anana' and - 'nana', where both suffixes have a period of 2. On the other - hand, with 'aab' and 'bba', both strings have a single critical - factorization of the last byte, with the suffix having a period - of 1. While the maximal lexicographic suffix of 'aab' is 'b', - the maximal lexicographic suffix of 'bba' is 'ba', which is not a - critical factorization. Conversely, the maximal reverse - lexicographic suffix of 'a' works for 'bba', but not 'ab' for - 'aab'. The shorter suffix of the two will always be a critical - factorization. */ - if (max_suffix_rev + 1 < max_suffix + 1) - return max_suffix + 1; - *period = p; - return max_suffix_rev + 1; -} - -/* Return the first location of non-empty NEEDLE within HAYSTACK, or - NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This - method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD. - Performance is guaranteed to be linear, with an initialization cost - of 2 * NEEDLE_LEN comparisons. - - If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at - most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. - If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * - HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */ -static RETURN_TYPE -two_way_short_needle (const unsigned char *haystack, size_t haystack_len, - const unsigned char *needle, size_t needle_len) -{ - size_t i; /* Index into current byte of NEEDLE. */ - size_t j; /* Index into current window of HAYSTACK. */ - size_t period; /* The period of the right half of needle. */ - size_t suffix; /* The index of the right half of needle. */ - - /* Factor the needle into two halves, such that the left half is - smaller than the global period, and the right half is - periodic (with a period as large as NEEDLE_LEN - suffix). */ - suffix = critical_factorization (needle, needle_len, &period); - - /* Perform the search. Each iteration compares the right half - first. */ - if (CMP_FUNC (needle, needle + period, suffix) == 0) - { - /* Entire needle is periodic; a mismatch in the left half can - only advance by the period, so use memory to avoid rescanning - known occurrences of the period in the right half. */ - size_t memory = 0; - j = 0; - while (AVAILABLE (haystack, haystack_len, j, needle_len)) - { - /* Scan for matches in right half. */ - i = MAX (suffix, memory); - while (i < needle_len && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - ++i; - if (needle_len <= i) - { - /* Scan for matches in left half. */ - i = suffix - 1; - while (memory < i + 1 && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - --i; - if (i + 1 < memory + 1) - return (RETURN_TYPE) (haystack + j); - /* No match, so remember how many repetitions of period - on the right half were scanned. */ - j += period; - memory = needle_len - period; - } - else - { - j += i - suffix + 1; - memory = 0; - } - } - } - else - { - /* The two halves of needle are distinct; no extra memory is - required, and any mismatch results in a maximal shift. */ - period = MAX (suffix, needle_len - suffix) + 1; - j = 0; - while (AVAILABLE (haystack, haystack_len, j, needle_len)) - { - /* Scan for matches in right half. */ - i = suffix; - while (i < needle_len && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - ++i; - if (needle_len <= i) - { - /* Scan for matches in left half. */ - i = suffix - 1; - while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - --i; - if (i == SIZE_MAX) - return (RETURN_TYPE) (haystack + j); - j += period; - } - else - j += i - suffix + 1; - } - } - return NULL; -} - -/* Return the first location of non-empty NEEDLE within HAYSTACK, or - NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This - method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN. - Performance is guaranteed to be linear, with an initialization cost - of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations. - - If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at - most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, - and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible. - If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * - HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and - sublinear performance is not possible. */ -static RETURN_TYPE -two_way_long_needle (const unsigned char *haystack, size_t haystack_len, - const unsigned char *needle, size_t needle_len) -{ - size_t i; /* Index into current byte of NEEDLE. */ - size_t j; /* Index into current window of HAYSTACK. */ - size_t period; /* The period of the right half of needle. */ - size_t suffix; /* The index of the right half of needle. */ - size_t shift_table[1U << CHAR_BIT]; /* See below. */ - - /* Factor the needle into two halves, such that the left half is - smaller than the global period, and the right half is - periodic (with a period as large as NEEDLE_LEN - suffix). */ - suffix = critical_factorization (needle, needle_len, &period); - - /* Populate shift_table. For each possible byte value c, - shift_table[c] is the distance from the last occurrence of c to - the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE. - shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */ - for (i = 0; i < 1U << CHAR_BIT; i++) - shift_table[i] = needle_len; - for (i = 0; i < needle_len; i++) - shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1; - - /* Perform the search. Each iteration compares the right half - first. */ - if (CMP_FUNC (needle, needle + period, suffix) == 0) - { - /* Entire needle is periodic; a mismatch in the left half can - only advance by the period, so use memory to avoid rescanning - known occurrences of the period in the right half. */ - size_t memory = 0; - size_t shift; - j = 0; - while (AVAILABLE (haystack, haystack_len, j, needle_len)) - { - /* Check the last byte first; if it does not match, then - shift to the next possible match location. */ - shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; - if (0 < shift) - { - if (memory && shift < period) - { - /* Since needle is periodic, but the last period has - a byte out of place, there can be no match until - after the mismatch. */ - shift = needle_len - period; - } - memory = 0; - j += shift; - continue; - } - /* Scan for matches in right half. The last byte has - already been matched, by virtue of the shift table. */ - i = MAX (suffix, memory); - while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - ++i; - if (needle_len - 1 <= i) - { - /* Scan for matches in left half. */ - i = suffix - 1; - while (memory < i + 1 && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - --i; - if (i + 1 < memory + 1) - return (RETURN_TYPE) (haystack + j); - /* No match, so remember how many repetitions of period - on the right half were scanned. */ - j += period; - memory = needle_len - period; - } - else - { - j += i - suffix + 1; - memory = 0; - } - } - } - else - { - /* The two halves of needle are distinct; no extra memory is - required, and any mismatch results in a maximal shift. */ - size_t shift; - period = MAX (suffix, needle_len - suffix) + 1; - j = 0; - while (AVAILABLE (haystack, haystack_len, j, needle_len)) - { - /* Check the last byte first; if it does not match, then - shift to the next possible match location. */ - shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; - if (0 < shift) - { - j += shift; - continue; - } - /* Scan for matches in right half. The last byte has - already been matched, by virtue of the shift table. */ - i = suffix; - while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - ++i; - if (needle_len - 1 <= i) - { - /* Scan for matches in left half. */ - i = suffix - 1; - while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) - == CANON_ELEMENT (haystack[i + j]))) - --i; - if (i == SIZE_MAX) - return (RETURN_TYPE) (haystack + j); - j += period; - } - else - j += i - suffix + 1; - } - } - return NULL; -} - -#undef AVAILABLE -#undef CANON_ELEMENT -#undef CMP_FUNC -#undef MAX -#undef RETURN_TYPE diff --git a/lib/gl/strcasecmp.c b/lib/gl/strcasecmp.c deleted file mode 100644 index 3d9ea4ac19..0000000000 --- a/lib/gl/strcasecmp.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include <string.h> - -#include <ctype.h> -#include <limits.h> - -#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) - -/* Compare strings S1 and S2, ignoring case, returning less than, equal to or - greater than zero if S1 is lexicographically less than, equal to or greater - than S2. - Note: This function does not work with multibyte strings! */ - -int -strcasecmp (const char *s1, const char *s2) -{ - const unsigned char *p1 = (const unsigned char *) s1; - const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - - if (p1 == p2) - return 0; - - do - { - c1 = TOLOWER (*p1); - c2 = TOLOWER (*p2); - - if (c1 == '\0') - break; - - ++p1; - ++p2; - } - while (c1 == c2); - - if (UCHAR_MAX <= INT_MAX) - return c1 - c2; - else - /* On machines where 'char' and 'int' are types of the same size, the - difference of two 'unsigned char' values - including the sign bit - - doesn't fit in an 'int'. */ - return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); -} diff --git a/lib/gl/string.in.h b/lib/gl/string.in.h deleted file mode 100644 index b5711c07c6..0000000000 --- a/lib/gl/string.in.h +++ /dev/null @@ -1,975 +0,0 @@ -/* A GNU-like <string.h>. - - Copyright (C) 1995-1996, 2001-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_STRING_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STRING_H@ - -#ifndef _GL_STRING_H -#define _GL_STRING_H - -/* NetBSD 5.0 mis-defines NULL. */ -#include <stddef.h> - -/* MirBSD defines mbslen as a macro. */ -#if @GNULIB_MBSLEN@ && defined __MirBSD__ -# include <wchar.h> -#endif - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -#endif -/* The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - -/* 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 definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -/* Return the first instance of C within N bytes of S, or NULL. */ -#if @GNULIB_MEMCHR@ -# if @REPLACE_MEMCHR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define memchr rpl_memchr -# endif -_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); -# else -# if ! @HAVE_MEMCHR@ -_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C" { const void * std::memchr (const void *, int, size_t); } - extern "C++" { void * std::memchr (void *, int, size_t); } */ -_GL_CXXALIAS_SYS_CAST2 (memchr, - void *, (void const *__s, int __c, size_t __n), - void const *, (void const *__s, int __c, size_t __n)); -# endif -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); -_GL_CXXALIASWARN1 (memchr, void const *, - (void const *__s, int __c, size_t __n)); -# else -_GL_CXXALIASWARN (memchr); -# endif -#elif defined GNULIB_POSIXCHECK -# undef memchr -/* Assume memchr is always declared. */ -_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " - "use gnulib module memchr for portability" ); -#endif - -/* Return the first occurrence of NEEDLE in HAYSTACK. */ -#if @GNULIB_MEMMEM@ -# if @REPLACE_MEMMEM@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define memmem rpl_memmem -# endif -_GL_FUNCDECL_RPL (memmem, void *, - (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 3))); -_GL_CXXALIAS_RPL (memmem, void *, - (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len)); -# else -# if ! @HAVE_DECL_MEMMEM@ -_GL_FUNCDECL_SYS (memmem, void *, - (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 3))); -# endif -_GL_CXXALIAS_SYS (memmem, void *, - (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len)); -# endif -_GL_CXXALIASWARN (memmem); -#elif defined GNULIB_POSIXCHECK -# undef memmem -# if HAVE_RAW_DECL_MEMMEM -_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " - "use gnulib module memmem-simple for portability, " - "and module memmem for speed" ); -# endif -#endif - -/* Copy N bytes of SRC to DEST, return pointer to bytes after the - last written byte. */ -#if @GNULIB_MEMPCPY@ -# if ! @HAVE_MEMPCPY@ -_GL_FUNCDECL_SYS (mempcpy, void *, - (void *restrict __dest, void const *restrict __src, - size_t __n) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (mempcpy, void *, - (void *restrict __dest, void const *restrict __src, - size_t __n)); -_GL_CXXALIASWARN (mempcpy); -#elif defined GNULIB_POSIXCHECK -# undef mempcpy -# if HAVE_RAW_DECL_MEMPCPY -_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " - "use gnulib module mempcpy for portability"); -# endif -#endif - -/* Search backwards through a block for a byte (specified as an int). */ -#if @GNULIB_MEMRCHR@ -# if ! @HAVE_DECL_MEMRCHR@ -_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C++" { const void * std::memrchr (const void *, int, size_t); } - extern "C++" { void * std::memrchr (void *, int, size_t); } */ -_GL_CXXALIAS_SYS_CAST2 (memrchr, - void *, (void const *, int, size_t), - void const *, (void const *, int, size_t)); -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); -_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); -# else -_GL_CXXALIASWARN (memrchr); -# endif -#elif defined GNULIB_POSIXCHECK -# undef memrchr -# if HAVE_RAW_DECL_MEMRCHR -_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " - "use gnulib module memrchr for portability"); -# endif -#endif - -/* Find the first occurrence of C in S. More efficient than - memchr(S,C,N), at the expense of undefined behavior if C does not - occur within N bytes. */ -#if @GNULIB_RAWMEMCHR@ -# if ! @HAVE_RAWMEMCHR@ -_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C++" { const void * std::rawmemchr (const void *, int); } - extern "C++" { void * std::rawmemchr (void *, int); } */ -_GL_CXXALIAS_SYS_CAST2 (rawmemchr, - void *, (void const *__s, int __c_in), - void const *, (void const *__s, int __c_in)); -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); -_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); -# else -_GL_CXXALIASWARN (rawmemchr); -# endif -#elif defined GNULIB_POSIXCHECK -# undef rawmemchr -# if HAVE_RAW_DECL_RAWMEMCHR -_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " - "use gnulib module rawmemchr for portability"); -# endif -#endif - -/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ -#if @GNULIB_STPCPY@ -# if ! @HAVE_STPCPY@ -_GL_FUNCDECL_SYS (stpcpy, char *, - (char *restrict __dst, char const *restrict __src) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (stpcpy, char *, - (char *restrict __dst, char const *restrict __src)); -_GL_CXXALIASWARN (stpcpy); -#elif defined GNULIB_POSIXCHECK -# undef stpcpy -# if HAVE_RAW_DECL_STPCPY -_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " - "use gnulib module stpcpy for portability"); -# endif -#endif - -/* Copy no more than N bytes of SRC to DST, returning a pointer past the - last non-NUL byte written into DST. */ -#if @GNULIB_STPNCPY@ -# if @REPLACE_STPNCPY@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef stpncpy -# define stpncpy rpl_stpncpy -# endif -_GL_FUNCDECL_RPL (stpncpy, char *, - (char *restrict __dst, char const *restrict __src, - size_t __n) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (stpncpy, char *, - (char *restrict __dst, char const *restrict __src, - size_t __n)); -# else -# if ! @HAVE_STPNCPY@ -_GL_FUNCDECL_SYS (stpncpy, char *, - (char *restrict __dst, char const *restrict __src, - size_t __n) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (stpncpy, char *, - (char *restrict __dst, char const *restrict __src, - size_t __n)); -# endif -_GL_CXXALIASWARN (stpncpy); -#elif defined GNULIB_POSIXCHECK -# undef stpncpy -# if HAVE_RAW_DECL_STPNCPY -_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " - "use gnulib module stpncpy for portability"); -# endif -#endif - -#if defined GNULIB_POSIXCHECK -/* strchr() does not work with multibyte strings if the locale encoding is - GB18030 and the character to be searched is a digit. */ -# undef strchr -/* Assume strchr is always declared. */ -_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " - "in some multibyte locales - " - "use mbschr if you care about internationalization"); -#endif - -/* Find the first occurrence of C in S or the final NUL byte. */ -#if @GNULIB_STRCHRNUL@ -# if ! @HAVE_STRCHRNUL@ -_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C++" { const char * std::strchrnul (const char *, int); } - extern "C++" { char * std::strchrnul (char *, int); } */ -_GL_CXXALIAS_SYS_CAST2 (strchrnul, - char *, (char const *__s, int __c_in), - char const *, (char const *__s, int __c_in)); -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); -_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); -# else -_GL_CXXALIASWARN (strchrnul); -# endif -#elif defined GNULIB_POSIXCHECK -# undef strchrnul -# if HAVE_RAW_DECL_STRCHRNUL -_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " - "use gnulib module strchrnul for portability"); -# endif -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -#if @GNULIB_STRDUP@ -# if @REPLACE_STRDUP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strdup -# define strdup rpl_strdup -# endif -_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); -# else -# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup - /* strdup exists as a function and as a macro. Get rid of the macro. */ -# undef strdup -# endif -# if !(@HAVE_DECL_STRDUP@ || defined strdup) -_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); -# endif -_GL_CXXALIASWARN (strdup); -#elif defined GNULIB_POSIXCHECK -# undef strdup -# if HAVE_RAW_DECL_STRDUP -_GL_WARN_ON_USE (strdup, "strdup is unportable - " - "use gnulib module strdup for portability"); -# endif -#endif - -/* Append no more than N characters from SRC onto DEST. */ -#if @GNULIB_STRNCAT@ -# if @REPLACE_STRNCAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strncat -# define strncat rpl_strncat -# endif -_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); -# else -_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); -# endif -_GL_CXXALIASWARN (strncat); -#elif defined GNULIB_POSIXCHECK -# undef strncat -# if HAVE_RAW_DECL_STRNCAT -_GL_WARN_ON_USE (strncat, "strncat is unportable - " - "use gnulib module strncat for portability"); -# endif -#endif - -/* Return a newly allocated copy of at most N bytes of STRING. */ -#if @GNULIB_STRNDUP@ -# if @REPLACE_STRNDUP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strndup -# define strndup rpl_strndup -# endif -_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); -# else -# if ! @HAVE_DECL_STRNDUP@ -_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); -# endif -_GL_CXXALIASWARN (strndup); -#elif defined GNULIB_POSIXCHECK -# undef strndup -# if HAVE_RAW_DECL_STRNDUP -_GL_WARN_ON_USE (strndup, "strndup is unportable - " - "use gnulib module strndup for portability"); -# endif -#endif - -/* Find the length (number of bytes) of STRING, but scan at most - MAXLEN bytes. If no '\0' terminator is found in that many bytes, - return MAXLEN. */ -#if @GNULIB_STRNLEN@ -# if @REPLACE_STRNLEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strnlen -# define strnlen rpl_strnlen -# endif -_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); -# else -# if ! @HAVE_DECL_STRNLEN@ -_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); -# endif -_GL_CXXALIASWARN (strnlen); -#elif defined GNULIB_POSIXCHECK -# undef strnlen -# if HAVE_RAW_DECL_STRNLEN -_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " - "use gnulib module strnlen for portability"); -# endif -#endif - -#if defined GNULIB_POSIXCHECK -/* strcspn() assumes the second argument is a list of single-byte characters. - Even in this simple case, it does not work with multibyte strings if the - locale encoding is GB18030 and one of the characters to be searched is a - digit. */ -# undef strcspn -/* Assume strcspn is always declared. */ -_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " - "in multibyte locales - " - "use mbscspn if you care about internationalization"); -#endif - -/* Find the first occurrence in S of any character in ACCEPT. */ -#if @GNULIB_STRPBRK@ -# if ! @HAVE_STRPBRK@ -_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 2))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C" { const char * strpbrk (const char *, const char *); } - extern "C++" { char * strpbrk (char *, const char *); } */ -_GL_CXXALIAS_SYS_CAST2 (strpbrk, - char *, (char const *__s, char const *__accept), - const char *, (char const *__s, char const *__accept)); -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); -_GL_CXXALIASWARN1 (strpbrk, char const *, - (char const *__s, char const *__accept)); -# else -_GL_CXXALIASWARN (strpbrk); -# endif -# if defined GNULIB_POSIXCHECK -/* strpbrk() assumes the second argument is a list of single-byte characters. - Even in this simple case, it does not work with multibyte strings if the - locale encoding is GB18030 and one of the characters to be searched is a - digit. */ -# undef strpbrk -_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " - "in multibyte locales - " - "use mbspbrk if you care about internationalization"); -# endif -#elif defined GNULIB_POSIXCHECK -# undef strpbrk -# if HAVE_RAW_DECL_STRPBRK -_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " - "use gnulib module strpbrk for portability"); -# endif -#endif - -#if defined GNULIB_POSIXCHECK -/* strspn() assumes the second argument is a list of single-byte characters. - Even in this simple case, it cannot work with multibyte strings. */ -# undef strspn -/* Assume strspn is always declared. */ -_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " - "in multibyte locales - " - "use mbsspn if you care about internationalization"); -#endif - -#if defined GNULIB_POSIXCHECK -/* strrchr() does not work with multibyte strings if the locale encoding is - GB18030 and the character to be searched is a digit. */ -# undef strrchr -/* Assume strrchr is always declared. */ -_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " - "in some multibyte locales - " - "use mbsrchr if you care about internationalization"); -#endif - -/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. - If one is found, overwrite it with a NUL, and advance *STRINGP - to point to the next char after it. Otherwise, set *STRINGP to NULL. - If *STRINGP was already NULL, nothing happens. - Return the old value of *STRINGP. - - This is a variant of strtok() that is multithread-safe and supports - empty fields. - - Caveat: It modifies the original string. - Caveat: These functions cannot be used on constant strings. - Caveat: The identity of the delimiting character is lost. - Caveat: It doesn't work with multibyte strings unless all of the delimiter - characters are ASCII characters < 0x30. - - See also strtok_r(). */ -#if @GNULIB_STRSEP@ -# if ! @HAVE_STRSEP@ -_GL_FUNCDECL_SYS (strsep, char *, - (char **restrict __stringp, char const *restrict __delim) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (strsep, char *, - (char **restrict __stringp, char const *restrict __delim)); -_GL_CXXALIASWARN (strsep); -# if defined GNULIB_POSIXCHECK -# undef strsep -_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " - "in multibyte locales - " - "use mbssep if you care about internationalization"); -# endif -#elif defined GNULIB_POSIXCHECK -# undef strsep -# if HAVE_RAW_DECL_STRSEP -_GL_WARN_ON_USE (strsep, "strsep is unportable - " - "use gnulib module strsep for portability"); -# endif -#endif - -#if @GNULIB_STRSTR@ -# if @REPLACE_STRSTR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define strstr rpl_strstr -# endif -_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); -# else - /* On some systems, this function is defined as an overloaded function: - extern "C++" { const char * strstr (const char *, const char *); } - extern "C++" { char * strstr (char *, const char *); } */ -_GL_CXXALIAS_SYS_CAST2 (strstr, - char *, (const char *haystack, const char *needle), - const char *, (const char *haystack, const char *needle)); -# endif -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); -_GL_CXXALIASWARN1 (strstr, const char *, - (const char *haystack, const char *needle)); -# else -_GL_CXXALIASWARN (strstr); -# endif -#elif defined GNULIB_POSIXCHECK -/* strstr() does not work with multibyte strings if the locale encoding is - different from UTF-8: - POSIX says that it operates on "strings", and "string" in POSIX is defined - as a sequence of bytes, not of characters. */ -# undef strstr -/* Assume strstr is always declared. */ -_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " - "work correctly on character strings in most " - "multibyte locales - " - "use mbsstr if you care about internationalization, " - "or use strstr if you care about speed"); -#endif - -/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive - comparison. */ -#if @GNULIB_STRCASESTR@ -# if @REPLACE_STRCASESTR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define strcasestr rpl_strcasestr -# endif -_GL_FUNCDECL_RPL (strcasestr, char *, - (const char *haystack, const char *needle) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (strcasestr, char *, - (const char *haystack, const char *needle)); -# else -# if ! @HAVE_STRCASESTR@ -_GL_FUNCDECL_SYS (strcasestr, char *, - (const char *haystack, const char *needle) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1, 2))); -# endif - /* On some systems, this function is defined as an overloaded function: - extern "C++" { const char * strcasestr (const char *, const char *); } - extern "C++" { char * strcasestr (char *, const char *); } */ -_GL_CXXALIAS_SYS_CAST2 (strcasestr, - char *, (const char *haystack, const char *needle), - const char *, (const char *haystack, const char *needle)); -# endif -# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); -_GL_CXXALIASWARN1 (strcasestr, const char *, - (const char *haystack, const char *needle)); -# else -_GL_CXXALIASWARN (strcasestr); -# endif -#elif defined GNULIB_POSIXCHECK -/* strcasestr() does not work with multibyte strings: - It is a glibc extension, and glibc implements it only for unibyte - locales. */ -# undef strcasestr -# if HAVE_RAW_DECL_STRCASESTR -_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " - "strings in multibyte locales - " - "use mbscasestr if you care about " - "internationalization, or use c-strcasestr if you want " - "a locale independent function"); -# endif -#endif - -/* Parse S into tokens separated by characters in DELIM. - If S is NULL, the saved pointer in SAVE_PTR is used as - the next starting point. For example: - char s[] = "-abc-=-def"; - char *sp; - x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" - x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL - x = strtok_r(NULL, "=", &sp); // x = NULL - // s = "abc\0-def\0" - - This is a variant of strtok() that is multithread-safe. - - For the POSIX documentation for this function, see: - http://www.opengroup.org/susv3xsh/strtok.html - - Caveat: It modifies the original string. - Caveat: These functions cannot be used on constant strings. - Caveat: The identity of the delimiting character is lost. - Caveat: It doesn't work with multibyte strings unless all of the delimiter - characters are ASCII characters < 0x30. - - See also strsep(). */ -#if @GNULIB_STRTOK_R@ -# if @REPLACE_STRTOK_R@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strtok_r -# define strtok_r rpl_strtok_r -# endif -_GL_FUNCDECL_RPL (strtok_r, char *, - (char *restrict s, char const *restrict delim, - char **restrict save_ptr) - _GL_ARG_NONNULL ((2, 3))); -_GL_CXXALIAS_RPL (strtok_r, char *, - (char *restrict s, char const *restrict delim, - char **restrict save_ptr)); -# else -# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK -# undef strtok_r -# endif -# if ! @HAVE_DECL_STRTOK_R@ -_GL_FUNCDECL_SYS (strtok_r, char *, - (char *restrict s, char const *restrict delim, - char **restrict save_ptr) - _GL_ARG_NONNULL ((2, 3))); -# endif -_GL_CXXALIAS_SYS (strtok_r, char *, - (char *restrict s, char const *restrict delim, - char **restrict save_ptr)); -# endif -_GL_CXXALIASWARN (strtok_r); -# if defined GNULIB_POSIXCHECK -_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " - "strings in multibyte locales - " - "use mbstok_r if you care about internationalization"); -# endif -#elif defined GNULIB_POSIXCHECK -# undef strtok_r -# if HAVE_RAW_DECL_STRTOK_R -_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " - "use gnulib module strtok_r for portability"); -# endif -#endif - - -/* The following functions are not specified by POSIX. They are gnulib - extensions. */ - -#if @GNULIB_MBSLEN@ -/* Return the number of multibyte characters in the character string STRING. - This considers multibyte characters, unlike strlen, which counts bytes. */ -# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ -# undef mbslen -# endif -# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbslen rpl_mbslen -# endif -_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); -# else -_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); -# endif -_GL_CXXALIASWARN (mbslen); -#endif - -#if @GNULIB_MBSNLEN@ -/* Return the number of multibyte characters in the character string starting - at STRING and ending at STRING + LEN. */ -_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) - _GL_ARG_NONNULL ((1)); -#endif - -#if @GNULIB_MBSCHR@ -/* Locate the first single-byte character C in the character string STRING, - and return a pointer to it. Return NULL if C is not found in STRING. - Unlike strchr(), this function works correctly in multibyte locales with - encodings such as GB18030. */ -# if defined __hpux -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ -# endif -_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); -# else -_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); -# endif -_GL_CXXALIASWARN (mbschr); -#endif - -#if @GNULIB_MBSRCHR@ -/* Locate the last single-byte character C in the character string STRING, - and return a pointer to it. Return NULL if C is not found in STRING. - Unlike strrchr(), this function works correctly in multibyte locales with - encodings such as GB18030. */ -# if defined __hpux -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ -# endif -_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); -# else -_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); -# endif -_GL_CXXALIASWARN (mbsrchr); -#endif - -#if @GNULIB_MBSSTR@ -/* Find the first occurrence of the character string NEEDLE in the character - string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. - Unlike strstr(), this function works correctly in multibyte locales with - encodings different from UTF-8. */ -_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSCASECMP@ -/* Compare the character strings S1 and S2, ignoring case, returning less than, - equal to or greater than zero if S1 is lexicographically less than, equal to - or greater than S2. - Note: This function may, in multibyte locales, return 0 for strings of - different lengths! - Unlike strcasecmp(), this function works correctly in multibyte locales. */ -_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSNCASECMP@ -/* Compare the initial segment of the character string S1 consisting of at most - N characters with the initial segment of the character string S2 consisting - of at most N characters, ignoring case, returning less than, equal to or - greater than zero if the initial segment of S1 is lexicographically less - than, equal to or greater than the initial segment of S2. - Note: This function may, in multibyte locales, return 0 for initial segments - of different lengths! - Unlike strncasecmp(), this function works correctly in multibyte locales. - But beware that N is not a byte count but a character count! */ -_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSPCASECMP@ -/* Compare the initial segment of the character string STRING consisting of - at most mbslen (PREFIX) characters with the character string PREFIX, - ignoring case. If the two match, return a pointer to the first byte - after this prefix in STRING. Otherwise, return NULL. - Note: This function may, in multibyte locales, return non-NULL if STRING - is of smaller length than PREFIX! - Unlike strncasecmp(), this function works correctly in multibyte - locales. */ -_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSCASESTR@ -/* Find the first occurrence of the character string NEEDLE in the character - string HAYSTACK, using case-insensitive comparison. - Note: This function may, in multibyte locales, return success even if - strlen (haystack) < strlen (needle) ! - Unlike strcasestr(), this function works correctly in multibyte locales. */ -_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSCSPN@ -/* Find the first occurrence in the character string STRING of any character - in the character string ACCEPT. Return the number of bytes from the - beginning of the string to this occurrence, or to the end of the string - if none exists. - Unlike strcspn(), this function works correctly in multibyte locales. */ -_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSPBRK@ -/* Find the first occurrence in the character string STRING of any character - in the character string ACCEPT. Return the pointer to it, or NULL if none - exists. - Unlike strpbrk(), this function works correctly in multibyte locales. */ -# if defined __hpux -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ -# endif -_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); -# else -_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); -# endif -_GL_CXXALIASWARN (mbspbrk); -#endif - -#if @GNULIB_MBSSPN@ -/* Find the first occurrence in the character string STRING of any character - not in the character string REJECT. Return the number of bytes from the - beginning of the string to this occurrence, or to the end of the string - if none exists. - Unlike strspn(), this function works correctly in multibyte locales. */ -_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSSEP@ -/* Search the next delimiter (multibyte character listed in the character - string DELIM) starting at the character string *STRINGP. - If one is found, overwrite it with a NUL, and advance *STRINGP to point - to the next multibyte character after it. Otherwise, set *STRINGP to NULL. - If *STRINGP was already NULL, nothing happens. - Return the old value of *STRINGP. - - This is a variant of mbstok_r() that supports empty fields. - - Caveat: It modifies the original string. - Caveat: These functions cannot be used on constant strings. - Caveat: The identity of the delimiting character is lost. - - See also mbstok_r(). */ -_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) - _GL_ARG_NONNULL ((1, 2)); -#endif - -#if @GNULIB_MBSTOK_R@ -/* Parse the character string STRING into tokens separated by characters in - the character string DELIM. - If STRING is NULL, the saved pointer in SAVE_PTR is used as - the next starting point. For example: - char s[] = "-abc-=-def"; - char *sp; - x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" - x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL - x = mbstok_r(NULL, "=", &sp); // x = NULL - // s = "abc\0-def\0" - - Caveat: It modifies the original string. - Caveat: These functions cannot be used on constant strings. - Caveat: The identity of the delimiting character is lost. - - See also mbssep(). */ -_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) - _GL_ARG_NONNULL ((2, 3)); -#endif - -/* Map any int, typically from errno, into an error message. */ -#if @GNULIB_STRERROR@ -# if @REPLACE_STRERROR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strerror -# define strerror rpl_strerror -# endif -_GL_FUNCDECL_RPL (strerror, char *, (int)); -_GL_CXXALIAS_RPL (strerror, char *, (int)); -# else -_GL_CXXALIAS_SYS (strerror, char *, (int)); -# endif -_GL_CXXALIASWARN (strerror); -#elif defined GNULIB_POSIXCHECK -# undef strerror -/* Assume strerror is always declared. */ -_GL_WARN_ON_USE (strerror, "strerror is unportable - " - "use gnulib module strerror to guarantee non-NULL result"); -#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 @REPLACE_STRSIGNAL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define strsignal rpl_strsignal -# endif -_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); -_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); -# else -# if ! @HAVE_DECL_STRSIGNAL@ -_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); -# endif -/* Need to cast, because on Cygwin 1.5.x systems, the return type is - 'const char *'. */ -_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); -# endif -_GL_CXXALIASWARN (strsignal); -#elif defined GNULIB_POSIXCHECK -# undef strsignal -# if HAVE_RAW_DECL_STRSIGNAL -_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " - "use gnulib module strsignal for portability"); -# endif -#endif - -#if @GNULIB_STRVERSCMP@ -# if !@HAVE_STRVERSCMP@ -_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); -_GL_CXXALIASWARN (strverscmp); -#elif defined GNULIB_POSIXCHECK -# undef strverscmp -# if HAVE_RAW_DECL_STRVERSCMP -_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " - "use gnulib module strverscmp for portability"); -# endif -#endif - - -#endif /* _GL_STRING_H */ -#endif /* _GL_STRING_H */ diff --git a/lib/gl/strings.in.h b/lib/gl/strings.in.h deleted file mode 100644 index fb1f19014d..0000000000 --- a/lib/gl/strings.in.h +++ /dev/null @@ -1,94 +0,0 @@ -/* A substitute <strings.h>. - - Copyright (C) 2007-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_STRINGS_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STRINGS_H@ - -#ifndef _GL_STRINGS_H -#define _GL_STRINGS_H - - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Compare strings S1 and S2, ignoring case, returning less than, equal to or - greater than zero if S1 is lexicographically less than, equal to or greater - than S2. - Note: This function does not work in multibyte locales. */ -#if ! @HAVE_STRCASECMP@ -extern int strcasecmp (char const *s1, char const *s2) - _GL_ARG_NONNULL ((1, 2)); -#endif -#if defined GNULIB_POSIXCHECK -/* strcasecmp() does not work with multibyte strings: - POSIX says that it operates on "strings", and "string" in POSIX is defined - as a sequence of bytes, not of characters. */ -# undef strcasecmp -# if HAVE_RAW_DECL_STRCASECMP -_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " - "strings in multibyte locales - " - "use mbscasecmp if you care about " - "internationalization, or use c_strcasecmp , " - "gnulib module c-strcase) if you want a locale " - "independent function"); -# endif -#endif - -/* Compare no more than N bytes of strings S1 and S2, ignoring case, - returning less than, equal to or greater than zero if S1 is - lexicographically less than, equal to or greater than S2. - Note: This function cannot work correctly in multibyte locales. */ -#if ! @HAVE_DECL_STRNCASECMP@ -extern int strncasecmp (char const *s1, char const *s2, size_t n) - _GL_ARG_NONNULL ((1, 2)); -#endif -#if defined GNULIB_POSIXCHECK -/* strncasecmp() does not work with multibyte strings: - POSIX says that it operates on "strings", and "string" in POSIX is defined - as a sequence of bytes, not of characters. */ -# undef strncasecmp -# if HAVE_RAW_DECL_STRNCASECMP -_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " - "strings in multibyte locales - " - "use mbsncasecmp or mbspcasecmp if you care about " - "internationalization, or use c_strncasecmp , " - "gnulib module c-strcase) if you want a locale " - "independent function"); -# endif -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_STRING_H */ -#endif /* _GL_STRING_H */ diff --git a/lib/gl/strncasecmp.c b/lib/gl/strncasecmp.c deleted file mode 100644 index 788e4234e4..0000000000 --- a/lib/gl/strncasecmp.c +++ /dev/null @@ -1,63 +0,0 @@ -/* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998-1999, 2005-2007, 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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include <string.h> - -#include <ctype.h> -#include <limits.h> - -#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) - -/* Compare no more than N bytes of strings S1 and S2, ignoring case, - returning less than, equal to or greater than zero if S1 is - lexicographically less than, equal to or greater than S2. - Note: This function cannot work correctly in multibyte locales. */ - -int -strncasecmp (const char *s1, const char *s2, size_t n) -{ - register const unsigned char *p1 = (const unsigned char *) s1; - register const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - - if (p1 == p2 || n == 0) - return 0; - - do - { - c1 = TOLOWER (*p1); - c2 = TOLOWER (*p2); - - if (--n == 0 || c1 == '\0') - break; - - ++p1; - ++p2; - } - while (c1 == c2); - - if (UCHAR_MAX <= INT_MAX) - return c1 - c2; - else - /* On machines where 'char' and 'int' are types of the same size, the - difference of two 'unsigned char' values - including the sign bit - - doesn't fit in an 'int'. */ - return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); -} diff --git a/lib/gl/strverscmp.c b/lib/gl/strverscmp.c deleted file mode 100644 index 5757d647f1..0000000000 --- a/lib/gl/strverscmp.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Compare strings while treating digits characters numerically. - Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2010 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. - - 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.1, 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. */ - -#if !_LIBC -# include <config.h> -#endif - -#include <string.h> -#include <ctype.h> - -/* states: S_N: normal, S_I: comparing integral part, S_F: comparing - fractional parts, S_Z: idem but with leading Zeroes only */ -#define S_N 0x0 -#define S_I 0x4 -#define S_F 0x8 -#define S_Z 0xC - -/* result_type: CMP: return diff; LEN: compare using len_diff/diff */ -#define CMP 2 -#define LEN 3 - - -/* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char - or EOF. - - It's typically faster. - POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - isdigit unless it's important to use the locale's definition - of `digit' even when the host does not conform to POSIX. */ -#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) - -#undef __strverscmp -#undef strverscmp - -#ifndef weak_alias -# define __strverscmp strverscmp -#endif - -/* Compare S1 and S2 as strings holding indices/version numbers, - returning less than, equal to or greater than zero if S1 is less than, - equal to or greater than S2 (for more info, see the texinfo doc). -*/ - -int -__strverscmp (const char *s1, const char *s2) -{ - const unsigned char *p1 = (const unsigned char *) s1; - const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - int state; - int diff; - - /* Symbol(s) 0 [1-9] others (padding) - Transition (10) 0 (01) d (00) x (11) - */ - static const unsigned int next_state[] = - { - /* state x d 0 - */ - /* S_N */ S_N, S_I, S_Z, S_N, - /* S_I */ S_N, S_I, S_I, S_I, - /* S_F */ S_N, S_F, S_F, S_F, - /* S_Z */ S_N, S_F, S_Z, S_Z - }; - - static const int result_type[] = - { - /* state x/x x/d x/0 x/- d/x d/d d/0 d/- - 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ - - /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, - 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, - /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, - -1, CMP, CMP, CMP - }; - - if (p1 == p2) - return 0; - - c1 = *p1++; - c2 = *p2++; - /* Hint: '0' is a digit too. */ - state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); - - while ((diff = c1 - c2) == 0 && c1 != '\0') - { - state = next_state[state]; - c1 = *p1++; - c2 = *p2++; - state |= (c1 == '0') + (ISDIGIT (c1) != 0); - } - - state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; - - switch (state) - { - case CMP: - return diff; - - case LEN: - while (ISDIGIT (*p1++)) - if (!ISDIGIT (*p2++)) - return 1; - - return ISDIGIT (*p2) ? -1 : diff; - - default: - return state; - } -} -#ifdef weak_alias -weak_alias (__strverscmp, strverscmp) -#endif diff --git a/lib/gl/sys_socket.in.h b/lib/gl/sys_socket.in.h deleted file mode 100644 index d62d8cfc3d..0000000000 --- a/lib/gl/sys_socket.in.h +++ /dev/null @@ -1,636 +0,0 @@ -/* Provide a sys/socket header file for systems lacking it (read: MinGW) - and for systems where it is incomplete. - Copyright (C) 2005-2010 Free Software Foundation, Inc. - Written by Simon Josefsson. - - 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.1, 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. */ - -/* This file is supposed to be used on platforms that lack <sys/socket.h>, - on platforms where <sys/socket.h> cannot be included standalone, and on - platforms where <sys/socket.h> does not provide all necessary definitions. - It is intended to provide definitions and prototypes needed by an - application. */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H -/* Special invocation convention: - - On Cygwin 1.5.x we have a sequence of nested includes - <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>, - and the latter includes <sys/socket.h>. In this situation, the functions - are not yet declared, therefore we cannot provide the C++ aliases. */ - -#@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_SYS_SOCKET_H - -#if @HAVE_SYS_SOCKET_H@ - -# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H - -/* On many platforms, <sys/socket.h> assumes prior inclusion of - <sys/types.h>. */ -# include <sys/types.h> - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ - -# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H - -#endif - -#ifndef _GL_SYS_SOCKET_H -#define _GL_SYS_SOCKET_H - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -#if !@HAVE_SA_FAMILY_T@ -typedef unsigned short sa_family_t; -#endif - -#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> -/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on - 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ -# define __ss_aligntype unsigned long int -# define _SS_SIZE 256 -# define _SS_PADSIZE \ - (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ - ? sizeof (sa_family_t) \ - : alignof (__ss_aligntype)) \ - + sizeof (__ss_aligntype))) - -struct sockaddr_storage -{ - sa_family_t ss_family; /* Address family, etc. */ - __ss_aligntype __ss_align; /* Force desired alignment. */ - char __ss_padding[_SS_PADSIZE]; -}; -#endif - -#if @HAVE_SYS_SOCKET_H@ - -/* A platform that has <sys/socket.h>. */ - -/* For shutdown(). */ -# if !defined SHUT_RD -# define SHUT_RD 0 -# endif -# if !defined SHUT_WR -# define SHUT_WR 1 -# endif -# if !defined SHUT_RDWR -# define SHUT_RDWR 2 -# endif - -#else - -# ifdef __CYGWIN__ -# error "Cygwin does have a sys/socket.h, doesn't it?!?" -# endif - -/* A platform that lacks <sys/socket.h>. - - Currently only MinGW is supported. See the gnulib manual regarding - Windows sockets. MinGW has the header files winsock2.h and - ws2tcpip.h that declare the sys/socket.h definitions we need. Note - that you can influence which definitions you get by setting the - WINVER symbol before including these two files. For example, - getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that - symbol is set indiriectly through WINVER). You can set this by - adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your - 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 - slightly confusing because - <http://msdn.microsoft.com/en-us/library/ms738520> - suggests that getaddrinfo should be available on all Windows - releases. */ - - -# if @HAVE_WINSOCK2_H@ -# include <winsock2.h> -# endif -# if @HAVE_WS2TCPIP_H@ -# include <ws2tcpip.h> -# endif - -/* For shutdown(). */ -# if !defined SHUT_RD && defined SD_RECEIVE -# define SHUT_RD SD_RECEIVE -# endif -# if !defined SHUT_WR && defined SD_SEND -# define SHUT_WR SD_SEND -# endif -# if !defined SHUT_RDWR && defined SD_BOTH -# define SHUT_RDWR SD_BOTH -# endif - -# if @HAVE_WINSOCK2_H@ -/* Include headers needed by the emulation code. */ -# include <sys/types.h> -# include <io.h> - -typedef int socklen_t; - -# endif - -#endif - -#if @HAVE_WINSOCK2_H@ - -/* Re-define FD_ISSET to avoid a WSA call while we are not using - network sockets. */ -static inline int -rpl_fd_isset (SOCKET fd, fd_set * set) -{ - u_int i; - if (set == NULL) - return 0; - - for (i = 0; i < set->fd_count; i++) - if (set->fd_array[i] == fd) - return 1; - - return 0; -} - -# undef FD_ISSET -# define FD_ISSET(fd, set) rpl_fd_isset(fd, set) - -#endif - -/* Wrap everything else to use libc file descriptors for sockets. */ - -#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef close -# define close close_used_without_including_unistd_h -# else - _GL_WARN_ON_USE (close, - "close() used without including <unistd.h>"); -# endif -#endif - -#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef gethostname -# define gethostname gethostname_used_without_including_unistd_h -# else - _GL_WARN_ON_USE (gethostname, - "gethostname() used without including <unistd.h>"); -# endif -#endif - -#if @GNULIB_SOCKET@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef socket -# define socket rpl_socket -# endif -_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); -_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); -# else -_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); -# endif -_GL_CXXALIASWARN (socket); -#elif @HAVE_WINSOCK2_H@ -# undef socket -# define socket socket_used_without_requesting_gnulib_module_socket -#elif defined GNULIB_POSIXCHECK -# undef socket -# if HAVE_RAW_DECL_SOCKET -_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " - "use gnulib module socket for portability"); -# endif -#endif - -#if @GNULIB_CONNECT@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef connect -# define connect rpl_connect -# endif -_GL_FUNCDECL_RPL (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); -# else -_GL_CXXALIAS_SYS (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); -# endif -_GL_CXXALIASWARN (connect); -#elif @HAVE_WINSOCK2_H@ -# undef connect -# define connect socket_used_without_requesting_gnulib_module_connect -#elif defined GNULIB_POSIXCHECK -# undef connect -# if HAVE_RAW_DECL_CONNECT -_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " - "use gnulib module connect for portability"); -# endif -#endif - -#if @GNULIB_ACCEPT@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef accept -# define accept rpl_accept -# endif -_GL_FUNCDECL_RPL (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -_GL_CXXALIAS_RPL (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# else -/* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ -_GL_CXXALIAS_SYS_CAST (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# endif -_GL_CXXALIASWARN (accept); -#elif @HAVE_WINSOCK2_H@ -# undef accept -# define accept accept_used_without_requesting_gnulib_module_accept -#elif defined GNULIB_POSIXCHECK -# undef accept -# if HAVE_RAW_DECL_ACCEPT -_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " - "use gnulib module accept for portability"); -# endif -#endif - -#if @GNULIB_BIND@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef bind -# define bind rpl_bind -# endif -_GL_FUNCDECL_RPL (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); -# else -_GL_CXXALIAS_SYS (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); -# endif -_GL_CXXALIASWARN (bind); -#elif @HAVE_WINSOCK2_H@ -# undef bind -# define bind bind_used_without_requesting_gnulib_module_bind -#elif defined GNULIB_POSIXCHECK -# undef bind -# if HAVE_RAW_DECL_BIND -_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " - "use gnulib module bind for portability"); -# endif -#endif - -#if @GNULIB_GETPEERNAME@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getpeername -# define getpeername rpl_getpeername -# endif -_GL_FUNCDECL_RPL (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen) - _GL_ARG_NONNULL ((2, 3))); -_GL_CXXALIAS_RPL (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# else -/* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ -_GL_CXXALIAS_SYS_CAST (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# endif -_GL_CXXALIASWARN (getpeername); -#elif @HAVE_WINSOCK2_H@ -# undef getpeername -# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername -#elif defined GNULIB_POSIXCHECK -# undef getpeername -# if HAVE_RAW_DECL_GETPEERNAME -_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " - "use gnulib module getpeername for portability"); -# endif -#endif - -#if @GNULIB_GETSOCKNAME@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getsockname -# define getsockname rpl_getsockname -# endif -_GL_FUNCDECL_RPL (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen) - _GL_ARG_NONNULL ((2, 3))); -_GL_CXXALIAS_RPL (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# else -/* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ -_GL_CXXALIAS_SYS_CAST (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); -# endif -_GL_CXXALIASWARN (getsockname); -#elif @HAVE_WINSOCK2_H@ -# undef getsockname -# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname -#elif defined GNULIB_POSIXCHECK -# undef getsockname -# if HAVE_RAW_DECL_GETSOCKNAME -_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " - "use gnulib module getsockname for portability"); -# endif -#endif - -#if @GNULIB_GETSOCKOPT@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getsockopt -# define getsockopt rpl_getsockopt -# endif -_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, - void *optval, socklen_t *optlen) - _GL_ARG_NONNULL ((4, 5))); -_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, - void *optval, socklen_t *optlen)); -# else -/* Need to cast, because on Solaris 10 systems, the fifth parameter is - void *optlen. */ -_GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname, - void *optval, socklen_t *optlen)); -# endif -_GL_CXXALIASWARN (getsockopt); -#elif @HAVE_WINSOCK2_H@ -# undef getsockopt -# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt -#elif defined GNULIB_POSIXCHECK -# undef getsockopt -# if HAVE_RAW_DECL_GETSOCKOPT -_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " - "use gnulib module getsockopt for portability"); -# endif -#endif - -#if @GNULIB_LISTEN@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef listen -# define listen rpl_listen -# endif -_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); -_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); -# else -_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); -# endif -_GL_CXXALIASWARN (listen); -#elif @HAVE_WINSOCK2_H@ -# undef listen -# define listen listen_used_without_requesting_gnulib_module_listen -#elif defined GNULIB_POSIXCHECK -# undef listen -# if HAVE_RAW_DECL_LISTEN -_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " - "use gnulib module listen for portability"); -# endif -#endif - -#if @GNULIB_RECV@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef recv -# define recv rpl_recv -# endif -_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); -# else -_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); -# endif -_GL_CXXALIASWARN (recv); -#elif @HAVE_WINSOCK2_H@ -# undef recv -# define recv recv_used_without_requesting_gnulib_module_recv -#elif defined GNULIB_POSIXCHECK -# undef recv -# if HAVE_RAW_DECL_RECV -_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " - "use gnulib module recv for portability"); -# endif -#endif - -#if @GNULIB_SEND@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef send -# define send rpl_send -# endif -_GL_FUNCDECL_RPL (send, ssize_t, - (int fd, const void *buf, size_t len, int flags) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (send, ssize_t, - (int fd, const void *buf, size_t len, int flags)); -# else -_GL_CXXALIAS_SYS (send, ssize_t, - (int fd, const void *buf, size_t len, int flags)); -# endif -_GL_CXXALIASWARN (send); -#elif @HAVE_WINSOCK2_H@ -# undef send -# define send send_used_without_requesting_gnulib_module_send -#elif defined GNULIB_POSIXCHECK -# undef send -# if HAVE_RAW_DECL_SEND -_GL_WARN_ON_USE (send, "send is not always POSIX compliant - " - "use gnulib module send for portability"); -# endif -#endif - -#if @GNULIB_RECVFROM@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef recvfrom -# define recvfrom rpl_recvfrom -# endif -_GL_FUNCDECL_RPL (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen)); -# else -/* Need to cast, because on Solaris 10 systems, the sixth parameter is - void *fromlen. */ -_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen)); -# endif -_GL_CXXALIASWARN (recvfrom); -#elif @HAVE_WINSOCK2_H@ -# undef recvfrom -# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom -#elif defined GNULIB_POSIXCHECK -# undef recvfrom -# if HAVE_RAW_DECL_RECVFROM -_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " - "use gnulib module recvfrom for portability"); -# endif -#endif - -#if @GNULIB_SENDTO@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef sendto -# define sendto rpl_sendto -# endif -_GL_FUNCDECL_RPL (sendto, ssize_t, - (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (sendto, ssize_t, - (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen)); -# else -_GL_CXXALIAS_SYS (sendto, ssize_t, - (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen)); -# endif -_GL_CXXALIASWARN (sendto); -#elif @HAVE_WINSOCK2_H@ -# undef sendto -# define sendto sendto_used_without_requesting_gnulib_module_sendto -#elif defined GNULIB_POSIXCHECK -# undef sendto -# if HAVE_RAW_DECL_SENDTO -_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " - "use gnulib module sendto for portability"); -# endif -#endif - -#if @GNULIB_SETSOCKOPT@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef setsockopt -# define setsockopt rpl_setsockopt -# endif -_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen) - _GL_ARG_NONNULL ((4))); -_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen)); -# else -_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen)); -# endif -_GL_CXXALIASWARN (setsockopt); -#elif @HAVE_WINSOCK2_H@ -# undef setsockopt -# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt -#elif defined GNULIB_POSIXCHECK -# undef setsockopt -# if HAVE_RAW_DECL_SETSOCKOPT -_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " - "use gnulib module setsockopt for portability"); -# endif -#endif - -#if @GNULIB_SHUTDOWN@ -# if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef shutdown -# define shutdown rpl_shutdown -# endif -_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); -_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); -# else -_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); -# endif -_GL_CXXALIASWARN (shutdown); -#elif @HAVE_WINSOCK2_H@ -# undef shutdown -# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown -#elif defined GNULIB_POSIXCHECK -# undef shutdown -# if HAVE_RAW_DECL_SHUTDOWN -_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " - "use gnulib module shutdown for portability"); -# endif -#endif - -#if @HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef select -# define select select_used_without_including_sys_select_h -# else - _GL_WARN_ON_USE (select, - "select() used without including <sys/select.h>"); -# endif -#endif - -#if @GNULIB_ACCEPT4@ -/* Accept a connection on a socket, with specific opening flags. - The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) - and O_TEXT, O_BINARY (defined in "binary-io.h"). - See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ -# if @HAVE_ACCEPT4@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define accept4 rpl_accept4 -# endif -_GL_FUNCDECL_RPL (accept4, int, - (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); -_GL_CXXALIAS_RPL (accept4, int, - (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); -# else -_GL_FUNCDECL_SYS (accept4, int, - (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); -_GL_CXXALIAS_SYS (accept4, int, - (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); -# endif -_GL_CXXALIASWARN (accept4); -#elif defined GNULIB_POSIXCHECK -# undef accept4 -# if HAVE_RAW_DECL_ACCEPT4 -_GL_WARN_ON_USE (accept4, "accept4 is unportable - " - "use gnulib module accept4 for portability"); -# endif -#endif - -#endif /* _GL_SYS_SOCKET_H */ -#endif /* _GL_SYS_SOCKET_H */ -#endif diff --git a/lib/gl/sys_stat.in.h b/lib/gl/sys_stat.in.h deleted file mode 100644 index 4203a5899f..0000000000 --- a/lib/gl/sys_stat.in.h +++ /dev/null @@ -1,642 +0,0 @@ -/* Provide a more complete sys/stat header file. - Copyright (C) 2005-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.1, 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 Eric Blake, Paul Eggert, and Jim Meyering. */ - -/* This file is supposed to be used on platforms where <sys/stat.h> is - incomplete. It is intended to provide definitions and prototypes - needed by an application. Start with what the system provides. */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined __need_system_sys_stat_h -/* Special invocation convention. */ - -#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_SYS_STAT_H - -/* Get nlink_t. */ -#include <sys/types.h> - -/* Get struct timespec. */ -#include <time.h> - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ - -#ifndef _GL_SYS_STAT_H -#define _GL_SYS_STAT_H - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* Before doing "#define mkdir rpl_mkdir" below, we need to include all - headers that may declare mkdir(). */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include <io.h> /* mingw32, mingw64 */ -# include <direct.h> /* mingw64 */ -#endif - -#ifndef S_IFMT -# define S_IFMT 0170000 -#endif - -#if STAT_MACROS_BROKEN -# undef S_ISBLK -# undef S_ISCHR -# undef S_ISDIR -# undef S_ISFIFO -# undef S_ISLNK -# undef S_ISNAM -# undef S_ISMPB -# undef S_ISMPC -# undef S_ISNWK -# undef S_ISREG -# undef S_ISSOCK -#endif - -#ifndef S_ISBLK -# ifdef S_IFBLK -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -# else -# define S_ISBLK(m) 0 -# endif -#endif - -#ifndef S_ISCHR -# ifdef S_IFCHR -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -# else -# define S_ISCHR(m) 0 -# endif -#endif - -#ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(m) 0 -# endif -#endif - -#ifndef S_ISDOOR /* Solaris 2.5 and up */ -# define S_ISDOOR(m) 0 -#endif - -#ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -#endif - -#ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(m) 0 -# endif -#endif - -#ifndef S_ISMPB /* V7 */ -# ifdef S_IFMPB -# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -# else -# define S_ISMPB(m) 0 -# define S_ISMPC(m) 0 -# endif -#endif - -#ifndef S_ISNAM /* Xenix */ -# ifdef S_IFNAM -# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -# else -# define S_ISNAM(m) 0 -# endif -#endif - -#ifndef S_ISNWK /* HP/UX */ -# ifdef S_IFNWK -# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -# else -# define S_ISNWK(m) 0 -# endif -#endif - -#ifndef S_ISPORT /* Solaris 10 and up */ -# define S_ISPORT(m) 0 -#endif - -#ifndef S_ISREG -# ifdef S_IFREG -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -# else -# define S_ISREG(m) 0 -# endif -#endif - -#ifndef S_ISSOCK -# ifdef S_IFSOCK -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -# else -# define S_ISSOCK(m) 0 -# endif -#endif - - -#ifndef S_TYPEISMQ -# define S_TYPEISMQ(p) 0 -#endif - -#ifndef S_TYPEISTMO -# define S_TYPEISTMO(p) 0 -#endif - - -#ifndef S_TYPEISSEM -# ifdef S_INSEM -# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -# else -# define S_TYPEISSEM(p) 0 -# endif -#endif - -#ifndef S_TYPEISSHM -# ifdef S_INSHD -# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -# else -# define S_TYPEISSHM(p) 0 -# endif -#endif - -/* high performance ("contiguous data") */ -#ifndef S_ISCTG -# define S_ISCTG(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with data */ -#ifndef S_ISOFD -# define S_ISOFD(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with no data */ -#ifndef S_ISOFL -# define S_ISOFL(p) 0 -#endif - -/* 4.4BSD whiteout */ -#ifndef S_ISWHT -# define S_ISWHT(m) 0 -#endif - -/* If any of the following are undefined, - define them to their de facto standard values. */ -#if !S_ISUID -# define S_ISUID 04000 -#endif -#if !S_ISGID -# define S_ISGID 02000 -#endif - -/* S_ISVTX is a common extension to POSIX. */ -#ifndef S_ISVTX -# define S_ISVTX 01000 -#endif - -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IRGRP -# define S_IRGRP (S_IRUSR >> 3) -#endif -#if !S_IROTH -# define S_IROTH (S_IRUSR >> 6) -#endif - -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IWGRP -# define S_IWGRP (S_IWUSR >> 3) -#endif -#if !S_IWOTH -# define S_IWOTH (S_IWUSR >> 6) -#endif - -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif -#if !S_IXGRP -# define S_IXGRP (S_IXUSR >> 3) -#endif -#if !S_IXOTH -# define S_IXOTH (S_IXUSR >> 6) -#endif - -#if !S_IRWXU -# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) -#endif -#if !S_IRWXG -# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) -#endif -#if !S_IRWXO -# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) -#endif - -/* S_IXUGO is a common extension to POSIX. */ -#if !S_IXUGO -# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -#endif - -#ifndef S_IRWXUGO -# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) -#endif - -/* Macros for futimens and utimensat. */ -#ifndef UTIME_NOW -# define UTIME_NOW (-1) -# define UTIME_OMIT (-2) -#endif - - -#if @GNULIB_FCHMODAT@ -# if !@HAVE_FCHMODAT@ -_GL_FUNCDECL_SYS (fchmodat, int, - (int fd, char const *file, mode_t mode, int flag) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (fchmodat, int, - (int fd, char const *file, mode_t mode, int flag)); -_GL_CXXALIASWARN (fchmodat); -#elif defined GNULIB_POSIXCHECK -# undef fchmodat -# if HAVE_RAW_DECL_FCHMODAT -_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -#if @REPLACE_FSTAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define fstat rpl_fstat -# endif -_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); -#else -_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); -#endif -_GL_CXXALIASWARN (fstat); - - -#if @GNULIB_FSTATAT@ -# if @REPLACE_FSTATAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fstatat -# define fstatat rpl_fstatat -# endif -_GL_FUNCDECL_RPL (fstatat, int, - (int fd, char const *name, struct stat *st, int flags) - _GL_ARG_NONNULL ((2, 3))); -_GL_CXXALIAS_RPL (fstatat, int, - (int fd, char const *name, struct stat *st, int flags)); -# else -# if !@HAVE_FSTATAT@ -_GL_FUNCDECL_SYS (fstatat, int, - (int fd, char const *name, struct stat *st, int flags) - _GL_ARG_NONNULL ((2, 3))); -# endif -_GL_CXXALIAS_SYS (fstatat, int, - (int fd, char const *name, struct stat *st, int flags)); -# endif -_GL_CXXALIASWARN (fstatat); -#elif defined GNULIB_POSIXCHECK -# undef fstatat -# if HAVE_RAW_DECL_FSTATAT -_GL_WARN_ON_USE (fstatat, "fstatat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -#if @GNULIB_FUTIMENS@ -# if @REPLACE_FUTIMENS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef futimens -# define futimens rpl_futimens -# endif -_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); -_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); -# else -# if !@HAVE_FUTIMENS@ -_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); -# endif -_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); -# endif -_GL_CXXALIASWARN (futimens); -#elif defined GNULIB_POSIXCHECK -# undef futimens -# if HAVE_RAW_DECL_FUTIMENS -_GL_WARN_ON_USE (futimens, "futimens is not portable - " - "use gnulib module futimens for portability"); -# endif -#endif - - -#if @GNULIB_LCHMOD@ -/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME - denotes a symbolic link. */ -# if !@HAVE_LCHMOD@ -/* The lchmod replacement follows symbolic links. Callers should take - this into account; lchmod should be applied only to arguments that - are known to not be symbolic links. On hosts that lack lchmod, - this can lead to race conditions between the check and the - invocation of lchmod, but we know of no workarounds that are - reliable in general. You might try requesting support for lchmod - from your operating system supplier. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define lchmod chmod -# endif -/* Need to cast, because on mingw, the second parameter of chmod is - int mode. */ -_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, - (const char *filename, mode_t mode)); -# else -# if 0 /* assume already declared */ -_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); -# endif -# if @HAVE_LCHMOD@ -_GL_CXXALIASWARN (lchmod); -# endif -#elif defined GNULIB_POSIXCHECK -# undef lchmod -# if HAVE_RAW_DECL_LCHMOD -_GL_WARN_ON_USE (lchmod, "lchmod is unportable - " - "use gnulib module lchmod for portability"); -# endif -#endif - - -#if @GNULIB_LSTAT@ -# if ! @HAVE_LSTAT@ -/* mingw does not support symlinks, therefore it does not have lstat. But - without links, stat does just fine. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define lstat stat -# endif -_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); -# elif @REPLACE_LSTAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef lstat -# define lstat rpl_lstat -# endif -_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); -# else -_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); -# endif -# if @HAVE_LSTAT@ -_GL_CXXALIASWARN (lstat); -# endif -#elif defined GNULIB_POSIXCHECK -# undef lstat -# if HAVE_RAW_DECL_LSTAT -_GL_WARN_ON_USE (lstat, "lstat is unportable - " - "use gnulib module lstat for portability"); -# endif -#endif - - -#if @REPLACE_MKDIR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mkdir -# define mkdir rpl_mkdir -# endif -_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); -#else -/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. - Additionally, it declares _mkdir (and depending on compile flags, an - alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, - which are included above. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -static inline int -rpl_mkdir (char const *name, mode_t mode) -{ - return _mkdir (name); -} - -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mkdir rpl_mkdir -# endif -_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); -# else -_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); -# endif -#endif -_GL_CXXALIASWARN (mkdir); - - -#if @GNULIB_MKDIRAT@ -# if !@HAVE_MKDIRAT@ -_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); -_GL_CXXALIASWARN (mkdirat); -#elif defined GNULIB_POSIXCHECK -# undef mkdirat -# if HAVE_RAW_DECL_MKDIRAT -_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -#if @GNULIB_MKFIFO@ -# if @REPLACE_MKFIFO@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mkfifo -# define mkfifo rpl_mkfifo -# endif -_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); -# else -# if !@HAVE_MKFIFO@ -_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); -# endif -_GL_CXXALIASWARN (mkfifo); -#elif defined GNULIB_POSIXCHECK -# undef mkfifo -# if HAVE_RAW_DECL_MKFIFO -_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " - "use gnulib module mkfifo for portability"); -# endif -#endif - - -#if @GNULIB_MKFIFOAT@ -# if !@HAVE_MKFIFOAT@ -_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); -_GL_CXXALIASWARN (mkfifoat); -#elif defined GNULIB_POSIXCHECK -# undef mkfifoat -# if HAVE_RAW_DECL_MKFIFOAT -_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " - "use gnulib module mkfifoat for portability"); -# endif -#endif - - -#if @GNULIB_MKNOD@ -# if @REPLACE_MKNOD@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mknod -# define mknod rpl_mknod -# endif -_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); -# else -# if !@HAVE_MKNOD@ -_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); -# endif -_GL_CXXALIASWARN (mknod); -#elif defined GNULIB_POSIXCHECK -# undef mknod -# if HAVE_RAW_DECL_MKNOD -_GL_WARN_ON_USE (mknod, "mknod is not portable - " - "use gnulib module mknod for portability"); -# endif -#endif - - -#if @GNULIB_MKNODAT@ -# if !@HAVE_MKNODAT@ -_GL_FUNCDECL_SYS (mknodat, int, - (int fd, char const *file, mode_t mode, dev_t dev) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (mknodat, int, - (int fd, char const *file, mode_t mode, dev_t dev)); -_GL_CXXALIASWARN (mknodat); -#elif defined GNULIB_POSIXCHECK -# undef mknodat -# if HAVE_RAW_DECL_MKNODAT -_GL_WARN_ON_USE (mknodat, "mknodat is not portable - " - "use gnulib module mkfifoat for portability"); -# endif -#endif - - -#if @GNULIB_STAT@ -# if @REPLACE_STAT@ -/* We can't use the object-like #define stat rpl_stat, because of - struct stat. This means that rpl_stat will not be used if the user - does (stat)(a,b). Oh well. */ -# undef stat -# ifdef _LARGE_FILES - /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, - so we have to replace stat64() instead of stat(). */ -# define stat stat64 -# undef stat64 -# define stat64(name, st) rpl_stat (name, st) -# else /* !_LARGE_FILES */ -# define stat(name, st) rpl_stat (name, st) -# endif /* !_LARGE_FILES */ -_GL_EXTERN_C int stat (const char *name, struct stat *buf) - _GL_ARG_NONNULL ((1, 2)); -# endif -#elif defined GNULIB_POSIXCHECK -# undef stat -# if HAVE_RAW_DECL_STAT -_GL_WARN_ON_USE (stat, "stat is unportable - " - "use gnulib module stat for portability"); -# endif -#endif - - -#if @GNULIB_UTIMENSAT@ -# if @REPLACE_UTIMENSAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef utimensat -# define utimensat rpl_utimensat -# endif -_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag)); -# else -# if !@HAVE_UTIMENSAT@ -_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag)); -# endif -_GL_CXXALIASWARN (utimensat); -#elif defined GNULIB_POSIXCHECK -# undef utimensat -# if HAVE_RAW_DECL_UTIMENSAT -_GL_WARN_ON_USE (utimensat, "utimensat is not portable - " - "use gnulib module utimensat for portability"); -# endif -#endif - - -#endif /* _GL_SYS_STAT_H */ -#endif /* _GL_SYS_STAT_H */ -#endif diff --git a/lib/gl/tests/Makefile.am b/lib/gl/tests/Makefile.am deleted file mode 100644 index 4be0a1f091..0000000000 --- a/lib/gl/tests/Makefile.am +++ /dev/null @@ -1,405 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. - -AUTOMAKE_OPTIONS = 1.5 foreign - -SUBDIRS = . -TESTS = -XFAIL_TESTS = -TESTS_ENVIRONMENT = -noinst_PROGRAMS = -check_PROGRAMS = -noinst_HEADERS = -noinst_LIBRARIES = -check_LIBRARIES = libtests.a -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = - -AM_CPPFLAGS = \ - -D@lgltests_WITNESS@=1 \ - -I. -I$(srcdir) \ - -I../.. -I$(srcdir)/../.. \ - -I../../gl -I$(srcdir)/../../gl - -LDADD = libtests.a ../../gl/liblgnu.la libtests.a $(LIBTESTS_LIBDEPS) - -libtests_a_SOURCES = -libtests_a_LIBADD = $(lgltests_LIBOBJS) -libtests_a_DEPENDENCIES = $(lgltests_LIBOBJS) -EXTRA_libtests_a_SOURCES = -AM_LIBTOOLFLAGS = --preserve-dup-deps - -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' - -## begin gnulib module alloca-opt-tests - -TESTS += test-alloca-opt -check_PROGRAMS += test-alloca-opt - -EXTRA_DIST += test-alloca-opt.c - -## end gnulib module alloca-opt-tests - -## begin gnulib module arg-nonnull - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/arg-nonnull.h, except that it has the copyright header cut off. -arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t - -ARG_NONNULL_H=arg-nonnull.h - -EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h - -## end gnulib module arg-nonnull - -## begin gnulib module binary-io - -libtests_a_SOURCES += binary-io.h - -## end gnulib module binary-io - -## begin gnulib module binary-io-tests - -TESTS += test-binary-io.sh -check_PROGRAMS += test-binary-io - -EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h - -## end gnulib module binary-io-tests - -## begin gnulib module byteswap-tests - -TESTS += test-byteswap -check_PROGRAMS += test-byteswap -EXTRA_DIST += test-byteswap.c macros.h - -## end gnulib module byteswap-tests - -## begin gnulib module c++defs - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t - -CXXDEFS_H=c++defs.h - -EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h - -## end gnulib module c++defs - -## begin gnulib module c-ctype-tests - -TESTS += test-c-ctype -check_PROGRAMS += test-c-ctype - -EXTRA_DIST += test-c-ctype.c macros.h - -## end gnulib module c-ctype-tests - -## begin gnulib module errno-tests - -TESTS += test-errno -check_PROGRAMS += test-errno - -EXTRA_DIST += test-errno.c - -## end gnulib module errno-tests - -## begin gnulib module fseeko-tests - -TESTS += test-fseeko.sh test-fseeko2.sh -check_PROGRAMS += test-fseeko -EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h - -## end gnulib module fseeko-tests - -## begin gnulib module ftello-tests - -TESTS += test-ftello.sh test-ftello2.sh test-ftello3 -check_PROGRAMS += test-ftello test-ftello3 -MOSTLYCLEANFILES += t-ftello3.tmp -EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c signature.h macros.h - -## end gnulib module ftello-tests - -## begin gnulib module func-tests - -TESTS += test-func -check_PROGRAMS += test-func -EXTRA_DIST += test-func.c macros.h - -## end gnulib module func-tests - -## begin gnulib module getpagesize - - -EXTRA_DIST += getpagesize.c - -EXTRA_libtests_a_SOURCES += getpagesize.c - -## end gnulib module getpagesize - -## begin gnulib module intprops - - -EXTRA_DIST += intprops.h - -## end gnulib module intprops - -## begin gnulib module memchr-tests - -TESTS += test-memchr -check_PROGRAMS += test-memchr -EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h - -## end gnulib module memchr-tests - -## begin gnulib module netdb-tests - -TESTS += test-netdb -check_PROGRAMS += test-netdb -EXTRA_DIST += test-netdb.c - -## end gnulib module netdb-tests - -## begin gnulib module read-file-tests - -TESTS += test-read-file -check_PROGRAMS += test-read-file -EXTRA_DIST += test-read-file.c - -## end gnulib module read-file-tests - -## begin gnulib module snprintf-tests - -TESTS += test-snprintf -check_PROGRAMS += test-snprintf - -EXTRA_DIST += test-snprintf.c signature.h macros.h - -## end gnulib module snprintf-tests - -## begin gnulib module sockets-tests - -TESTS += test-sockets -check_PROGRAMS += test-sockets -test_sockets_LDADD = $(LDADD) @LIBSOCKET@ -EXTRA_DIST += test-sockets.c - -## end gnulib module sockets-tests - -## begin gnulib module stdbool-tests - -TESTS += test-stdbool -check_PROGRAMS += test-stdbool -EXTRA_DIST += test-stdbool.c - -## end gnulib module stdbool-tests - -## begin gnulib module stddef-tests - -TESTS += test-stddef -check_PROGRAMS += test-stddef -EXTRA_DIST += test-stddef.c - -## end gnulib module stddef-tests - -## begin gnulib module stdint-tests - -TESTS += test-stdint -check_PROGRAMS += test-stdint -EXTRA_DIST += test-stdint.c - -## end gnulib module stdint-tests - -## begin gnulib module stdio-tests - -TESTS += test-stdio -check_PROGRAMS += test-stdio -EXTRA_DIST += test-stdio.c - -## end gnulib module stdio-tests - -## begin gnulib module stdlib-tests - -TESTS += test-stdlib -check_PROGRAMS += test-stdlib -EXTRA_DIST += test-stdlib.c test-sys_wait.h - -## end gnulib module stdlib-tests - -## begin gnulib module string-tests - -TESTS += test-string -check_PROGRAMS += test-string -EXTRA_DIST += test-string.c - -## end gnulib module string-tests - -## begin gnulib module strings-tests - -TESTS += test-strings -check_PROGRAMS += test-strings -EXTRA_DIST += test-strings.c - -## end gnulib module strings-tests - -## begin gnulib module strverscmp-tests - -TESTS += test-strverscmp -check_PROGRAMS += test-strverscmp -EXTRA_DIST += test-strverscmp.c signature.h macros.h - -## end gnulib module strverscmp-tests - -## begin gnulib module sys_socket-tests - -TESTS += test-sys_socket -check_PROGRAMS += test-sys_socket -EXTRA_DIST += test-sys_socket.c - -## end gnulib module sys_socket-tests - -## begin gnulib module sys_stat-tests - -TESTS += test-sys_stat -check_PROGRAMS += test-sys_stat -EXTRA_DIST += test-sys_stat.c - -## end gnulib module sys_stat-tests - -## begin gnulib module time-tests - -TESTS += test-time -check_PROGRAMS += test-time -EXTRA_DIST += test-time.c - -## end gnulib module time-tests - -## begin gnulib module unistd-tests - -TESTS += test-unistd -check_PROGRAMS += test-unistd -EXTRA_DIST += test-unistd.c - -## end gnulib module unistd-tests - -## begin gnulib module vasnprintf-tests - -TESTS += test-vasnprintf -check_PROGRAMS += test-vasnprintf - -EXTRA_DIST += test-vasnprintf.c macros.h - -## end gnulib module vasnprintf-tests - -## begin gnulib module vasprintf-tests - -TESTS += test-vasprintf -check_PROGRAMS += test-vasprintf - -EXTRA_DIST += test-vasprintf.c signature.h macros.h - -## end gnulib module vasprintf-tests - -## begin gnulib module verify-tests - -TESTS_ENVIRONMENT += MAKE='$(MAKE)' -TESTS += test-verify test-verify.sh -check_PROGRAMS += test-verify -EXTRA_DIST += test-verify.c test-verify.sh init.sh - -## end gnulib module verify-tests - -## begin gnulib module vsnprintf-tests - -TESTS += test-vsnprintf -check_PROGRAMS += test-vsnprintf - -EXTRA_DIST += test-vsnprintf.c signature.h macros.h - -## end gnulib module vsnprintf-tests - -## begin gnulib module warn-on-use - -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/warn-on-use.h, except that it has the copyright header cut off. -warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h - -## end gnulib module warn-on-use - -## begin gnulib module wchar-tests - -TESTS += test-wchar -check_PROGRAMS += test-wchar -EXTRA_DIST += test-wchar.c - -## end gnulib module wchar-tests - -## begin gnulib module dummy - -libtests_a_SOURCES += dummy.c - -## end gnulib module dummy - -# Clean up after Solaris cc. -clean-local: - rm -rf SunWS_cache - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/lib/gl/tests/binary-io.h b/lib/gl/tests/binary-io.h deleted file mode 100644 index 5451fd48f4..0000000000 --- a/lib/gl/tests/binary-io.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _BINARY_H -#define _BINARY_H - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in <fcntl.h>. */ -#include <fcntl.h> - -/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...', - so we include it here first. */ -#include <stdio.h> - -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - -/* SET_BINARY (fd); - changes the file descriptor fd to perform binary I/O. */ -#if O_BINARY -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ -# include <io.h> /* declares setmode() */ -# else -# define setmode _setmode -# undef fileno -# define fileno _fileno -# endif -# ifdef __DJGPP__ -# include <unistd.h> /* declares isatty() */ - /* Avoid putting stdin/stdout in binary mode if it is connected to - the console, because that would make it impossible for the user - to interrupt the program through Ctrl-C or Ctrl-Break. */ -# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0)) -# else -# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY)) -# endif -#else - /* On reasonable systems, binary I/O is the default. */ -# undef O_BINARY -# define O_BINARY 0 -# define SET_BINARY(fd) /* do nothing */ ((void) 0) -#endif - -#endif /* _BINARY_H */ diff --git a/lib/gl/tests/dummy.c b/lib/gl/tests/dummy.c deleted file mode 100644 index 0f9a277962..0000000000 --- a/lib/gl/tests/dummy.c +++ /dev/null @@ -1,42 +0,0 @@ -/* A dummy file, to prevent empty libraries from breaking builds. - Copyright (C) 2004, 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create - libraries without any object files. You might get an error like: - - > ar cru .libs/libgl.a - > ar: no archive members specified - - Compiling this file, and adding its object file to the library, will - prevent the library from being empty. */ - -/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries - that don't export any symbol. You might get an error like: - - > cc ... libgnu.a - > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a - - Compiling this file, and adding its object file to the library, will - prevent the library from exporting no symbols. */ - -#ifdef __sun -/* This declaration ensures that the library will export at least 1 symbol. */ -int gl_dummy_symbol; -#else -/* This declaration is solely to ensure that after preprocessing - this file is never empty. */ -typedef int dummy; -#endif diff --git a/lib/gl/tests/getpagesize.c b/lib/gl/tests/getpagesize.c deleted file mode 100644 index cc2526870f..0000000000 --- a/lib/gl/tests/getpagesize.c +++ /dev/null @@ -1,39 +0,0 @@ -/* getpagesize emulation for systems where it cannot be done in a C macro. - - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible and Martin Lambers. */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -/* This implementation is only for native Win32 systems. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# define WIN32_LEAN_AND_MEAN -# include <windows.h> - -int -getpagesize (void) -{ - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - return system_info.dwPageSize; -} - -#endif diff --git a/lib/gl/tests/init.sh b/lib/gl/tests/init.sh deleted file mode 100644 index 14f3b198d4..0000000000 --- a/lib/gl/tests/init.sh +++ /dev/null @@ -1,471 +0,0 @@ -# source this file; set up for tests - -# 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 General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Using this file in a test -# ========================= -# -# The typical skeleton of a test looks like this: -# -# #!/bin/sh -# . "${srcdir=.}/init.sh"; path_prepend_ . -# Execute some commands. -# Note that these commands are executed in a subdirectory, therefore you -# need to prepend "../" to relative filenames in the build directory. -# Note that the "path_prepend_ ." is useful only if the body of your -# test invokes programs residing in the initial directory. -# For example, if the programs you want to test are in src/, and this test -# script is named tests/test-1, then you would use "path_prepend_ ../src", -# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" -# to all tests via automake's TESTS_ENVIRONMENT. -# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. -# Use the skip_ and fail_ functions to print a diagnostic and then exit -# with the corresponding exit code. -# Exit $? - -# Executing a test that uses this file -# ==================================== -# -# Running a single test: -# $ make check TESTS=test-foo.sh -# -# Running a single test, with verbose output: -# $ make check TESTS=test-foo.sh VERBOSE=yes -# -# Running a single test, with single-stepping: -# 1. Go into a sub-shell: -# $ bash -# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the -# Makefile: -# $ export srcdir=../../tests # this is an example -# 3. Execute the commands from the test, copy&pasting them one by one: -# $ . "$srcdir/init.sh"; path_prepend_ . -# ... -# 4. Finally -# $ exit - -ME_=`expr "./$0" : '.*/\(.*\)$'` - -# We use a trap below for cleanup. This requires us to go through -# hoops to get the right exit status transported through the handler. -# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. -# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 -# sh inside this function. -Exit () { set +e; (exit $1); exit $1; } - -# Print warnings (e.g., about skipped and failed tests) to this file number. -# Override by defining to say, 9, in init.cfg, and putting say, -# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition -# of TESTS_ENVIRONMENT in your tests/Makefile.am file. -# This is useful when using automake's parallel tests mode, to print -# the reason for skip/failure to console, rather than to the .log files. -: ${stderr_fileno_=2} - -warn_() { echo "$@" 1>&$stderr_fileno_; } -fail_() { warn_ "$ME_: failed test: $@"; Exit 1; } -skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } -framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; } - -# Sanitize this shell to POSIX mode, if possible. -DUALCASE=1; export DUALCASE -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; - esac -fi - -# We require $(...) support unconditionally. -# We require a few additional shell features only when $EXEEXT is nonempty, -# in order to support automatic $EXEEXT emulation: -# - hyphen-containing alias names -# - we prefer to use ${var#...} substitution, rather than having -# to work around lack of support for that feature. -# The following code attempts to find a shell with support for these features. -# If the current shell passes the test, we're done. Otherwise, test other -# shells until we find one that passes. If one is found, re-exec it. -# If no acceptable shell is found, skip the current test. -# -# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that -# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do. -# -# Use "9" to indicate success (rather than 0), in case some shell acts -# like Solaris 10's /bin/sh but exits successfully instead of with status 2. - -# Eval this code in a subshell to determine a shell's suitability. -# 10 - passes all tests; ok to use -# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score -# ? - not ok -gl_shell_test_script_=' -test $(echo y) = y || exit 1 -score_=10 -if test "$VERBOSE" = yes; then - test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 -fi -test -z "$EXEEXT" && exit $score_ -shopt -s expand_aliases -alias a-b="echo zoo" -v=abx - test ${v%x} = ab \ - && test ${v#a} = bx \ - && test $(a-b) = zoo \ - && exit $score_ -' - -if test "x$1" = "x--no-reexec"; then - shift -else - # Assume a working shell. Export to subshells (setup_ needs this). - gl_set_x_corrupts_stderr_=false - export gl_set_x_corrupts_stderr_ - - # Record the first marginally acceptable shell. - marginal_= - - # Search for a shell that meets our requirements. - for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \ - /bin/sh bash dash zsh pdksh fail - do - test "$re_shell_" = no_shell && continue - - # If we've made it all the way to the sentinel, "fail" without - # finding even a marginal shell, skip this test. - if test "$re_shell_" = fail; then - test -z "$marginal_" && skip_ failed to find an adequate shell - re_shell_=$marginal_ - break - fi - - # When testing the current shell, simply "eval" the test code. - # Otherwise, run it via $re_shell_ -c ... - if test "$re_shell_" = __current__; then - # 'eval'ing this code makes Solaris 10's /bin/sh exit with - # $? set to 2. It does not evaluate any of the code after the - # "unexpected" first `('. Thus, we must run it in a subshell. - ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 - else - "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null - fi - - st_=$? - - # $re_shell_ works just fine. Use it. - test $st_ = 10 && break - - # If this is our first marginally acceptable shell, remember it. - if test "$st_:$marginal_" = 9: ; then - marginal_="$re_shell_" - gl_set_x_corrupts_stderr_=true - fi - done - - if test "$re_shell_" != __current__; then - # Found a usable shell. Preserve -v and -x. - case $- in - *v*x* | *x*v*) opts_=-vx ;; - *v*) opts_=-v ;; - *x*) opts_=-x ;; - *) opts_= ;; - esac - exec "$re_shell_" $opts_ "$0" --no-reexec "$@" - echo "$ME_: exec failed" 1>&2 - exit 127 - fi -fi - -test -n "$EXEEXT" && shopt -s expand_aliases - -# Enable glibc's malloc-perturbing option. -# This is cheap and useful for exposing code that depends on the fact that -# malloc-related functions often return memory that is mostly zeroed. -# If you have the time and cycles, use valgrind to do an even better job. -: ${MALLOC_PERTURB_=87} -export MALLOC_PERTURB_ - -# This is a stub function that is run upon trap (upon regular exit and -# interrupt). Override it with a per-test function, e.g., to unmount -# a partition, or to undo any other global state changes. -cleanup_() { :; } - -if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { diff -u "$@"; } -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { cmp -s "$@"; } -else - compare() { cmp "$@"; } -fi - -# An arbitrary prefix to help distinguish test directories. -testdir_prefix_() { printf gt; } - -# Run the user-overridable cleanup_ function, remove the temporary -# directory and exit with the incoming value of $?. -remove_tmp_() -{ - __st=$? - cleanup_ - # cd out of the directory we're about to remove - cd "$initial_cwd_" || cd / || cd /tmp - chmod -R u+rwx "$test_dir_" - # If removal fails and exit status was to be 0, then change it to 1. - rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } - exit $__st -} - -# Given a directory name, DIR, if every entry in it that matches *.exe -# contains only the specified bytes (see the case stmt below), then print -# a space-separated list of those names and return 0. Otherwise, don't -# print anything and return 1. Naming constraints apply also to DIR. -find_exe_basenames_() -{ - feb_dir_=$1 - feb_fail_=0 - feb_result_= - feb_sp_= - for feb_file_ in $feb_dir_/*.exe; do - # If there was no *.exe file, or there existed a file named "*.exe" that - # was deleted between the above glob expansion and the existence test - # below, just skip it. - test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ - && continue - case $feb_file_ in - *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; - *) # Remove leading file name components as well as the .exe suffix. - feb_file_=${feb_file_##*/} - feb_file_=${feb_file_%.exe} - feb_result_="$feb_result_$feb_sp_$feb_file_";; - esac - feb_sp_=' ' - done - test $feb_fail_ = 0 && printf %s "$feb_result_" - return $feb_fail_ -} - -# Consider the files in directory, $1. -# For each file name of the form PROG.exe, create an alias named -# PROG that simply invokes PROG.exe, then return 0. If any selected -# file name or the directory name, $1, contains an unexpected character, -# define no alias and return 1. -create_exe_shims_() -{ - case $EXEEXT in - '') return 0 ;; - .exe) ;; - *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; - esac - - base_names_=`find_exe_basenames_ $1` \ - || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } - - if test -n "$base_names_"; then - for base_ in $base_names_; do - alias "$base_"="$base_$EXEEXT" - done - fi - - return 0 -} - -# Use this function to prepend to PATH an absolute name for each -# specified, possibly-$initial_cwd_-relative, directory. -path_prepend_() -{ - while test $# != 0; do - path_dir_=$1 - case $path_dir_ in - '') fail_ "invalid path dir: '$1'";; - /*) abs_path_dir_=$path_dir_;; - *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \ - || fail_ "invalid path dir: $path_dir_";; - esac - case $abs_path_dir_ in - *:*) fail_ "invalid path dir: '$abs_path_dir_'";; - esac - PATH="$abs_path_dir_:$PATH" - - # Create an alias, FOO, for each FOO.exe in this directory. - create_exe_shims_ "$abs_path_dir_" \ - || fail_ "something failed (above): $abs_path_dir_" - shift - done - export PATH -} - -setup_() -{ - if test "$VERBOSE" = yes; then - # Test whether set -x may cause the selected shell to corrupt an - # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh - # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5. - # If enabling verbose output this way would cause trouble, simply - # issue a warning and refrain. - if $gl_set_x_corrupts_stderr_; then - warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" - else - set -x - fi - fi - - initial_cwd_=$PWD - - pfx_=`testdir_prefix_` - test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ - || fail_ "failed to create temporary directory in $initial_cwd_" - cd "$test_dir_" - - # As autoconf-generated configure scripts do, ensure that IFS - # is defined initially, so that saving and restoring $IFS works. - gl_init_sh_nl_=' -' - IFS=" "" $gl_init_sh_nl_" - - # This trap statement, along with a trap on 0 below, ensure that the - # temporary directory, $test_dir_, is removed upon exit as well as - # upon receipt of any of the listed signals. - for sig_ in 1 2 3 13 15; do - eval "trap 'Exit $(expr $sig_ + 128)' $sig_" - done -} - -# Create a temporary directory, much like mktemp -d does. -# Written by Jim Meyering. -# -# Usage: mktempd_ /tmp phoey.XXXXXXXXXX -# -# First, try to use the mktemp program. -# Failing that, we'll roll our own mktemp-like function: -# - try to get random bytes from /dev/urandom -# - failing that, generate output from a combination of quickly-varying -# sources and gzip. Ignore non-varying gzip header, and extract -# "random" bits from there. -# - given those bits, map to file-name bytes using tr, and try to create -# the desired directory. -# - make only $MAX_TRIES_ attempts - -# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_() -{ - n_=$1 - - # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? - # But if they have openssl, they probably have mktemp, too. - - chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - dev_rand_=/dev/urandom - if test -r "$dev_rand_"; then - # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. - dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ - return - fi - - n_plus_50_=`expr $n_ + 50` - cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n' - data_=` (eval "$cmds_") 2>&1 | gzip ` - - # Ensure that $data_ has length at least 50+$n_ - while :; do - len_=`echo "$data_"|wc -c` - test $n_plus_50_ -le $len_ && break; - data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` - done - - echo "$data_" \ - | dd bs=1 skip=50 count=$n_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ -} - -mktempd_() -{ - case $# in - 2);; - *) fail_ "Usage: $ME DIR TEMPLATE";; - esac - - destdir_=$1 - template_=$2 - - MAX_TRIES_=4 - - # Disallow any trailing slash on specified destdir: - # it would subvert the post-mktemp "case"-based destdir test. - case $destdir_ in - /) ;; - */) fail_ "invalid destination dir: remove trailing slash(es)";; - esac - - case $template_ in - *XXXX) ;; - *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; - esac - - fail=0 - - # First, try to use mktemp. - d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \ - || fail=1 - - # The resulting name must be in the specified directory. - case $d in "$destdir_"*);; *) fail=1;; esac - - # It must have created the directory. - test -d "$d" || fail=1 - - # It must have 0700 permissions. Handle sticky "S" bits. - perms=`ls -dgo "$d" 2>/dev/null|tr S -` || fail=1 - case $perms in drwx------*) ;; *) fail=1;; esac - - test $fail = 0 && { - echo "$d" - return - } - - # If we reach this point, we'll have to create a directory manually. - - # Get a copy of the template without its suffix of X's. - base_template_=`echo "$template_"|sed 's/XX*$//'` - - # Calculate how many X's we've just removed. - template_length_=`echo "$template_" | wc -c` - nx_=`echo "$base_template_" | wc -c` - nx_=`expr $template_length_ - $nx_` - - err_= - i_=1 - while :; do - X_=`rand_bytes_ $nx_` - candidate_dir_="$destdir_/$base_template_$X_" - err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ - && { echo "$candidate_dir_"; return; } - test $MAX_TRIES_ -le $i_ && break; - i_=`expr $i_ + 1` - done - fail_ "$err_" -} - -# If you want to override the testdir_prefix_ function, -# or to add more utility functions, use this file. -test -f "$srcdir/init.cfg" \ - && . "$srcdir/init.cfg" - -setup_ "$@" -# This trap is here, rather than in the setup_ function, because some -# shells run the exit trap at shell function exit, rather than script exit. -trap remove_tmp_ 0 diff --git a/lib/gl/tests/intprops.h b/lib/gl/tests/intprops.h deleted file mode 100644 index 0c2787582f..0000000000 --- a/lib/gl/tests/intprops.h +++ /dev/null @@ -1,87 +0,0 @@ -/* intprops.h -- properties of integer types - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paul Eggert. */ - -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H - -# include <limits.h> - -/* The extra casts in the following macros work around compiler bugs, - e.g., in Cray C 5.0.3.0. */ - -/* True if the arithmetic type T is an integer type. bool counts as - an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) - -/* True if negative values of the signed integer type T use two's - complement, ones' complement, or signed magnitude representation, - respectively. Much GNU code assumes two's complement, but some - people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) - -/* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - -/* The maximum and minimum values for the integer type T. These - macros have undefined behavior if T is signed and has padding bits. - If this is a problem for you, please let us know how to fix it for - your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) - -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif - -/* Bound on length of the string representing an unsigned integer - value representable in B bits. log10 (2.0) < 146/485. The - smallest value of B where this bound is not tight is 2621. */ -# define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) - -/* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if T is signed, and then add 1 more for - a minus sign if needed. */ -# define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) \ - + signed_type_or_expr__ (t)) - -/* Bound on buffer size needed to represent an integer type or expression T, - including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) - -#endif /* GL_INTPROPS_H */ diff --git a/lib/gl/tests/macros.h b/lib/gl/tests/macros.h deleted file mode 100644 index 11db5a8af0..0000000000 --- a/lib/gl/tests/macros.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Common macros used by gnulib tests. - Copyright (C) 2006-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - - -/* This file contains macros that are used by many gnulib tests. - Put here only frequently used macros, say, used by 10 tests or more. */ - -#include <stdio.h> -#include <stdlib.h> - -/* Define ASSERT_STREAM before including this file if ASSERT must - target a stream other than stderr. */ -#ifndef ASSERT_STREAM -# define ASSERT_STREAM stderr -#endif - -/* ASSERT (condition); - verifies that the specified condition is fulfilled. If not, a message - is printed to ASSERT_STREAM if defined (defaulting to stderr if - undefined) and the program is terminated with an error code. - - This macro has the following properties: - - The programmer specifies the expected condition, not the failure - condition. This simplifies thinking. - - The condition is tested always, regardless of compilation flags. - (Unlike the macro from <assert.h>.) - - On Unix platforms, the tester can debug the test program with a - debugger (provided core dumps are enabled: "ulimit -c unlimited"). - - For the sake of platforms where no debugger is available (such as - some mingw systems), an error message is printed on the error - stream that includes the source location of the ASSERT invocation. - */ -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (ASSERT_STREAM); \ - abort (); \ - } \ - } \ - while (0) - -/* SIZEOF (array) - returns the number of elements of an array. It works for arrays that are - declared outside functions and for local variables of array type. It does - *not* work for function parameters of array type, because they are actually - parameters of pointer type. */ -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) diff --git a/lib/gl/tests/signature.h b/lib/gl/tests/signature.h deleted file mode 100644 index 6e15c43a2a..0000000000 --- a/lib/gl/tests/signature.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Macro for checking that a function declaration is compliant. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef SIGNATURE_CHECK - -/* Check that the function FN takes the specified arguments ARGS with - a return type of RET. This header is designed to be included after - <config.h> and the one system header that is supposed to contain - the function being checked, but prior to any other system headers - that are necessary for the unit test. Therefore, this file does - not include any system headers, nor reference anything outside of - the macro arguments. For an example, if foo.h should provide: - - extern int foo (char, float); - - then the unit test named test-foo.c would start out with: - - #include <config.h> - #include <foo.h> - #include "signature.h" - SIGNATURE_CHECK (foo, int, (char, float)); - #include <other.h> - ... -*/ -# define SIGNATURE_CHECK(fn, ret, args) \ - SIGNATURE_CHECK1 (fn, ret, args, __LINE__) - -/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. - Note that the checks must not occupy the same line. */ -# define SIGNATURE_CHECK1(fn, ret, args, id) \ - SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ -# define SIGNATURE_CHECK2(fn, ret, args, id) \ - static ret (* _GL_UNUSED signature_check ## id) args = fn - -#endif /* SIGNATURE_CHECK */ diff --git a/lib/gl/tests/test-alloca-opt.c b/lib/gl/tests/test-alloca-opt.c deleted file mode 100644 index cfbecafcb9..0000000000 --- a/lib/gl/tests/test-alloca-opt.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <alloca.h> - -#if HAVE_ALLOCA - -static void -do_allocation (int n) -{ - void *ptr = alloca (n); - (void) ptr; -} - -void (*func) (int) = do_allocation; - -#endif - -int -main () -{ -#if HAVE_ALLOCA - int i; - - /* Repeat a lot of times, to make sure there's no memory leak. */ - for (i = 0; i < 100000; i++) - { - /* Try various values. - n = 0 gave a crash on Alpha with gcc-2.5.8. - Some versions of MacOS X have a stack size limit of 512 KB. */ - func (34); - func (134); - func (399); - func (510823); - func (129321); - func (0); - func (4070); - func (4095); - func (1); - func (16582); - } -#endif - - return 0; -} diff --git a/lib/gl/tests/test-binary-io.c b/lib/gl/tests/test-binary-io.c deleted file mode 100644 index 125150b21f..0000000000 --- a/lib/gl/tests/test-binary-io.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Test of binary mode I/O. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ - -#include <config.h> - -#include "binary-io.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "macros.h" - -int -main () -{ - /* Test the O_BINARY macro. */ - { - int fd = - open ("t-bin-out2.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); - if (write (fd, "Hello\n", 6) < 0) - exit (1); - close (fd); - } - { - struct stat statbuf; - if (stat ("t-bin-out2.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } - unlink ("t-bin-out2.tmp"); - - /* Test the SET_BINARY macro. */ - SET_BINARY (1); - fputs ("Hello\n", stdout); - fclose (stdout); - fclose (stderr); - { - struct stat statbuf; - if (stat ("t-bin-out1.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } - - return 0; -} diff --git a/lib/gl/tests/test-binary-io.sh b/lib/gl/tests/test-binary-io.sh deleted file mode 100755 index 33e128c309..0000000000 --- a/lib/gl/tests/test-binary-io.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp" -./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/lib/gl/tests/test-byteswap.c b/lib/gl/tests/test-byteswap.c deleted file mode 100644 index 0c036052f7..0000000000 --- a/lib/gl/tests/test-byteswap.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <byteswap.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <byteswap.h> - -#include "macros.h" - -int -main () -{ - ASSERT (bswap_16 (0xABCD) == 0xCDAB); - ASSERT (bswap_32 (0xDEADBEEF) == 0xEFBEADDE); - - return 0; -} diff --git a/lib/gl/tests/test-c-ctype.c b/lib/gl/tests/test-c-ctype.c deleted file mode 100644 index ebe594dd4f..0000000000 --- a/lib/gl/tests/test-c-ctype.c +++ /dev/null @@ -1,386 +0,0 @@ -/* Test of character handling in C locale. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ - -#include <config.h> - -#include "c-ctype.h" - -#include <locale.h> - -#include "macros.h" - -static void -test_all (void) -{ - int c; - - for (c = -0x80; c < 0x100; c++) - { - ASSERT (c_isascii (c) == (c >= 0 && c < 0x80)); - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isalnum (c) == 1); - break; - default: - ASSERT (c_isalnum (c) == 0); - break; - } - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_isalpha (c) == 1); - break; - default: - ASSERT (c_isalpha (c) == 0); - break; - } - - switch (c) - { - case '\t': case ' ': - ASSERT (c_isblank (c) == 1); - break; - default: - ASSERT (c_isblank (c) == 0); - break; - } - - ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isdigit (c) == 1); - break; - default: - ASSERT (c_isdigit (c) == 0); - break; - } - - switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_islower (c) == 1); - break; - default: - ASSERT (c_islower (c) == 0); - break; - } - - ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); - - ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f)); - - ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c))); - - switch (c) - { - case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': - ASSERT (c_isspace (c) == 1); - break; - default: - ASSERT (c_isspace (c) == 0); - break; - } - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - ASSERT (c_isupper (c) == 1); - break; - default: - ASSERT (c_isupper (c) == 0); - break; - } - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - ASSERT (c_isxdigit (c) == 1); - break; - default: - ASSERT (c_isxdigit (c) == 0); - break; - } - - switch (c) - { - case 'A': - ASSERT (c_tolower (c) == 'a'); - ASSERT (c_toupper (c) == c); - break; - case 'B': - ASSERT (c_tolower (c) == 'b'); - ASSERT (c_toupper (c) == c); - break; - case 'C': - ASSERT (c_tolower (c) == 'c'); - ASSERT (c_toupper (c) == c); - break; - case 'D': - ASSERT (c_tolower (c) == 'd'); - ASSERT (c_toupper (c) == c); - break; - case 'E': - ASSERT (c_tolower (c) == 'e'); - ASSERT (c_toupper (c) == c); - break; - case 'F': - ASSERT (c_tolower (c) == 'f'); - ASSERT (c_toupper (c) == c); - break; - case 'G': - ASSERT (c_tolower (c) == 'g'); - ASSERT (c_toupper (c) == c); - break; - case 'H': - ASSERT (c_tolower (c) == 'h'); - ASSERT (c_toupper (c) == c); - break; - case 'I': - ASSERT (c_tolower (c) == 'i'); - ASSERT (c_toupper (c) == c); - break; - case 'J': - ASSERT (c_tolower (c) == 'j'); - ASSERT (c_toupper (c) == c); - break; - case 'K': - ASSERT (c_tolower (c) == 'k'); - ASSERT (c_toupper (c) == c); - break; - case 'L': - ASSERT (c_tolower (c) == 'l'); - ASSERT (c_toupper (c) == c); - break; - case 'M': - ASSERT (c_tolower (c) == 'm'); - ASSERT (c_toupper (c) == c); - break; - case 'N': - ASSERT (c_tolower (c) == 'n'); - ASSERT (c_toupper (c) == c); - break; - case 'O': - ASSERT (c_tolower (c) == 'o'); - ASSERT (c_toupper (c) == c); - break; - case 'P': - ASSERT (c_tolower (c) == 'p'); - ASSERT (c_toupper (c) == c); - break; - case 'Q': - ASSERT (c_tolower (c) == 'q'); - ASSERT (c_toupper (c) == c); - break; - case 'R': - ASSERT (c_tolower (c) == 'r'); - ASSERT (c_toupper (c) == c); - break; - case 'S': - ASSERT (c_tolower (c) == 's'); - ASSERT (c_toupper (c) == c); - break; - case 'T': - ASSERT (c_tolower (c) == 't'); - ASSERT (c_toupper (c) == c); - break; - case 'U': - ASSERT (c_tolower (c) == 'u'); - ASSERT (c_toupper (c) == c); - break; - case 'V': - ASSERT (c_tolower (c) == 'v'); - ASSERT (c_toupper (c) == c); - break; - case 'W': - ASSERT (c_tolower (c) == 'w'); - ASSERT (c_toupper (c) == c); - break; - case 'X': - ASSERT (c_tolower (c) == 'x'); - ASSERT (c_toupper (c) == c); - break; - case 'Y': - ASSERT (c_tolower (c) == 'y'); - ASSERT (c_toupper (c) == c); - break; - case 'Z': - ASSERT (c_tolower (c) == 'z'); - ASSERT (c_toupper (c) == c); - break; - case 'a': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'A'); - break; - case 'b': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'B'); - break; - case 'c': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'C'); - break; - case 'd': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'D'); - break; - case 'e': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'E'); - break; - case 'f': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'F'); - break; - case 'g': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'G'); - break; - case 'h': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'H'); - break; - case 'i': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'I'); - break; - case 'j': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'J'); - break; - case 'k': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'K'); - break; - case 'l': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'L'); - break; - case 'm': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'M'); - break; - case 'n': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'N'); - break; - case 'o': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'O'); - break; - case 'p': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'P'); - break; - case 'q': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Q'); - break; - case 'r': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'R'); - break; - case 's': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'S'); - break; - case 't': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'T'); - break; - case 'u': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'U'); - break; - case 'v': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'V'); - break; - case 'w': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'W'); - break; - case 'x': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'X'); - break; - case 'y': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Y'); - break; - case 'z': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Z'); - break; - default: - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == c); - break; - } - } -} - -int -main () -{ - test_all (); - - setlocale (LC_ALL, "de_DE"); - test_all (); - - setlocale (LC_ALL, "ja_JP.EUC-JP"); - test_all (); - - return 0; -} diff --git a/lib/gl/tests/test-errno.c b/lib/gl/tests/test-errno.c deleted file mode 100644 index 129b236fe9..0000000000 --- a/lib/gl/tests/test-errno.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Test of <errno.h> substitute. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2008. */ - -#include <config.h> - -#include <errno.h> - -/* Verify that the POSIX mandated errno values exist and can be used as - initializers outside of a function. - The variable names happen to match the Linux/x86 error numbers. */ -int e1 = EPERM; -int e2 = ENOENT; -int e3 = ESRCH; -int e4 = EINTR; -int e5 = EIO; -int e6 = ENXIO; -int e7 = E2BIG; -int e8 = ENOEXEC; -int e9 = EBADF; -int e10 = ECHILD; -int e11 = EAGAIN; -int e11a = EWOULDBLOCK; -int e12 = ENOMEM; -int e13 = EACCES; -int e14 = EFAULT; -int e16 = EBUSY; -int e17 = EEXIST; -int e18 = EXDEV; -int e19 = ENODEV; -int e20 = ENOTDIR; -int e21 = EISDIR; -int e22 = EINVAL; -int e23 = ENFILE; -int e24 = EMFILE; -int e25 = ENOTTY; -int e26 = ETXTBSY; -int e27 = EFBIG; -int e28 = ENOSPC; -int e29 = ESPIPE; -int e30 = EROFS; -int e31 = EMLINK; -int e32 = EPIPE; -int e33 = EDOM; -int e34 = ERANGE; -int e35 = EDEADLK; -int e36 = ENAMETOOLONG; -int e37 = ENOLCK; -int e38 = ENOSYS; -int e39 = ENOTEMPTY; -int e40 = ELOOP; -int e42 = ENOMSG; -int e43 = EIDRM; -int e67 = ENOLINK; -int e71 = EPROTO; -int e72 = EMULTIHOP; -int e74 = EBADMSG; -int e75 = EOVERFLOW; -int e84 = EILSEQ; -int e88 = ENOTSOCK; -int e89 = EDESTADDRREQ; -int e90 = EMSGSIZE; -int e91 = EPROTOTYPE; -int e92 = ENOPROTOOPT; -int e93 = EPROTONOSUPPORT; -int e95 = EOPNOTSUPP; -int e95a = ENOTSUP; -int e97 = EAFNOSUPPORT; -int e98 = EADDRINUSE; -int e99 = EADDRNOTAVAIL; -int e100 = ENETDOWN; -int e101 = ENETUNREACH; -int e102 = ENETRESET; -int e103 = ECONNABORTED; -int e104 = ECONNRESET; -int e105 = ENOBUFS; -int e106 = EISCONN; -int e107 = ENOTCONN; -int e110 = ETIMEDOUT; -int e111 = ECONNREFUSED; -int e113 = EHOSTUNREACH; -int e114 = EALREADY; -int e115 = EINPROGRESS; -int e116 = ESTALE; -int e122 = EDQUOT; -int e125 = ECANCELED; - -/* Don't verify that these errno values are all different, except for possibly - EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has - ENOTSUP == EOPNOTSUPP. */ - -int -main () -{ - /* Verify that errno can be assigned. */ - errno = EOVERFLOW; - - /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ - if (errno == EINVAL) - return 1; - - return 0; -} diff --git a/lib/gl/tests/test-fseeko.c b/lib/gl/tests/test-fseeko.c deleted file mode 100644 index be2a78dce1..0000000000 --- a/lib/gl/tests/test-fseeko.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Test of fseeko() function. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int)); - - -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv _GL_UNUSED) -{ - /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh' - iff argc > 1. */ - int expected = argc > 1 ? 0 : -1; - /* Exit with success only if fseek/fseeko agree. */ - int r1 = fseeko (stdin, 0, SEEK_CUR); - int r2 = fseek (stdin, 0, SEEK_CUR); - ASSERT (r1 == r2 && r1 == expected); - if (argc > 1) - { - /* Test that fseek discards previously read ungetc data. */ - int ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ungetc (ch, stdin) == ch); - ASSERT (fseeko (stdin, 2, SEEK_SET) == 0); - ch = fgetc (stdin); - ASSERT (ch == '/'); - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test that fseek discards random ungetc data. */ - ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff)); - } - ASSERT (fseeko (stdin, 0, SEEK_END) == 0); - ASSERT (fgetc (stdin) == EOF); - /* Test that fseek resets end-of-file marker. */ - ASSERT (feof (stdin)); - ASSERT (fseeko (stdin, 0, SEEK_END) == 0); - ASSERT (!feof (stdin)); - } - return 0; -} diff --git a/lib/gl/tests/test-fseeko.sh b/lib/gl/tests/test-fseeko.sh deleted file mode 100755 index 5c558272cb..0000000000 --- a/lib/gl/tests/test-fseeko.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-fseeko${EXEEXT} 1 < "$srcdir/test-fseeko.sh" || exit 1 -echo hi | ./test-fseeko${EXEEXT} || exit 1 -exit 0 diff --git a/lib/gl/tests/test-fseeko2.sh b/lib/gl/tests/test-fseeko2.sh deleted file mode 100755 index 6e1130cf58..0000000000 --- a/lib/gl/tests/test-fseeko2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-fseeko${EXEEXT} 1 2 < "$srcdir/test-fseeko2.sh" diff --git a/lib/gl/tests/test-ftello.c b/lib/gl/tests/test-ftello.c deleted file mode 100644 index 5fae570f28..0000000000 --- a/lib/gl/tests/test-ftello.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (ftello, off_t, (FILE *)); - -#include "binary-io.h" -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv _GL_UNUSED) -{ - int ch; - /* Assume stdin is seekable iff argc > 1. */ - if (argc == 1) - { - ASSERT (ftell (stdin) == -1); - ASSERT (ftello (stdin) == -1); - return 0; - } - - /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); - - /* Simple tests. For each test, make sure ftell and ftello agree. */ - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after ungetc of read input. */ - ch = ungetc ('#', stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after fseek. */ - ASSERT (fseek (stdin, 2, SEEK_SET) == 0); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - /* Test ftell after random ungetc. */ - ch = fgetc (stdin); - ASSERT (ch == '/'); - ch = ungetc ('@', stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - ch = fgetc (stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test ftell after ungetc without read. */ - ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - ch = ungetc ('~', stdin); - ASSERT (ch == '~'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - } - -#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */ - /* Test ftell beyond end of file. */ - ASSERT (fseek (stdin, 0, SEEK_END) == 0); - ch = ftello (stdin); - ASSERT (fseek (stdin, 10, SEEK_END) == 0); - ASSERT (ftell (stdin) == ch + 10); - ASSERT (ftello (stdin) == ch + 10); -#endif - - return 0; -} diff --git a/lib/gl/tests/test-ftello.sh b/lib/gl/tests/test-ftello.sh deleted file mode 100755 index 33d2e838db..0000000000 --- a/lib/gl/tests/test-ftello.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1 -echo hi | ./test-ftello${EXEEXT} || exit 1 -exit 0 diff --git a/lib/gl/tests/test-ftello2.sh b/lib/gl/tests/test-ftello2.sh deleted file mode 100755 index ba750b003d..0000000000 --- a/lib/gl/tests/test-ftello2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-ftello${EXEEXT} 1 2 < "$srcdir/test-ftello2.sh" diff --git a/lib/gl/tests/test-ftello3.c b/lib/gl/tests/test-ftello3.c deleted file mode 100644 index b07ba64610..0000000000 --- a/lib/gl/tests/test-ftello3.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include <string.h> - -#include "macros.h" - -#define TESTFILE "t-ftello3.tmp" - -int -main (void) -{ - FILE *fp; - - /* Create a file with some contents. */ - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - goto skip; - if (fwrite ("foogarsh", 1, 8, fp) < 8) - goto skip; - if (fclose (fp)) - goto skip; - - /* The file's contents is now "foogarsh". */ - - /* Try writing after reading to EOF. */ - fp = fopen (TESTFILE, "r+"); - if (fp == NULL) - goto skip; - if (fseek (fp, -1, SEEK_END)) - goto skip; - ASSERT (getc (fp) == 'h'); - ASSERT (getc (fp) == EOF); - ASSERT (ftello (fp) == 8); - ASSERT (ftello (fp) == 8); - ASSERT (putc ('!', fp) == '!'); - ASSERT (ftello (fp) == 9); - ASSERT (fclose (fp) == 0); - fp = fopen (TESTFILE, "r"); - if (fp == NULL) - goto skip; - { - char buf[10]; - ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); - } - ASSERT (fclose (fp) == 0); - - /* The file's contents is now "foogarsh!". */ - - remove (TESTFILE); - return 0; - - skip: - fprintf (stderr, "Skipping test: prerequisite file operations failed.\n"); - remove (TESTFILE); - return 77; -} diff --git a/lib/gl/tests/test-func.c b/lib/gl/tests/test-func.c deleted file mode 100644 index 476e04dd9e..0000000000 --- a/lib/gl/tests/test-func.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test whether __func__ is available - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "macros.h" - -int -main () -{ - ASSERT (strlen (__func__) > 0); - - /* On SunPRO C 5.9, sizeof __func__ evaluates to 0. The compiler warns: - "warning: null dimension: sizeof()". */ -#if !defined __SUNPRO_C - ASSERT (strlen (__func__) + 1 == sizeof __func__); -#endif - - ASSERT (strcmp (__func__, "main") == 0 - || strcmp (__func__, "<unknown function>") == 0); - - return 0; -} diff --git a/lib/gl/tests/test-memchr.c b/lib/gl/tests/test-memchr.c deleted file mode 100644 index 05e1bfaed2..0000000000 --- a/lib/gl/tests/test-memchr.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2008-2010 Free Software Foundation, Inc. - * Written by Eric Blake and Bruno Haible - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); - -#include <stdlib.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -/* Calculating void * + int is not portable, so this wrapper converts - to char * to make the tests easier to write. */ -#define MEMCHR (char *) memchr - -int -main (void) -{ - size_t n = 0x100000; - char *input = malloc (n); - ASSERT (input); - - input[0] = 'a'; - input[1] = 'b'; - memset (input + 2, 'c', 1024); - memset (input + 1026, 'd', n - 1028); - input[n - 2] = 'e'; - input[n - 1] = 'a'; - - /* Basic behavior tests. */ - ASSERT (MEMCHR (input, 'a', n) == input); - - ASSERT (MEMCHR (input, 'a', 0) == NULL); - ASSERT (MEMCHR (zerosize_ptr (), 'a', 0) == NULL); - - ASSERT (MEMCHR (input, 'b', n) == input + 1); - ASSERT (MEMCHR (input, 'c', n) == input + 2); - ASSERT (MEMCHR (input, 'd', n) == input + 1026); - - ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1); - ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2); - ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2); - - ASSERT (MEMCHR (input, 'f', n) == NULL); - ASSERT (MEMCHR (input, '\0', n) == NULL); - - /* Check that a very long haystack is handled quickly if the byte is - found near the beginning. */ - { - size_t repeat = 10000; - for (; repeat > 0; repeat--) - { - ASSERT (MEMCHR (input, 'c', n) == input + 2); - } - } - - /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 256; j++) - input[i + j] = j; - for (j = 0; j < 256; j++) - { - ASSERT (MEMCHR (input + i, j, 256) == input + i + j); - } - } - } - - /* Check that memchr() does not read past the first occurrence of the - byte being searched. See the Austin Group's clarification - <http://www.opengroup.org/austin/docs/austin_454.txt>. - Test both '\0' and something else, since some implementations - special-case searching for NUL. - */ - { - char *page_boundary = (char *) zerosize_ptr (); - /* Too small, and we miss cache line boundary tests; too large, - and the test takes cubically longer to complete. */ - int limit = 257; - - if (page_boundary != NULL) - { - for (n = 1; n <= limit; n++) - { - char *mem = page_boundary - n; - memset (mem, 'X', n); - ASSERT (MEMCHR (mem, 'U', n) == NULL); - ASSERT (MEMCHR (mem, 0, n) == NULL); - - { - size_t i; - size_t k; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 'U', k) == mem + i); - mem[i] = 0; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 0, k) == mem + i); - mem[i] = 'X'; - } - } - } - } - } - - free (input); - - return 0; -} diff --git a/lib/gl/tests/test-netdb.c b/lib/gl/tests/test-netdb.c deleted file mode 100644 index 697bbc8dbf..0000000000 --- a/lib/gl/tests/test-netdb.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <netdb.h> substitute. - Copyright (C) 2007-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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */ - -#include <config.h> -#include <netdb.h> - -/* Check that the 'struct hostent' type is defined. */ -struct hostent t1; - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t2; - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-read-file.c b/lib/gl/tests/test-read-file.c deleted file mode 100644 index daa61668c6..0000000000 --- a/lib/gl/tests/test-read-file.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. - * Written by Simon Josefsson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include "read-file.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#define FILE1 "/etc/resolv.conf" -#define FILE2 "/dev/null" - -int -main (void) -{ - struct stat statbuf; - int err = 0; - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE1, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE1, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - if (S_ISREG (statbuf.st_mode)) - { - /* FILE1 is a regular file or a symlink to a regular file. */ - if (len != statbuf.st_size) - { - fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1); - err = 1; - } - } - else - { - /* Assume FILE1 is not empty. */ - if (len == 0) - { - fprintf (stderr, "Read nothing from %s\n", FILE1); - err = 1; - } - } - free (out); - } - } - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE2, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE2, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - /* /dev/null should always be empty. Ignore statbuf.st_size, since it - is not a regular file. */ - if (len != 0) - { - fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2); - err = 1; - } - free (out); - } - } - - return err; -} diff --git a/lib/gl/tests/test-snprintf.c b/lib/gl/tests/test-snprintf.c deleted file mode 100644 index 62a411bf91..0000000000 --- a/lib/gl/tests/test-snprintf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Test of snprintf() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); - -#include <string.h> - -#include "macros.h" - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = snprintf (buf, size, "%d", 12345); - if (size < 6) - { -#if CHECK_SNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_SNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - } - else - { - ASSERT (retval == 5); - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - return 0; -} diff --git a/lib/gl/tests/test-sockets.c b/lib/gl/tests/test-sockets.c deleted file mode 100644 index ab5460ad46..0000000000 --- a/lib/gl/tests/test-sockets.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. - * Written by Simon Josefsson. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "sockets.h" - -int -main (void) -{ - int err; - - err = gl_sockets_startup (SOCKETS_1_1); - if (err != 0) - { - printf ("wsastartup failed %d\n", err); - return 1; - } - - err = gl_sockets_cleanup (); - if (err != 0) - { - printf ("wsacleanup failed %d\n", err); - return 1; - } - - (void) gl_fd_to_handle (0); - - return 0; -} diff --git a/lib/gl/tests/test-stdbool.c b/lib/gl/tests/test-stdbool.c deleted file mode 100644 index 2103d8bab9..0000000000 --- a/lib/gl/tests/test-stdbool.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -/* We want this test to succeed even when using gcc's -Werror; but to - do that requires a pragma that didn't exist before 4.3.0. */ -#ifndef __GNUC__ -# define ADDRESS_CHECK_OKAY -#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) -/* No way to silence -Waddress. */ -#else -# pragma GCC diagnostic ignored "-Waddress" -# define ADDRESS_CHECK_OKAY -#endif - -#include <config.h> - -#include <stdbool.h> - -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" -#endif - -/* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at - least, not for all compilers and compiler options. */ -#if HAVE_STDBOOL_H || defined __GNUC__ -struct s { _Bool s: 1; _Bool t; } s; -#endif - -char a[true == 1 ? 1 : -1]; -char b[false == 0 ? 1 : -1]; -char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ -char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY -bool e = &s; -# endif -char f[(_Bool) 0.0 == false ? 1 : -1]; -#endif -char g[true]; -char h[sizeof (_Bool)]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ -char i[sizeof s.t]; -#endif -enum { j = false, k = true, l = false * true, m = true * 256 }; -_Bool n[m]; -char o[sizeof n == m * sizeof n[0] ? 1 : -1]; -char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -/* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ -_Bool q = true; -_Bool *pq = &q; - -int -main () -{ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This is a runtime test, since a corresponding compile-time - test would rely on initializer extensions. */ - char digs[] = "0123456789"; - return &(digs + 5)[-2 + (bool) 1] != &digs[4]; -} diff --git a/lib/gl/tests/test-stddef.c b/lib/gl/tests/test-stddef.c deleted file mode 100644 index 2c392c7547..0000000000 --- a/lib/gl/tests/test-stddef.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Test of <stddef.h> substitute. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <stddef.h> - -#include "verify.h" - -/* Check that appropriate types are defined. */ -wchar_t a = 'c'; -ptrdiff_t b = 1; -size_t c = 2; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that offsetof produces integer constants with correct type. */ -struct d -{ - char e; - char f; -}; -/* Solaris 10 has a bug where offsetof is under-parenthesized, and - cannot be used as an arbitrary expression. However, since it is - unlikely to bite real code, we ignore that short-coming. */ -/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */ -verify (sizeof (offsetof (struct d, e)) == sizeof (size_t)); -verify (offsetof (struct d, e) < -1); /* Must be unsigned. */ -verify (offsetof (struct d, f) == 1); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-stdint.c b/lib/gl/tests/test-stdint.c deleted file mode 100644 index d64057a256..0000000000 --- a/lib/gl/tests/test-stdint.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Test of <stdint.h> substitute. - Copyright (C) 2006-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2006. */ - -#include <config.h> - -/* Whether to enable pedantic checks. */ -#define DO_PEDANTIC 0 - -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* likewise */ -#include <stdint.h> - -#include "verify.h" -#include "intprops.h" - -#if __GNUC__ >= 2 && DO_PEDANTIC -# define verify_same_types(expr1,expr2) \ - extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ - extern void _verify_func(__LINE__) (__typeof__ (expr2) *); -# define _verify_func(line) _verify_func2(line) -# define _verify_func2(line) verify_func_ ## line -#else -# define verify_same_types(expr1,expr2) extern void verify_func (int) -#endif - -/* 7.18.1.1. Exact-width integer types */ -/* 7.18.2.1. Limits of exact-width integer types */ - -int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; -verify (TYPE_MINIMUM (int8_t) == INT8_MIN); -verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); -verify_same_types (INT8_MIN, (int8_t) 0 + 0); -verify_same_types (INT8_MAX, (int8_t) 0 + 0); - -int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; -verify (TYPE_MINIMUM (int16_t) == INT16_MIN); -verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); -verify_same_types (INT16_MIN, (int16_t) 0 + 0); -verify_same_types (INT16_MAX, (int16_t) 0 + 0); - -int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; -verify (TYPE_MINIMUM (int32_t) == INT32_MIN); -verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); -verify_same_types (INT32_MIN, (int32_t) 0 + 0); -verify_same_types (INT32_MAX, (int32_t) 0 + 0); - -#ifdef INT64_MAX -int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; -verify (TYPE_MINIMUM (int64_t) == INT64_MIN); -verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); -verify_same_types (INT64_MIN, (int64_t) 0 + 0); -verify_same_types (INT64_MAX, (int64_t) 0 + 0); -#endif - -uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; -verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); -verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); - -uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; -verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); -verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); - -uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; -verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); -verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); - -#ifdef UINT64_MAX -uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; -verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); -verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); -#endif - -#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT8_MAX && UINT16_MAX && UINT32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.2. Minimum-width integer types */ -/* 7.18.2.2. Limits of minimum-width integer types */ - -int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; -verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); -verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); -verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); -verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); - -int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; -verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); -verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); -verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); -verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); - -int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; -verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); -verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); -verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); -verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); - -#ifdef INT_LEAST64_MAX -int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; -verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); -verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); -verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); -verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); -#endif - -uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; -verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); -verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); - -uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; -verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); -verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); - -uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; -verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); -verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); - -#ifdef UINT_LEAST64_MAX -uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; -verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); -verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); -#endif - -#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.3. Fastest minimum-width integer types */ -/* 7.18.2.3. Limits of fastest minimum-width integer types */ - -int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; -verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); -verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); -verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); -verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); - -int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; -verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); -verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); -verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); -verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); - -int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; -verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); -verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); -verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); -verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); - -#ifdef INT_FAST64_MAX -int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; -verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); -verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); -verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); -verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); -#endif - -uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; -verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); -verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); - -uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; -verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); -verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); - -uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; -verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); -verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); - -#ifdef UINT_FAST64_MAX -uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; -verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); -verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); -#endif - -#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.4. Integer types capable of holding object pointers */ -/* 7.18.2.4. Limits of integer types capable of holding object pointers */ - -intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; -verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); -verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); -verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); -verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); - -uintptr_t h[2] = { 17, UINTPTR_MAX }; -verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); -verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); - -#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.5. Greatest-width integer types */ -/* 7.18.2.5. Limits of greatest-width integer types */ - -intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; -verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); -verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); -verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); -verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); - -uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; -verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); -verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); - -/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in - the preprocessor. */ -#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) -#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX -/* ok */ -#else -err or; -#endif -#endif - -/* 7.18.3. Limits of other integer types */ - -#include <stddef.h> - -verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); -verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); -verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); -verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); - -#if PTRDIFF_MIN && PTRDIFF_MAX -/* ok */ -#else -err or; -#endif - -#include <signal.h> - -verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); -verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); -verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); -verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); - -#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX -/* ok */ -#else -err or; -#endif - -verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); -verify_same_types (SIZE_MAX, (size_t) 0 + 0); - -#if SIZE_MAX -/* ok */ -#else -err or; -#endif - -#if HAVE_WCHAR_T -verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); -verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); -verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); -verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); - -# if WCHAR_MIN != 17 && WCHAR_MAX -/* ok */ -# else -err or; -# endif -#endif - -#if HAVE_WINT_T -# include <wchar.h> - -verify (TYPE_MINIMUM (wint_t) == WINT_MIN); -verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); -verify_same_types (WINT_MIN, (wint_t) 0 + 0); -verify_same_types (WINT_MAX, (wint_t) 0 + 0); - -# if WINT_MIN != 17 && WINT_MAX -/* ok */ -# else -err or; -# endif -#endif - -/* 7.18.4. Macros for integer constants */ - -verify (INT8_C (17) == 17); -verify_same_types (INT8_C (17), (int_least8_t)0 + 0); -verify (UINT8_C (17) == 17); -verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); - -verify (INT16_C (17) == 17); -verify_same_types (INT16_C (17), (int_least16_t)0 + 0); -verify (UINT16_C (17) == 17); -verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); - -verify (INT32_C (17) == 17); -verify_same_types (INT32_C (17), (int_least32_t)0 + 0); -verify (UINT32_C (17) == 17); -verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); - -#ifdef INT64_C -verify (INT64_C (17) == 17); -verify_same_types (INT64_C (17), (int_least64_t)0 + 0); -#endif -#ifdef UINT64_C -verify (UINT64_C (17) == 17); -verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); -#endif - -verify (INTMAX_C (17) == 17); -verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); -verify (UINTMAX_C (17) == 17); -verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-stdlib.c b/lib/gl/tests/test-stdlib.c deleted file mode 100644 index 1e7956b68c..0000000000 --- a/lib/gl/tests/test-stdlib.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Test of <stdlib.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdlib.h> - -#include "verify.h" - -/* Check that EXIT_SUCCESS is 0, per POSIX. */ -static int exitcode = EXIT_SUCCESS; -#if EXIT_SUCCESS -"oops" -#endif - -/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by - gnulib). */ -#if EXIT_FAILURE != 1 -"oops" -#endif - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -#if GNULIB_TEST_SYSTEM_POSIX -# include "test-sys_wait.h" -#else -# define test_sys_wait_macros() 0 -#endif - -int -main (void) -{ - if (test_sys_wait_macros ()) - return 1; - - return exitcode; -} diff --git a/lib/gl/tests/test-string.c b/lib/gl/tests/test-string.c deleted file mode 100644 index 019a8174ac..0000000000 --- a/lib/gl/tests/test-string.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test of <string.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <string.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-strings.c b/lib/gl/tests/test-strings.c deleted file mode 100644 index caba95cd2a..0000000000 --- a/lib/gl/tests/test-strings.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <strings.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <strings.h> - -int -main () -{ - return 0; -} diff --git a/lib/gl/tests/test-strverscmp.c b/lib/gl/tests/test-strverscmp.c deleted file mode 100644 index d7348150e1..0000000000 --- a/lib/gl/tests/test-strverscmp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Test of strverscmp() function. - 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strverscmp, int, (const char *, const char *)); - -#include "macros.h" - -int -main (void) -{ - ASSERT (strverscmp ("", "") == 0); - ASSERT (strverscmp ("a", "a") == 0); - ASSERT (strverscmp ("a", "b") < 0); - ASSERT (strverscmp ("b", "a") > 0); - ASSERT (strverscmp ("000", "00") < 0); - ASSERT (strverscmp ("00", "000") > 0); - ASSERT (strverscmp ("a0", "a") > 0); - ASSERT (strverscmp ("00", "01") < 0); - ASSERT (strverscmp ("01", "010") < 0); - ASSERT (strverscmp ("010", "09") < 0); - ASSERT (strverscmp ("09", "0") < 0); - ASSERT (strverscmp ("9", "10") < 0); - ASSERT (strverscmp ("0a", "0") > 0); - return 0; -} diff --git a/lib/gl/tests/test-sys_socket.c b/lib/gl/tests/test-sys_socket.c deleted file mode 100644 index e976ff6a7b..0000000000 --- a/lib/gl/tests/test-sys_socket.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Test of <sys/socket.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <sys/socket.h> - -#include <errno.h> - -#if HAVE_SHUTDOWN -/* Check some integer constant expressions. */ -int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; -#endif - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t1; - -int -main (void) -{ - struct sockaddr_storage x; - sa_family_t i; - - /* Check some errno values. */ - switch (0) - { - case ENOTSOCK: - case EADDRINUSE: - case ENETRESET: - case ECONNABORTED: - case ECONNRESET: - case ENOTCONN: - case ESHUTDOWN: - break; - } - - x.ss_family = 42; - i = 42; - - /* Tell the compiler that these variables are used. */ - (void) x; - (void) i; - - return 0; -} diff --git a/lib/gl/tests/test-sys_stat.c b/lib/gl/tests/test-sys_stat.c deleted file mode 100644 index 5f1aacd1cc..0000000000 --- a/lib/gl/tests/test-sys_stat.c +++ /dev/null @@ -1,288 +0,0 @@ -/* Test of <sys/stat.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <sys/stat.h> - -#include "verify.h" - -/* Check the existence of some macros. */ -int a[] = - { - S_IFMT, - S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG, -#ifdef S_IFLNK /* missing on mingw and djgpp */ - S_IFLNK, -#endif -#ifdef S_IFSOCK /* missing on mingw and djgpp */ - S_IFSOCK, -#endif - S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, - S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, - S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, - S_ISUID, S_ISGID, S_ISVTX, - S_ISBLK (S_IFREG), - S_ISCHR (S_IFREG), - S_ISDIR (S_IFREG), - S_ISFIFO (S_IFREG), - S_ISREG (S_IFREG), - S_ISLNK (S_IFREG), - S_ISSOCK (S_IFREG), - S_ISDOOR (S_IFREG), - S_ISMPB (S_IFREG), - S_ISNAM (S_IFREG), - S_ISNWK (S_IFREG), - S_ISPORT (S_IFREG), - S_ISCTG (S_IFREG), - S_ISOFD (S_IFREG), - S_ISOFL (S_IFREG), - S_ISWHT (S_IFREG) - }; - -/* Sanity checks. */ - -verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR)); -verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP)); -verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH)); - -verify (S_ISBLK (S_IFBLK)); -verify (!S_ISBLK (S_IFCHR)); -verify (!S_ISBLK (S_IFDIR)); -verify (!S_ISBLK (S_IFIFO)); -verify (!S_ISBLK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISBLK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISBLK (S_IFSOCK)); -#endif - -verify (!S_ISCHR (S_IFBLK)); -verify (S_ISCHR (S_IFCHR)); -verify (!S_ISCHR (S_IFDIR)); -verify (!S_ISCHR (S_IFIFO)); -verify (!S_ISCHR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCHR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCHR (S_IFSOCK)); -#endif - -verify (!S_ISDIR (S_IFBLK)); -verify (!S_ISDIR (S_IFCHR)); -verify (S_ISDIR (S_IFDIR)); -verify (!S_ISDIR (S_IFIFO)); -verify (!S_ISDIR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDIR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDIR (S_IFSOCK)); -#endif - -verify (!S_ISFIFO (S_IFBLK)); -verify (!S_ISFIFO (S_IFCHR)); -verify (!S_ISFIFO (S_IFDIR)); -verify (S_ISFIFO (S_IFIFO)); -verify (!S_ISFIFO (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISFIFO (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISFIFO (S_IFSOCK)); -#endif - -verify (!S_ISREG (S_IFBLK)); -verify (!S_ISREG (S_IFCHR)); -verify (!S_ISREG (S_IFDIR)); -verify (!S_ISREG (S_IFIFO)); -verify (S_ISREG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISREG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISREG (S_IFSOCK)); -#endif - -verify (!S_ISLNK (S_IFBLK)); -verify (!S_ISLNK (S_IFCHR)); -verify (!S_ISLNK (S_IFDIR)); -verify (!S_ISLNK (S_IFIFO)); -verify (!S_ISLNK (S_IFREG)); -#ifdef S_IFLNK -verify (S_ISLNK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISLNK (S_IFSOCK)); -#endif - -verify (!S_ISSOCK (S_IFBLK)); -verify (!S_ISSOCK (S_IFCHR)); -verify (!S_ISSOCK (S_IFDIR)); -verify (!S_ISSOCK (S_IFIFO)); -verify (!S_ISSOCK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISSOCK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (S_ISSOCK (S_IFSOCK)); -#endif - -verify (!S_ISDOOR (S_IFBLK)); -verify (!S_ISDOOR (S_IFCHR)); -verify (!S_ISDOOR (S_IFDIR)); -verify (!S_ISDOOR (S_IFIFO)); -verify (!S_ISDOOR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDOOR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDOOR (S_IFSOCK)); -#endif - -verify (!S_ISMPB (S_IFBLK)); -verify (!S_ISMPB (S_IFCHR)); -verify (!S_ISMPB (S_IFDIR)); -verify (!S_ISMPB (S_IFIFO)); -verify (!S_ISMPB (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISMPB (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISMPB (S_IFSOCK)); -#endif - -verify (!S_ISNAM (S_IFBLK)); -verify (!S_ISNAM (S_IFCHR)); -verify (!S_ISNAM (S_IFDIR)); -verify (!S_ISNAM (S_IFIFO)); -verify (!S_ISNAM (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNAM (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNAM (S_IFSOCK)); -#endif - -verify (!S_ISNWK (S_IFBLK)); -verify (!S_ISNWK (S_IFCHR)); -verify (!S_ISNWK (S_IFDIR)); -verify (!S_ISNWK (S_IFIFO)); -verify (!S_ISNWK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNWK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNWK (S_IFSOCK)); -#endif - -verify (!S_ISPORT (S_IFBLK)); -verify (!S_ISPORT (S_IFCHR)); -verify (!S_ISPORT (S_IFDIR)); -verify (!S_ISPORT (S_IFIFO)); -verify (!S_ISPORT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISPORT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISPORT (S_IFSOCK)); -#endif - -verify (!S_ISCTG (S_IFBLK)); -verify (!S_ISCTG (S_IFCHR)); -verify (!S_ISCTG (S_IFDIR)); -verify (!S_ISCTG (S_IFIFO)); -verify (!S_ISCTG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCTG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCTG (S_IFSOCK)); -#endif - -verify (!S_ISOFD (S_IFBLK)); -verify (!S_ISOFD (S_IFCHR)); -verify (!S_ISOFD (S_IFDIR)); -verify (!S_ISOFD (S_IFIFO)); -verify (!S_ISOFD (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFD (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFD (S_IFSOCK)); -#endif - -verify (!S_ISOFL (S_IFBLK)); -verify (!S_ISOFL (S_IFCHR)); -verify (!S_ISOFL (S_IFDIR)); -verify (!S_ISOFL (S_IFIFO)); -verify (!S_ISOFL (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFL (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFL (S_IFSOCK)); -#endif - -verify (!S_ISWHT (S_IFBLK)); -verify (!S_ISWHT (S_IFCHR)); -verify (!S_ISWHT (S_IFDIR)); -verify (!S_ISWHT (S_IFIFO)); -verify (!S_ISWHT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISWHT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISWHT (S_IFSOCK)); -#endif - -/* POSIX 2008 requires traditional encoding of permission constants. */ -verify (S_IRWXU == 00700); -verify (S_IRUSR == 00400); -verify (S_IWUSR == 00200); -verify (S_IXUSR == 00100); -verify (S_IRWXG == 00070); -verify (S_IRGRP == 00040); -verify (S_IWGRP == 00020); -verify (S_IXGRP == 00010); -verify (S_IRWXO == 00007); -verify (S_IROTH == 00004); -verify (S_IWOTH == 00002); -verify (S_IXOTH == 00001); -verify (S_ISUID == 04000); -verify (S_ISGID == 02000); -verify (S_ISVTX == 01000); - -#if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \ - || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \ - || UTIME_NOW == UTIME_OMIT) -invalid UTIME macros -#endif - -/* Check the existence of some types. */ -nlink_t t1; - -struct timespec t2; - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-sys_wait.h b/lib/gl/tests/test-sys_wait.h deleted file mode 100644 index bb10450867..0000000000 --- a/lib/gl/tests/test-sys_wait.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2010. */ - -static int -test_sys_wait_macros (void) -{ - /* Check subset of <sys/wait.h> macros that must be visible here. - Note that some of these macros are only portable when operating - on an lvalue. */ - int i; - for (i = 0; i < 0x8000; i = (i ? i << 1 : 1)) - { - /* POSIX requires that for all valid process statuses, that - exactly one of these three macros is true. But not all - possible 16-bit values map to valid process status. - Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits - to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80 - or 0x8000 to flag that core was also dumped. Since we don't - know which byte is WIFEXITED, we skip the both possible bits - that can signal core dump. */ - if (i == 0x80) - continue; - if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1) - return 1; - } - i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i); - - switch (i) - { -#if 0 - /* Gnulib doesn't guarantee these, yet. */ - case WNOHANG: - case WUNTRACED: -#endif - break; - } - return 0; -} diff --git a/lib/gl/tests/test-time.c b/lib/gl/tests/test-time.c deleted file mode 100644 index 8e250bd2d5..0000000000 --- a/lib/gl/tests/test-time.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test of <time.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <time.h> - -#include "verify.h" - -struct timespec a; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-unistd.c b/lib/gl/tests/test-unistd.c deleted file mode 100644 index ec02eeefca..0000000000 --- a/lib/gl/tests/test-unistd.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test of <unistd.h> substitute. - Copyright (C) 2007, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <unistd.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that the various *_FILENO macros are defined. */ -#if ! (defined STDIN_FILENO \ - && (STDIN_FILENO + STDOUT_FILENO + STDERR_FILENO == 3)) -missing or broken *_FILENO macros -#endif - -/* Check that the types are all defined. */ -size_t t1; -ssize_t t2; -#ifdef TODO /* Not implemented in gnulib yet */ -uid_t t3; -gid_t t4; -#endif -off_t t5; -pid_t t6; -#ifdef TODO -useconds_t t7; -intptr_t t8; -#endif - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-vasnprintf.c b/lib/gl/tests/test-vasnprintf.c deleted file mode 100644 index 15401eb4ca..0000000000 --- a/lib/gl/tests/test-vasnprintf.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include "vasnprintf.h" - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static void -test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) -{ - char buf[8]; - int size; - - for (size = 0; size <= 8; size++) - { - size_t length = size; - char *result = my_asnprintf (NULL, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - free (result); - } - - for (size = 0; size <= 8; size++) - { - size_t length; - char *result; - - memcpy (buf, "DEADBEEF", 8); - length = size; - result = my_asnprintf (buf, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - if (size < 6) - ASSERT (result != buf); - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - if (result != buf) - free (result); - } -} - -static char * -my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) -{ - va_list args; - char *ret; - - va_start (args, format); - ret = vasnprintf (resultbuf, lengthp, format, args); - va_end (args); - return ret; -} - -static void -test_vasnprintf () -{ - test_function (my_asnprintf); -} - -static void -test_asnprintf () -{ - test_function (asnprintf); -} - -int -main (int argc, char *argv[]) -{ - test_vasnprintf (); - test_asnprintf (); - return 0; -} diff --git a/lib/gl/tests/test-vasprintf.c b/lib/gl/tests/test-vasprintf.c deleted file mode 100644 index cfde4f49c7..0000000000 --- a/lib/gl/tests/test-vasprintf.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Test of vasprintf() and asprintf() functions. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...)); -SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list)); - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static int -my_asprintf (char **result, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vasprintf (result, format, args); - va_end (args); - return ret; -} - -static void -test_vasprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -static void -test_asprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -int -main (int argc, char *argv[]) -{ - test_vasprintf (); - test_asprintf (); - return 0; -} diff --git a/lib/gl/tests/test-verify.c b/lib/gl/tests/test-verify.c deleted file mode 100644 index 3f89ba9058..0000000000 --- a/lib/gl/tests/test-verify.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Test the "verify" module. - - Copyright (C) 2005, 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible. */ - -#include <config.h> - -#include "verify.h" - -#ifndef EXP_FAIL -# define EXP_FAIL 0 -#endif - -int x; -enum { a, b, c }; - -#if EXP_FAIL == 1 -verify (x >= 0); /* should give ERROR: non-constant expression */ -#endif -verify (c == 2); /* should be ok */ -#if EXP_FAIL == 2 -verify (1 + 1 == 3); /* should give ERROR */ -#endif -verify (1 == 1); verify (1 == 1); /* should be ok */ - -enum -{ - item = verify_true (1 == 1) * 0 + 17 /* should be ok */ -}; - -static int -function (int n) -{ -#if EXP_FAIL == 3 - verify (n >= 0); /* should give ERROR: non-constant expression */ -#endif - verify (c == 2); /* should be ok */ -#if EXP_FAIL == 4 - verify (1 + 1 == 3); /* should give ERROR */ -#endif - verify (1 == 1); verify (1 == 1); /* should be ok */ - - if (n) - return ((void) verify_true (1 == 1), verify_true (1 == 1) + 7); /* should be ok */ -#if EXP_FAIL == 5 - return (verify_true (1 == 2), 5); /* should give ERROR */ -#endif - return 0; -} - -int -main (void) -{ - return !(function (0) == 0 && function (1) == 8); -} diff --git a/lib/gl/tests/test-verify.sh b/lib/gl/tests/test-verify.sh deleted file mode 100755 index 3e7676148a..0000000000 --- a/lib/gl/tests/test-verify.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -. "${srcdir=.}/init.sh" - -# We are not interested in triggering bugs in the compilers and tools -# (such as gcc 4.3.1 on openSUSE 11.0). -unset MALLOC_PERTURB_ - -# Rather than figure out how to invoke the compiler with the right -# include path ourselves, we let make do it: -(cd "$initial_cwd_" && rm -f test-verify.o \ - && $MAKE test-verify.o >/dev/null 2>&1) \ - || skip_ "cannot compile error-free" - -# Now, prove that we encounter all expected compilation failures: -: >out -: >err -for i in 1 2 3 4 5; do - (cd "$initial_cwd_" - rm -f test-verify.o - $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \ - && { warn_ "compiler didn't detect verification failure $i"; fail=1; } -done - -Exit $fail diff --git a/lib/gl/tests/test-vsnprintf.c b/lib/gl/tests/test-vsnprintf.c deleted file mode 100644 index 1bfa5540f7..0000000000 --- a/lib/gl/tests/test-vsnprintf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Test of vsnprintf() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list)); - -#include <stdarg.h> -#include <string.h> - -#include "macros.h" - -static int -my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = my_snprintf (buf, size, "%d", 12345); - if (size < 6) - { -#if CHECK_VSNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_VSNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - } - else - { - ASSERT (retval == 5); - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - return 0; -} diff --git a/lib/gl/tests/test-wchar.c b/lib/gl/tests/test-wchar.c deleted file mode 100644 index 2a03d6b669..0000000000 --- a/lib/gl/tests/test-wchar.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of <wchar.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <wchar.h> - -#include "verify.h" - -/* Check that the types wchar_t and wint_t are defined. */ -wchar_t a = 'c'; -wint_t b = 'x'; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/zerosize-ptr.h b/lib/gl/tests/zerosize-ptr.h deleted file mode 100644 index cfab200871..0000000000 --- a/lib/gl/tests/zerosize-ptr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Return a pointer to a zero-size object in memory. - 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 General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* ISO C 99 does not allow memcmp(), memchr() etc. to be invoked with a NULL - argument. Therefore this file produces a non-NULL pointer which cannot - be dereferenced, if possible. */ - -#include <stdlib.h> - -/* Test whether mmap() and mprotect() are available. - We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX. - HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an - mprotect() function in libgcc.a. */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# include <fcntl.h> -# include <unistd.h> -# include <sys/types.h> -# include <sys/mman.h> -/* Define MAP_FILE when it isn't otherwise. */ -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif - -/* Return a pointer to a zero-size object in memory (that is, actually, a - pointer to a page boundary where the previous page is readable and writable - and the next page is neither readable not writable), if possible. - Return NULL otherwise. */ - -static void * -zerosize_ptr (void) -{ -/* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is - not defined on HP-UX 11 (since it does not support MAP_FIXED). */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - return two_pages + pagesize; - } -#endif - return NULL; -} diff --git a/lib/gl/time.in.h b/lib/gl/time.in.h deleted file mode 100644 index 9d0d68031b..0000000000 --- a/lib/gl/time.in.h +++ /dev/null @@ -1,239 +0,0 @@ -/* A more-standard <time.h>. - - Copyright (C) 2007-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.1, 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. */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* 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 - symbols. Also, Solaris 8 <time.h> eventually includes itself - recursively; if that is happening, just include the system <time.h> - without adding our own declarations. */ -#if (defined __need_time_t || defined __need_clock_t \ - || defined __need_timespec \ - || defined _GL_TIME_H) - -# @INCLUDE_NEXT@ @NEXT_TIME_H@ - -#else - -# define _GL_TIME_H - -# @INCLUDE_NEXT@ @NEXT_TIME_H@ - -/* NetBSD 5.0 mis-defines NULL. */ -# include <stddef.h> - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). - Or they define it with the wrong member names or define it in <sys/time.h> - (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the - pthreads-win32 library defines it in <pthread.h>. */ -# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ -# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -# include <sys/time.h> -# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ -# include <pthread.h> -/* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */ -# undef asctime_r -# undef ctime_r -# undef gmtime_r -# undef localtime_r -# undef rand_r -# undef strtok_r -# else - -# ifdef __cplusplus -extern "C" { -# endif - -# undef timespec -# define timespec rpl_timespec -struct timespec -{ - time_t tv_sec; - long int tv_nsec; -}; - -# ifdef __cplusplus -} -# 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, - return -1 and store the remaining time into RMTP. See - <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ -# if @GNULIB_NANOSLEEP@ -# if @REPLACE_NANOSLEEP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define nanosleep rpl_nanosleep -# endif -_GL_FUNCDECL_RPL (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp)); -# else -# if ! @HAVE_NANOSLEEP@ -_GL_FUNCDECL_SYS (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp)); -# endif -_GL_CXXALIASWARN (nanosleep); -# endif - -/* Return the 'time_t' representation of TP and normalize TP. */ -# if @GNULIB_MKTIME@ -# if @REPLACE_MKTIME@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mktime rpl_mktime -# endif -_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); -# else -_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); -# endif -_GL_CXXALIASWARN (mktime); -# endif - -/* Convert TIMER to RESULT, assuming local time and UTC respectively. See - <http://www.opengroup.org/susv3xsh/localtime_r.html> and - <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */ -# if @GNULIB_TIME_R@ -# if @REPLACE_LOCALTIME_R@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef localtime_r -# define localtime_r rpl_localtime_r -# endif -_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result)); -# else -# if ! @HAVE_LOCALTIME_R@ -_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result)); -# endif -_GL_CXXALIASWARN (localtime_r); -# if @REPLACE_LOCALTIME_R@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef gmtime_r -# define gmtime_r rpl_gmtime_r -# endif -_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result)); -# else -# if ! @HAVE_LOCALTIME_R@ -_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result)); -# endif -_GL_CXXALIASWARN (gmtime_r); -# endif - -/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store - the resulting broken-down time into TM. See - <http://www.opengroup.org/susv3xsh/strptime.html>. */ -# if @GNULIB_STRPTIME@ -# if ! @HAVE_STRPTIME@ -_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, - char const *restrict __format, - struct tm *restrict __tm) - _GL_ARG_NONNULL ((1, 2, 3))); -# endif -_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, - char const *restrict __format, - struct tm *restrict __tm)); -_GL_CXXALIASWARN (strptime); -# endif - -/* Convert TM to a time_t value, assuming UTC. */ -# if @GNULIB_TIMEGM@ -# if @REPLACE_TIMEGM@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef timegm -# define timegm rpl_timegm -# endif -_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); -# else -# if ! @HAVE_TIMEGM@ -_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); -# endif -_GL_CXXALIASWARN (timegm); -# endif - -/* Encourage applications to avoid unsafe functions that can overrun - buffers when given outlandish struct tm values. Portable - applications should use strftime (or even sprintf) instead. */ -# if defined GNULIB_POSIXCHECK -# undef asctime -_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " - "better use strftime (or even sprintf) instead"); -# endif -# if defined GNULIB_POSIXCHECK -# undef asctime_r -_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " - "better use strftime (or even sprintf) instead"); -# endif -# if defined GNULIB_POSIXCHECK -# undef ctime -_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " - "better use strftime (or even sprintf) instead"); -# endif -# if defined GNULIB_POSIXCHECK -# undef ctime_r -_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " - "better use strftime (or even sprintf) instead"); -# endif - -#endif diff --git a/lib/gl/time_r.c b/lib/gl/time_r.c deleted file mode 100644 index 591bc02b23..0000000000 --- a/lib/gl/time_r.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Reentrant time functions like localtime_r. - - Copyright (C) 2003, 2006-2007, 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.1, 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 Paul Eggert. */ - -#include <config.h> - -#include <time.h> - -static struct tm * -copy_tm_result (struct tm *dest, struct tm const *src) -{ - if (! src) - return 0; - *dest = *src; - return dest; -} - - -struct tm * -gmtime_r (time_t const * restrict t, struct tm * restrict tp) -{ - return copy_tm_result (tp, gmtime (t)); -} - -struct tm * -localtime_r (time_t const * restrict t, struct tm * restrict tp) -{ - return copy_tm_result (tp, localtime (t)); -} diff --git a/lib/gl/unistd.in.h b/lib/gl/unistd.in.h deleted file mode 100644 index 255869af1e..0000000000 --- a/lib/gl/unistd.in.h +++ /dev/null @@ -1,1344 +0,0 @@ -/* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-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.1, 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. */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* Special invocation convention: - - On mingw, several headers, including <winsock2.h>, include <unistd.h>, - but we need to ensure that both the system <unistd.h> and <winsock2.h> - are completely included before we replace gethostname. */ -#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ - && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H -/* <unistd.h> is being indirectly included for the first time from - <winsock2.h>; avoid declaring any overrides. */ -# if @HAVE_UNISTD_H@ -# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ -# else -# error unexpected; report this to bug-gnulib@gnu.org -# endif -# define _GL_WINSOCK2_H_WITNESS - -/* Normal invocation. */ -#elif !defined _GL_UNISTD_H - -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_UNISTD_H@ -# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ -#endif - -/* Get all possible declarations of gethostname(). */ -#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ - && !defined _GL_INCLUDING_WINSOCK2_H -# define _GL_INCLUDING_WINSOCK2_H -# include <winsock2.h> -# undef _GL_INCLUDING_WINSOCK2_H -#endif - -#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H -#define _GL_UNISTD_H - -/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ -#include <stddef.h> - -/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ -/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ -/* But avoid namespace pollution on glibc systems. */ -#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ - || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ - && defined __CYGWIN__)) \ - && ! defined __GLIBC__ -# include <stdio.h> -#endif - -/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ -/* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ - && ! defined __GLIBC__ -# include <fcntl.h> -#endif - -/* mingw fails to declare _exit in <unistd.h>. */ -/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ -/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ -/* But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# include <stdlib.h> -#endif - -/* mingw declares getcwd in <io.h>, not in <unistd.h>. */ -#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ - && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) -# include <io.h> -#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@ \ - || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) -/* Get ssize_t. */ -# include <sys/types.h> -#endif - -/* Get getopt(), optarg, optind, opterr, optopt. - But avoid namespace pollution on glibc systems. */ -#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT -# include <getopt.h> -#endif - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -#if @GNULIB_GETHOSTNAME@ -/* Get all possible declarations of gethostname(). */ -# if @UNISTD_H_HAVE_WINSOCK2_H@ -# if !defined _GL_SYS_SOCKET_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef socket -# define socket socket_used_without_including_sys_socket_h -# undef connect -# define connect connect_used_without_including_sys_socket_h -# undef accept -# define accept accept_used_without_including_sys_socket_h -# undef bind -# define bind bind_used_without_including_sys_socket_h -# undef getpeername -# define getpeername getpeername_used_without_including_sys_socket_h -# undef getsockname -# define getsockname getsockname_used_without_including_sys_socket_h -# undef getsockopt -# define getsockopt getsockopt_used_without_including_sys_socket_h -# undef listen -# define listen listen_used_without_including_sys_socket_h -# undef recv -# define recv recv_used_without_including_sys_socket_h -# undef send -# define send send_used_without_including_sys_socket_h -# undef recvfrom -# define recvfrom recvfrom_used_without_including_sys_socket_h -# undef sendto -# define sendto sendto_used_without_including_sys_socket_h -# undef setsockopt -# define setsockopt setsockopt_used_without_including_sys_socket_h -# undef shutdown -# define shutdown shutdown_used_without_including_sys_socket_h -# else - _GL_WARN_ON_USE (socket, - "socket() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (connect, - "connect() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (accept, - "accept() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (bind, - "bind() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (getpeername, - "getpeername() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (getsockname, - "getsockname() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (getsockopt, - "getsockopt() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (listen, - "listen() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (recv, - "recv() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (send, - "send() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (recvfrom, - "recvfrom() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (sendto, - "sendto() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (setsockopt, - "setsockopt() used without including <sys/socket.h>"); - _GL_WARN_ON_USE (shutdown, - "shutdown() used without including <sys/socket.h>"); -# endif -# endif -# if !defined _GL_SYS_SELECT_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef select -# define select select_used_without_including_sys_select_h -# else - _GL_WARN_ON_USE (select, - "select() used without including <sys/select.h>"); -# endif -# endif -# endif -#endif - - -/* OS/2 EMX lacks these macros. */ -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - -/* Ensure *_OK macros exist. */ -#ifndef F_OK -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 -#endif - - -/* Declare overridden functions. */ - - -#if defined GNULIB_POSIXCHECK -/* The access() function is a security risk. */ -_GL_WARN_ON_USE (access, "the access function is a security risk - " - "use the gnulib module faccessat instead"); -#endif - - -#if @GNULIB_CHOWN@ -/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). Follow symbolic links. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/chown.html>. */ -# if @REPLACE_CHOWN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef chown -# define chown rpl_chown -# endif -_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); -# else -# if !@HAVE_CHOWN@ -_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); -# endif -_GL_CXXALIASWARN (chown); -#elif defined GNULIB_POSIXCHECK -# undef chown -# if HAVE_RAW_DECL_CHOWN -_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " - "doesn't treat a uid or gid of -1 on some systems - " - "use gnulib module chown for portability"); -# endif -#endif - - -#if @GNULIB_CLOSE@ -# if @REPLACE_CLOSE@ -/* Automatically included by modules that need a replacement for close. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef close -# define close rpl_close -# endif -_GL_FUNCDECL_RPL (close, int, (int fd)); -_GL_CXXALIAS_RPL (close, int, (int fd)); -# else -_GL_CXXALIAS_SYS (close, int, (int fd)); -# endif -_GL_CXXALIASWARN (close); -#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ -# undef close -# define close close_used_without_requesting_gnulib_module_close -#elif defined GNULIB_POSIXCHECK -# undef close -/* Assume close is always declared. */ -_GL_WARN_ON_USE (close, "close does not portably work on sockets - " - "use gnulib module close for portability"); -#endif - - -#if @REPLACE_DUP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define dup rpl_dup -# endif -_GL_FUNCDECL_RPL (dup, int, (int oldfd)); -_GL_CXXALIAS_RPL (dup, int, (int oldfd)); -#else -_GL_CXXALIAS_SYS (dup, int, (int oldfd)); -#endif -_GL_CXXALIASWARN (dup); - - -#if @GNULIB_DUP2@ -/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if - NEWFD = OLDFD, otherwise close NEWFD first if it is open. - Return newfd if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/dup2.html>. */ -# if @REPLACE_DUP2@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define dup2 rpl_dup2 -# endif -_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); -_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); -# else -# if !@HAVE_DUP2@ -_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); -# endif -_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); -# endif -_GL_CXXALIASWARN (dup2); -#elif defined GNULIB_POSIXCHECK -# undef dup2 -# if HAVE_RAW_DECL_DUP2 -_GL_WARN_ON_USE (dup2, "dup2 is unportable - " - "use gnulib module dup2 for portability"); -# endif -#endif - - -#if @GNULIB_DUP3@ -/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the - specified flags. - The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) - and O_TEXT, O_BINARY (defined in "binary-io.h"). - Close NEWFD first if it is open. - Return newfd if successful, otherwise -1 and errno set. - See the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ -# if @HAVE_DUP3@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define dup3 rpl_dup3 -# endif -_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); -_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); -# else -_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); -_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); -# endif -_GL_CXXALIASWARN (dup3); -#elif defined GNULIB_POSIXCHECK -# undef dup3 -# if HAVE_RAW_DECL_DUP3 -_GL_WARN_ON_USE (dup3, "dup3 is unportable - " - "use gnulib module dup3 for portability"); -# endif -#endif - - -#if @GNULIB_ENVIRON@ -# if !@HAVE_DECL_ENVIRON@ -/* Set of environment variables and values. An array of strings of the form - "VARIABLE=VALUE", terminated with a NULL. */ -# if defined __APPLE__ && defined __MACH__ -# include <crt_externs.h> -# define environ (*_NSGetEnviron ()) -# else -# ifdef __cplusplus -extern "C" { -# endif -extern char **environ; -# ifdef __cplusplus -} -# endif -# endif -# endif -#elif defined GNULIB_POSIXCHECK -# if HAVE_RAW_DECL_ENVIRON -static inline char *** -rpl_environ (void) -{ - return &environ; -} -_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " - "use gnulib module environ for portability"); -# undef environ -# define environ (*rpl_environ ()) -# endif -#endif - - -#if @GNULIB_EUIDACCESS@ -/* Like access(), except that it uses the effective user id and group id of - the current process. */ -# if !@HAVE_EUIDACCESS@ -_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); -_GL_CXXALIASWARN (euidaccess); -# if defined GNULIB_POSIXCHECK -/* Like access(), this function is a security risk. */ -_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " - "use the gnulib module faccessat instead"); -# endif -#elif defined GNULIB_POSIXCHECK -# undef euidaccess -# if HAVE_RAW_DECL_EUIDACCESS -_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " - "use gnulib module euidaccess for portability"); -# endif -#endif - - -#if @GNULIB_FACCESSAT@ -# if !@HAVE_FACCESSAT@ -_GL_FUNCDECL_SYS (faccessat, int, - (int fd, char const *file, int mode, int flag) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (faccessat, int, - (int fd, char const *file, int mode, int flag)); -_GL_CXXALIASWARN (faccessat); -#elif defined GNULIB_POSIXCHECK -# undef faccessat -# if HAVE_RAW_DECL_FACCESSAT -_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " - "use gnulib module faccessat for portability"); -# endif -#endif - - -#if @GNULIB_FCHDIR@ -/* Change the process' current working directory to the directory on which - the given file descriptor is open. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/fchdir.html>. */ -# if ! @HAVE_FCHDIR@ -_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); - -/* Gnulib internal hooks needed to maintain the fchdir metadata. */ -_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) - _GL_ARG_NONNULL ((2)); -_GL_EXTERN_C void _gl_unregister_fd (int fd); -_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); -_GL_EXTERN_C const char *_gl_directory_name (int fd); - -# endif -_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); -_GL_CXXALIASWARN (fchdir); -#elif defined GNULIB_POSIXCHECK -# undef fchdir -# if HAVE_RAW_DECL_FCHDIR -_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " - "use gnulib module fchdir for portability"); -# endif -#endif - - -#if @GNULIB_FCHOWNAT@ -# if @REPLACE_FCHOWNAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fchownat -# define fchownat rpl_fchownat -# endif -_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag)); -# else -# if !@HAVE_FCHOWNAT@ -_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag)); -# endif -_GL_CXXALIASWARN (fchownat); -#elif defined GNULIB_POSIXCHECK -# undef fchownat -# if HAVE_RAW_DECL_FCHOWNAT -_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -#if @GNULIB_FSYNC@ -/* Synchronize changes to a file. - Return 0 if successful, otherwise -1 and errno set. - See POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/fsync.html>. */ -# if !@HAVE_FSYNC@ -_GL_FUNCDECL_SYS (fsync, int, (int fd)); -# endif -_GL_CXXALIAS_SYS (fsync, int, (int fd)); -_GL_CXXALIASWARN (fsync); -#elif defined GNULIB_POSIXCHECK -# undef fsync -# if HAVE_RAW_DECL_FSYNC -_GL_WARN_ON_USE (fsync, "fsync is unportable - " - "use gnulib module fsync for portability"); -# endif -#endif - - -#if @GNULIB_FTRUNCATE@ -/* Change the size of the file to which FD is opened to become equal to LENGTH. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ -# if !@HAVE_FTRUNCATE@ -_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); -# endif -_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); -_GL_CXXALIASWARN (ftruncate); -#elif defined GNULIB_POSIXCHECK -# undef ftruncate -# if HAVE_RAW_DECL_FTRUNCATE -_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " - "use gnulib module ftruncate for portability"); -# endif -#endif - - -#if @GNULIB_GETCWD@ -/* Get the name of the current working directory, and put it in SIZE bytes - of BUF. - Return BUF if successful, or NULL if the directory couldn't be determined - or SIZE was too small. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/getcwd.html>. - Additionally, the gnulib module 'getcwd' guarantees the following GNU - extension: If BUF is NULL, an array is allocated with 'malloc'; the array - is SIZE bytes long, unless SIZE == 0, in which case it is as big as - necessary. */ -# if @REPLACE_GETCWD@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define getcwd rpl_getcwd -# endif -_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); -_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); -# else -/* Need to cast, because on mingw, the second parameter is - int size. */ -_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); -# endif -_GL_CXXALIASWARN (getcwd); -#elif defined GNULIB_POSIXCHECK -# undef getcwd -# if HAVE_RAW_DECL_GETCWD -_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " - "use gnulib module getcwd for portability"); -# endif -#endif - - -#if @GNULIB_GETDOMAINNAME@ -/* Return the NIS domain name of the machine. - WARNING! The NIS domain name is unrelated to the fully qualified host name - of the machine. It is also unrelated to email addresses. - WARNING! The NIS domain name is usually the empty string or "(none)" when - not using NIS. - - Put up to LEN bytes of the NIS domain name into NAME. - Null terminate it if the name is shorter than LEN. - If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. - Return 0 if successful, otherwise set errno and return -1. */ -# if @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_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); -# endif -_GL_CXXALIASWARN (getdomainname); -#elif defined GNULIB_POSIXCHECK -# undef getdomainname -# if HAVE_RAW_DECL_GETDOMAINNAME -_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " - "use gnulib module getdomainname for portability"); -# endif -#endif - - -#if @GNULIB_GETDTABLESIZE@ -/* Return the maximum number of file descriptors in the current process. - In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ -# if !@HAVE_GETDTABLESIZE@ -_GL_FUNCDECL_SYS (getdtablesize, int, (void)); -# endif -_GL_CXXALIAS_SYS (getdtablesize, int, (void)); -_GL_CXXALIASWARN (getdtablesize); -#elif defined GNULIB_POSIXCHECK -# undef getdtablesize -# if HAVE_RAW_DECL_GETDTABLESIZE -_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " - "use gnulib module getdtablesize for portability"); -# endif -#endif - - -#if @GNULIB_GETGROUPS@ -/* Return the supplemental groups that the current process belongs to. - It is unspecified whether the effective group id is in the list. - If N is 0, return the group count; otherwise, N describes how many - entries are available in GROUPS. Return -1 and set errno if N is - not 0 and not large enough. Fails with ENOSYS on some systems. */ -# if @REPLACE_GETGROUPS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getgroups -# define getgroups rpl_getgroups -# endif -_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); -_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); -# else -# if !@HAVE_GETGROUPS@ -_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); -# endif -_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); -# endif -_GL_CXXALIASWARN (getgroups); -#elif defined GNULIB_POSIXCHECK -# undef getgroups -# if HAVE_RAW_DECL_GETGROUPS -_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " - "use gnulib module getgroups for portability"); -# endif -#endif - - -#if @GNULIB_GETHOSTNAME@ -/* Return the standard host name of the machine. - WARNING! The host name may or may not be fully qualified. - - Put up to LEN bytes of the host name into NAME. - Null terminate it if the name is shorter than LEN. - If the host name is longer than LEN, set errno = EINVAL and return -1. - Return 0 if successful, otherwise set errno and return -1. */ -# if @UNISTD_H_HAVE_WINSOCK2_H@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef gethostname -# define gethostname rpl_gethostname -# endif -_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); -# else -# if !@HAVE_GETHOSTNAME@ -_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) - _GL_ARG_NONNULL ((1))); -# endif -/* Need to cast, because on Solaris 10 systems, the second parameter is - int len. */ -_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); -# endif -_GL_CXXALIASWARN (gethostname); -#elif @UNISTD_H_HAVE_WINSOCK2_H@ -# undef gethostname -# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname -#elif defined GNULIB_POSIXCHECK -# undef gethostname -# if HAVE_RAW_DECL_GETHOSTNAME -_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " - "use gnulib module gethostname for portability"); -# endif -#endif - - -#if @GNULIB_GETLOGIN@ -/* Returns the user's login name, or NULL if it cannot be found. Upon error, - returns NULL with errno set. - - See <http://www.opengroup.org/susv3xsh/getlogin.html>. - - Most programs don't need to use this function, because the information is - available through environment variables: - ${LOGNAME-$USER} on Unix platforms, - $USERNAME on native Windows platforms. - */ -# if !@HAVE_GETLOGIN@ -_GL_FUNCDECL_SYS (getlogin, char *, (void)); -# endif -_GL_CXXALIAS_SYS (getlogin, char *, (void)); -_GL_CXXALIASWARN (getlogin); -#elif defined GNULIB_POSIXCHECK -# undef getlogin -# if HAVE_RAW_DECL_GETLOGIN -_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " - "use gnulib module getlogin for portability"); -# endif -#endif - - -#if @GNULIB_GETLOGIN_R@ -/* Copies the user's login name to NAME. - The array pointed to by NAME has room for SIZE bytes. - - Returns 0 if successful. Upon error, an error number is returned, or -1 in - the case that the login name cannot be found but no specific error is - provided (this case is hopefully rare but is left open by the POSIX spec). - - See <http://www.opengroup.org/susv3xsh/getlogin.html>. - - Most programs don't need to use this function, because the information is - available through environment variables: - ${LOGNAME-$USER} on Unix platforms, - $USERNAME on native Windows platforms. - */ -# if !@HAVE_DECL_GETLOGIN_R@ -_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) - _GL_ARG_NONNULL ((1))); -# endif -/* Need to cast, because on Solaris 10 systems, the second argument is - int size. */ -_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); -_GL_CXXALIASWARN (getlogin_r); -#elif defined GNULIB_POSIXCHECK -# undef getlogin_r -# if HAVE_RAW_DECL_GETLOGIN_R -_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " - "use gnulib module getlogin_r for portability"); -# endif -#endif - - -#if @GNULIB_GETPAGESIZE@ -# if @REPLACE_GETPAGESIZE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define getpagesize rpl_getpagesize -# endif -_GL_FUNCDECL_RPL (getpagesize, int, (void)); -_GL_CXXALIAS_RPL (getpagesize, int, (void)); -# else -# if !@HAVE_GETPAGESIZE@ -# if !defined getpagesize -/* This is for POSIX systems. */ -# if !defined _gl_getpagesize && defined _SC_PAGESIZE -# if ! (defined __VMS && __VMS_VER < 70000000) -# define _gl_getpagesize() sysconf (_SC_PAGESIZE) -# endif -# endif -/* This is for older VMS. */ -# if !defined _gl_getpagesize && defined __VMS -# ifdef __ALPHA -# define _gl_getpagesize() 8192 -# else -# define _gl_getpagesize() 512 -# endif -# endif -/* This is for BeOS. */ -# if !defined _gl_getpagesize && @HAVE_OS_H@ -# include <OS.h> -# if defined B_PAGE_SIZE -# define _gl_getpagesize() B_PAGE_SIZE -# endif -# endif -/* This is for AmigaOS4.0. */ -# if !defined _gl_getpagesize && defined __amigaos4__ -# define _gl_getpagesize() 2048 -# endif -/* This is for older Unix systems. */ -# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define _gl_getpagesize() EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define CLSIZE 1 -# endif -# define _gl_getpagesize() (NBPG * CLSIZE) -# else -# ifdef NBPC -# define _gl_getpagesize() NBPC -# endif -# endif -# endif -# endif -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define getpagesize() _gl_getpagesize () -# else -static inline int -getpagesize () -{ - return _gl_getpagesize (); -} -# endif -# endif -# endif -/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ -_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); -# endif -# if @HAVE_DECL_GETPAGESIZE@ -_GL_CXXALIASWARN (getpagesize); -# endif -#elif defined GNULIB_POSIXCHECK -# undef getpagesize -# if HAVE_RAW_DECL_GETPAGESIZE -_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " - "use gnulib module getpagesize for portability"); -# endif -#endif - - -#if @GNULIB_GETUSERSHELL@ -/* Return the next valid login shell on the system, or NULL when the end of - the list has been reached. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (getusershell, char *, (void)); -# endif -_GL_CXXALIAS_SYS (getusershell, char *, (void)); -_GL_CXXALIASWARN (getusershell); -#elif defined GNULIB_POSIXCHECK -# undef getusershell -# if HAVE_RAW_DECL_GETUSERSHELL -_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " - "use gnulib module getusershell for portability"); -# endif -#endif - -#if @GNULIB_GETUSERSHELL@ -/* Rewind to pointer that is advanced at each getusershell() call. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (setusershell, void, (void)); -# endif -_GL_CXXALIAS_SYS (setusershell, void, (void)); -_GL_CXXALIASWARN (setusershell); -#elif defined GNULIB_POSIXCHECK -# undef setusershell -# if HAVE_RAW_DECL_SETUSERSHELL -_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " - "use gnulib module getusershell for portability"); -# endif -#endif - -#if @GNULIB_GETUSERSHELL@ -/* Free the pointer that is advanced at each getusershell() call and - associated resources. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (endusershell, void, (void)); -# endif -_GL_CXXALIAS_SYS (endusershell, void, (void)); -_GL_CXXALIASWARN (endusershell); -#elif defined GNULIB_POSIXCHECK -# undef endusershell -# if HAVE_RAW_DECL_ENDUSERSHELL -_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " - "use gnulib module getusershell for portability"); -# endif -#endif - - -#if @GNULIB_LCHOWN@ -/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). Do not follow symbolic links. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/lchown.html>. */ -# if @REPLACE_LCHOWN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef lchown -# define lchown rpl_lchown -# endif -_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); -# else -# if !@HAVE_LCHOWN@ -_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) - _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); -# endif -_GL_CXXALIASWARN (lchown); -#elif defined GNULIB_POSIXCHECK -# undef lchown -# if HAVE_RAW_DECL_LCHOWN -_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " - "use gnulib module lchown for portability"); -# endif -#endif - - -#if @GNULIB_LINK@ -/* Create a new hard link for an existing file. - Return 0 if successful, otherwise -1 and errno set. - See POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/link.html>. */ -# if @REPLACE_LINK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define link rpl_link -# endif -_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); -# else -# if !@HAVE_LINK@ -_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); -# endif -_GL_CXXALIASWARN (link); -#elif defined GNULIB_POSIXCHECK -# undef link -# if HAVE_RAW_DECL_LINK -_GL_WARN_ON_USE (link, "link is unportable - " - "use gnulib module link for portability"); -# endif -#endif - - -#if @GNULIB_LINKAT@ -/* Create a new hard link for an existing file, relative to two - directories. FLAG controls whether symlinks are followed. - Return 0 if successful, otherwise -1 and errno set. */ -# if @REPLACE_LINKAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef linkat -# define linkat rpl_linkat -# endif -_GL_FUNCDECL_RPL (linkat, int, - (int fd1, const char *path1, int fd2, const char *path2, - int flag) - _GL_ARG_NONNULL ((2, 4))); -_GL_CXXALIAS_RPL (linkat, int, - (int fd1, const char *path1, int fd2, const char *path2, - int flag)); -# else -# if !@HAVE_LINKAT@ -_GL_FUNCDECL_SYS (linkat, int, - (int fd1, const char *path1, int fd2, const char *path2, - int flag) - _GL_ARG_NONNULL ((2, 4))); -# endif -_GL_CXXALIAS_SYS (linkat, int, - (int fd1, const char *path1, int fd2, const char *path2, - int flag)); -# endif -_GL_CXXALIASWARN (linkat); -#elif defined GNULIB_POSIXCHECK -# undef linkat -# if HAVE_RAW_DECL_LINKAT -_GL_WARN_ON_USE (linkat, "linkat is unportable - " - "use gnulib module linkat for portability"); -# endif -#endif - - -#if @GNULIB_LSEEK@ -/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. - Return the new offset if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/lseek.html>. */ -# if @REPLACE_LSEEK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define lseek rpl_lseek -# endif -_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); -_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); -# else -_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); -# endif -_GL_CXXALIASWARN (lseek); -#elif defined GNULIB_POSIXCHECK -# undef lseek -# if HAVE_RAW_DECL_LSEEK -_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " - "systems - use gnulib module lseek for portability"); -# endif -#endif - - -#if @GNULIB_PIPE2@ -/* Create a pipe, applying the given flags when opening the read-end of the - pipe and the write-end of the pipe. - The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) - and O_TEXT, O_BINARY (defined in "binary-io.h"). - Store the read-end as fd[0] and the write-end as fd[1]. - Return 0 upon success, or -1 with errno set upon failure. - See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ -# if @HAVE_PIPE2@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define pipe2 rpl_pipe2 -# endif -_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); -# else -_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); -# endif -_GL_CXXALIASWARN (pipe2); -#elif defined GNULIB_POSIXCHECK -# undef pipe2 -# if HAVE_RAW_DECL_PIPE2 -_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " - "use gnulib module pipe2 for portability"); -# endif -#endif - - -#if @GNULIB_PREAD@ -/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. - Return the number of bytes placed into BUF if successful, otherwise - set errno and return -1. 0 indicates EOF. See the POSIX:2001 - specification <http://www.opengroup.org/susv3xsh/pread.html>. */ -# if @REPLACE_PREAD@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define pread rpl_pread -# endif -_GL_FUNCDECL_RPL (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset)); -# else -# if !@HAVE_PREAD@ -_GL_FUNCDECL_SYS (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset)); -# endif -_GL_CXXALIASWARN (pread); -#elif defined GNULIB_POSIXCHECK -# undef pread -# if HAVE_RAW_DECL_PREAD -_GL_WARN_ON_USE (pread, "pread is unportable - " - "use gnulib module pread for portability"); -# endif -#endif - - -#if @GNULIB_PWRITE@ -/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. - Return the number of bytes written if successful, otherwise - set errno and return -1. 0 indicates nothing written. See the - POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/pwrite.html>. */ -# if @REPLACE_PWRITE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define pwrite rpl_pwrite -# endif -_GL_FUNCDECL_RPL (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset)); -# else -# if !@HAVE_PWRITE@ -_GL_FUNCDECL_SYS (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset)); -# endif -_GL_CXXALIASWARN (pwrite); -#elif defined GNULIB_POSIXCHECK -# undef pwrite -# if HAVE_RAW_DECL_PWRITE -_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " - "use gnulib module pwrite for portability"); -# endif -#endif - - -#if @GNULIB_READLINK@ -/* Read the contents of the symbolic link FILE and place the first BUFSIZE - bytes of it into BUF. Return the number of bytes placed into BUF if - successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/readlink.html>. */ -# if @REPLACE_READLINK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define readlink rpl_readlink -# endif -_GL_FUNCDECL_RPL (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize)); -# else -# if !@HAVE_READLINK@ -_GL_FUNCDECL_SYS (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize)); -# endif -_GL_CXXALIASWARN (readlink); -#elif defined GNULIB_POSIXCHECK -# undef readlink -# if HAVE_RAW_DECL_READLINK -_GL_WARN_ON_USE (readlink, "readlink is unportable - " - "use gnulib module readlink for portability"); -# endif -#endif - - -#if @GNULIB_READLINKAT@ -# if !@HAVE_READLINKAT@ -_GL_FUNCDECL_SYS (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len) - _GL_ARG_NONNULL ((2, 3))); -# endif -_GL_CXXALIAS_SYS (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len)); -_GL_CXXALIASWARN (readlinkat); -#elif defined GNULIB_POSIXCHECK -# undef readlinkat -# if HAVE_RAW_DECL_READLINKAT -_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " - "use gnulib module readlinkat for portability"); -# endif -#endif - - -#if @GNULIB_RMDIR@ -/* Remove the directory DIR. */ -# if @REPLACE_RMDIR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define rmdir rpl_rmdir -# endif -_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); -# else -_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); -# endif -_GL_CXXALIASWARN (rmdir); -#elif defined GNULIB_POSIXCHECK -# undef rmdir -# if HAVE_RAW_DECL_RMDIR -_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " - "use gnulib module rmdir for portability"); -# endif -#endif - - -#if @GNULIB_SLEEP@ -/* Pause the execution of the current thread for N seconds. - Returns the number of seconds left to sleep. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/sleep.html>. */ -# if @REPLACE_SLEEP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef sleep -# define sleep rpl_sleep -# endif -_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); -_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); -# else -# if !@HAVE_SLEEP@ -_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); -# endif -_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); -# endif -_GL_CXXALIASWARN (sleep); -#elif defined GNULIB_POSIXCHECK -# undef sleep -# if HAVE_RAW_DECL_SLEEP -_GL_WARN_ON_USE (sleep, "sleep is unportable - " - "use gnulib module sleep for portability"); -# endif -#endif - - -#if @GNULIB_SYMLINK@ -# if @REPLACE_SYMLINK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef symlink -# define symlink rpl_symlink -# endif -_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); -# else -# if !@HAVE_SYMLINK@ -_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); -# endif -_GL_CXXALIASWARN (symlink); -#elif defined GNULIB_POSIXCHECK -# undef symlink -# if HAVE_RAW_DECL_SYMLINK -_GL_WARN_ON_USE (symlink, "symlink is not portable - " - "use gnulib module symlink for portability"); -# endif -#endif - - -#if @GNULIB_SYMLINKAT@ -# if !@HAVE_SYMLINKAT@ -_GL_FUNCDECL_SYS (symlinkat, int, - (char const *contents, int fd, char const *file) - _GL_ARG_NONNULL ((1, 3))); -# endif -_GL_CXXALIAS_SYS (symlinkat, int, - (char const *contents, int fd, char const *file)); -_GL_CXXALIASWARN (symlinkat); -#elif defined GNULIB_POSIXCHECK -# undef symlinkat -# if HAVE_RAW_DECL_SYMLINKAT -_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " - "use gnulib module symlinkat for portability"); -# endif -#endif - - -#if @GNULIB_TTYNAME_R@ -/* Store at most BUFLEN characters of the pathname of the terminal FD is - open on in BUF. Return 0 on success, otherwise an error number. */ -# if @REPLACE_TTYNAME_R@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef ttyname_r -# define ttyname_r rpl_ttyname_r -# endif -_GL_FUNCDECL_RPL (ttyname_r, int, - (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (ttyname_r, int, - (int fd, char *buf, size_t buflen)); -# else -# if !@HAVE_TTYNAME_R@ -_GL_FUNCDECL_SYS (ttyname_r, int, - (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (ttyname_r, int, - (int fd, char *buf, size_t buflen)); -# endif -_GL_CXXALIASWARN (ttyname_r); -#elif defined GNULIB_POSIXCHECK -# undef ttyname_r -# if HAVE_RAW_DECL_TTYNAME_R -_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " - "use gnulib module ttyname_r for portability"); -# endif -#endif - - -#if @GNULIB_UNLINK@ -# if @REPLACE_UNLINK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef unlink -# define unlink rpl_unlink -# endif -_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (unlink, int, (char const *file)); -# else -_GL_CXXALIAS_SYS (unlink, int, (char const *file)); -# endif -_GL_CXXALIASWARN (unlink); -#elif defined GNULIB_POSIXCHECK -# undef unlink -# if HAVE_RAW_DECL_UNLINK -_GL_WARN_ON_USE (unlink, "unlink is not portable - " - "use gnulib module unlink for portability"); -# endif -#endif - - -#if @GNULIB_UNLINKAT@ -# if @REPLACE_UNLINKAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef unlinkat -# define unlinkat rpl_unlinkat -# endif -_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); -# else -# if !@HAVE_UNLINKAT@ -_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); -# endif -_GL_CXXALIASWARN (unlinkat); -#elif defined GNULIB_POSIXCHECK -# undef unlinkat -# if HAVE_RAW_DECL_UNLINKAT -_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -#if @GNULIB_USLEEP@ -/* Pause the execution of the current thread for N microseconds. - Returns 0 on completion, or -1 on range error. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/sleep.html>. */ -# if @REPLACE_USLEEP@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef usleep -# define usleep rpl_usleep -# endif -_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); -_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); -# else -# if !@HAVE_USLEEP@ -_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); -# endif -_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); -# endif -_GL_CXXALIASWARN (usleep); -#elif defined GNULIB_POSIXCHECK -# undef usleep -# if HAVE_RAW_DECL_USLEEP -_GL_WARN_ON_USE (usleep, "usleep is unportable - " - "use gnulib module usleep for portability"); -# endif -#endif - - -#if @GNULIB_WRITE@ -/* Write up to COUNT bytes starting at BUF to file descriptor FD. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/write.html>. */ -# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef write -# define write rpl_write -# endif -_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); -# else -/* Need to cast, because on mingw, the third parameter is - unsigned int count - and the return type is 'int'. */ -_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); -# endif -_GL_CXXALIASWARN (write); -#endif - - -#endif /* _GL_UNISTD_H */ -#endif /* _GL_UNISTD_H */ diff --git a/lib/gl/vasnprintf.c b/lib/gl/vasnprintf.c deleted file mode 100644 index 8585e84156..0000000000 --- a/lib/gl/vasnprintf.c +++ /dev/null @@ -1,5577 +0,0 @@ -/* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-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.1, 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. */ - -/* This file can be parametrized with the following macros: - VASNPRINTF The name of the function being defined. - FCHAR_T The element type of the format string. - DCHAR_T The element type of the destination (result) string. - FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters - in the format string are ASCII. MUST be set if - FCHAR_T and DCHAR_T are not the same type. - DIRECTIVE Structure denoting a format directive. - Depends on FCHAR_T. - DIRECTIVES Structure denoting the set of format directives of a - format string. Depends on FCHAR_T. - PRINTF_PARSE Function that parses a format string. - Depends on FCHAR_T. - DCHAR_CPY memcpy like function for DCHAR_T[] arrays. - DCHAR_SET memset like function for DCHAR_T[] arrays. - DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. - SNPRINTF The system's snprintf (or similar) function. - This may be either snprintf or swprintf. - TCHAR_T The element type of the argument and result string - of the said SNPRINTF function. This may be either - char or wchar_t. The code exploits that - sizeof (TCHAR_T) | sizeof (DCHAR_T) and - alignof (TCHAR_T) <= alignof (DCHAR_T). - DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. - DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. - DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. - DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. - DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */ - -/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). - This must come before <config.h> because <config.h> may include - <features.h>, and once <features.h> has been included, it's too late. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifndef VASNPRINTF -# include <config.h> -#endif -#ifndef IN_LIBINTL -# include <alloca.h> -#endif - -/* Specification. */ -#ifndef VASNPRINTF -# if WIDE_CHAR_VERSION -# include "vasnwprintf.h" -# else -# include "vasnprintf.h" -# endif -#endif - -#include <locale.h> /* localeconv() */ -#include <stdio.h> /* snprintf(), sprintf() */ -#include <stdlib.h> /* abort(), malloc(), realloc(), free() */ -#include <string.h> /* memcpy(), strlen() */ -#include <errno.h> /* errno */ -#include <limits.h> /* CHAR_BIT */ -#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ -#if HAVE_NL_LANGINFO -# include <langinfo.h> -#endif -#ifndef VASNPRINTF -# if WIDE_CHAR_VERSION -# include "wprintf-parse.h" -# else -# include "printf-parse.h" -# endif -#endif - -/* Checked size_t computations. */ -#include "xsize.h" - -#include "verify.h" - -#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL -# include <math.h> -# include "float+.h" -#endif - -#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL -# include <math.h> -# include "isnand-nolibm.h" -#endif - -#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL -# include <math.h> -# include "isnanl-nolibm.h" -# include "fpucw.h" -#endif - -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL -# include <math.h> -# include "isnand-nolibm.h" -# include "printf-frexp.h" -#endif - -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL -# include <math.h> -# include "isnanl-nolibm.h" -# include "printf-frexpl.h" -# include "fpucw.h" -#endif - -/* Default parameters. */ -#ifndef VASNPRINTF -# if WIDE_CHAR_VERSION -# define VASNPRINTF vasnwprintf -# define FCHAR_T wchar_t -# define DCHAR_T wchar_t -# define TCHAR_T wchar_t -# define DCHAR_IS_TCHAR 1 -# define DIRECTIVE wchar_t_directive -# define DIRECTIVES wchar_t_directives -# define PRINTF_PARSE wprintf_parse -# define DCHAR_CPY wmemcpy -# define DCHAR_SET wmemset -# else -# define VASNPRINTF vasnprintf -# define FCHAR_T char -# define DCHAR_T char -# define TCHAR_T char -# define DCHAR_IS_TCHAR 1 -# define DIRECTIVE char_directive -# define DIRECTIVES char_directives -# define PRINTF_PARSE printf_parse -# define DCHAR_CPY memcpy -# define DCHAR_SET memset -# endif -#endif -#if WIDE_CHAR_VERSION - /* TCHAR_T is wchar_t. */ -# define USE_SNPRINTF 1 -# if HAVE_DECL__SNWPRINTF - /* On Windows, the function swprintf() has a different signature than - on Unix; we use the function _snwprintf() or - on mingw - snwprintf() - instead. The mingw function snwprintf() has fewer bugs than the - MSVCRT function _snwprintf(), so prefer that. */ -# if defined __MINGW32__ -# define SNPRINTF snwprintf -# else -# define SNPRINTF _snwprintf -# endif -# else - /* Unix. */ -# define SNPRINTF swprintf -# endif -#else - /* TCHAR_T is char. */ - /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. - But don't use it on BeOS, since BeOS snprintf produces no output if the - size argument is >= 0x3000000. - Also don't use it on Linux libc5, since there snprintf with size = 1 - writes any output without bounds, like sprintf. */ -# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1) -# define USE_SNPRINTF 1 -# else -# define USE_SNPRINTF 0 -# endif -# if HAVE_DECL__SNPRINTF - /* Windows. The mingw function snprintf() has fewer bugs than the MSVCRT - function _snprintf(), so prefer that. */ -# if defined __MINGW32__ -# define SNPRINTF snprintf - /* Here we need to call the native snprintf, not rpl_snprintf. */ -# undef snprintf -# else -# define SNPRINTF _snprintf -# endif -# else - /* Unix. */ -# define SNPRINTF snprintf - /* Here we need to call the native snprintf, not rpl_snprintf. */ -# undef snprintf -# endif -#endif -/* Here we need to call the native sprintf, not rpl_sprintf. */ -#undef sprintf - -/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" - warnings in this file. Use -Dlint to suppress them. */ -#ifdef lint -# define IF_LINT(Code) Code -#else -# define IF_LINT(Code) /* empty */ -#endif - -/* Avoid some warnings from "gcc -Wshadow". - This file doesn't use the exp() and remainder() functions. */ -#undef exp -#define exp expo -#undef remainder -#define remainder rem - -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && !WIDE_CHAR_VERSION -# if (HAVE_STRNLEN && !defined _AIX) -# define local_strnlen strnlen -# else -# ifndef local_strnlen_defined -# define local_strnlen_defined 1 -static size_t -local_strnlen (const char *string, size_t maxlen) -{ - const char *end = memchr (string, '\0', maxlen); - return end ? (size_t) (end - string) : maxlen; -} -# endif -# endif -#endif - -#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T -# if HAVE_WCSLEN -# define local_wcslen wcslen -# else - /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid - a dependency towards this library, here is a local substitute. - Define this substitute only once, even if this file is included - twice in the same compilation unit. */ -# ifndef local_wcslen_defined -# define local_wcslen_defined 1 -static size_t -local_wcslen (const wchar_t *s) -{ - const wchar_t *ptr; - - for (ptr = s; *ptr != (wchar_t) 0; ptr++) - ; - return ptr - s; -} -# endif -# endif -#endif - -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && HAVE_WCHAR_T && WIDE_CHAR_VERSION -# if HAVE_WCSNLEN -# define local_wcsnlen wcsnlen -# else -# ifndef local_wcsnlen_defined -# define local_wcsnlen_defined 1 -static size_t -local_wcsnlen (const wchar_t *s, size_t maxlen) -{ - const wchar_t *ptr; - - for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--) - ; - return ptr - s; -} -# endif -# endif -#endif - -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL -/* Determine the decimal-point character according to the current locale. */ -# ifndef decimal_point_char_defined -# define decimal_point_char_defined 1 -static char -decimal_point_char (void) -{ - const char *point; - /* Determine it in a multithread-safe way. We know nl_langinfo is - multithread-safe on glibc systems and MacOS X systems, but is not required - to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. - localeconv() is rarely multithread-safe. */ -# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__)) - point = nl_langinfo (RADIXCHAR); -# elif 1 - char pointbuf[5]; - sprintf (pointbuf, "%#.0f", 1.0); - point = &pointbuf[1]; -# else - point = localeconv () -> decimal_point; -# endif - /* The decimal point is always a single byte: either '.' or ','. */ - return (point[0] != '\0' ? point[0] : '.'); -} -# endif -#endif - -#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL - -/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ -static int -is_infinite_or_zero (double x) -{ - return isnand (x) || x + x == x; -} - -#endif - -#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL - -/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ -static int -is_infinite_or_zerol (long double x) -{ - return isnanl (x) || x + x == x; -} - -#endif - -#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL - -/* Converting 'long double' to decimal without rare rounding bugs requires - real bignums. We use the naming conventions of GNU gmp, but vastly simpler - (and slower) algorithms. */ - -typedef unsigned int mp_limb_t; -# define GMP_LIMB_BITS 32 -verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS); - -typedef unsigned long long mp_twolimb_t; -# define GMP_TWOLIMB_BITS 64 -verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS); - -/* Representation of a bignum >= 0. */ -typedef struct -{ - size_t nlimbs; - mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ -} mpn_t; - -/* Compute the product of two bignums >= 0. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ -static void * -multiply (mpn_t src1, mpn_t src2, mpn_t *dest) -{ - const mp_limb_t *p1; - const mp_limb_t *p2; - size_t len1; - size_t len2; - - if (src1.nlimbs <= src2.nlimbs) - { - len1 = src1.nlimbs; - p1 = src1.limbs; - len2 = src2.nlimbs; - p2 = src2.limbs; - } - else - { - len1 = src2.nlimbs; - p1 = src2.limbs; - len2 = src1.nlimbs; - p2 = src1.limbs; - } - /* Now 0 <= len1 <= len2. */ - if (len1 == 0) - { - /* src1 or src2 is zero. */ - dest->nlimbs = 0; - dest->limbs = (mp_limb_t *) malloc (1); - } - else - { - /* Here 1 <= len1 <= len2. */ - size_t dlen; - mp_limb_t *dp; - size_t k, i, j; - - dlen = len1 + len2; - dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); - if (dp == NULL) - return NULL; - for (k = len2; k > 0; ) - dp[--k] = 0; - for (i = 0; i < len1; i++) - { - mp_limb_t digit1 = p1[i]; - mp_twolimb_t carry = 0; - for (j = 0; j < len2; j++) - { - mp_limb_t digit2 = p2[j]; - carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; - carry += dp[i + j]; - dp[i + j] = (mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; - } - dp[i + len2] = (mp_limb_t) carry; - } - /* Normalise. */ - while (dlen > 0 && dp[dlen - 1] == 0) - dlen--; - dest->nlimbs = dlen; - dest->limbs = dp; - } - return dest->limbs; -} - -/* Compute the quotient of a bignum a >= 0 and a bignum b > 0. - a is written as a = q * b + r with 0 <= r < b. q is the quotient, r - the remainder. - Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, - q is incremented. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ -static void * -divide (mpn_t a, mpn_t b, mpn_t *q) -{ - /* Algorithm: - First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] - with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). - If m<n, then q:=0 and r:=a. - If m>=n=1, perform a single-precision division: - r:=0, j:=m, - while j>0 do - {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = - = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta} - j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j]. - Normalise [q[m-1],...,q[0]], yields q. - If m>=n>1, perform a multiple-precision division: - We have a/b < beta^(m-n+1). - s:=intDsize-1-(highest bit in b[n-1]), 0<=s<intDsize. - Shift a and b left by s bits, copying them. r:=a. - r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2. - For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} - Compute q* : - q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). - In case of overflow (q* >= beta) set q* := beta-1. - Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] - and c3 := b[n-2] * q*. - {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow - occurred. Furthermore 0 <= c3 < beta^2. - If there was overflow and - r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, - the next test can be skipped.} - While c3 > c2, {Here 0 <= c2 < c3 < beta^2} - Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. - If q* > 0: - Put r := r - b * q* * beta^j. In detail: - [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. - hence: u:=0, for i:=0 to n-1 do - u := u + q* * b[i], - r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), - u:=u div beta (+ 1, if carry in subtraction) - r[n+j]:=r[n+j]-u. - {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 - < q* + 1 <= beta, - the carry u does not overflow.} - If a negative carry occurs, put q* := q* - 1 - and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. - Set q[j] := q*. - Normalise [q[m-n],..,q[0]]; this yields the quotient q. - Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the - rest r. - The room for q[j] can be allocated at the memory location of r[n+j]. - Finally, round-to-even: - Shift r left by 1 bit. - If r > b or if r = b and q[0] is odd, q := q+1. - */ - const mp_limb_t *a_ptr = a.limbs; - size_t a_len = a.nlimbs; - const mp_limb_t *b_ptr = b.limbs; - size_t b_len = b.nlimbs; - mp_limb_t *roomptr; - mp_limb_t *tmp_roomptr = NULL; - mp_limb_t *q_ptr; - size_t q_len; - mp_limb_t *r_ptr; - size_t r_len; - - /* Allocate room for a_len+2 digits. - (Need a_len+1 digits for the real division and 1 more digit for the - final rounding of q.) */ - roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); - if (roomptr == NULL) - return NULL; - - /* Normalise a. */ - while (a_len > 0 && a_ptr[a_len - 1] == 0) - a_len--; - - /* Normalise b. */ - for (;;) - { - if (b_len == 0) - /* Division by zero. */ - abort (); - if (b_ptr[b_len - 1] == 0) - b_len--; - else - break; - } - - /* Here m = a_len >= 0 and n = b_len > 0. */ - - if (a_len < b_len) - { - /* m<n: trivial case. q=0, r := copy of a. */ - r_ptr = roomptr; - r_len = a_len; - memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); - q_ptr = roomptr + a_len; - q_len = 0; - } - else if (b_len == 1) - { - /* n=1: single precision division. - beta^(m-1) <= a < beta^m ==> beta^(m-2) <= a/b < beta^m */ - r_ptr = roomptr; - q_ptr = roomptr + 1; - { - mp_limb_t den = b_ptr[0]; - mp_limb_t remainder = 0; - const mp_limb_t *sourceptr = a_ptr + a_len; - mp_limb_t *destptr = q_ptr + a_len; - size_t count; - for (count = a_len; count > 0; count--) - { - mp_twolimb_t num = - ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; - *--destptr = num / den; - remainder = num % den; - } - /* Normalise and store r. */ - if (remainder > 0) - { - r_ptr[0] = remainder; - r_len = 1; - } - else - r_len = 0; - /* Normalise q. */ - q_len = a_len; - if (q_ptr[q_len - 1] == 0) - q_len--; - } - } - else - { - /* n>1: multiple precision division. - beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> - beta^(m-n-1) <= a/b < beta^(m-n+1). */ - /* Determine s. */ - size_t s; - { - mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ - s = 31; - if (msd >= 0x10000) - { - msd = msd >> 16; - s -= 16; - } - if (msd >= 0x100) - { - msd = msd >> 8; - s -= 8; - } - if (msd >= 0x10) - { - msd = msd >> 4; - s -= 4; - } - if (msd >= 0x4) - { - msd = msd >> 2; - s -= 2; - } - if (msd >= 0x2) - { - msd = msd >> 1; - s -= 1; - } - } - /* 0 <= s < GMP_LIMB_BITS. - Copy b, shifting it left by s bits. */ - if (s > 0) - { - tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); - if (tmp_roomptr == NULL) - { - free (roomptr); - return NULL; - } - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = tmp_roomptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - /* accu must be zero, since that was how s was determined. */ - if (accu != 0) - abort (); - } - b_ptr = tmp_roomptr; - } - /* Copy a, shifting it left by s bits, yields r. - Memory layout: - At the beginning: r = roomptr[0..a_len], - at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ - r_ptr = roomptr; - if (s == 0) - { - memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); - r_ptr[a_len] = 0; - } - else - { - const mp_limb_t *sourceptr = a_ptr; - mp_limb_t *destptr = r_ptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = a_len; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - *destptr++ = (mp_limb_t) accu; - } - q_ptr = roomptr + b_len; - q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ - { - size_t j = a_len - b_len; /* m-n */ - mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ - mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ - mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ - ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; - /* Division loop, traversed m-n+1 times. - j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ - for (;;) - { - mp_limb_t q_star; - mp_limb_t c1; - if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ - { - /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ - mp_twolimb_t num = - ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) - | r_ptr[j + b_len - 1]; - q_star = num / b_msd; - c1 = num % b_msd; - } - else - { - /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ - q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ - /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta - <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta - <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) - {<= beta !}. - If yes, jump directly to the subtraction loop. - (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta - <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ - if (r_ptr[j + b_len] > b_msd - || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) - /* r[j+n] >= b[n-1]+1 or - r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a - carry. */ - goto subtract; - } - /* q_star = q*, - c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta). */ - { - mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */ - ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2]; - mp_twolimb_t c3 = /* b[n-2] * q* */ - (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star; - /* While c2 < c3, increase c2 and decrease c3. - Consider c3-c2. While it is > 0, decrease it by - b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 - this can happen only twice. */ - if (c3 > c2) - { - q_star = q_star - 1; /* q* := q* - 1 */ - if (c3 - c2 > b_msdd) - q_star = q_star - 1; /* q* := q* - 1 */ - } - } - if (q_star > 0) - subtract: - { - /* Subtract r := r - b * q* * beta^j. */ - mp_limb_t cr; - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = r_ptr + j; - mp_twolimb_t carry = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - /* Here 0 <= carry <= q*. */ - carry = - carry - + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ - + (mp_limb_t) ~(*destptr); - /* Here 0 <= carry <= beta*q* + beta-1. */ - *destptr++ = ~(mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; /* <= q* */ - } - cr = (mp_limb_t) carry; - } - /* Subtract cr from r_ptr[j + b_len], then forget about - r_ptr[j + b_len]. */ - if (cr > r_ptr[j + b_len]) - { - /* Subtraction gave a carry. */ - q_star = q_star - 1; /* q* := q* - 1 */ - /* Add b back. */ - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = r_ptr + j; - mp_limb_t carry = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - mp_limb_t source1 = *sourceptr++; - mp_limb_t source2 = *destptr; - *destptr++ = source1 + source2 + carry; - carry = - (carry - ? source1 >= (mp_limb_t) ~source2 - : source1 > (mp_limb_t) ~source2); - } - } - /* Forget about the carry and about r[j+n]. */ - } - } - /* q* is determined. Store it as q[j]. */ - q_ptr[j] = q_star; - if (j == 0) - break; - j--; - } - } - r_len = b_len; - /* Normalise q. */ - if (q_ptr[q_len - 1] == 0) - q_len--; -# if 0 /* Not needed here, since we need r only to compare it with b/2, and - b is shifted left by s bits. */ - /* Shift r right by s bits. */ - if (s > 0) - { - mp_limb_t ptr = r_ptr + r_len; - mp_twolimb_t accu = 0; - size_t count; - for (count = r_len; count > 0; count--) - { - accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; - accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); - *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); - } - } -# endif - /* Normalise r. */ - while (r_len > 0 && r_ptr[r_len - 1] == 0) - r_len--; - } - /* Compare r << 1 with b. */ - if (r_len > b_len) - goto increment_q; - { - size_t i; - for (i = b_len;;) - { - mp_limb_t r_i = - (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) - | (i < r_len ? r_ptr[i] << 1 : 0); - mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); - if (r_i > b_i) - goto increment_q; - if (r_i < b_i) - goto keep_q; - if (i == 0) - break; - i--; - } - } - if (q_len > 0 && ((q_ptr[0] & 1) != 0)) - /* q is odd. */ - increment_q: - { - size_t i; - for (i = 0; i < q_len; i++) - if (++(q_ptr[i]) != 0) - goto keep_q; - q_ptr[q_len++] = 1; - } - keep_q: - if (tmp_roomptr != NULL) - free (tmp_roomptr); - q->limbs = q_ptr; - q->nlimbs = q_len; - return roomptr; -} - -/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal - representation. - Destroys the contents of a. - Return the allocated memory - containing the decimal digits in low-to-high - order, terminated with a NUL character - in case of success, NULL in case - of memory allocation failure. */ -static char * -convert_to_decimal (mpn_t a, size_t extra_zeroes) -{ - mp_limb_t *a_ptr = a.limbs; - size_t a_len = a.nlimbs; - /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ - size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); - char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes)); - if (c_ptr != NULL) - { - char *d_ptr = c_ptr; - for (; extra_zeroes > 0; extra_zeroes--) - *d_ptr++ = '0'; - while (a_len > 0) - { - /* Divide a by 10^9, in-place. */ - mp_limb_t remainder = 0; - mp_limb_t *ptr = a_ptr + a_len; - size_t count; - for (count = a_len; count > 0; count--) - { - mp_twolimb_t num = - ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; - *ptr = num / 1000000000; - remainder = num % 1000000000; - } - /* Store the remainder as 9 decimal digits. */ - for (count = 9; count > 0; count--) - { - *d_ptr++ = '0' + (remainder % 10); - remainder = remainder / 10; - } - /* Normalize a. */ - if (a_ptr[a_len - 1] == 0) - a_len--; - } - /* Remove leading zeroes. */ - while (d_ptr > c_ptr && d_ptr[-1] == '0') - d_ptr--; - /* But keep at least one zero. */ - if (d_ptr == c_ptr) - *d_ptr++ = '0'; - /* Terminate the string. */ - *d_ptr = '\0'; - } - return c_ptr; -} - -# if NEED_PRINTF_LONG_DOUBLE - -/* Assuming x is finite and >= 0: - write x as x = 2^e * m, where m is a bignum. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ -static void * -decode_long_double (long double x, int *ep, mpn_t *mp) -{ - mpn_t m; - int exp; - long double y; - size_t i; - - /* Allocate memory for result. */ - m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; - m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); - if (m.limbs == NULL) - return NULL; - /* Split into exponential part and mantissa. */ - y = frexpl (x, &exp); - if (!(y >= 0.0L && y < 1.0L)) - abort (); - /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the - latter is an integer. */ - /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. - I'm not sure whether it's safe to cast a 'long double' value between - 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only - 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', - doesn't matter). */ -# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 -# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 - { - mp_limb_t hi, lo; - y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); - hi = (int) y; - y -= hi; - if (!(y >= 0.0L && y < 1.0L)) - abort (); - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - lo = (int) y; - y -= lo; - if (!(y >= 0.0L && y < 1.0L)) - abort (); - m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; - } -# else - { - mp_limb_t d; - y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); - d = (int) y; - y -= d; - if (!(y >= 0.0L && y < 1.0L)) - abort (); - m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; - } -# endif -# endif - for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) - { - mp_limb_t hi, lo; - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - hi = (int) y; - y -= hi; - if (!(y >= 0.0L && y < 1.0L)) - abort (); - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - lo = (int) y; - y -= lo; - if (!(y >= 0.0L && y < 1.0L)) - 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 (!(y == 0.0L)) - abort (); -#endif - /* Normalise. */ - while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) - m.nlimbs--; - *mp = m; - *ep = exp - LDBL_MANT_BIT; - return m.limbs; -} - -# endif - -# if NEED_PRINTF_DOUBLE - -/* Assuming x is finite and >= 0: - write x as x = 2^e * m, where m is a bignum. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ -static void * -decode_double (double x, int *ep, mpn_t *mp) -{ - mpn_t m; - int exp; - double y; - size_t i; - - /* Allocate memory for result. */ - m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; - m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); - if (m.limbs == NULL) - return NULL; - /* Split into exponential part and mantissa. */ - y = frexp (x, &exp); - if (!(y >= 0.0 && y < 1.0)) - abort (); - /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the - latter is an integer. */ - /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. - I'm not sure whether it's safe to cast a 'double' value between - 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only - 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', - doesn't matter). */ -# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 -# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 - { - mp_limb_t hi, lo; - y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); - hi = (int) y; - y -= hi; - if (!(y >= 0.0 && y < 1.0)) - abort (); - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - lo = (int) y; - y -= lo; - if (!(y >= 0.0 && y < 1.0)) - abort (); - m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; - } -# else - { - mp_limb_t d; - y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); - d = (int) y; - y -= d; - if (!(y >= 0.0 && y < 1.0)) - abort (); - m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; - } -# endif -# endif - for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) - { - mp_limb_t hi, lo; - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - hi = (int) y; - y -= hi; - if (!(y >= 0.0 && y < 1.0)) - abort (); - y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); - lo = (int) y; - y -= lo; - if (!(y >= 0.0 && y < 1.0)) - abort (); - m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; - } - if (!(y == 0.0)) - abort (); - /* Normalise. */ - while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) - m.nlimbs--; - *mp = m; - *ep = exp - DBL_MANT_BIT; - return m.limbs; -} - -# endif - -/* Assuming x = 2^e * m is finite and >= 0, and n is an integer: - Returns the decimal representation of round (x * 10^n). - Return the allocated memory - containing the decimal digits in low-to-high - order, terminated with a NUL character - in case of success, NULL in case - of memory allocation failure. */ -static char * -scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) -{ - int s; - size_t extra_zeroes; - unsigned int abs_n; - unsigned int abs_s; - mp_limb_t *pow5_ptr; - size_t pow5_len; - unsigned int s_limbs; - unsigned int s_bits; - mpn_t pow5; - mpn_t z; - void *z_memory; - char *digits; - - if (memory == NULL) - return NULL; - /* x = 2^e * m, hence - y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) - = round (2^s * 5^n * m). */ - s = e + n; - extra_zeroes = 0; - /* Factor out a common power of 10 if possible. */ - if (s > 0 && n > 0) - { - extra_zeroes = (s < n ? s : n); - s -= extra_zeroes; - n -= extra_zeroes; - } - /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. - Before converting to decimal, we need to compute - z = round (2^s * 5^n * m). */ - /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same - sign. 2.322 is slightly larger than log(5)/log(2). */ - abs_n = (n >= 0 ? n : -n); - abs_s = (s >= 0 ? s : -s); - pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 - + abs_s / GMP_LIMB_BITS + 1) - * sizeof (mp_limb_t)); - if (pow5_ptr == NULL) - { - free (memory); - return NULL; - } - /* Initialize with 1. */ - pow5_ptr[0] = 1; - pow5_len = 1; - /* Multiply with 5^|n|. */ - if (abs_n > 0) - { - static mp_limb_t const small_pow5[13 + 1] = - { - 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, - 48828125, 244140625, 1220703125 - }; - unsigned int n13; - for (n13 = 0; n13 <= abs_n; n13 += 13) - { - mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; - size_t j; - mp_twolimb_t carry = 0; - for (j = 0; j < pow5_len; j++) - { - mp_limb_t digit2 = pow5_ptr[j]; - carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; - pow5_ptr[j] = (mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; - } - if (carry > 0) - pow5_ptr[pow5_len++] = (mp_limb_t) carry; - } - } - s_limbs = abs_s / GMP_LIMB_BITS; - s_bits = abs_s % GMP_LIMB_BITS; - if (n >= 0 ? s >= 0 : s <= 0) - { - /* Multiply with 2^|s|. */ - if (s_bits > 0) - { - mp_limb_t *ptr = pow5_ptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = pow5_len; count > 0; count--) - { - accu += (mp_twolimb_t) *ptr << s_bits; - *ptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - if (accu > 0) - { - *ptr = (mp_limb_t) accu; - pow5_len++; - } - } - if (s_limbs > 0) - { - size_t count; - for (count = pow5_len; count > 0;) - { - count--; - pow5_ptr[s_limbs + count] = pow5_ptr[count]; - } - for (count = s_limbs; count > 0;) - { - count--; - pow5_ptr[count] = 0; - } - pow5_len += s_limbs; - } - pow5.limbs = pow5_ptr; - pow5.nlimbs = pow5_len; - if (n >= 0) - { - /* Multiply m with pow5. No division needed. */ - z_memory = multiply (m, pow5, &z); - } - else - { - /* Divide m by pow5 and round. */ - z_memory = divide (m, pow5, &z); - } - } - else - { - pow5.limbs = pow5_ptr; - pow5.nlimbs = pow5_len; - if (n >= 0) - { - /* n >= 0, s < 0. - Multiply m with pow5, then divide by 2^|s|. */ - mpn_t numerator; - mpn_t denominator; - void *tmp_memory; - tmp_memory = multiply (m, pow5, &numerator); - if (tmp_memory == NULL) - { - free (pow5_ptr); - free (memory); - return NULL; - } - /* Construct 2^|s|. */ - { - mp_limb_t *ptr = pow5_ptr + pow5_len; - size_t i; - for (i = 0; i < s_limbs; i++) - ptr[i] = 0; - ptr[s_limbs] = (mp_limb_t) 1 << s_bits; - denominator.limbs = ptr; - denominator.nlimbs = s_limbs + 1; - } - z_memory = divide (numerator, denominator, &z); - free (tmp_memory); - } - else - { - /* n < 0, s > 0. - Multiply m with 2^s, then divide by pow5. */ - mpn_t numerator; - mp_limb_t *num_ptr; - num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) - * sizeof (mp_limb_t)); - if (num_ptr == NULL) - { - free (pow5_ptr); - free (memory); - return NULL; - } - { - mp_limb_t *destptr = num_ptr; - { - size_t i; - for (i = 0; i < s_limbs; i++) - *destptr++ = 0; - } - if (s_bits > 0) - { - const mp_limb_t *sourceptr = m.limbs; - mp_twolimb_t accu = 0; - size_t count; - for (count = m.nlimbs; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s_bits; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - if (accu > 0) - *destptr++ = (mp_limb_t) accu; - } - else - { - const mp_limb_t *sourceptr = m.limbs; - size_t count; - for (count = m.nlimbs; count > 0; count--) - *destptr++ = *sourceptr++; - } - numerator.limbs = num_ptr; - numerator.nlimbs = destptr - num_ptr; - } - z_memory = divide (numerator, pow5, &z); - free (num_ptr); - } - } - free (pow5_ptr); - free (memory); - - /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ - - if (z_memory == NULL) - return NULL; - digits = convert_to_decimal (z, extra_zeroes); - free (z_memory); - return digits; -} - -# if NEED_PRINTF_LONG_DOUBLE - -/* Assuming x is finite and >= 0, and n is an integer: - Returns the decimal representation of round (x * 10^n). - Return the allocated memory - containing the decimal digits in low-to-high - order, terminated with a NUL character - in case of success, NULL in case - of memory allocation failure. */ -static char * -scale10_round_decimal_long_double (long double x, int n) -{ - int e IF_LINT(= 0); - mpn_t m; - void *memory = decode_long_double (x, &e, &m); - return scale10_round_decimal_decoded (e, m, memory, n); -} - -# endif - -# if NEED_PRINTF_DOUBLE - -/* Assuming x is finite and >= 0, and n is an integer: - Returns the decimal representation of round (x * 10^n). - Return the allocated memory - containing the decimal digits in low-to-high - order, terminated with a NUL character - in case of success, NULL in case - of memory allocation failure. */ -static char * -scale10_round_decimal_double (double x, int n) -{ - int e IF_LINT(= 0); - mpn_t m; - void *memory = decode_double (x, &e, &m); - return scale10_round_decimal_decoded (e, m, memory, n); -} - -# endif - -# if NEED_PRINTF_LONG_DOUBLE - -/* Assuming x is finite and > 0: - Return an approximation for n with 10^n <= x < 10^(n+1). - The approximation is usually the right n, but may be off by 1 sometimes. */ -static int -floorlog10l (long double x) -{ - int exp; - long double y; - double z; - double l; - - /* Split into exponential part and mantissa. */ - y = frexpl (x, &exp); - if (!(y >= 0.0L && y < 1.0L)) - abort (); - if (y == 0.0L) - return INT_MIN; - if (y < 0.5L) - { - while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) - { - y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); - exp -= GMP_LIMB_BITS; - } - if (y < (1.0L / (1 << 16))) - { - y *= 1.0L * (1 << 16); - exp -= 16; - } - if (y < (1.0L / (1 << 8))) - { - y *= 1.0L * (1 << 8); - exp -= 8; - } - if (y < (1.0L / (1 << 4))) - { - y *= 1.0L * (1 << 4); - exp -= 4; - } - if (y < (1.0L / (1 << 2))) - { - y *= 1.0L * (1 << 2); - exp -= 2; - } - if (y < (1.0L / (1 << 1))) - { - y *= 1.0L * (1 << 1); - exp -= 1; - } - } - if (!(y >= 0.5L && y < 1.0L)) - abort (); - /* Compute an approximation for l = log2(x) = exp + log2(y). */ - l = exp; - z = y; - if (z < 0.70710678118654752444) - { - z *= 1.4142135623730950488; - l -= 0.5; - } - if (z < 0.8408964152537145431) - { - z *= 1.1892071150027210667; - l -= 0.25; - } - if (z < 0.91700404320467123175) - { - z *= 1.0905077326652576592; - l -= 0.125; - } - if (z < 0.9576032806985736469) - { - z *= 1.0442737824274138403; - l -= 0.0625; - } - /* Now 0.95 <= z <= 1.01. */ - z = 1 - z; - /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) - Four terms are enough to get an approximation with error < 10^-7. */ - l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); - /* Finally multiply with log(2)/log(10), yields an approximation for - log10(x). */ - l *= 0.30102999566398119523; - /* Round down to the next integer. */ - return (int) l + (l < 0 ? -1 : 0); -} - -# endif - -# if NEED_PRINTF_DOUBLE - -/* Assuming x is finite and > 0: - Return an approximation for n with 10^n <= x < 10^(n+1). - The approximation is usually the right n, but may be off by 1 sometimes. */ -static int -floorlog10 (double x) -{ - int exp; - double y; - double z; - double l; - - /* Split into exponential part and mantissa. */ - y = frexp (x, &exp); - if (!(y >= 0.0 && y < 1.0)) - abort (); - if (y == 0.0) - return INT_MIN; - if (y < 0.5) - { - while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) - { - y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); - exp -= GMP_LIMB_BITS; - } - if (y < (1.0 / (1 << 16))) - { - y *= 1.0 * (1 << 16); - exp -= 16; - } - if (y < (1.0 / (1 << 8))) - { - y *= 1.0 * (1 << 8); - exp -= 8; - } - if (y < (1.0 / (1 << 4))) - { - y *= 1.0 * (1 << 4); - exp -= 4; - } - if (y < (1.0 / (1 << 2))) - { - y *= 1.0 * (1 << 2); - exp -= 2; - } - if (y < (1.0 / (1 << 1))) - { - y *= 1.0 * (1 << 1); - exp -= 1; - } - } - if (!(y >= 0.5 && y < 1.0)) - abort (); - /* Compute an approximation for l = log2(x) = exp + log2(y). */ - l = exp; - z = y; - if (z < 0.70710678118654752444) - { - z *= 1.4142135623730950488; - l -= 0.5; - } - if (z < 0.8408964152537145431) - { - z *= 1.1892071150027210667; - l -= 0.25; - } - if (z < 0.91700404320467123175) - { - z *= 1.0905077326652576592; - l -= 0.125; - } - if (z < 0.9576032806985736469) - { - z *= 1.0442737824274138403; - l -= 0.0625; - } - /* Now 0.95 <= z <= 1.01. */ - z = 1 - z; - /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) - Four terms are enough to get an approximation with error < 10^-7. */ - l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); - /* Finally multiply with log(2)/log(10), yields an approximation for - log10(x). */ - l *= 0.30102999566398119523; - /* Round down to the next integer. */ - return (int) l + (l < 0 ? -1 : 0); -} - -# endif - -/* Tests whether a string of digits consists of exactly PRECISION zeroes and - a single '1' digit. */ -static int -is_borderline (const char *digits, size_t precision) -{ - for (; precision > 0; precision--, digits++) - if (*digits != '0') - return 0; - if (*digits != '1') - return 0; - digits++; - return *digits == '\0'; -} - -#endif - -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 - -/* Use a different function name, to make it possible that the 'wchar_t' - parametrization and the 'char' parametrization get compiled in the same - translation unit. */ -# if WIDE_CHAR_VERSION -# define MAX_ROOM_NEEDED wmax_room_needed -# else -# define MAX_ROOM_NEEDED max_room_needed -# endif - -/* Returns the number of TCHAR_T units needed as temporary space for the result - of sprintf or SNPRINTF of a single conversion directive. */ -static inline size_t -MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, - arg_type type, int flags, size_t width, int has_precision, - size_t precision, int pad_ourselves) -{ - size_t tmp_length; - - switch (conversion) - { - case 'd': case 'i': case 'u': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Multiply by 2, as an estimate for FLAG_GROUP. */ - tmp_length = xsum (tmp_length, tmp_length); - /* Add 1, to account for a leading sign. */ - tmp_length = xsum (tmp_length, 1); - break; - - case 'o': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Add 1, to account for a leading sign. */ - tmp_length = xsum (tmp_length, 1); - break; - - case 'x': case 'X': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Add 2, to account for a leading sign or alternate form. */ - tmp_length = xsum (tmp_length, 2); - break; - - case 'f': case 'F': - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) (LDBL_MAX_EXP - * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ - ) - + 1 /* turn floor into ceil */ - + 10; /* sign, decimal point etc. */ - else - tmp_length = - (unsigned int) (DBL_MAX_EXP - * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ - ) - + 1 /* turn floor into ceil */ - + 10; /* sign, decimal point etc. */ - tmp_length = xsum (tmp_length, precision); - break; - - case 'e': case 'E': case 'g': case 'G': - tmp_length = - 12; /* sign, decimal point, exponent etc. */ - tmp_length = xsum (tmp_length, precision); - break; - - case 'a': case 'A': - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) (LDBL_DIG - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (DBL_DIG - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - break; - - case 'c': -# if HAVE_WINT_T && !WIDE_CHAR_VERSION - if (type == TYPE_WIDE_CHAR) - tmp_length = MB_CUR_MAX; - else -# endif - tmp_length = 1; - break; - - case 's': -# if HAVE_WCHAR_T - if (type == TYPE_WIDE_STRING) - { -# if WIDE_CHAR_VERSION - /* ISO C says about %ls in fwprintf: - "If the precision is not specified or is greater than the size - of the array, the array shall contain a null wide character." - So if there is a precision, we must not use wcslen. */ - const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; - - if (has_precision) - tmp_length = local_wcsnlen (arg, precision); - else - tmp_length = local_wcslen (arg); -# else - /* ISO C says about %ls in fprintf: - "If a precision is specified, no more than that many bytes are - written (including shift sequences, if any), and the array - shall contain a null wide character if, to equal the multibyte - character sequence length given by the precision, the function - would need to access a wide character one past the end of the - array." - So if there is a precision, we must not use wcslen. */ - /* This case has already been handled separately in VASNPRINTF. */ - abort (); -# endif - } - else -# endif - { -# if WIDE_CHAR_VERSION - /* ISO C says about %s in fwprintf: - "If the precision is not specified or is greater than the size - of the converted array, the converted array shall contain a - null wide character." - So if there is a precision, we must not use strlen. */ - /* This case has already been handled separately in VASNPRINTF. */ - abort (); -# else - /* ISO C says about %s in fprintf: - "If the precision is not specified or greater than the size of - the array, the array shall contain a null character." - So if there is a precision, we must not use strlen. */ - const char *arg = ap->arg[arg_index].a.a_string; - - if (has_precision) - tmp_length = local_strnlen (arg, precision); - else - tmp_length = strlen (arg); -# endif - } - break; - - case 'p': - tmp_length = - (unsigned int) (sizeof (void *) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1 /* turn floor into ceil */ - + 2; /* account for leading 0x */ - break; - - default: - abort (); - } - - if (!pad_ourselves) - { -# if ENABLE_UNISTDIO - /* Padding considers the number of characters, therefore the number of - elements after padding may be - > max (tmp_length, width) - but is certainly - <= tmp_length + width. */ - tmp_length = xsum (tmp_length, width); -# else - /* Padding considers the number of elements, says POSIX. */ - if (tmp_length < width) - tmp_length = width; -# endif - } - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - - return tmp_length; -} - -#endif - -DCHAR_T * -VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, - const FCHAR_T *format, va_list args) -{ - DIRECTIVES d; - arguments a; - - if (PRINTF_PARSE (format, &d, &a) < 0) - /* errno is already set. */ - return NULL; - -#define CLEANUP() \ - free (d.dir); \ - if (a.arg) \ - free (a.arg); - - if (PRINTF_FETCHARGS (args, &a) < 0) - { - CLEANUP (); - errno = EINVAL; - return NULL; - } - - { - size_t buf_neededlength; - TCHAR_T *buf; - TCHAR_T *buf_malloced; - const FCHAR_T *cp; - size_t i; - DIRECTIVE *dp; - /* Output string accumulator. */ - DCHAR_T *result; - size_t allocated; - size_t length; - - /* Allocate a small buffer that will hold a directive passed to - sprintf or snprintf. */ - buf_neededlength = - xsum4 (7, d.max_width_length, d.max_precision_length, 6); -#if HAVE_ALLOCA - if (buf_neededlength < 4000 / sizeof (TCHAR_T)) - { - buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); - buf_malloced = NULL; - } - else -#endif - { - size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); - if (size_overflow_p (buf_memsize)) - goto out_of_memory_1; - buf = (TCHAR_T *) malloc (buf_memsize); - if (buf == NULL) - goto out_of_memory_1; - buf_malloced = buf; - } - - if (resultbuf != NULL) - { - result = resultbuf; - allocated = *lengthp; - } - else - { - result = NULL; - allocated = 0; - } - length = 0; - /* Invariants: - result is either == resultbuf or == NULL or malloc-allocated. - If length > 0, then result != NULL. */ - - /* Ensures that allocated >= needed. Aborts through a jump to - out_of_memory if needed is SIZE_MAX or otherwise too big. */ -#define ENSURE_ALLOCATION(needed) \ - if ((needed) > allocated) \ - { \ - size_t memory_size; \ - DCHAR_T *memory; \ - \ - allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ - if ((needed) > allocated) \ - allocated = (needed); \ - memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ - if (size_overflow_p (memory_size)) \ - goto out_of_memory; \ - if (result == resultbuf || result == NULL) \ - memory = (DCHAR_T *) malloc (memory_size); \ - else \ - memory = (DCHAR_T *) realloc (result, memory_size); \ - if (memory == NULL) \ - goto out_of_memory; \ - if (result == resultbuf && length > 0) \ - DCHAR_CPY (memory, result, length); \ - result = memory; \ - } - - for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) - { - if (cp != dp->dir_start) - { - size_t n = dp->dir_start - cp; - size_t augmented_length = xsum (length, n); - - ENSURE_ALLOCATION (augmented_length); - /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we - need that the format string contains only ASCII characters - if FCHAR_T and DCHAR_T are not the same type. */ - if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) - { - DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); - length = augmented_length; - } - else - { - do - result[length++] = (unsigned char) *cp++; - while (--n > 0); - } - } - if (i == d.count) - break; - - /* Execute a single directive. */ - if (dp->conversion == '%') - { - size_t augmented_length; - - if (!(dp->arg_index == ARG_NONE)) - abort (); - augmented_length = xsum (length, 1); - ENSURE_ALLOCATION (augmented_length); - result[length] = '%'; - length = augmented_length; - } - else - { - if (!(dp->arg_index != ARG_NONE)) - abort (); - - if (dp->conversion == 'n') - { - switch (a.arg[dp->arg_index].type) - { - case TYPE_COUNT_SCHAR_POINTER: - *a.arg[dp->arg_index].a.a_count_schar_pointer = length; - break; - case TYPE_COUNT_SHORT_POINTER: - *a.arg[dp->arg_index].a.a_count_short_pointer = length; - break; - case TYPE_COUNT_INT_POINTER: - *a.arg[dp->arg_index].a.a_count_int_pointer = length; - break; - case TYPE_COUNT_LONGINT_POINTER: - *a.arg[dp->arg_index].a.a_count_longint_pointer = length; - break; -#if HAVE_LONG_LONG_INT - case TYPE_COUNT_LONGLONGINT_POINTER: - *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; - break; -#endif - default: - abort (); - } - } -#if ENABLE_UNISTDIO - /* The unistdio extensions. */ - else if (dp->conversion == 'U') - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - switch (type) - { - case TYPE_U8_STRING: - { - const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; - const uint8_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u8_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u8_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u8_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - -# if DCHAR_IS_UINT8_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } -# else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; -# if DCHAR_IS_TCHAR - /* Convert from UTF-8 to locale encoding. */ - converted = - u8_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); -# else - /* Convert from UTF-8 to UTF-16/UTF-32. */ - converted = - U8_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); -# endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } -# endif - - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - case TYPE_U16_STRING: - { - const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; - const uint16_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u16_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u16_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u16_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - -# if DCHAR_IS_UINT16_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } -# else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; -# if DCHAR_IS_TCHAR - /* Convert from UTF-16 to locale encoding. */ - converted = - u16_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); -# else - /* Convert from UTF-16 to UTF-8/UTF-32. */ - converted = - U16_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); -# endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } -# endif - - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - case TYPE_U32_STRING: - { - const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; - const uint32_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u32_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u32_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u32_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - -# if DCHAR_IS_UINT32_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } -# else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; -# if DCHAR_IS_TCHAR - /* Convert from UTF-32 to locale encoding. */ - converted = - u32_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); -# else - /* Convert from UTF-32 to UTF-8/UTF-16. */ - converted = - U32_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); -# endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } -# endif - - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - default: - abort (); - } - } -#endif -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T - else if (dp->conversion == 's' -# if WIDE_CHAR_VERSION - && a.arg[dp->arg_index].type != TYPE_WIDE_STRING -# else - && a.arg[dp->arg_index].type == TYPE_WIDE_STRING -# endif - ) - { - /* The normal handling of the 's' directive below requires - allocating a temporary buffer. The determination of its - length (tmp_length), in the case when a precision is - specified, below requires a conversion between a char[] - string and a wchar_t[] wide string. It could be done, but - we have no guarantee that the implementation of sprintf will - use the exactly same algorithm. Without this guarantee, it - is possible to have buffer overrun bugs. In order to avoid - such bugs, we implement the entire processing of the 's' - directive ourselves. */ - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 6; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - -# if WIDE_CHAR_VERSION - /* %s in vasnwprintf. See the specification of fwprintf. */ - { - const char *arg = a.arg[dp->arg_index].a.a_string; - const char *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only as many bytes as needed to produce PRECISION - wide characters, from the left. */ -# if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count; -# if HAVE_MBRTOWC - count = mbrlen (arg_end, MB_CUR_MAX, &state); -# else - count = mblen (arg_end, MB_CUR_MAX); -# endif - if (count == 0) - /* Found the terminating NUL. */ - break; - if (count < 0) - { - /* Invalid or incomplete multibyte character. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of wide - characters. */ -# if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - arg_end = arg; - characters = 0; - for (;;) - { - int count; -# if HAVE_MBRTOWC - count = mbrlen (arg_end, MB_CUR_MAX, &state); -# else - count = mblen (arg_end, MB_CUR_MAX); -# endif - if (count == 0) - /* Found the terminating NUL. */ - break; - if (count < 0) - { - /* Invalid or incomplete multibyte character. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - - if (has_precision || has_width) - { - /* We know the number of wide characters in advance. */ - size_t remaining; -# if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - ENSURE_ALLOCATION (xsum (length, characters)); - for (remaining = characters; remaining > 0; remaining--) - { - wchar_t wc; - int count; -# if HAVE_MBRTOWC - count = mbrtowc (&wc, arg, arg_end - arg, &state); -# else - count = mbtowc (&wc, arg, arg_end - arg); -# endif - if (count <= 0) - /* mbrtowc not consistent with mbrlen, or mbtowc - not consistent with mblen. */ - abort (); - result[length++] = wc; - arg += count; - } - if (!(arg == arg_end)) - abort (); - } - else - { -# if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - while (arg < arg_end) - { - wchar_t wc; - int count; -# if HAVE_MBRTOWC - count = mbrtowc (&wc, arg, arg_end - arg, &state); -# else - count = mbtowc (&wc, arg, arg_end - arg); -# endif - if (count <= 0) - /* mbrtowc not consistent with mbrlen, or mbtowc - not consistent with mblen. */ - abort (); - ENSURE_ALLOCATION (xsum (length, 1)); - result[length++] = wc; - arg += count; - } - } - - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } -# else - /* %ls in vasnprintf. See the specification of fprintf. */ - { - const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; - const wchar_t *arg_end; - size_t characters; -# if !DCHAR_IS_TCHAR - /* This code assumes that TCHAR_T is 'char'. */ - verify (sizeof (TCHAR_T) == 1); - TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t tmpdst_len; -# endif - size_t w; - - if (has_precision) - { - /* Use only as many wide characters as needed to produce - at most PRECISION bytes, from the left. */ -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - arg_end = arg; - characters = 0; - while (precision > 0) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg_end == 0) - /* Found the terminating null wide character. */ - break; -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - count = wcrtomb (cbuf, *arg_end, &state); -# else - count = wctomb (cbuf, *arg_end); -# endif - if (count < 0) - { - /* Cannot convert. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - if (precision < count) - break; - arg_end++; - characters += count; - precision -= count; - } - } -# if DCHAR_IS_TCHAR - else if (has_width) -# else - else -# endif - { - /* Use the entire string, and count the number of - bytes. */ -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - arg_end = arg; - characters = 0; - for (;;) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg_end == 0) - /* Found the terminating null wide character. */ - break; -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - count = wcrtomb (cbuf, *arg_end, &state); -# else - count = wctomb (cbuf, *arg_end); -# endif - if (count < 0) - { - /* Cannot convert. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end++; - characters += count; - } - } -# if DCHAR_IS_TCHAR - else - { - /* Use the entire string. */ - arg_end = arg + local_wcslen (arg); - /* The number of bytes doesn't matter. */ - characters = 0; - } -# endif - -# if !DCHAR_IS_TCHAR - /* Convert the string into a piece of temporary memory. */ - tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); - if (tmpsrc == NULL) - goto out_of_memory; - { - TCHAR_T *tmpptr = tmpsrc; - size_t remaining; -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - for (remaining = characters; remaining > 0; ) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - count = wcrtomb (cbuf, *arg, &state); -# else - count = wctomb (cbuf, *arg); -# endif - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (tmpptr, cbuf, count); - tmpptr += count; - arg++; - remaining -= count; - } - if (!(arg == arg_end)) - abort (); - } - - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, characters, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - { - int saved_errno = errno; - free (tmpsrc); - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - free (tmpsrc); -# endif - - if (has_width) - { -# if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width - against the number of _characters_ of the converted - value. */ - w = DCHAR_MBSNLEN (result + length, characters); -# else - /* The width is compared against the number of _bytes_ - of the converted value, says POSIX. */ - w = characters; -# endif - } - else - /* w doesn't matter. */ - w = 0; - - if (has_width && width > w - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - w; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - -# if DCHAR_IS_TCHAR - if (has_precision || has_width) - { - /* We know the number of bytes in advance. */ - size_t remaining; -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - ENSURE_ALLOCATION (xsum (length, characters)); - for (remaining = characters; remaining > 0; ) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - count = wcrtomb (cbuf, *arg, &state); -# else - count = wctomb (cbuf, *arg); -# endif - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (result + length, cbuf, count); - length += count; - arg++; - remaining -= count; - } - if (!(arg == arg_end)) - abort (); - } - else - { -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); -# endif - while (arg < arg_end) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - count = wcrtomb (cbuf, *arg, &state); -# else - count = wctomb (cbuf, *arg); -# endif - if (count <= 0) - { - /* Cannot convert. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - ENSURE_ALLOCATION (xsum (length, count)); - memcpy (result + length, cbuf, count); - length += count; - arg++; - } - } -# else - ENSURE_ALLOCATION (xsum (length, tmpdst_len)); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - length += tmpdst_len; -# endif - - if (has_width && width > w - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - w; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } -# endif - } -#endif -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL - else if ((dp->conversion == 'a' || dp->conversion == 'A') -# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) - && (0 -# if NEED_PRINTF_DOUBLE - || a.arg[dp->arg_index].type == TYPE_DOUBLE -# endif -# if NEED_PRINTF_LONG_DOUBLE - || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE -# endif - ) -# endif - ) - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - size_t tmp_length; - DCHAR_T tmpbuf[700]; - DCHAR_T *tmp; - DCHAR_T *pad_ptr; - DCHAR_T *p; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - /* Allocate a temporary buffer of sufficient size. */ - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) ((LDBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) ((DBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - - if (tmp_length < width) - tmp_length = width; - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - - if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); - - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (DCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } - - pad_ptr = NULL; - p = tmp; - if (type == TYPE_LONGDOUBLE) - { -# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE - long double arg = a.arg[dp->arg_index].a.a_longdouble; - - if (isnanl (arg)) - { - if (dp->conversion == 'A') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - DECL_LONG_DOUBLE_ROUNDING - - BEGIN_LONG_DOUBLE_ROUNDING (); - - if (signbit (arg)) /* arg < 0.0L or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0L && arg + arg == arg) - { - if (dp->conversion == 'A') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { - int exponent; - long double mantissa; - - if (arg > 0.0L) - mantissa = printf_frexpl (arg, &exponent); - else - { - exponent = 0; - mantissa = 0.0L; - } - - if (has_precision - && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) - { - /* Round the mantissa. */ - long double tail = mantissa; - size_t q; - - for (q = precision; ; q--) - { - int digit = (int) tail; - tail -= digit; - if (q == 0) - { - if (digit & 1 ? tail >= 0.5L : tail > 0.5L) - tail = 1 - tail; - else - tail = - tail; - break; - } - tail *= 16.0L; - } - if (tail != 0.0L) - for (q = precision; q > 0; q--) - tail *= 0.0625L; - mantissa += tail; - } - - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - { - int digit; - - digit = (int) mantissa; - mantissa -= digit; - *p++ = '0' + digit; - if ((flags & FLAG_ALT) - || mantissa > 0.0L || precision > 0) - { - *p++ = decimal_point_char (); - /* This loop terminates because we assume - that FLT_RADIX is a power of 2. */ - while (mantissa > 0.0L) - { - mantissa *= 16.0L; - digit = (int) mantissa; - mantissa -= digit; - *p++ = digit - + (digit < 10 - ? '0' - : dp->conversion - 10); - if (precision > 0) - precision--; - } - while (precision > 0) - { - *p++ = '0'; - precision--; - } - } - } - *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } -# endif - } - - END_LONG_DOUBLE_ROUNDING (); - } -# else - abort (); -# endif - } - else - { -# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE - double arg = a.arg[dp->arg_index].a.a_double; - - if (isnand (arg)) - { - if (dp->conversion == 'A') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - - if (signbit (arg)) /* arg < 0.0 or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0 && arg + arg == arg) - { - if (dp->conversion == 'A') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { - int exponent; - double mantissa; - - if (arg > 0.0) - mantissa = printf_frexp (arg, &exponent); - else - { - exponent = 0; - mantissa = 0.0; - } - - if (has_precision - && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) - { - /* Round the mantissa. */ - double tail = mantissa; - size_t q; - - for (q = precision; ; q--) - { - int digit = (int) tail; - tail -= digit; - if (q == 0) - { - if (digit & 1 ? tail >= 0.5 : tail > 0.5) - tail = 1 - tail; - else - tail = - tail; - break; - } - tail *= 16.0; - } - if (tail != 0.0) - for (q = precision; q > 0; q--) - tail *= 0.0625; - mantissa += tail; - } - - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - { - int digit; - - digit = (int) mantissa; - mantissa -= digit; - *p++ = '0' + digit; - if ((flags & FLAG_ALT) - || mantissa > 0.0 || precision > 0) - { - *p++ = decimal_point_char (); - /* This loop terminates because we assume - that FLT_RADIX is a power of 2. */ - while (mantissa > 0.0) - { - mantissa *= 16.0; - digit = (int) mantissa; - mantissa -= digit; - *p++ = digit - + (digit < 10 - ? '0' - : dp->conversion - 10); - if (precision > 0) - precision--; - } - while (precision > 0) - { - *p++ = '0'; - precision--; - } - } - } - *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } -# endif - } - } -# else - abort (); -# endif - } - /* The generated string now extends from tmp to p, with the - zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) - { - size_t pad = width - (p - tmp); - DCHAR_T *end = p + pad; - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > tmp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - - p = end; - } - - { - size_t count = p - tmp; - - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); - - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); - - ENSURE_ALLOCATION (n); - } - - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } - } -#endif -#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL - else if ((dp->conversion == 'f' || dp->conversion == 'F' - || dp->conversion == 'e' || dp->conversion == 'E' - || dp->conversion == 'g' || dp->conversion == 'G' - || dp->conversion == 'a' || dp->conversion == 'A') - && (0 -# if NEED_PRINTF_DOUBLE - || a.arg[dp->arg_index].type == TYPE_DOUBLE -# elif NEED_PRINTF_INFINITE_DOUBLE - || (a.arg[dp->arg_index].type == TYPE_DOUBLE - /* The systems (mingw) which produce wrong output - for Inf, -Inf, and NaN also do so for -0.0. - Therefore we treat this case here as well. */ - && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) -# endif -# if NEED_PRINTF_LONG_DOUBLE - || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE -# elif NEED_PRINTF_INFINITE_LONG_DOUBLE - || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE - /* Some systems produce wrong output for Inf, - -Inf, and NaN. Some systems in this category - (IRIX 5.3) also do so for -0.0. Therefore we - treat this case here as well. */ - && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) -# endif - )) - { -# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) - arg_type type = a.arg[dp->arg_index].type; -# endif - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - size_t tmp_length; - DCHAR_T tmpbuf[700]; - DCHAR_T *tmp; - DCHAR_T *pad_ptr; - DCHAR_T *p; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - /* POSIX specifies the default precision to be 6 for %f, %F, - %e, %E, but not for %g, %G. Implementations appear to use - the same default precision also for %g, %G. But for %a, %A, - the default precision is 0. */ - if (!has_precision) - if (!(dp->conversion == 'a' || dp->conversion == 'A')) - precision = 6; - - /* Allocate a temporary buffer of sufficient size. */ -# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE - tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); -# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE - tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); -# elif NEED_PRINTF_LONG_DOUBLE - tmp_length = LDBL_DIG + 1; -# elif NEED_PRINTF_DOUBLE - tmp_length = DBL_DIG + 1; -# else - tmp_length = 0; -# endif - if (tmp_length < precision) - tmp_length = precision; -# if NEED_PRINTF_LONG_DOUBLE -# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - if (type == TYPE_LONGDOUBLE) -# endif - if (dp->conversion == 'f' || dp->conversion == 'F') - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - if (!(isnanl (arg) || arg + arg == arg)) - { - /* arg is finite and nonzero. */ - int exponent = floorlog10l (arg < 0 ? -arg : arg); - if (exponent >= 0 && tmp_length < exponent + precision) - tmp_length = exponent + precision; - } - } -# endif -# if NEED_PRINTF_DOUBLE -# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE - if (type == TYPE_DOUBLE) -# endif - if (dp->conversion == 'f' || dp->conversion == 'F') - { - double arg = a.arg[dp->arg_index].a.a_double; - if (!(isnand (arg) || arg + arg == arg)) - { - /* arg is finite and nonzero. */ - int exponent = floorlog10 (arg < 0 ? -arg : arg); - if (exponent >= 0 && tmp_length < exponent + precision) - tmp_length = exponent + precision; - } - } -# endif - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - - if (tmp_length < width) - tmp_length = width; - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - - if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); - - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (DCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } - - pad_ptr = NULL; - p = tmp; - -# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE -# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - if (type == TYPE_LONGDOUBLE) -# endif - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - - if (isnanl (arg)) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - DECL_LONG_DOUBLE_ROUNDING - - BEGIN_LONG_DOUBLE_ROUNDING (); - - if (signbit (arg)) /* arg < 0.0L or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0L && arg + arg == arg) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { -# if NEED_PRINTF_LONG_DOUBLE - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - char *digits; - size_t ndigits; - - digits = - scale10_round_decimal_long_double (arg, precision); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); - else - *p++ = '0'; - /* Here ndigits <= precision. */ - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > ndigits; precision--) - *p++ = '0'; - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - int exponent; - - if (arg == 0.0L) - { - exponent = 0; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else - { - /* arg > 0.0L. */ - int adjusted; - char *digits; - size_t ndigits; - - exponent = floorlog10l (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_long_double (arg, - (int)precision - exponent); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits == precision + 1) - break; - if (ndigits < precision - || ndigits > precision + 2) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits == precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision+1. */ - if (is_borderline (digits, precision)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_long_double (arg, - (int)precision - exponent + 1); - if (digits2 == NULL) - { - free (digits); - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - if (strlen (digits2) == precision + 1) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision+1. */ - - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - - *p++ = dp->conversion; /* 'e' or 'E' */ -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', '.', '2', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+.2d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+.2d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } -# endif - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - if (precision == 0) - precision = 1; - /* precision >= 1. */ - - if (arg == 0.0L) - /* The exponent is 0, >= -4, < precision. - Use fixed-point notation. */ - { - size_t ndigits = precision; - /* Number of trailing zeroes that have to be - dropped. */ - size_t nzeroes = - (flags & FLAG_ALT ? 0 : precision - 1); - - --ndigits; - *p++ = '0'; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = '0'; - } - } - } - else - { - /* arg > 0.0L. */ - int exponent; - int adjusted; - char *digits; - size_t ndigits; - size_t nzeroes; - - exponent = floorlog10l (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_long_double (arg, - (int)(precision - 1) - exponent); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits == precision) - break; - if (ndigits < precision - 1 - || ndigits > precision + 1) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits < precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision. */ - if (is_borderline (digits, precision - 1)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_long_double (arg, - (int)(precision - 1) - exponent + 1); - if (digits2 == NULL) - { - free (digits); - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - if (strlen (digits2) == precision) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision. */ - - /* Determine the number of trailing zeroes - that have to be dropped. */ - nzeroes = 0; - if ((flags & FLAG_ALT) == 0) - while (nzeroes < ndigits - && digits[nzeroes] == '0') - nzeroes++; - - /* The exponent is now determined. */ - if (exponent >= -4 - && exponent < (long)precision) - { - /* Fixed-point notation: - max(exponent,0)+1 digits, then the - decimal point, then the remaining - digits without trailing zeroes. */ - if (exponent >= 0) - { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - size_t count = -exponent - 1; - *p++ = '0'; - *p++ = decimal_point_char (); - for (; count > 0; count--) - *p++ = '0'; - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - /* Exponential notation. */ - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', '.', '2', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+.2d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+.2d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } -# endif - } - - free (digits); - } - } - else - abort (); -# else - /* arg is finite. */ - if (!(arg == 0.0L)) - abort (); - - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion; /* 'e' or 'E' */ - *p++ = '+'; - *p++ = '0'; - *p++ = '0'; - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - *p++ = '0'; - if (flags & FLAG_ALT) - { - size_t ndigits = - (precision > 0 ? precision - 1 : 0); - *p++ = decimal_point_char (); - for (; ndigits > 0; --ndigits) - *p++ = '0'; - } - } - else if (dp->conversion == 'a' || dp->conversion == 'A') - { - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion - 'A' + 'P'; - *p++ = '+'; - *p++ = '0'; - } - else - abort (); -# endif - } - - END_LONG_DOUBLE_ROUNDING (); - } - } -# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - else -# endif -# endif -# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - { - double arg = a.arg[dp->arg_index].a.a_double; - - if (isnand (arg)) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - - if (signbit (arg)) /* arg < 0.0 or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0 && arg + arg == arg) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { -# if NEED_PRINTF_DOUBLE - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - char *digits; - size_t ndigits; - - digits = - scale10_round_decimal_double (arg, precision); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); - else - *p++ = '0'; - /* Here ndigits <= precision. */ - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > ndigits; precision--) - *p++ = '0'; - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - int exponent; - - if (arg == 0.0) - { - exponent = 0; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else - { - /* arg > 0.0. */ - int adjusted; - char *digits; - size_t ndigits; - - exponent = floorlog10 (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_double (arg, - (int)precision - exponent); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits == precision + 1) - break; - if (ndigits < precision - || ndigits > precision + 2) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits == precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision+1. */ - if (is_borderline (digits, precision)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_double (arg, - (int)precision - exponent + 1); - if (digits2 == NULL) - { - free (digits); - goto out_of_memory; - } - if (strlen (digits2) == precision + 1) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision+1. */ - - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - - *p++ = dp->conversion; /* 'e' or 'E' */ -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - { '%', '+', '.', '3', 'd', '\0' }; -# else - { '%', '+', '.', '2', 'd', '\0' }; -# endif - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - { - static const char decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - "%+.3d"; -# else - "%+.2d"; -# endif - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, decimal_format, exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, decimal_format, exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } - } -# endif - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - if (precision == 0) - precision = 1; - /* precision >= 1. */ - - if (arg == 0.0) - /* The exponent is 0, >= -4, < precision. - Use fixed-point notation. */ - { - size_t ndigits = precision; - /* Number of trailing zeroes that have to be - dropped. */ - size_t nzeroes = - (flags & FLAG_ALT ? 0 : precision - 1); - - --ndigits; - *p++ = '0'; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = '0'; - } - } - } - else - { - /* arg > 0.0. */ - int exponent; - int adjusted; - char *digits; - size_t ndigits; - size_t nzeroes; - - exponent = floorlog10 (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_double (arg, - (int)(precision - 1) - exponent); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits == precision) - break; - if (ndigits < precision - 1 - || ndigits > precision + 1) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits < precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision. */ - if (is_borderline (digits, precision - 1)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_double (arg, - (int)(precision - 1) - exponent + 1); - if (digits2 == NULL) - { - free (digits); - goto out_of_memory; - } - if (strlen (digits2) == precision) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision. */ - - /* Determine the number of trailing zeroes - that have to be dropped. */ - nzeroes = 0; - if ((flags & FLAG_ALT) == 0) - while (nzeroes < ndigits - && digits[nzeroes] == '0') - nzeroes++; - - /* The exponent is now determined. */ - if (exponent >= -4 - && exponent < (long)precision) - { - /* Fixed-point notation: - max(exponent,0)+1 digits, then the - decimal point, then the remaining - digits without trailing zeroes. */ - if (exponent >= 0) - { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - size_t count = -exponent - 1; - *p++ = '0'; - *p++ = decimal_point_char (); - for (; count > 0; count--) - *p++ = '0'; - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - /* Exponential notation. */ - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ -# if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - { '%', '+', '.', '3', 'd', '\0' }; -# else - { '%', '+', '.', '2', 'd', '\0' }; -# endif - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; -# else - { - static const char decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - "%+.3d"; -# else - "%+.2d"; -# endif - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, decimal_format, exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, decimal_format, exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } - } -# endif - } - - free (digits); - } - } - else - abort (); -# else - /* arg is finite. */ - if (!(arg == 0.0)) - abort (); - - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion; /* 'e' or 'E' */ - *p++ = '+'; - /* Produce the same number of exponent digits as - the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - *p++ = '0'; -# endif - *p++ = '0'; - *p++ = '0'; - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - *p++ = '0'; - if (flags & FLAG_ALT) - { - size_t ndigits = - (precision > 0 ? precision - 1 : 0); - *p++ = decimal_point_char (); - for (; ndigits > 0; --ndigits) - *p++ = '0'; - } - } - else - abort (); -# endif - } - } - } -# endif - - /* The generated string now extends from tmp to p, with the - zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) - { - size_t pad = width - (p - tmp); - DCHAR_T *end = p + pad; - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > tmp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - - p = end; - } - - { - size_t count = p - tmp; - - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); - - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); - - ENSURE_ALLOCATION (n); - } - - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } - } -#endif - else - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - int has_width; - size_t width; -#endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION - int has_precision; - size_t precision; -#endif -#if NEED_PRINTF_UNBOUNDED_PRECISION - int prec_ourselves; -#else -# define prec_ourselves 0 -#endif -#if NEED_PRINTF_FLAG_LEFTADJUST -# define pad_ourselves 1 -#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - int pad_ourselves; -#else -# define pad_ourselves 0 -#endif - TCHAR_T *fbp; - unsigned int prefix_count; - int prefixes[2] IF_LINT (= { 0 }); - int orig_errno; -#if !USE_SNPRINTF - size_t tmp_length; - TCHAR_T tmpbuf[700]; - TCHAR_T *tmp; -#endif - -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } -#endif - -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION - has_precision = 0; - precision = 6; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } -#endif - - /* Decide whether to handle the precision ourselves. */ -#if NEED_PRINTF_UNBOUNDED_PRECISION - switch (dp->conversion) - { - case 'd': case 'i': case 'u': - case 'o': - case 'x': case 'X': case 'p': - prec_ourselves = has_precision && (precision > 0); - break; - default: - prec_ourselves = 0; - break; - } -#endif - - /* Decide whether to perform the padding ourselves. */ -#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) - switch (dp->conversion) - { -# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO - /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need - to perform the padding after this conversion. Functions - with unistdio extensions perform the padding based on - character count rather than element count. */ - case 'c': case 's': -# endif -# if NEED_PRINTF_FLAG_ZERO - case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': - case 'a': case 'A': -# endif - pad_ourselves = 1; - break; - default: - pad_ourselves = prec_ourselves; - break; - } -#endif - -#if !USE_SNPRINTF - /* Allocate a temporary buffer of sufficient size for calling - sprintf. */ - tmp_length = - MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, - flags, width, has_precision, precision, - pad_ourselves); - - if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); - - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (TCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } -#endif - - /* Construct the format string for calling snprintf or - sprintf. */ - fbp = buf; - *fbp++ = '%'; -#if NEED_PRINTF_FLAG_GROUPING - /* The underlying implementation doesn't support the ' flag. - Produce no grouping characters in this case; this is - acceptable because the grouping is locale dependent. */ -#else - if (flags & FLAG_GROUP) - *fbp++ = '\''; -#endif - if (flags & FLAG_LEFT) - *fbp++ = '-'; - if (flags & FLAG_SHOWSIGN) - *fbp++ = '+'; - if (flags & FLAG_SPACE) - *fbp++ = ' '; - if (flags & FLAG_ALT) - *fbp++ = '#'; -#if __GLIBC__ >= 2 && !defined __UCLIBC__ - if (flags & FLAG_LOCALIZED) - *fbp++ = 'I'; -#endif - if (!pad_ourselves) - { - if (flags & FLAG_ZERO) - *fbp++ = '0'; - if (dp->width_start != dp->width_end) - { - size_t n = dp->width_end - dp->width_start; - /* The width specification is known to consist only - of standard ASCII characters. */ - if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) - { - memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); - fbp += n; - } - else - { - const FCHAR_T *mp = dp->width_start; - do - *fbp++ = (unsigned char) *mp++; - while (--n > 0); - } - } - } - if (!prec_ourselves) - { - if (dp->precision_start != dp->precision_end) - { - size_t n = dp->precision_end - dp->precision_start; - /* The precision specification is known to consist only - of standard ASCII characters. */ - if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) - { - memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); - fbp += n; - } - else - { - const FCHAR_T *mp = dp->precision_start; - do - *fbp++ = (unsigned char) *mp++; - while (--n > 0); - } - } - } - - switch (type) - { -#if HAVE_LONG_LONG_INT - case TYPE_LONGLONGINT: - case TYPE_ULONGLONGINT: -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - *fbp++ = 'I'; - *fbp++ = '6'; - *fbp++ = '4'; - break; -# else - *fbp++ = 'l'; - /*FALLTHROUGH*/ -# endif -#endif - case TYPE_LONGINT: - case TYPE_ULONGINT: -#if HAVE_WINT_T - case TYPE_WIDE_CHAR: -#endif -#if HAVE_WCHAR_T - case TYPE_WIDE_STRING: -#endif - *fbp++ = 'l'; - break; - case TYPE_LONGDOUBLE: - *fbp++ = 'L'; - break; - default: - break; - } -#if NEED_PRINTF_DIRECTIVE_F - if (dp->conversion == 'F') - *fbp = 'f'; - else -#endif - *fbp = dp->conversion; -#if USE_SNPRINTF -# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; -# else - /* On glibc2 systems from glibc >= 2.3 - probably also older - ones - we know that snprintf's return value conforms to - ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and - gl_SNPRINTF_TRUNCATION_C99 pass. - Therefore we can avoid using %n in this situation. - On glibc2 systems from 2004-10-18 or newer, the use of %n - in format strings in writable memory may crash the program - (if compiled with _FORTIFY_SOURCE=2), so we should avoid it - in this situation. */ - /* On native Win32 systems (such as mingw), we can avoid using - %n because: - - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, - snprintf does not write more than the specified number - of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes - '4', '5', '6' into buf, not '4', '5', '\0'.) - - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf - allows us to recognize the case of an insufficient - buffer size: it returns -1 in this case. - On native Win32 systems (such as mingw) where the OS is - Windows Vista, the use of %n in format strings by default - crashes the program. See - <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and - <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx> - So we should avoid %n in this situation. */ - fbp[1] = '\0'; -# endif -#else - fbp[1] = '\0'; -#endif - - /* Construct the arguments for calling snprintf or sprintf. */ - prefix_count = 0; - if (!pad_ourselves && dp->width_arg_index != ARG_NONE) - { - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; - } - if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) - { - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; - } - -#if USE_SNPRINTF - /* The SNPRINTF result is appended after result[0..length]. - The latter is an array of DCHAR_T; SNPRINTF appends an - array of TCHAR_T to it. This is possible because - sizeof (TCHAR_T) divides sizeof (DCHAR_T) and - alignof (TCHAR_T) <= alignof (DCHAR_T). */ -# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) - /* Ensure that maxlen below will be >= 2. Needed on BeOS, - where an snprintf() with maxlen==1 acts like sprintf(). */ - ENSURE_ALLOCATION (xsum (length, - (2 + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR)); - /* Prepare checking whether snprintf returns the count - via %n. */ - *(TCHAR_T *) (result + length) = '\0'; -#endif - - orig_errno = errno; - - for (;;) - { - int count = -1; - -#if USE_SNPRINTF - int retcount = 0; - size_t maxlen = allocated - length; - /* SNPRINTF can fail if its second argument is - > INT_MAX. */ - if (maxlen > INT_MAX / TCHARS_PER_DCHAR) - maxlen = INT_MAX / TCHARS_PER_DCHAR; - maxlen = maxlen * TCHARS_PER_DCHAR; -# define SNPRINTF_BUF(arg) \ - switch (prefix_count) \ - { \ - case 0: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - arg, &count); \ - break; \ - case 1: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - prefixes[0], arg, &count); \ - break; \ - case 2: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - prefixes[0], prefixes[1], arg, \ - &count); \ - break; \ - default: \ - abort (); \ - } -#else -# define SNPRINTF_BUF(arg) \ - switch (prefix_count) \ - { \ - case 0: \ - count = sprintf (tmp, buf, arg); \ - break; \ - case 1: \ - count = sprintf (tmp, buf, prefixes[0], arg); \ - break; \ - case 2: \ - count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ - arg); \ - break; \ - default: \ - abort (); \ - } -#endif - - errno = 0; - switch (type) - { - case TYPE_SCHAR: - { - int arg = a.arg[dp->arg_index].a.a_schar; - SNPRINTF_BUF (arg); - } - break; - case TYPE_UCHAR: - { - unsigned int arg = a.arg[dp->arg_index].a.a_uchar; - SNPRINTF_BUF (arg); - } - break; - case TYPE_SHORT: - { - int arg = a.arg[dp->arg_index].a.a_short; - SNPRINTF_BUF (arg); - } - break; - case TYPE_USHORT: - { - unsigned int arg = a.arg[dp->arg_index].a.a_ushort; - SNPRINTF_BUF (arg); - } - break; - case TYPE_INT: - { - int arg = a.arg[dp->arg_index].a.a_int; - SNPRINTF_BUF (arg); - } - break; - case TYPE_UINT: - { - unsigned int arg = a.arg[dp->arg_index].a.a_uint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_LONGINT: - { - long int arg = a.arg[dp->arg_index].a.a_longint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_ULONGINT: - { - unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; - SNPRINTF_BUF (arg); - } - break; -#if HAVE_LONG_LONG_INT - case TYPE_LONGLONGINT: - { - long long int arg = a.arg[dp->arg_index].a.a_longlongint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_ULONGLONGINT: - { - unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; - SNPRINTF_BUF (arg); - } - break; -#endif - case TYPE_DOUBLE: - { - double arg = a.arg[dp->arg_index].a.a_double; - SNPRINTF_BUF (arg); - } - break; - case TYPE_LONGDOUBLE: - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - SNPRINTF_BUF (arg); - } - break; - case TYPE_CHAR: - { - int arg = a.arg[dp->arg_index].a.a_char; - SNPRINTF_BUF (arg); - } - break; -#if HAVE_WINT_T - case TYPE_WIDE_CHAR: - { - wint_t arg = a.arg[dp->arg_index].a.a_wide_char; - SNPRINTF_BUF (arg); - } - break; -#endif - case TYPE_STRING: - { - const char *arg = a.arg[dp->arg_index].a.a_string; - SNPRINTF_BUF (arg); - } - break; -#if HAVE_WCHAR_T - case TYPE_WIDE_STRING: - { - const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; - SNPRINTF_BUF (arg); - } - break; -#endif - case TYPE_POINTER: - { - void *arg = a.arg[dp->arg_index].a.a_pointer; - SNPRINTF_BUF (arg); - } - break; - default: - abort (); - } - -#if USE_SNPRINTF - /* Portability: Not all implementations of snprintf() - are ISO C 99 compliant. Determine the number of - bytes that snprintf() has produced or would have - produced. */ - if (count >= 0) - { - /* Verify that snprintf() has NUL-terminated its - result. */ - if (count < maxlen - && ((TCHAR_T *) (result + length)) [count] != '\0') - abort (); - /* Portability hack. */ - if (retcount > count) - count = retcount; - } - else - { - /* snprintf() doesn't understand the '%n' - directive. */ - if (fbp[1] != '\0') - { - /* Don't use the '%n' directive; instead, look - at the snprintf() return value. */ - fbp[1] = '\0'; - continue; - } - else - { - /* Look at the snprintf() return value. */ - if (retcount < 0) - { -# if !HAVE_SNPRINTF_RETVAL_C99 - /* HP-UX 10.20 snprintf() is doubly deficient: - It doesn't understand the '%n' directive, - *and* it returns -1 (rather than the length - that would have been required) when the - buffer is too small. - But a failure at this point can also come - from other reasons than a too small buffer, - such as an invalid wide string argument to - the %ls directive, or possibly an invalid - floating-point argument. */ - size_t tmp_length = - MAX_ROOM_NEEDED (&a, dp->arg_index, - dp->conversion, type, flags, - width, has_precision, - precision, pad_ourselves); - - if (maxlen < tmp_length) - { - /* Make more room. But try to do through - this reallocation only once. */ - size_t bigger_need = - xsum (length, - xsum (tmp_length, - TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR); - /* And always grow proportionally. - (There may be several arguments, each - needing a little more room than the - previous one.) */ - size_t bigger_need2 = - xsum (xtimes (allocated, 2), 12); - if (bigger_need < bigger_need2) - bigger_need = bigger_need2; - ENSURE_ALLOCATION (bigger_need); - continue; - } -# endif - } - else - count = retcount; - } - } -#endif - - /* Attempt to handle failure. */ - if (count < 0) - { - /* SNPRINTF or sprintf failed. Save and use the errno - that it has set, if any. */ - int saved_errno = errno; - - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = - (saved_errno != 0 - ? saved_errno - : (dp->conversion == 'c' || dp->conversion == 's' - ? EILSEQ - : EINVAL)); - return NULL; - } - -#if USE_SNPRINTF - /* Handle overflow of the allocated buffer. - If such an overflow occurs, a C99 compliant snprintf() - returns a count >= maxlen. However, a non-compliant - snprintf() function returns only count = maxlen - 1. To - cover both cases, test whether count >= maxlen - 1. */ - if ((unsigned int) count + 1 >= maxlen) - { - /* If maxlen already has attained its allowed maximum, - allocating more memory will not increase maxlen. - Instead of looping, bail out. */ - if (maxlen == INT_MAX / TCHARS_PER_DCHAR) - goto overflow; - else - { - /* Need at least (count + 1) * sizeof (TCHAR_T) - bytes. (The +1 is for the trailing NUL.) - But ask for (count + 2) * sizeof (TCHAR_T) - bytes, so that in the next round, we likely get - maxlen > (unsigned int) count + 1 - and so we don't get here again. - And allocate proportionally, to avoid looping - eternally if snprintf() reports a too small - count. */ - size_t n = - xmax (xsum (length, - ((unsigned int) count + 2 - + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR), - xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - continue; - } - } -#endif - -#if NEED_PRINTF_UNBOUNDED_PRECISION - if (prec_ourselves) - { - /* Handle the precision. */ - TCHAR_T *prec_ptr = -# if USE_SNPRINTF - (TCHAR_T *) (result + length); -# else - tmp; -# endif - size_t prefix_count; - size_t move; - - prefix_count = 0; - /* Put the additional zeroes after the sign. */ - if (count >= 1 - && (*prec_ptr == '-' || *prec_ptr == '+' - || *prec_ptr == ' ')) - prefix_count = 1; - /* Put the additional zeroes after the 0x prefix if - (flags & FLAG_ALT) || (dp->conversion == 'p'). */ - else if (count >= 2 - && prec_ptr[0] == '0' - && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) - prefix_count = 2; - - move = count - prefix_count; - if (precision > move) - { - /* Insert zeroes. */ - size_t insert = precision - move; - TCHAR_T *prec_end; - -# if USE_SNPRINTF - size_t n = - xsum (length, - (count + insert + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR); - length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; - ENSURE_ALLOCATION (n); - length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; - prec_ptr = (TCHAR_T *) (result + length); -# endif - - prec_end = prec_ptr + count; - prec_ptr += prefix_count; - - while (prec_end > prec_ptr) - { - prec_end--; - prec_end[insert] = prec_end[0]; - } - - prec_end += insert; - do - *--prec_end = '0'; - while (prec_end > prec_ptr); - - count += insert; - } - } -#endif - -#if !USE_SNPRINTF - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); -#endif - -#if !DCHAR_IS_TCHAR - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - if (dp->conversion == 'c' || dp->conversion == 's') - { - /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING - TYPE_WIDE_STRING. - The result string is not certainly ASCII. */ - const TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t tmpdst_len; - /* This code assumes that TCHAR_T is 'char'. */ - verify (sizeof (TCHAR_T) == 1); -# if USE_SNPRINTF - tmpsrc = (TCHAR_T *) (result + length); -# else - tmpsrc = tmp; -# endif - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, count, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - ENSURE_ALLOCATION (xsum (length, tmpdst_len)); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - count = tmpdst_len; - } - else - { - /* The result string is ASCII. - Simple 1:1 conversion. */ -# if USE_SNPRINTF - /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a - no-op conversion, in-place on the array starting - at (result + length). */ - if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) -# endif - { - const TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t n; - -# if USE_SNPRINTF - if (result == resultbuf) - { - tmpsrc = (TCHAR_T *) (result + length); - /* ENSURE_ALLOCATION will not move tmpsrc - (because it's part of resultbuf). */ - ENSURE_ALLOCATION (xsum (length, count)); - } - else - { - /* ENSURE_ALLOCATION will move the array - (because it uses realloc(). */ - ENSURE_ALLOCATION (xsum (length, count)); - tmpsrc = (TCHAR_T *) (result + length); - } -# else - tmpsrc = tmp; - ENSURE_ALLOCATION (xsum (length, count)); -# endif - tmpdst = result + length; - /* Copy backwards, because of overlapping. */ - tmpsrc += count; - tmpdst += count; - for (n = count; n > 0; n--) - *--tmpdst = (unsigned char) *--tmpsrc; - } - } -#endif - -#if DCHAR_IS_TCHAR && !USE_SNPRINTF - /* Make room for the result. */ - if (count > allocated - length) - { - /* Need at least count elements. But allocate - proportionally. */ - size_t n = - xmax (xsum (length, count), xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - } -#endif - - /* Here count <= allocated - length. */ - - /* Perform padding. */ -#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - if (pad_ourselves && has_width) - { - size_t w; -# if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width - against the number of _characters_ of the converted - value. */ - w = DCHAR_MBSNLEN (result + length, count); -# else - /* The width is compared against the number of _bytes_ - of the converted value, says POSIX. */ - w = count; -# endif - if (w < width) - { - size_t pad = width - w; - - /* Make room for the result. */ - if (xsum (count, pad) > allocated - length) - { - /* Need at least count + pad elements. But - allocate proportionally. */ - size_t n = - xmax (xsum3 (length, count, pad), - xtimes (allocated, 2)); - -# if USE_SNPRINTF - length += count; - ENSURE_ALLOCATION (n); - length -= count; -# else - ENSURE_ALLOCATION (n); -# endif - } - /* Here count + pad <= allocated - length. */ - - { -# if !DCHAR_IS_TCHAR || USE_SNPRINTF - DCHAR_T * const rp = result + length; -# else - DCHAR_T * const rp = tmp; -# endif - DCHAR_T *p = rp + count; - DCHAR_T *end = p + pad; - DCHAR_T *pad_ptr; -# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO - if (dp->conversion == 'c' - || dp->conversion == 's') - /* No zero-padding for string directives. */ - pad_ptr = NULL; - else -# endif - { - pad_ptr = (*rp == '-' ? rp + 1 : rp); - /* No zero-padding of "inf" and "nan". */ - if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') - || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) - pad_ptr = NULL; - } - /* The generated string now extends from rp to p, - with the zero padding insertion point being at - pad_ptr. */ - - count = count + pad; /* = end - rp */ - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > rp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - } - } - } -#endif - - /* Here still count <= allocated - length. */ - -#if !DCHAR_IS_TCHAR || USE_SNPRINTF - /* The snprintf() result did fit. */ -#else - /* Append the sprintf() result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); -#endif -#if !USE_SNPRINTF - if (tmp != tmpbuf) - free (tmp); -#endif - -#if NEED_PRINTF_DIRECTIVE_F - if (dp->conversion == 'F') - { - /* Convert the %f result to upper case for %F. */ - DCHAR_T *rp = result + length; - size_t rc; - for (rc = count; rc > 0; rc--, rp++) - if (*rp >= 'a' && *rp <= 'z') - *rp = *rp - 'a' + 'A'; - } -#endif - - length += count; - break; - } - errno = orig_errno; -#undef pad_ourselves -#undef prec_ourselves - } - } - } - - /* Add the final NUL. */ - ENSURE_ALLOCATION (xsum (length, 1)); - result[length] = '\0'; - - if (result != resultbuf && length + 1 < allocated) - { - /* Shrink the allocated memory if possible. */ - DCHAR_T *memory; - - memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); - if (memory != NULL) - result = memory; - } - - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - *lengthp = length; - /* Note that we can produce a big string of a length > INT_MAX. POSIX - says that snprintf() fails with errno = EOVERFLOW in this case, but - that's only because snprintf() returns an 'int'. This function does - not have this limitation. */ - return result; - -#if USE_SNPRINTF - overflow: - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EOVERFLOW; - return NULL; -#endif - - out_of_memory: - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - out_of_memory_1: - CLEANUP (); - errno = ENOMEM; - return NULL; - } -} - -#undef MAX_ROOM_NEEDED -#undef TCHARS_PER_DCHAR -#undef SNPRINTF -#undef USE_SNPRINTF -#undef DCHAR_SET -#undef DCHAR_CPY -#undef PRINTF_PARSE -#undef DIRECTIVES -#undef DIRECTIVE -#undef DCHAR_IS_TCHAR -#undef TCHAR_T -#undef DCHAR_T -#undef FCHAR_T -#undef VASNPRINTF diff --git a/lib/gl/vasnprintf.h b/lib/gl/vasnprintf.h deleted file mode 100644 index 6bf9c59cd9..0000000000 --- a/lib/gl/vasnprintf.h +++ /dev/null @@ -1,80 +0,0 @@ -/* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _VASNPRINTF_H -#define _VASNPRINTF_H - -/* Get va_list. */ -#include <stdarg.h> - -/* 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 - 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 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Write formatted output to a string dynamically allocated with malloc(). - You can pass a preallocated buffer for the result in RESULTBUF and its - size in *LENGTHP; otherwise you pass RESULTBUF = NULL. - If successful, return the address of the string (this may be = RESULTBUF - if no dynamic memory allocation was necessary) and set *LENGTHP to the - number of resulting bytes, excluding the trailing NUL. Upon error, set - errno and return NULL. - - When dynamic memory allocation occurs, the preallocated buffer is left - alone (with possibly modified contents). This makes it possible to use - a statically allocated or stack-allocated buffer, like this: - - char buf[100]; - size_t len = sizeof (buf); - char *output = vasnprintf (buf, &len, format, args); - if (output == NULL) - ... error handling ...; - else - { - ... use the output string ...; - if (output != buf) - free (output); - } - */ -#if REPLACE_VASNPRINTF -# define asnprintf rpl_asnprintf -# define vasnprintf rpl_vasnprintf -#endif -extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); -extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))); - -#ifdef __cplusplus -} -#endif - -#endif /* _VASNPRINTF_H */ diff --git a/lib/gl/vasprintf.c b/lib/gl/vasprintf.c deleted file mode 100644 index b8c52a9ec8..0000000000 --- a/lib/gl/vasprintf.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-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.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#ifdef IN_LIBASPRINTF -# include "vasprintf.h" -#else -# include <stdio.h> -#endif - -#include <errno.h> -#include <limits.h> -#include <stdlib.h> - -#include "vasnprintf.h" - -int -vasprintf (char **resultp, const char *format, va_list args) -{ - size_t length; - char *result = vasnprintf (NULL, &length, format, args); - if (result == NULL) - return -1; - - if (length > INT_MAX) - { - free (result); - errno = EOVERFLOW; - return -1; - } - - *resultp = result; - /* Return the number of resulting bytes, excluding the trailing NUL. */ - return length; -} diff --git a/lib/gl/verify.h b/lib/gl/verify.h deleted file mode 100644 index a29f8666df..0000000000 --- a/lib/gl/verify.h +++ /dev/null @@ -1,163 +0,0 @@ -/* Compile-time assert-like macros. - - Copyright (C) 2005-2006, 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.1 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 Paul Eggert, Bruno Haible, and Jim Meyering. */ - -#ifndef VERIFY_H -# define VERIFY_H 1 - -/* Each of these macros verifies that its argument R is nonzero. To - be portable, R should be an integer constant expression. Unlike - assert (R), there is no run-time overhead. - - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. - - Symbols ending in "__" are private to this header. - - The code below uses several ideas. - - * The first step is ((R) ? 1 : -1). Given an expression R, of - integral or boolean or floating-point type, this yields an - expression of integral type, whose value is later verified to be - constant and nonnegative. - - * Next this expression W is wrapped in a type - struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. - If W is negative, this yields a compile-time error. No compiler can - deal with a bit-field of negative size. - - One might think that an array size check would have the same - effect, that is, that the type struct { unsigned int dummy[W]; } - would work as well. However, inside a function, some compilers - (such as C++ compilers and GNU C) allow local parameters and - variables inside array size expressions. With these compilers, - an array size check would not properly diagnose this misuse of - the verify macro: - - void function (int n) { verify (n < 0); } - - * For the verify macro, the struct verify_type__ will need to - somehow be embedded into a declaration. To be portable, this - declaration must declare an object, a constant, a function, or a - typedef name. If the declared entity uses the type directly, - such as in - - struct dummy {...}; - typedef struct {...} dummy; - extern struct {...} *dummy; - extern void dummy (struct {...} *); - extern struct {...} *dummy (void); - - two uses of the verify macro would yield colliding declarations - if the entity names are not disambiguated. A workaround is to - attach the current line number to the entity name: - - #define _GL_CONCAT0(x, y) x##y - #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) - extern struct {...} * _GL_CONCAT (dummy, __LINE__); - - But this has the problem that two invocations of verify from - within the same macro would collide, since the __LINE__ value - would be the same for both invocations. (The GCC __COUNTER__ - macro solves this problem, but is not portable.) - - A solution is to use the sizeof operator. It yields a number, - getting rid of the identity of the type. Declarations like - - extern int dummy [sizeof (struct {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - - can be repeated. - - * Should the implementation use a named struct or an unnamed struct? - Which of the following alternatives can be used? - - extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; - - In the second and sixth case, the struct type is exported to the - outer scope; two such declarations therefore collide. GCC warns - about the first, third, and fourth cases. So the only remaining - possibility is the fifth case: - - extern int (*dummy (void)) [sizeof (struct {...})]; - - * GCC warns about duplicate declarations of the dummy function if - -Wredundant_decls is used. GCC 4.3 and later have a builtin - __COUNTER__ macro that can let us generate unique identifiers for - each dummy function, to suppress this warning. - - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, just as __COUNTER__ is already - being used if available. - - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif - - * In C++, any struct definition inside sizeof is invalid. - Use a template type to work around the problem. */ - -/* Concatenate two preprocessor tokens. */ -# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) -# define _GL_CONCAT0(x, y) x##y - -/* _GL_COUNTER is an integer, preferably one that changes each time we - use it. Use __COUNTER__ if it works, falling back on __LINE__ - otherwise. __LINE__ isn't perfect, but it's better than a - constant. */ -# if defined __COUNTER__ && __COUNTER__ != __COUNTER__ -# define _GL_COUNTER __COUNTER__ -# else -# define _GL_COUNTER __LINE__ -# endif - -/* Generate a symbol with the given prefix, making it unique if - possible. */ -# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) - -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ - -# ifdef __cplusplus -template <int w> - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) -# else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) -# endif - -/* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ - -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] - -#endif diff --git a/lib/gl/vsnprintf.c b/lib/gl/vsnprintf.c deleted file mode 100644 index 2ec3cae9d7..0000000000 --- a/lib/gl/vsnprintf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Formatted output to strings. - Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. - Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. - - 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.1, 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. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> -#include <limits.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "vasnprintf.h" - -/* Print formatted output to string STR. Similar to vsprintf, but - additional length SIZE limit how much is written into STR. Returns - string length of formatted string (which may be larger than SIZE). - STR may be NULL, in which case nothing will be written. On error, - return a negative value. */ -int -vsnprintf (char *str, size_t size, const char *format, va_list args) -{ - char *output; - size_t len; - size_t lenbuf = size; - - output = vasnprintf (str, &lenbuf, format, args); - len = lenbuf; - - if (!output) - return -1; - - if (output != str) - { - if (size) - { - size_t pruned_len = (len < size ? len : size - 1); - memcpy (str, output, pruned_len); - str[pruned_len] = '\0'; - } - - free (output); - } - - if (len > INT_MAX) - { - errno = EOVERFLOW; - return -1; - } - - return len; -} diff --git a/lib/gl/w32sock.h b/lib/gl/w32sock.h deleted file mode 100644 index 1bcee466d6..0000000000 --- a/lib/gl/w32sock.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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 2.1 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; - } -} diff --git a/lib/gl/wchar.in.h b/lib/gl/wchar.in.h deleted file mode 100644 index edae751f5e..0000000000 --- a/lib/gl/wchar.in.h +++ /dev/null @@ -1,433 +0,0 @@ -/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - - Copyright (C) 2007-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.1, 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 Eric Blake. */ - -/* - * ISO C 99 <wchar.h> for platforms that have issues. - * <http://www.opengroup.org/susv3xbd/wchar.h.html> - * - * For now, this just ensures proper prerequisite inclusion order and - * the declaration of wcwidth(). - */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#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 -/* Special invocation convention: - - Inside glibc and uClibc header files. - - On HP-UX 11.00 we have a sequence of nested includes - <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, - once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> - and once directly. In both situations 'wint_t' is not yet defined, - therefore we cannot provide the function overrides; instead include only - the system's <wchar.h>. - - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and - the latter includes <wchar.h>. But here, we have no way to detect whether - <wctype.h> is completely included or is still being included. */ - -#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_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 - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. - But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# include <stddef.h> -# include <stdio.h> -# include <time.h> -#endif - -/* Include the original <wchar.h> if it exists. - Some builds of uClibc lack it. */ -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_WCHAR_H@ -# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ -#endif - -#undef _GL_ALREADY_INCLUDING_WCHAR_H - -#ifndef _GL_WCHAR_H -#define _GL_WCHAR_H - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -/* Define wint_t and WEOF. (Also done in wctype.in.h.) */ -#if !@HAVE_WINT_T@ && !defined wint_t -# define wint_t int -# ifndef WEOF -# define WEOF -1 -# endif -#else -# ifndef WEOF -# define WEOF ((wint_t) -1) -# endif -#endif - - -/* Override mbstate_t if it is too small. - On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for - implementing mbrtowc for encodings like UTF-8. */ -#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ -typedef int rpl_mbstate_t; -# undef mbstate_t -# define mbstate_t rpl_mbstate_t -# define GNULIB_defined_mbstate_t 1 -#endif - - -/* Convert a single-byte character to a wide character. */ -#if @GNULIB_BTOWC@ -# if @REPLACE_BTOWC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef btowc -# define btowc rpl_btowc -# endif -_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); -_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); -# else -# if !@HAVE_BTOWC@ -_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); -# endif -_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); -# endif -_GL_CXXALIASWARN (btowc); -#elif defined GNULIB_POSIXCHECK -# undef btowc -# if HAVE_RAW_DECL_BTOWC -_GL_WARN_ON_USE (btowc, "btowc is unportable - " - "use gnulib module btowc for portability"); -# endif -#endif - - -/* Convert a wide character to a single-byte character. */ -#if @GNULIB_WCTOB@ -# if @REPLACE_WCTOB@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef wctob -# define wctob rpl_wctob -# endif -_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); -_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); -# else -# if !defined wctob && !@HAVE_DECL_WCTOB@ -/* wctob is provided by gnulib, or wctob exists but is not declared. */ -_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); -# endif -_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); -# endif -_GL_CXXALIASWARN (wctob); -#elif defined GNULIB_POSIXCHECK -# undef wctob -# if HAVE_RAW_DECL_WCTOB -_GL_WARN_ON_USE (wctob, "wctob is unportable - " - "use gnulib module wctob for portability"); -# endif -#endif - - -/* Test whether *PS is in the initial state. */ -#if @GNULIB_MBSINIT@ -# if @REPLACE_MBSINIT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mbsinit -# define mbsinit rpl_mbsinit -# endif -_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); -_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); -# else -# if !@HAVE_MBSINIT@ -_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); -# endif -_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (mbsinit); -#elif defined GNULIB_POSIXCHECK -# undef mbsinit -# if HAVE_RAW_DECL_MBSINIT -_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " - "use gnulib module mbsinit for portability"); -# endif -#endif - - -/* Convert a multibyte character to a wide character. */ -#if @GNULIB_MBRTOWC@ -# if @REPLACE_MBRTOWC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mbrtowc -# define mbrtowc rpl_mbrtowc -# endif -_GL_FUNCDECL_RPL (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); -_GL_CXXALIAS_RPL (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); -# else -# if !@HAVE_MBRTOWC@ -_GL_FUNCDECL_SYS (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); -# endif -_GL_CXXALIAS_SYS (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (mbrtowc); -#elif defined GNULIB_POSIXCHECK -# undef mbrtowc -# if HAVE_RAW_DECL_MBRTOWC -_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " - "use gnulib module mbrtowc for portability"); -# endif -#endif - - -/* Recognize a multibyte character. */ -#if @GNULIB_MBRLEN@ -# if @REPLACE_MBRLEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mbrlen -# define mbrlen rpl_mbrlen -# endif -_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); -_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); -# else -# if !@HAVE_MBRLEN@ -_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); -# endif -_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (mbrlen); -#elif defined GNULIB_POSIXCHECK -# undef mbrlen -# if HAVE_RAW_DECL_MBRLEN -_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " - "use gnulib module mbrlen for portability"); -# endif -#endif - - -/* Convert a string to a wide string. */ -#if @GNULIB_MBSRTOWCS@ -# if @REPLACE_MBSRTOWCS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mbsrtowcs -# define mbsrtowcs rpl_mbsrtowcs -# endif -_GL_FUNCDECL_RPL (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, - mbstate_t *ps)); -# else -# if !@HAVE_MBSRTOWCS@ -_GL_FUNCDECL_SYS (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, - mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (mbsrtowcs); -#elif defined GNULIB_POSIXCHECK -# undef mbsrtowcs -# if HAVE_RAW_DECL_MBSRTOWCS -_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " - "use gnulib module mbsrtowcs for portability"); -# endif -#endif - - -/* Convert a string to a wide string. */ -#if @GNULIB_MBSNRTOWCS@ -# if @REPLACE_MBSNRTOWCS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef mbsnrtowcs -# define mbsnrtowcs rpl_mbsnrtowcs -# endif -_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps)); -# else -# if !@HAVE_MBSNRTOWCS@ -_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (mbsnrtowcs); -#elif defined GNULIB_POSIXCHECK -# undef mbsnrtowcs -# if HAVE_RAW_DECL_MBSNRTOWCS -_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " - "use gnulib module mbsnrtowcs for portability"); -# endif -#endif - - -/* Convert a wide character to a multibyte character. */ -#if @GNULIB_WCRTOMB@ -# if @REPLACE_WCRTOMB@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef wcrtomb -# define wcrtomb rpl_wcrtomb -# endif -_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); -_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); -# else -# if !@HAVE_WCRTOMB@ -_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); -# endif -_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (wcrtomb); -#elif defined GNULIB_POSIXCHECK -# undef wcrtomb -# if HAVE_RAW_DECL_WCRTOMB -_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " - "use gnulib module wcrtomb for portability"); -# endif -#endif - - -/* Convert a wide string to a string. */ -#if @GNULIB_WCSRTOMBS@ -# if @REPLACE_WCSRTOMBS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef wcsrtombs -# define wcsrtombs rpl_wcsrtombs -# endif -_GL_FUNCDECL_RPL (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, - mbstate_t *ps)); -# else -# if !@HAVE_WCSRTOMBS@ -_GL_FUNCDECL_SYS (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, - mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (wcsrtombs); -#elif defined GNULIB_POSIXCHECK -# undef wcsrtombs -# if HAVE_RAW_DECL_WCSRTOMBS -_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " - "use gnulib module wcsrtombs for portability"); -# endif -#endif - - -/* Convert a wide string to a string. */ -#if @GNULIB_WCSNRTOMBS@ -# if @REPLACE_WCSNRTOMBS@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef wcsnrtombs -# define wcsnrtombs rpl_wcsnrtombs -# endif -_GL_FUNCDECL_RPL (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps)); -# else -# if !@HAVE_WCSNRTOMBS@ -_GL_FUNCDECL_SYS (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps)); -# endif -_GL_CXXALIASWARN (wcsnrtombs); -#elif defined GNULIB_POSIXCHECK -# undef wcsnrtombs -# if HAVE_RAW_DECL_WCSNRTOMBS -_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " - "use gnulib module wcsnrtombs for portability"); -# endif -#endif - - -/* Return the number of screen columns needed for WC. */ -#if @GNULIB_WCWIDTH@ -# if @REPLACE_WCWIDTH@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef wcwidth -# define wcwidth rpl_wcwidth -# endif -_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); -_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); -# else -# if !@HAVE_DECL_WCWIDTH@ -/* wcwidth exists but is not declared. */ -_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); -# endif -_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); -# endif -_GL_CXXALIASWARN (wcwidth); -#elif defined GNULIB_POSIXCHECK -# undef wcwidth -# if HAVE_RAW_DECL_WCWIDTH -_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " - "use gnulib module wcwidth for portability"); -# endif -#endif - - -#endif /* _GL_WCHAR_H */ -#endif /* _GL_WCHAR_H */ -#endif diff --git a/lib/gl/xsize.h b/lib/gl/xsize.h deleted file mode 100644 index 1d43dfe4c2..0000000000 --- a/lib/gl/xsize.h +++ /dev/null @@ -1,108 +0,0 @@ -/* xsize.h -- Checked size_t computations. - - Copyright (C) 2003, 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 2.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _XSIZE_H -#define _XSIZE_H - -/* Get size_t. */ -#include <stddef.h> - -/* Get SIZE_MAX. */ -#include <limits.h> -#if HAVE_STDINT_H -# include <stdint.h> -#endif - -/* The size of memory objects is often computed through expressions of - type size_t. Example: - void* p = malloc (header_size + n * element_size). - These computations can lead to overflow. When this happens, malloc() - returns a piece of memory that is way too small, and the program then - crashes while attempting to fill the memory. - To avoid this, the functions and macros in this file check for overflow. - The convention is that SIZE_MAX represents overflow. - malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc - implementation that uses mmap --, it's recommended to use size_overflow_p() - or size_in_bounds_p() before invoking malloc(). - The example thus becomes: - size_t size = xsum (header_size, xtimes (n, element_size)); - void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); -*/ - -/* Convert an arbitrary value >= 0 to type size_t. */ -#define xcast_size_t(N) \ - ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) - -/* Sum of two sizes, with overflow check. */ -static inline size_t -#if __GNUC__ >= 3 -__attribute__ ((__pure__)) -#endif -xsum (size_t size1, size_t size2) -{ - size_t sum = size1 + size2; - return (sum >= size1 ? sum : SIZE_MAX); -} - -/* Sum of three sizes, with overflow check. */ -static inline size_t -#if __GNUC__ >= 3 -__attribute__ ((__pure__)) -#endif -xsum3 (size_t size1, size_t size2, size_t size3) -{ - return xsum (xsum (size1, size2), size3); -} - -/* Sum of four sizes, with overflow check. */ -static inline size_t -#if __GNUC__ >= 3 -__attribute__ ((__pure__)) -#endif -xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) -{ - return xsum (xsum (xsum (size1, size2), size3), size4); -} - -/* Maximum of two sizes, with overflow check. */ -static inline size_t -#if __GNUC__ >= 3 -__attribute__ ((__pure__)) -#endif -xmax (size_t size1, size_t size2) -{ - /* No explicit check is needed here, because for any n: - max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ - return (size1 >= size2 ? size1 : size2); -} - -/* Multiplication of a count with an element size, with overflow check. - The count must be >= 0 and the element size must be > 0. - This is a macro, not an inline function, so that it works correctly even - when N is of a wider type and N > SIZE_MAX. */ -#define xtimes(N, ELSIZE) \ - ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) - -/* Check for overflow. */ -#define size_overflow_p(SIZE) \ - ((SIZE) == SIZE_MAX) -/* Check against overflow. */ -#define size_in_bounds_p(SIZE) \ - ((SIZE) != SIZE_MAX) - -#endif /* _XSIZE_H */ diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index b11df42fcf..8f595c7ebf 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -48,6 +48,7 @@ typedef int ssize_t; #include <sys/stat.h> #include <sys/socket.h> #include <time.h> +#include <u64.h> /* gnulib for uint64_t */ /* some systems had problems with long long int, thus, * it is not used. diff --git a/lib/minitasn1/Makefile.am b/lib/minitasn1/Makefile.am index 54d15143e5..e5be71bc49 100644 --- a/lib/minitasn1/Makefile.am +++ b/lib/minitasn1/Makefile.am @@ -22,8 +22,7 @@ # MA 02110-1301, USA AM_CPPFLAGS = -DASN1_BUILDING \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/.. noinst_LTLIBRARIES = libminitasn1.la diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am index a580fc258e..e902e774d5 100644 --- a/lib/nettle/Makefile.am +++ b/lib/nettle/Makefile.am @@ -23,8 +23,7 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/../includes \ -I$(builddir)/../includes \ -I$(srcdir)/.. diff --git a/lib/opencdk/Makefile.am b/lib/opencdk/Makefile.am index 5728d8bfb0..882c39f060 100644 --- a/lib/opencdk/Makefile.am +++ b/lib/opencdk/Makefile.am @@ -22,8 +22,7 @@ # MA 02110-1301, USA AM_CPPFLAGS = \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/../includes \ -I$(builddir)/../includes \ -I$(srcdir)/.. diff --git a/lib/openpgp/Makefile.am b/lib/openpgp/Makefile.am index 3b73c97366..4f00d704d3 100644 --- a/lib/openpgp/Makefile.am +++ b/lib/openpgp/Makefile.am @@ -23,8 +23,7 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/../includes \ -I$(builddir)/../includes \ -I$(srcdir)/.. \ diff --git a/lib/po/POTFILES.in b/lib/po/POTFILES.in deleted file mode 100644 index 25a582a429..0000000000 --- a/lib/po/POTFILES.in +++ /dev/null @@ -1,5 +0,0 @@ -# List of source files which contain translatable strings. -gnutls_errors.c -gnutls_alert.c -x509/output.c -openpgp/output.c diff --git a/lib/x509/Makefile.am b/lib/x509/Makefile.am index 983f32309f..7b022bf765 100644 --- a/lib/x509/Makefile.am +++ b/lib/x509/Makefile.am @@ -21,8 +21,7 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ + -I$(srcdir)/../../gl \ -I$(srcdir)/../includes \ -I$(builddir)/../includes \ -I$(srcdir)/.. \ diff --git a/libextra/Makefile.am b/libextra/Makefile.am index e280527964..27a05badee 100644 --- a/libextra/Makefile.am +++ b/libextra/Makefile.am @@ -21,13 +21,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. -ACLOCAL_AMFLAGS = -I m4 -I gl/m4 -I ../lib/m4 -I ../lib/gl/m4 +ACLOCAL_AMFLAGS = -I ../m4 -I ../gl/m4 AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../lib/gl \ - -I$(builddir)/../lib/gl \ - -I$(srcdir)/gl \ + -I$(srcdir)/../gl \ -I$(builddir)/../lib/includes \ -I$(srcdir)/../lib/includes \ -I$(srcdir)/includes \ @@ -37,7 +35,7 @@ if ENABLE_MINITASN1 AM_CPPFLAGS += -I$(srcdir)/../lib/minitasn1 endif -SUBDIRS = gl includes +SUBDIRS = includes # Pkg-config script. pkgconfigdir = $(libdir)/pkgconfig @@ -61,7 +59,7 @@ lib_LTLIBRARIES += libgnutls-openssl.la libgnutls_openssl_la_SOURCES = gnutls_openssl.c openssl_compat.h \ openssl_compat.c -libgnutls_openssl_la_LIBADD = ../lib/gl/liblgnu.la $(LIBSOCKET) \ +libgnutls_openssl_la_LIBADD = ../gl/libgnu.la $(LIBSOCKET) \ ../lib/libgnutls.la libgnutls_openssl_la_LDFLAGS += -version-info $(LT_SSL_CURRENT):$(LT_SSL_REVISION):$(LT_SSL_AGE) @@ -102,7 +100,7 @@ libgnutls_extra_la_LDFLAGS += \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ $(LZO_LIBS) -libgnutls_extra_la_LIBADD += ../lib/gl/liblgnu.la gl/libxgnu.la \ +libgnutls_extra_la_LIBADD += ../gl/libgnu.la \ ../lib/libgnutls.la if HAVE_LD_VERSION_SCRIPT diff --git a/libextra/configure.ac b/libextra/configure.ac deleted file mode 100644 index d63dfd80e2..0000000000 --- a/libextra/configure.ac +++ /dev/null @@ -1,62 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -# 2009, 2010 Free Software Foundation, Inc. -# -# Author: Nikos Mavrogiannopoulos, Simon Josefsson -# -# This file is part of GnuTLS-EXTRA. -# -# GnuTLS-extra is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# GnuTLS-extra is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GnuTLS-EXTRA; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -AC_PREREQ(2.61) -AC_INIT([libgnutls-extra], [2.11.7], [bug-gnutls@gnu.org]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) - -AM_INIT_AUTOMAKE([1.10 -Wall -Werror -Wno-override]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(config.h) - -AC_PROG_CC -xgl_EARLY - -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -LIBGNUTLS_HOOKS -LIBGNUTLS_EXTRA_HOOKS - -xgl_INIT - -LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LZO_LIBS $LIBGNUTLS_LIBS" -LIBGNUTLS_EXTRA_CFLAGS="-I${includedir}" -AC_SUBST(LIBGNUTLS_EXTRA_LIBS) -AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS) - -# Finish things from ../configure.ac. -AC_SUBST([WERROR_CFLAGS]) -AC_SUBST([WSTACK_CFLAGS]) -AC_SUBST([WARN_CFLAGS]) - -AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.]) - -AC_CONFIG_FILES([ - Makefile - gnutls-extra.pc - gl/Makefile - includes/Makefile -]) -AC_OUTPUT diff --git a/libextra/gl/Makefile.am b/libextra/gl/Makefile.am deleted file mode 100644 index 51e5e417a4..0000000000 --- a/libextra/gl/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -## Process this file with automake to produce Makefile.in -# Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. -# -# Author: Simon Josefsson -# -# This file is part of GnuTLS-EXTRA. -# -# GnuTLS-extra is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# GnuTLS-extra is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GnuTLS-EXTRA; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -AUTOMAKE_OPTIONS = 1.5 gnits - -noinst_HEADERS = -noinst_LIBRARIES = -noinst_LTLIBRARIES = -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = - -AM_CPPFLAGS = -I$(srcdir)/../../lib/gl -I$(builddir)/../../lib/gl - -include gnulib.mk diff --git a/libextra/gl/gnulib.mk b/libextra/gl/gnulib.mk deleted file mode 100644 index 9b88b00222..0000000000 --- a/libextra/gl/gnulib.mk +++ /dev/null @@ -1,67 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libxgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --avoid=dummy --avoid=stdint --makefile-name=gnulib.mk --libtool --macro-prefix=xgl --no-vc-files crypto/hmac-md5 crypto/md5 extensions havelib lib-msvc-compat lib-symbol-versions - - -MOSTLYCLEANFILES += core *.stackdump - -noinst_LTLIBRARIES += libxgnu.la - -libxgnu_la_SOURCES = -libxgnu_la_LIBADD = $(xgl_LTLIBOBJS) -libxgnu_la_DEPENDENCIES = $(xgl_LTLIBOBJS) -EXTRA_libxgnu_la_SOURCES = -libxgnu_la_LDFLAGS = $(AM_LDFLAGS) -libxgnu_la_LDFLAGS += -no-undefined - -## begin gnulib module crypto/hmac-md5 - - -EXTRA_DIST += hmac-md5.c hmac.h - -EXTRA_libxgnu_la_SOURCES += hmac-md5.c - -## end gnulib module crypto/hmac-md5 - -## begin gnulib module crypto/md5 - - -EXTRA_DIST += md5.c md5.h - -EXTRA_libxgnu_la_SOURCES += md5.c - -## end gnulib module crypto/md5 - -## begin gnulib module havelib - - -EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath - -## end gnulib module havelib - -## begin gnulib module memxor - - -EXTRA_DIST += memxor.c memxor.h - -EXTRA_libxgnu_la_SOURCES += memxor.c - -## end gnulib module memxor - - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/libextra/gl/hmac-md5.c b/libextra/gl/hmac-md5.c deleted file mode 100644 index 5e457ece10..0000000000 --- a/libextra/gl/hmac-md5.c +++ /dev/null @@ -1,81 +0,0 @@ -/* hmac-md5.c -- hashed message authentication codes - Copyright (C) 2005, 2006, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Simon Josefsson. */ - -#include <config.h> - -#include "hmac.h" - -#include "memxor.h" -#include "md5.h" - -#include <string.h> - -#define IPAD 0x36 -#define OPAD 0x5c - -int -hmac_md5 (const void *key, size_t keylen, - const void *in, size_t inlen, void *resbuf) -{ - struct md5_ctx inner; - struct md5_ctx outer; - char optkeybuf[16]; - char block[64]; - char innerhash[16]; - - /* Reduce the key's size, so that it becomes <= 64 bytes large. */ - - if (keylen > 64) - { - struct md5_ctx keyhash; - - md5_init_ctx (&keyhash); - md5_process_bytes (key, keylen, &keyhash); - md5_finish_ctx (&keyhash, optkeybuf); - - key = optkeybuf; - keylen = 16; - } - - /* Compute INNERHASH from KEY and IN. */ - - md5_init_ctx (&inner); - - memset (block, IPAD, sizeof (block)); - memxor (block, key, keylen); - - md5_process_block (block, 64, &inner); - md5_process_bytes (in, inlen, &inner); - - md5_finish_ctx (&inner, innerhash); - - /* Compute result from KEY and INNERHASH. */ - - md5_init_ctx (&outer); - - memset (block, OPAD, sizeof (block)); - memxor (block, key, keylen); - - md5_process_block (block, 64, &outer); - md5_process_bytes (innerhash, 16, &outer); - - md5_finish_ctx (&outer, resbuf); - - return 0; -} diff --git a/libextra/gl/hmac.h b/libextra/gl/hmac.h deleted file mode 100644 index 1ee9c4a78a..0000000000 --- a/libextra/gl/hmac.h +++ /dev/null @@ -1,41 +0,0 @@ -/* hmac.h -- hashed message authentication codes - Copyright (C) 2005, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Simon Josefsson. */ - -#ifndef HMAC_H -# define HMAC_H 1 - -#include <stddef.h> - -/* Compute Hashed Message Authentication Code with MD5, as described - in RFC 2104, over BUFFER data of BUFLEN bytes using the KEY of - KEYLEN bytes, writing the output to pre-allocated 16 byte minimum - RESBUF buffer. Return 0 on success. */ -int -hmac_md5 (const void *key, size_t keylen, - const void *buffer, size_t buflen, void *resbuf); - -/* Compute Hashed Message Authentication Code with SHA-1, over BUFFER - data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the - output to pre-allocated 20 byte minimum RESBUF buffer. Return 0 on - success. */ -int -hmac_sha1 (const void *key, size_t keylen, - const void *in, size_t inlen, void *resbuf); - -#endif /* HMAC_H */ diff --git a/libextra/gl/m4/00gnulib.m4 b/libextra/gl/m4/00gnulib.m4 deleted file mode 100644 index 301469b31c..0000000000 --- a/libextra/gl/m4/00gnulib.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# 00gnulib.m4 serial 2 -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. - -dnl This file must be named something that sorts before all other -dnl gnulib-provided .m4 files. It is needed until such time as we can -dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. - -# AC_DEFUN_ONCE([NAME], VALUE) -# ---------------------------- -# Define NAME to expand to VALUE on the first use (whether by direct -# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. -# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This -# definition is slower than the version in Autoconf 2.64, because it -# can only use interfaces that existed since 2.59; but it achieves the -# same effect. Quoting is necessary to avoid confusing Automake. -m4_version_prereq([2.63.263], [], -[m4_define([AC][_DEFUN_ONCE], - [AC][_DEFUN([$1], - [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], - [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl -[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) - -# gl_00GNULIB -# ----------- -# Witness macro that this file has been included. Needed to force -# Automake to include this file prior to all other gnulib .m4 files. -AC_DEFUN([gl_00GNULIB]) diff --git a/libextra/gl/m4/extensions.m4 b/libextra/gl/m4/extensions.m4 deleted file mode 100644 index 7d9458a8d6..0000000000 --- a/libextra/gl/m4/extensions.m4 +++ /dev/null @@ -1,118 +0,0 @@ -# serial 9 -*- Autoconf -*- -# Enable extensions on systems that normally disable them. - -# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS -# Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly -# enough in this area it's likely we'll need to redefine -# AC_USE_SYSTEM_EXTENSIONS for quite some time. - -# If autoconf reports a warning -# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS -# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS -# the fix is -# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked -# but always AC_REQUIREd, -# 2) to ensure that for each occurrence of -# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -# or -# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -# the corresponding gnulib module description has 'extensions' among -# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS -# invocation occurs in gl_EARLY, not in gl_INIT. - -# AC_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -# Remember that #undef in AH_VERBATIM gets replaced with #define by -# AC_DEFINE. The goal here is to define all known feature-enabling -# macros, then, if reports of conflicts are made, disable macros that -# cause problems on some platforms (such as __EXTENSIONS__). -AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], -[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl -AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - - AC_REQUIRE([AC_CANONICAL_HOST]) - - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) - if test "$MINIX" = yes; then - AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other - things to work.]) - AC_DEFINE([_POSIX_1_SOURCE], [2], - [Define to 2 if the system does not provide POSIX.1 features - except with this defined.]) - AC_DEFINE([_MINIX], [1], - [Define to 1 if on MINIX.]) - fi - - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -]) - AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], - [ac_cv_safe_to_define___extensions__], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -# define __EXTENSIONS__ 1 - ]AC_INCLUDES_DEFAULT])], - [ac_cv_safe_to_define___extensions__=yes], - [ac_cv_safe_to_define___extensions__=no])]) - test $ac_cv_safe_to_define___extensions__ = yes && - AC_DEFINE([__EXTENSIONS__]) - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) - AC_DEFINE([_TANDEM_SOURCE]) -])# AC_USE_SYSTEM_EXTENSIONS - -# gl_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], -[ - dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. - dnl gnulib does not need it. But if it gets required by third-party macros - dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a - dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". - dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, - dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -]) diff --git a/libextra/gl/m4/gnulib-cache.m4 b/libextra/gl/m4/gnulib-cache.m4 deleted file mode 100644 index ad8c687dbc..0000000000 --- a/libextra/gl/m4/gnulib-cache.m4 +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# -# This file represents the specification of how gnulib-tool is used. -# It acts as a cache: It is written and read by gnulib-tool. -# In projects that use version control, this file is meant to be put under -# version control, like the configure.ac and various Makefile.am files. - - -# Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libxgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --avoid=dummy --avoid=stdint --makefile-name=gnulib.mk --libtool --macro-prefix=xgl --no-vc-files crypto/hmac-md5 crypto/md5 extensions havelib lib-msvc-compat lib-symbol-versions - -# Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_LOCAL_DIR([gl/override]) -gl_MODULES([ - crypto/hmac-md5 - crypto/md5 - extensions - havelib - lib-msvc-compat - lib-symbol-versions -]) -gl_AVOID([dummy stdint]) -gl_SOURCE_BASE([gl]) -gl_M4_BASE([gl/m4]) -gl_PO_BASE([]) -gl_DOC_BASE([doc]) -gl_TESTS_BASE([gl/tests]) -gl_LIB([libxgnu]) -gl_MAKEFILE_NAME([gnulib.mk]) -gl_LIBTOOL -gl_MACRO_PREFIX([xgl]) -gl_PO_DOMAIN([]) -gl_VC_FILES([false]) diff --git a/libextra/gl/m4/gnulib-common.m4 b/libextra/gl/m4/gnulib-common.m4 deleted file mode 100644 index d0c8b66287..0000000000 --- a/libextra/gl/m4/gnulib-common.m4 +++ /dev/null @@ -1,214 +0,0 @@ -# gnulib-common.m4 serial 21 -dnl Copyright (C) 2007-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. - -# gl_COMMON -# is expanded unconditionally through gnulib-tool magic. -AC_DEFUN([gl_COMMON], [ - dnl Use AC_REQUIRE here, so that the code is expanded once only. - AC_REQUIRE([gl_00GNULIB]) - AC_REQUIRE([gl_COMMON_BODY]) -]) -AC_DEFUN([gl_COMMON_BODY], [ - AH_VERBATIM([isoc99_inline], -[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports - the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of - earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. - __APPLE_CC__ tests for the Apple compiler and its version. - __STDC_VERSION__ tests for the C99 mode. */ -#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ -# define __GNUC_STDC_INLINE__ 1 -#endif]) - AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED -]) - dnl Preparation for running test programs: - dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not - dnl to /dev/tty, so they can be redirected to log files. Such diagnostics - dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. - LIBC_FATAL_STDERR_=1 - export LIBC_FATAL_STDERR_ -]) - -# gl_MODULE_INDICATOR_CONDITION -# expands to a C preprocessor expression that evaluates to 1 or 0, depending -# whether a gnulib module that has been requested shall be considered present -# or not. -AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) - -# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) -# sets the shell variable that indicates the presence of the given module to -# a C preprocessor expression that will evaluate to 1. -AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], -[ - GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION -]) - -# gl_MODULE_INDICATOR([modulename]) -# defines a C macro indicating the presence of the given module -# in a location where it can be used. -# | Value | Value | -# | in lib/ | in tests/ | -# --------------------------------------------+---------+-----------+ -# Module present among main modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module present among tests-related modules: | 0 | 1 | -# --------------------------------------------+---------+-----------+ -# Module not present at all: | 0 | 0 | -# --------------------------------------------+---------+-----------+ -AC_DEFUN([gl_MODULE_INDICATOR], -[ - AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), - [gl_MODULE_INDICATOR_CONDITION], - [Define to a C preprocessor expression that evaluates to 1 or 0, - depending whether the gnulib module $1 shall be considered present.]) -]) - -# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) -# defines a C macro indicating the presence of the given module -# in lib or tests. This is useful to determine whether the module -# should be tested. -# | Value | Value | -# | in lib/ | in tests/ | -# --------------------------------------------+---------+-----------+ -# Module present among main modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module present among tests-related modules: | 1 | 1 | -# --------------------------------------------+---------+-----------+ -# Module not present at all: | 0 | 0 | -# --------------------------------------------+---------+-----------+ -AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], -[ - AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], - [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 -# is a backport of autoconf-2.59c's m4_foreach_w. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - -# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) -# ---------------------------------------------------- -# Backport of autoconf-2.63b's macro. -# Remove this macro when we can assume autoconf >= 2.64. -m4_ifndef([AS_VAR_IF], -[m4_define([AS_VAR_IF], -[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) - -# AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix -# for interoperability with automake-1.9.6 from autoconf-2.62. -# Remove this macro when we can assume autoconf >= 2.62 or -# autoconf >= 2.60 && automake >= 1.10. -m4_ifdef([AC_PROG_MKDIR_P], [ - dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. - m4_define([AC_PROG_MKDIR_P], - m4_defn([AC_PROG_MKDIR_P])[ - AC_SUBST([MKDIR_P])])], [ - dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. - AC_DEFUN_ONCE([AC_PROG_MKDIR_P], - [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])])]) - -# AC_C_RESTRICT -# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, -# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ -# works. -# This definition can be removed once autoconf >= 2.62 can be assumed. -m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ -AC_DEFUN([AC_C_RESTRICT], -[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], - [ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - }]], - [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], - [ac_cv_c_restrict=$ac_kw]) - test "$ac_cv_c_restrict" != no && break - done - ]) - AH_VERBATIM([restrict], -[/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict, even - though the corresponding Sun C compiler does, which causes - "#define restrict _Restrict" in the previous line. Perhaps some future - version of Sun C++ will work with _Restrict; if so, it'll probably - define __RESTRICT, just as Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -#endif]) - case $ac_cv_c_restrict in - restrict) ;; - no) AC_DEFINE([restrict], []) ;; - *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; - esac -]) -]) - -# gl_BIGENDIAN -# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. -# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some -# macros invoke AC_C_BIGENDIAN with arguments. -AC_DEFUN([gl_BIGENDIAN], -[ - AC_C_BIGENDIAN -]) - -# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) -# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not -# output a spurious "(cached)" mark in the midst of other configure output. -# This macro should be used instead of AC_CACHE_VAL when it is not surrounded -# by an AC_MSG_CHECKING/AC_MSG_RESULT pair. -AC_DEFUN([gl_CACHE_VAL_SILENT], -[ - saved_as_echo_n="$as_echo_n" - as_echo_n=':' - AC_CACHE_VAL([$1], [$2]) - as_echo_n="$saved_as_echo_n" -]) diff --git a/libextra/gl/m4/gnulib-comp.m4 b/libextra/gl/m4/gnulib-comp.m4 deleted file mode 100644 index d02a7275fc..0000000000 --- a/libextra/gl/m4/gnulib-comp.m4 +++ /dev/null @@ -1,219 +0,0 @@ -# DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2010 Free Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# -# This file represents the compiled summary of the specification in -# gnulib-cache.m4. It lists the computed macro invocations that need -# to be invoked from configure.ac. -# In projects that use version control, this file can be treated like -# other built files. - - -# This macro should be invoked from ./configure.ac, in the section -# "Checks for programs", right after AC_PROG_CC, and certainly before -# any checks for libraries, header files, types and library functions. -AC_DEFUN([xgl_EARLY], -[ - m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace - m4_pattern_allow([^gl_ES$])dnl a valid locale name - m4_pattern_allow([^gl_LIBOBJS$])dnl a variable - m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable - AC_REQUIRE([AC_PROG_RANLIB]) - # Code from module crypto/hmac-md5: - # Code from module crypto/md5: - # Code from module extensions: - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - # Code from module havelib: - # Code from module lib-msvc-compat: - # Code from module lib-symbol-versions: - # Code from module memxor: -]) - -# This macro should be invoked from ./configure.ac, in the section -# "Check for header files, types and library functions". -AC_DEFUN([xgl_INIT], -[ - AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) - gl_cond_libtool=true - gl_m4_base='gl/m4' - m4_pushdef([AC_LIBOBJ], m4_defn([xgl_LIBOBJ])) - m4_pushdef([AC_REPLACE_FUNCS], m4_defn([xgl_REPLACE_FUNCS])) - m4_pushdef([AC_LIBSOURCES], m4_defn([xgl_LIBSOURCES])) - m4_pushdef([xgl_LIBSOURCES_LIST], []) - m4_pushdef([xgl_LIBSOURCES_DIR], []) - gl_COMMON - gl_source_base='gl' - # Code from module crypto/hmac-md5: - gl_HMAC_MD5 - # Code from module crypto/md5: - gl_MD5 - # Code from module extensions: - # Code from module havelib: - # Code from module lib-msvc-compat: - gl_LD_OUTPUT_DEF - # Code from module lib-symbol-versions: - gl_LD_VERSION_SCRIPT - # Code from module memxor: - gl_MEMXOR - # End of code from modules - m4_ifval(xgl_LIBSOURCES_LIST, [ - m4_syscmd([test ! -d ]m4_defn([xgl_LIBSOURCES_DIR])[ || - for gl_file in ]xgl_LIBSOURCES_LIST[ ; do - if test ! -r ]m4_defn([xgl_LIBSOURCES_DIR])[/$gl_file ; then - echo "missing file ]m4_defn([xgl_LIBSOURCES_DIR])[/$gl_file" >&2 - exit 1 - fi - done])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) - m4_popdef([xgl_LIBSOURCES_DIR]) - m4_popdef([xgl_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) - m4_popdef([AC_REPLACE_FUNCS]) - m4_popdef([AC_LIBOBJ]) - AC_CONFIG_COMMANDS_PRE([ - xgl_libobjs= - xgl_ltlibobjs= - if test -n "$xgl_LIBOBJS"; then - # Remove the extension. - sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $xgl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do - xgl_libobjs="$xgl_libobjs $i.$ac_objext" - xgl_ltlibobjs="$xgl_ltlibobjs $i.lo" - done - fi - AC_SUBST([xgl_LIBOBJS], [$xgl_libobjs]) - AC_SUBST([xgl_LTLIBOBJS], [$xgl_ltlibobjs]) - ]) - gltests_libdeps= - gltests_ltlibdeps= - m4_pushdef([AC_LIBOBJ], m4_defn([xgltests_LIBOBJ])) - m4_pushdef([AC_REPLACE_FUNCS], m4_defn([xgltests_REPLACE_FUNCS])) - m4_pushdef([AC_LIBSOURCES], m4_defn([xgltests_LIBSOURCES])) - m4_pushdef([xgltests_LIBSOURCES_LIST], []) - m4_pushdef([xgltests_LIBSOURCES_DIR], []) - gl_COMMON - gl_source_base='gl/tests' -changequote(,)dnl - xgltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS -changequote([, ])dnl - AC_SUBST([xgltests_WITNESS]) - gl_module_indicator_condition=$xgltests_WITNESS - m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) - m4_popdef([gl_MODULE_INDICATOR_CONDITION]) - m4_ifval(xgltests_LIBSOURCES_LIST, [ - m4_syscmd([test ! -d ]m4_defn([xgltests_LIBSOURCES_DIR])[ || - for gl_file in ]xgltests_LIBSOURCES_LIST[ ; do - if test ! -r ]m4_defn([xgltests_LIBSOURCES_DIR])[/$gl_file ; then - echo "missing file ]m4_defn([xgltests_LIBSOURCES_DIR])[/$gl_file" >&2 - exit 1 - fi - done])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) - m4_popdef([xgltests_LIBSOURCES_DIR]) - m4_popdef([xgltests_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) - m4_popdef([AC_REPLACE_FUNCS]) - m4_popdef([AC_LIBOBJ]) - AC_CONFIG_COMMANDS_PRE([ - xgltests_libobjs= - xgltests_ltlibobjs= - if test -n "$xgltests_LIBOBJS"; then - # Remove the extension. - sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $xgltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do - xgltests_libobjs="$xgltests_libobjs $i.$ac_objext" - xgltests_ltlibobjs="$xgltests_ltlibobjs $i.lo" - done - fi - AC_SUBST([xgltests_LIBOBJS], [$xgltests_libobjs]) - AC_SUBST([xgltests_LTLIBOBJS], [$xgltests_ltlibobjs]) - ]) -]) - -# Like AC_LIBOBJ, except that the module name goes -# into xgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([xgl_LIBOBJ], [ - AS_LITERAL_IF([$1], [xgl_LIBSOURCES([$1.c])])dnl - xgl_LIBOBJS="$xgl_LIBOBJS $1.$ac_objext" -]) - -# Like AC_REPLACE_FUNCS, except that the module name goes -# into xgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([xgl_REPLACE_FUNCS], [ - m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl - AC_CHECK_FUNCS([$1], , [xgl_LIBOBJ($ac_func)]) -]) - -# Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parameterization, -# and alloca is special cased (for the alloca-opt module). -# We could also entirely rely on EXTRA_lib..._SOURCES. -AC_DEFUN([xgl_LIBSOURCES], [ - m4_foreach([_gl_NAME], [$1], [ - m4_if(_gl_NAME, [alloca.c], [], [ - m4_define([xgl_LIBSOURCES_DIR], [gl]) - m4_append([xgl_LIBSOURCES_LIST], _gl_NAME, [ ]) - ]) - ]) -]) - -# Like AC_LIBOBJ, except that the module name goes -# into xgltests_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([xgltests_LIBOBJ], [ - AS_LITERAL_IF([$1], [xgltests_LIBSOURCES([$1.c])])dnl - xgltests_LIBOBJS="$xgltests_LIBOBJS $1.$ac_objext" -]) - -# Like AC_REPLACE_FUNCS, except that the module name goes -# into xgltests_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([xgltests_REPLACE_FUNCS], [ - m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl - AC_CHECK_FUNCS([$1], , [xgltests_LIBOBJ($ac_func)]) -]) - -# Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parameterization, -# and alloca is special cased (for the alloca-opt module). -# We could also entirely rely on EXTRA_lib..._SOURCES. -AC_DEFUN([xgltests_LIBSOURCES], [ - m4_foreach([_gl_NAME], [$1], [ - m4_if(_gl_NAME, [alloca.c], [], [ - m4_define([xgltests_LIBSOURCES_DIR], [gl/tests]) - m4_append([xgltests_LIBSOURCES_LIST], _gl_NAME, [ ]) - ]) - ]) -]) - -# This macro records the list of files which have been installed by -# gnulib-tool and may be removed by future gnulib-tool invocations. -AC_DEFUN([xgl_FILE_LIST], [ - build-aux/config.rpath - lib/hmac-md5.c - lib/hmac.h - lib/md5.c - lib/md5.h - lib/memxor.c - lib/memxor.h - m4/00gnulib.m4 - m4/extensions.m4 - m4/gnulib-common.m4 - m4/hmac-md5.m4 - m4/ld-output-def.m4 - m4/ld-version-script.m4 - m4/lib-ld.m4 - m4/lib-link.m4 - m4/lib-prefix.m4 - m4/md5.m4 - m4/memxor.m4 -]) diff --git a/libextra/gl/m4/gnulib-tool.m4 b/libextra/gl/m4/gnulib-tool.m4 deleted file mode 100644 index 69e7733b99..0000000000 --- a/libextra/gl/m4/gnulib-tool.m4 +++ /dev/null @@ -1,57 +0,0 @@ -# gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 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. - -dnl The following macros need not be invoked explicitly. -dnl Invoking them does nothing except to declare default arguments -dnl for "gnulib-tool --import". - -dnl Usage: gl_LOCAL_DIR([DIR]) -AC_DEFUN([gl_LOCAL_DIR], []) - -dnl Usage: gl_MODULES([module1 module2 ...]) -AC_DEFUN([gl_MODULES], []) - -dnl Usage: gl_AVOID([module1 module2 ...]) -AC_DEFUN([gl_AVOID], []) - -dnl Usage: gl_SOURCE_BASE([DIR]) -AC_DEFUN([gl_SOURCE_BASE], []) - -dnl Usage: gl_M4_BASE([DIR]) -AC_DEFUN([gl_M4_BASE], []) - -dnl Usage: gl_PO_BASE([DIR]) -AC_DEFUN([gl_PO_BASE], []) - -dnl Usage: gl_DOC_BASE([DIR]) -AC_DEFUN([gl_DOC_BASE], []) - -dnl Usage: gl_TESTS_BASE([DIR]) -AC_DEFUN([gl_TESTS_BASE], []) - -dnl Usage: gl_WITH_TESTS -AC_DEFUN([gl_WITH_TESTS], []) - -dnl Usage: gl_LIB([LIBNAME]) -AC_DEFUN([gl_LIB], []) - -dnl Usage: gl_LGPL or gl_LGPL([VERSION]) -AC_DEFUN([gl_LGPL], []) - -dnl Usage: gl_MAKEFILE_NAME([FILENAME]) -AC_DEFUN([gl_MAKEFILE_NAME], []) - -dnl Usage: gl_LIBTOOL -AC_DEFUN([gl_LIBTOOL], []) - -dnl Usage: gl_MACRO_PREFIX([PREFIX]) -AC_DEFUN([gl_MACRO_PREFIX], []) - -dnl Usage: gl_PO_DOMAIN([DOMAIN]) -AC_DEFUN([gl_PO_DOMAIN], []) - -dnl Usage: gl_VC_FILES([BOOLEAN]) -AC_DEFUN([gl_VC_FILES], []) diff --git a/libextra/gl/m4/hmac-md5.m4 b/libextra/gl/m4/hmac-md5.m4 deleted file mode 100644 index 417b3e36f4..0000000000 --- a/libextra/gl/m4/hmac-md5.m4 +++ /dev/null @@ -1,10 +0,0 @@ -# hmac-md5.m4 serial 2 -dnl Copyright (C) 2005, 2006, 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_HMAC_MD5], -[ - AC_LIBOBJ([hmac-md5]) -]) diff --git a/libextra/gl/m4/ld-output-def.m4 b/libextra/gl/m4/ld-output-def.m4 deleted file mode 100644 index 2dc6bf5205..0000000000 --- a/libextra/gl/m4/ld-output-def.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# ld-output-def.m4 serial 2 -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. - -dnl From Simon Josefsson - -# gl_LD_OUTPUT_DEF() -# ------------- -# Check if linker supports -Wl,--output-def and define automake -# conditional HAVE_LD_OUTPUT_DEF if it is. -AC_DEFUN([gl_LD_OUTPUT_DEF], -[ - AC_CACHE_CHECK([if gcc/ld supports -Wl,--output-def], - [gl_cv_ld_output_def], - [if test "$enable_shared" = no; then - gl_cv_ld_output_def="not needed, shared libraries are disabled" - else - gl_ldflags_save=$LDFLAGS - LDFLAGS="-Wl,--output-def,conftest.def" - AC_LINK_IFELSE([AC_LANG_PROGRAM([])], - [gl_cv_ld_output_def=yes], - [gl_cv_ld_output_def=no]) - rm -f conftest.def - LDFLAGS="$gl_ldflags_save" - fi]) - AM_CONDITIONAL([HAVE_LD_OUTPUT_DEF], test "x$gl_cv_ld_output_def" = "xyes") -]) diff --git a/libextra/gl/m4/ld-version-script.m4 b/libextra/gl/m4/ld-version-script.m4 deleted file mode 100644 index 8fd8c8995c..0000000000 --- a/libextra/gl/m4/ld-version-script.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# ld-version-script.m4 serial 2 -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. - -dnl From Simon Josefsson - -# FIXME: The test below returns a false positive for mingw -# cross-compiles, 'local:' statements does not reduce number of -# exported symbols in a DLL. Use --disable-ld-version-script to work -# around the problem. - -# gl_LD_VERSION_SCRIPT -# -------------------- -# Check if LD supports linker scripts, and define automake conditional -# HAVE_LD_VERSION_SCRIPT if so. -AC_DEFUN([gl_LD_VERSION_SCRIPT], -[ - AC_ARG_ENABLE([ld-version-script], - AS_HELP_STRING([--enable-ld-version-script], - [enable linker version script (default is enabled when possible)]), - [have_ld_version_script=$enableval], []) - if test -z "$have_ld_version_script"; then - AC_MSG_CHECKING([if LD -Wl,--version-script works]) - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" - cat > conftest.map <<EOF -VERS_1 { - global: sym; -}; - -VERS_2 { - global: sym; -} VERS_1; -EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) - rm -f conftest.map - LDFLAGS="$save_LDFLAGS" - AC_MSG_RESULT($have_ld_version_script) - fi - AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") -]) diff --git a/libextra/gl/m4/lib-ld.m4 b/libextra/gl/m4/lib-ld.m4 deleted file mode 100644 index 294db72e13..0000000000 --- a/libextra/gl/m4/lib-ld.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 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. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - acl_cv_prog_gnu_ld=yes ;; -*) - acl_cv_prog_gnu_ld=no ;; -esac]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH([gnu-ld], -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT([$LD]) -else - AC_MSG_RESULT([no]) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/libextra/gl/m4/lib-link.m4 b/libextra/gl/m4/lib-link.m4 deleted file mode 100644 index 2ea9d6d073..0000000000 --- a/libextra/gl/m4/lib-link.m4 +++ /dev/null @@ -1,775 +0,0 @@ -# lib-link.m4 serial 25 (gettext-0.18.2) -dnl Copyright (C) 2001-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 From Bruno Haible. - -AC_PREREQ([2.54]) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - popdef([NAME]) - popdef([Name]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. The missing-message -dnl defaults to 'no' and may contain additional hints for the user. -dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} -dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, - dnl because these -l options might require -L options that are present in - dnl LIBS. -l options benefit only from the -L options listed before it. - dnl Otherwise, add it to the front of LIBS, because it may be a static - dnl library that depends on another static library that is present in LIBS. - dnl Static libraries benefit only from the static libraries listed after - dnl it. - case " $LIB[]NAME" in - *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; - *) LIBS="$LIB[]NAME $LIBS" ;; - esac - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[$3]], [[$4]])], - [ac_cv_lib[]Name=yes], - [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - LIB[]NAME[]_PREFIX= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - popdef([NAME]) - popdef([Name]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl acl_libext, -dnl acl_shlibext, -dnl acl_hardcode_libdir_flag_spec, -dnl acl_hardcode_libdir_separator, -dnl acl_hardcode_direct, -dnl acl_hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([P_A_C_K]) - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) diff --git a/libextra/gl/m4/lib-prefix.m4 b/libextra/gl/m4/lib-prefix.m4 deleted file mode 100644 index 1601ceaefd..0000000000 --- a/libextra/gl/m4/lib-prefix.m4 +++ /dev/null @@ -1,224 +0,0 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 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 From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>. - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -]) diff --git a/libextra/gl/m4/md5.m4 b/libextra/gl/m4/md5.m4 deleted file mode 100644 index 52f9c1b873..0000000000 --- a/libextra/gl/m4/md5.m4 +++ /dev/null @@ -1,16 +0,0 @@ -# md5.m4 serial 11 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software -dnl 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_MD5], -[ - AC_LIBOBJ([md5]) - - dnl Prerequisites of lib/md5.c. - AC_REQUIRE([gl_BIGENDIAN]) - AC_REQUIRE([AC_C_INLINE]) - : -]) diff --git a/libextra/gl/m4/memxor.m4 b/libextra/gl/m4/memxor.m4 deleted file mode 100644 index 3093cdc320..0000000000 --- a/libextra/gl/m4/memxor.m4 +++ /dev/null @@ -1,11 +0,0 @@ -# memxor.m4 serial 3 -dnl Copyright (C) 2006, 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_MEMXOR], -[ - AC_LIBOBJ([memxor]) - AC_REQUIRE([AC_C_RESTRICT]) -]) diff --git a/libextra/gl/md5.c b/libextra/gl/md5.c deleted file mode 100644 index 912738a500..0000000000 --- a/libextra/gl/md5.c +++ /dev/null @@ -1,465 +0,0 @@ -/* Functions to compute MD5 message digest of files or memory blocks. - according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005, 2006, 2008, 2009, - 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ - -#include <config.h> - -#include "md5.h" - -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> - -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - -#ifdef _LIBC -# include <endian.h> -# if __BYTE_ORDER == __BIG_ENDIAN -# define WORDS_BIGENDIAN 1 -# endif -/* We need to keep the namespace clean so define the MD5 function - protected using leading __ . */ -# define md5_init_ctx __md5_init_ctx -# define md5_process_block __md5_process_block -# define md5_process_bytes __md5_process_bytes -# define md5_finish_ctx __md5_finish_ctx -# define md5_read_ctx __md5_read_ctx -# define md5_stream __md5_stream -# define md5_buffer __md5_buffer -#endif - -#ifdef WORDS_BIGENDIAN -# define SWAP(n) \ - (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) -#else -# define SWAP(n) (n) -#endif - -#define BLOCKSIZE 32768 -#if BLOCKSIZE % 64 != 0 -# error "invalid BLOCKSIZE" -#endif - -/* This array contains the bytes used to pad the buffer to the next - 64-byte boundary. (RFC 1321, 3.1: Step 1) */ -static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; - - -/* Initialize structure containing state of computation. - (RFC 1321, 3.3: Step 3) */ -void -md5_init_ctx (struct md5_ctx *ctx) -{ - ctx->A = 0x67452301; - ctx->B = 0xefcdab89; - ctx->C = 0x98badcfe; - ctx->D = 0x10325476; - - ctx->total[0] = ctx->total[1] = 0; - ctx->buflen = 0; -} - -/* Copy the 4 byte value from v into the memory location pointed to by *cp, - If your architecture allows unaligned access this is equivalent to - * (uint32_t *) cp = v */ -static inline void -set_uint32 (char *cp, uint32_t v) -{ - memcpy (cp, &v, sizeof v); -} - -/* Put result from CTX in first 16 bytes following RESBUF. The result - must be in little endian byte order. */ -void * -md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) -{ - char *r = resbuf; - set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); - set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); - set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); - set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); - - return resbuf; -} - -/* Process the remaining bytes in the internal buffer and the usual - prolog according to the standard and write the result to RESBUF. */ -void * -md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) -{ - /* Take yet unprocessed bytes into account. */ - uint32_t bytes = ctx->buflen; - size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; - - /* Now count remaining bytes. */ - ctx->total[0] += bytes; - if (ctx->total[0] < bytes) - ++ctx->total[1]; - - /* Put the 64-bit file length in *bits* at the end of the buffer. */ - ctx->buffer[size - 2] = SWAP (ctx->total[0] << 3); - ctx->buffer[size - 1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); - - memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); - - /* Process last bytes. */ - md5_process_block (ctx->buffer, size * 4, ctx); - - return md5_read_ctx (ctx, resbuf); -} - -#if 0 /* Not needed by GnuTLS, and it has a large stack frame. */ - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -int -md5_stream (FILE *stream, void *resblock) -{ - struct md5_ctx ctx; - size_t sum; - - char *buffer = malloc (BLOCKSIZE + 72); - if (!buffer) - return 1; - - /* Initialize the computation context. */ - md5_init_ctx (&ctx); - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - { - free (buffer); - return 1; - } - goto process_partial_block; - } - - /* We've read at least one byte, so ignore errors. But always - check for EOF, since feof may be true even though N > 0. - Otherwise, we could end up calling fread after EOF. */ - if (feof (stream)) - goto process_partial_block; - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 - */ - md5_process_block (buffer, BLOCKSIZE, &ctx); - } - -process_partial_block: - - /* Process any remaining bytes. */ - if (sum > 0) - md5_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - md5_finish_ctx (&ctx, resblock); - free (buffer); - return 0; -} -#endif - -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise - output yields to the wanted ASCII representation of the message - digest. */ -void * -md5_buffer (const char *buffer, size_t len, void *resblock) -{ - struct md5_ctx ctx; - - /* Initialize the computation context. */ - md5_init_ctx (&ctx); - - /* Process whole buffer but last len % 64 bytes. */ - md5_process_bytes (buffer, len, &ctx); - - /* Put result in desired memory area. */ - return md5_finish_ctx (&ctx, resblock); -} - - -void -md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) -{ - /* When we already have some bits in our internal buffer concatenate - both inputs first. */ - if (ctx->buflen != 0) - { - size_t left_over = ctx->buflen; - size_t add = 128 - left_over > len ? len : 128 - left_over; - - memcpy (&((char *) ctx->buffer)[left_over], buffer, add); - ctx->buflen += add; - - if (ctx->buflen > 64) - { - md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); - - ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ - memcpy (ctx->buffer, - &((char *) ctx->buffer)[(left_over + add) & ~63], - ctx->buflen); - } - - buffer = (const char *) buffer + add; - len -= add; - } - - /* Process available complete blocks. */ - if (len >= 64) - { -#if !_STRING_ARCH_unaligned -# define alignof(type) offsetof (struct { char c; type x; }, x) -# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) - if (UNALIGNED_P (buffer)) - while (len > 64) - { - md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); - buffer = (const char *) buffer + 64; - len -= 64; - } - else -#endif - { - md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); - len &= 63; - } - } - - /* Move remaining bytes in internal buffer. */ - if (len > 0) - { - size_t left_over = ctx->buflen; - - memcpy (&((char *) ctx->buffer)[left_over], buffer, len); - left_over += len; - if (left_over >= 64) - { - md5_process_block (ctx->buffer, 64, ctx); - left_over -= 64; - memcpy (ctx->buffer, &ctx->buffer[16], left_over); - } - ctx->buflen = left_over; - } -} - - -/* These are the four functions used in the four steps of the MD5 algorithm - and defined in the RFC 1321. The first function is a little bit optimized - (as found in Colin Plumbs public domain implementation). */ -/* #define FF(b, c, d) ((b & c) | (~b & d)) */ -#define FF(b, c, d) (d ^ (b & (c ^ d))) -#define FG(b, c, d) FF (d, b, c) -#define FH(b, c, d) (b ^ c ^ d) -#define FI(b, c, d) (c ^ (b | ~d)) - -/* Process LEN bytes of BUFFER, accumulating context into CTX. - It is assumed that LEN % 64 == 0. */ - -void -md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) -{ - uint32_t correct_words[16]; - const uint32_t *words = buffer; - size_t nwords = len / sizeof (uint32_t); - const uint32_t *endp = words + nwords; - uint32_t A = ctx->A; - uint32_t B = ctx->B; - uint32_t C = ctx->C; - uint32_t D = ctx->D; - - /* First increment the byte count. RFC 1321 specifies the possible - length of the file up to 2^64 bits. Here we only compute the - number of bytes. Do a double word increment. */ - ctx->total[0] += len; - if (ctx->total[0] < len) - ++ctx->total[1]; - - /* Process all bytes in the buffer with 64 bytes in each round of - the loop. */ - while (words < endp) - { - uint32_t *cwp = correct_words; - uint32_t A_save = A; - uint32_t B_save = B; - uint32_t C_save = C; - uint32_t D_save = D; - - /* First round: using the given function, the context and a constant - the next context is computed. Because the algorithms processing - unit is a 32-bit word and it is determined to work on words in - little endian byte order we perhaps have to change the byte order - before the computation. To reduce the work for the next steps - we store the swapped words in the array CORRECT_WORDS. */ - -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ - ++words; \ - CYCLIC (a, s); \ - a += b; \ - } \ - while (0) - - /* It is unfortunate that C does not provide an operator for - cyclic rotation. Hope the C compiler is smart enough. */ -#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) - - /* Before we start, one word to the strange constants. - They are defined in RFC 1321 as - - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 - - Here is an equivalent invocation using Perl: - - perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' - */ - - /* Round 1. */ - OP (A, B, C, D, 7, 0xd76aa478); - OP (D, A, B, C, 12, 0xe8c7b756); - OP (C, D, A, B, 17, 0x242070db); - OP (B, C, D, A, 22, 0xc1bdceee); - OP (A, B, C, D, 7, 0xf57c0faf); - OP (D, A, B, C, 12, 0x4787c62a); - OP (C, D, A, B, 17, 0xa8304613); - OP (B, C, D, A, 22, 0xfd469501); - OP (A, B, C, D, 7, 0x698098d8); - OP (D, A, B, C, 12, 0x8b44f7af); - OP (C, D, A, B, 17, 0xffff5bb1); - OP (B, C, D, A, 22, 0x895cd7be); - OP (A, B, C, D, 7, 0x6b901122); - OP (D, A, B, C, 12, 0xfd987193); - OP (C, D, A, B, 17, 0xa679438e); - OP (B, C, D, A, 22, 0x49b40821); - - /* For the second to fourth round we have the possibly swapped words - in CORRECT_WORDS. Redefine the macro to take an additional first - argument specifying the function to use. */ -#undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ - a += f (b, c, d) + correct_words[k] + T; \ - CYCLIC (a, s); \ - a += b; \ - } \ - while (0) - - /* Round 2. */ - OP (FG, A, B, C, D, 1, 5, 0xf61e2562); - OP (FG, D, A, B, C, 6, 9, 0xc040b340); - OP (FG, C, D, A, B, 11, 14, 0x265e5a51); - OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); - OP (FG, A, B, C, D, 5, 5, 0xd62f105d); - OP (FG, D, A, B, C, 10, 9, 0x02441453); - OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); - OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); - OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); - OP (FG, D, A, B, C, 14, 9, 0xc33707d6); - OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); - OP (FG, B, C, D, A, 8, 20, 0x455a14ed); - OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); - OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); - OP (FG, C, D, A, B, 7, 14, 0x676f02d9); - OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - - /* Round 3. */ - OP (FH, A, B, C, D, 5, 4, 0xfffa3942); - OP (FH, D, A, B, C, 8, 11, 0x8771f681); - OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); - OP (FH, B, C, D, A, 14, 23, 0xfde5380c); - OP (FH, A, B, C, D, 1, 4, 0xa4beea44); - OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); - OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); - OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); - OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); - OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); - OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); - OP (FH, B, C, D, A, 6, 23, 0x04881d05); - OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); - OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); - OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); - OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); - - /* Round 4. */ - OP (FI, A, B, C, D, 0, 6, 0xf4292244); - OP (FI, D, A, B, C, 7, 10, 0x432aff97); - OP (FI, C, D, A, B, 14, 15, 0xab9423a7); - OP (FI, B, C, D, A, 5, 21, 0xfc93a039); - OP (FI, A, B, C, D, 12, 6, 0x655b59c3); - OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); - OP (FI, C, D, A, B, 10, 15, 0xffeff47d); - OP (FI, B, C, D, A, 1, 21, 0x85845dd1); - OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); - OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); - OP (FI, C, D, A, B, 6, 15, 0xa3014314); - OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); - OP (FI, A, B, C, D, 4, 6, 0xf7537e82); - OP (FI, D, A, B, C, 11, 10, 0xbd3af235); - OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); - OP (FI, B, C, D, A, 9, 21, 0xeb86d391); - - /* Add the starting values of the context. */ - A += A_save; - B += B_save; - C += C_save; - D += D_save; - } - - /* Put checksum in context given as argument. */ - ctx->A = A; - ctx->B = B; - ctx->C = C; - ctx->D = D; -} diff --git a/libextra/gl/md5.h b/libextra/gl/md5.h deleted file mode 100644 index 1247d786e5..0000000000 --- a/libextra/gl/md5.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Declaration of functions and data types used for MD5 sum computing - library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2010 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _MD5_H -#define _MD5_H 1 - -#include <stdio.h> -#include <stdint.h> - -#define MD5_DIGEST_SIZE 16 -#define MD5_BLOCK_SIZE 64 - -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#ifndef __THROW -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -#ifndef _LIBC -# define __md5_buffer md5_buffer -# define __md5_finish_ctx md5_finish_ctx -# define __md5_init_ctx md5_init_ctx -# define __md5_process_block md5_process_block -# define __md5_process_bytes md5_process_bytes -# define __md5_read_ctx md5_read_ctx -# define __md5_stream md5_stream -#endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* Structure to save state of computation between the single steps. */ -struct md5_ctx -{ - uint32_t A; - uint32_t B; - uint32_t C; - uint32_t D; - - uint32_t total[2]; - uint32_t buflen; - uint32_t buffer[32]; -}; - -/* - * The following three functions are build up the low level used in - * the functions `md5_stream' and `md5_buffer'. - */ - -/* Initialize structure containing state of computation. - (RFC 1321, 3.3: Step 3) */ -extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; - -/* Starting with the result of former calls of this function (or the - initialization function update the context for the next LEN bytes - starting at BUFFER. - It is necessary that LEN is a multiple of 64!!! */ -extern void __md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx) __THROW; - -/* Starting with the result of former calls of this function (or the - initialization function update the context for the next LEN bytes - starting at BUFFER. - It is NOT required that LEN is a multiple of 64. */ -extern void __md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx) __THROW; - -/* Process the remaining bytes in the buffer and put result from CTX - in first 16 bytes following RESBUF. The result is always in little - endian byte order, so that a byte-wise output yields to the wanted - ASCII representation of the message digest. */ -extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; - - -/* Put result from CTX in first 16 bytes following RESBUF. The result is - always in little endian byte order, so that a byte-wise output yields - to the wanted ASCII representation of the message digest. */ -extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; - - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -extern int __md5_stream (FILE *stream, void *resblock) __THROW; - -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise - output yields to the wanted ASCII representation of the message - digest. */ -extern void *__md5_buffer (const char *buffer, size_t len, - void *resblock) __THROW; - -# ifdef __cplusplus -} -# endif - -#endif /* md5.h */ diff --git a/libextra/gl/memxor.c b/libextra/gl/memxor.c deleted file mode 100644 index da0ef91b50..0000000000 --- a/libextra/gl/memxor.c +++ /dev/null @@ -1,35 +0,0 @@ -/* memxor.c -- perform binary exclusive OR operation of two memory blocks. - Copyright (C) 2005, 2006, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Simon Josefsson. The interface was inspired by memxor - in Niels Möller's Nettle. */ - -#include <config.h> - -#include "memxor.h" - -void * -memxor (void *restrict dest, const void *restrict src, size_t n) -{ - char const *s = src; - char *d = dest; - - for (; n > 0; n--) - *d++ ^= *s++; - - return dest; -} diff --git a/libextra/gl/memxor.h b/libextra/gl/memxor.h deleted file mode 100644 index e8eba8ba26..0000000000 --- a/libextra/gl/memxor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* memxor.h -- perform binary exclusive OR operation on memory blocks. - Copyright (C) 2005, 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 General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Simon Josefsson. The interface was inspired by memxor - in Niels Möller's Nettle. */ - -#ifndef MEMXOR_H -# define MEMXOR_H - -#include <stddef.h> - -/* Compute binary exclusive OR of memory areas DEST and SRC, putting - the result in DEST, of length N bytes. Returns a pointer to - DEST. */ -void *memxor (void *restrict dest, const void *restrict src, size_t n); - -#endif /* MEMXOR_H */ diff --git a/libextra/gl/override/lib/md5.c.diff b/libextra/gl/override/lib/md5.c.diff deleted file mode 100644 index 327b50e175..0000000000 --- a/libextra/gl/override/lib/md5.c.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- gl/md5.c.orig 2009-08-20 15:33:39.000000000 +0200 -+++ gl/md5.c 2009-08-20 15:32:00.000000000 +0200 -@@ -129,6 +129,8 @@ - return md5_read_ctx (ctx, resbuf); - } - -+#if 0 /* Not needed by GnuTLS, and it has a large stack frame. */ -+ - /* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -@@ -196,6 +194,7 @@ - md5_finish_ctx (&ctx, resblock); - return 0; - } -+#endif - - /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise diff --git a/libextra/m4/hooks.m4 b/libextra/m4/hooks.m4 deleted file mode 100644 index ec16fed7f3..0000000000 --- a/libextra/m4/hooks.m4 +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -# 2009, 2010 Free Software Foundation, Inc. -# -# Author: Nikos Mavrogiannopoulos, Simon Josefsson -# -# This file is part of GnuTLS-EXTRA. -# -# GnuTLS-extra is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# GnuTLS-extra is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GnuTLS-EXTRA; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -AC_DEFUN([LIBGNUTLS_EXTRA_HOOKS], -[ - AC_MSG_CHECKING([whether to build OpenSSL compatibility layer]) - AC_ARG_ENABLE(openssl-compatibility, - AS_HELP_STRING([--disable-openssl-compatibility], - [disable the OpenSSL compatibility support]), - enable_openssl=$enableval, enable_openssl=yes) - AC_MSG_RESULT($enable_openssl) - AM_CONDITIONAL(ENABLE_OPENSSL, test "$enable_openssl" = "yes") - - # We link to ../lib's gnulib, which needs -lws2_32 via LIBSOCKET in Makefile.am. - gl_SOCKETS -]) diff --git a/lib/m4/hooks.m4 b/m4/hooks.m4 index c3defdea33..c629e6f3a9 100644 --- a/lib/m4/hooks.m4 +++ b/m4/hooks.m4 @@ -20,6 +20,20 @@ # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA +AC_DEFUN([LIBGNUTLS_EXTRA_HOOKS], +[ + AC_MSG_CHECKING([whether to build OpenSSL compatibility layer]) + AC_ARG_ENABLE(openssl-compatibility, + AS_HELP_STRING([--disable-openssl-compatibility], + [disable the OpenSSL compatibility support]), + enable_openssl=$enableval, enable_openssl=yes) + AC_MSG_RESULT($enable_openssl) + AM_CONDITIONAL(ENABLE_OPENSSL, test "$enable_openssl" = "yes") + + # We link to ../lib's gnulib, which needs -lws2_32 via LIBSOCKET in Makefile.am. + gl_SOCKETS +]) + AC_DEFUN([LIBGNUTLS_HOOKS], [ # Library code modified: REVISION++ diff --git a/lib/po/LINGUAS b/po/LINGUAS index 0f7f5bc56f..0f7f5bc56f 100644 --- a/lib/po/LINGUAS +++ b/po/LINGUAS diff --git a/lib/po/Makevars b/po/Makevars index 6487d53ac7..6487d53ac7 100644 --- a/lib/po/Makevars +++ b/po/Makevars diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000000..8943037b4f --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,5 @@ +# List of source files which contain translatable strings. +lib/gnutls_errors.c +lib/gnutls_alert.c +lib/x509/output.c +lib/openpgp/output.c diff --git a/lib/po/cs.po.in b/po/cs.po.in index 970c2eb472..970c2eb472 100644 --- a/lib/po/cs.po.in +++ b/po/cs.po.in diff --git a/lib/po/de.po.in b/po/de.po.in index 1b75bd62bd..1b75bd62bd 100644 --- a/lib/po/de.po.in +++ b/po/de.po.in diff --git a/lib/po/fr.po.in b/po/fr.po.in index 7fa9ccac2a..7fa9ccac2a 100644 --- a/lib/po/fr.po.in +++ b/po/fr.po.in diff --git a/lib/po/it.po.in b/po/it.po.in index 6878f2b27d..6878f2b27d 100644 --- a/lib/po/it.po.in +++ b/po/it.po.in diff --git a/lib/po/ms.po.in b/po/ms.po.in index 4260eb4927..4260eb4927 100644 --- a/lib/po/ms.po.in +++ b/po/ms.po.in diff --git a/lib/po/nl.po.in b/po/nl.po.in index 6cfc8a8cdb..6cfc8a8cdb 100644 --- a/lib/po/nl.po.in +++ b/po/nl.po.in diff --git a/lib/po/pl.po.in b/po/pl.po.in index f78185fc6e..f78185fc6e 100644 --- a/lib/po/pl.po.in +++ b/po/pl.po.in diff --git a/lib/po/sv.po.in b/po/sv.po.in index b7234b4453..b7234b4453 100644 --- a/lib/po/sv.po.in +++ b/po/sv.po.in diff --git a/lib/po/vi.po.in b/po/vi.po.in index 302653f73c..302653f73c 100644 --- a/lib/po/vi.po.in +++ b/po/vi.po.in diff --git a/lib/po/zh_CN.po.in b/po/zh_CN.po.in index 6505039dc8..6505039dc8 100644 --- a/lib/po/zh_CN.po.in +++ b/po/zh_CN.po.in diff --git a/src/Makefile.am b/src/Makefile.am index e1d9b4cae1..c35f569dba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,6 @@ SUBDIRS = cfg AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) AM_CPPFLAGS = \ -I$(srcdir)/../gl \ - -I$(builddir)/../gl \ -I$(builddir)/../lib/includes \ -I$(srcdir)/../lib/includes \ -I$(srcdir)/../libextra/includes \ diff --git a/tests/suite/Makefile.in b/tests/suite/Makefile.in index 4946ec57fa..dcc9aac409 100644 --- a/tests/suite/Makefile.in +++ b/tests/suite/Makefile.in @@ -61,73 +61,70 @@ subdir = tests/suite DIST_COMMON = README $(dist_check_SCRIPTS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/libextra/m4/hooks.m4 \ - $(top_srcdir)/lib/m4/hooks.m4 $(top_srcdir)/lib/gl/m4/po.m4 \ - $(top_srcdir)/gl/m4/00gnulib.m4 $(top_srcdir)/gl/m4/alloca.m4 \ - $(top_srcdir)/gl/m4/arpa_inet_h.m4 \ - $(top_srcdir)/gl/m4/asm-underscore.m4 \ - $(top_srcdir)/gl/m4/autobuild.m4 \ - $(top_srcdir)/gl/m4/clock_time.m4 $(top_srcdir)/gl/m4/close.m4 \ - $(top_srcdir)/gl/m4/errno_h.m4 $(top_srcdir)/gl/m4/error.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ + $(top_srcdir)/gl/m4/alloca.m4 $(top_srcdir)/gl/m4/byteswap.m4 \ + $(top_srcdir)/gl/m4/clock_time.m4 \ + $(top_srcdir)/gl/m4/errno_h.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ - $(top_srcdir)/gl/m4/fclose.m4 $(top_srcdir)/gl/m4/float_h.m4 \ - $(top_srcdir)/gl/m4/fseeko.m4 $(top_srcdir)/gl/m4/ftello.m4 \ - $(top_srcdir)/gl/m4/getaddrinfo.m4 \ + $(top_srcdir)/gl/m4/fcntl-o.m4 $(top_srcdir)/gl/m4/fcntl_h.m4 \ + $(top_srcdir)/gl/m4/float_h.m4 $(top_srcdir)/gl/m4/fseeko.m4 \ + $(top_srcdir)/gl/m4/ftello.m4 $(top_srcdir)/gl/m4/func.m4 \ $(top_srcdir)/gl/m4/getdelim.m4 $(top_srcdir)/gl/m4/getline.m4 \ $(top_srcdir)/gl/m4/getpagesize.m4 \ $(top_srcdir)/gl/m4/getpass.m4 $(top_srcdir)/gl/m4/gettime.m4 \ $(top_srcdir)/gl/m4/gettimeofday.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ - $(top_srcdir)/gl/m4/hostent.m4 \ + $(top_srcdir)/gl/m4/hmac-md5.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ - $(top_srcdir)/gl/m4/inet_ntop.m4 \ - $(top_srcdir)/gl/m4/inet_pton.m4 \ $(top_srcdir)/gl/m4/intmax_t.m4 \ - $(top_srcdir)/gl/m4/inttypes_h.m4 $(top_srcdir)/gl/m4/ioctl.m4 \ - $(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \ - $(top_srcdir)/gl/m4/lib-prefix.m4 \ - $(top_srcdir)/gl/m4/longlong.m4 $(top_srcdir)/gl/m4/lseek.m4 \ - $(top_srcdir)/gl/m4/malloc.m4 \ - $(top_srcdir)/gl/m4/manywarnings.m4 \ - $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/minmax.m4 \ + $(top_srcdir)/gl/m4/ld-output-def.m4 \ + $(top_srcdir)/gl/m4/ld-version-script.m4 \ + $(top_srcdir)/gl/m4/lseek.m4 $(top_srcdir)/gl/m4/malloc.m4 \ + $(top_srcdir)/gl/m4/manywarnings.m4 $(top_srcdir)/gl/m4/md5.m4 \ + $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/memmem.m4 \ + $(top_srcdir)/gl/m4/memxor.m4 $(top_srcdir)/gl/m4/minmax.m4 \ $(top_srcdir)/gl/m4/mmap-anon.m4 \ $(top_srcdir)/gl/m4/multiarch.m4 \ $(top_srcdir)/gl/m4/netdb_h.m4 \ $(top_srcdir)/gl/m4/netinet_in_h.m4 \ $(top_srcdir)/gl/m4/onceonly_2_57.m4 \ - $(top_srcdir)/gl/m4/perror.m4 $(top_srcdir)/gl/m4/printf.m4 \ - $(top_srcdir)/gl/m4/read-file.m4 \ - $(top_srcdir)/gl/m4/readline.m4 $(top_srcdir)/gl/m4/realloc.m4 \ - $(top_srcdir)/gl/m4/select.m4 $(top_srcdir)/gl/m4/servent.m4 \ - $(top_srcdir)/gl/m4/size_max.m4 \ - $(top_srcdir)/gl/m4/snprintf.m4 \ + $(top_srcdir)/gl/m4/printf.m4 $(top_srcdir)/gl/m4/read-file.m4 \ + $(top_srcdir)/gl/m4/realloc.m4 $(top_srcdir)/gl/m4/snprintf.m4 \ $(top_srcdir)/gl/m4/socketlib.m4 \ $(top_srcdir)/gl/m4/sockets.m4 $(top_srcdir)/gl/m4/socklen.m4 \ - $(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/stdarg.m4 \ - $(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stddef_h.m4 \ - $(top_srcdir)/gl/m4/stdint.m4 $(top_srcdir)/gl/m4/stdint_h.m4 \ + $(top_srcdir)/gl/m4/stdarg.m4 $(top_srcdir)/gl/m4/stdbool.m4 \ + $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/stdint.m4 \ $(top_srcdir)/gl/m4/stdio_h.m4 $(top_srcdir)/gl/m4/stdlib_h.m4 \ - $(top_srcdir)/gl/m4/strerror.m4 \ + $(top_srcdir)/gl/m4/strcase.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ - $(top_srcdir)/gl/m4/sys_ioctl_h.m4 \ - $(top_srcdir)/gl/m4/sys_select_h.m4 \ + $(top_srcdir)/gl/m4/strings_h.m4 \ + $(top_srcdir)/gl/m4/strverscmp.m4 \ $(top_srcdir)/gl/m4/sys_socket_h.m4 \ $(top_srcdir)/gl/m4/sys_stat_h.m4 \ $(top_srcdir)/gl/m4/sys_time_h.m4 \ - $(top_srcdir)/gl/m4/time_h.m4 $(top_srcdir)/gl/m4/timespec.m4 \ - $(top_srcdir)/gl/m4/ungetc.m4 $(top_srcdir)/gl/m4/unistd_h.m4 \ - $(top_srcdir)/gl/m4/valgrind-tests.m4 \ + $(top_srcdir)/gl/m4/time_h.m4 $(top_srcdir)/gl/m4/time_r.m4 \ + $(top_srcdir)/gl/m4/timespec.m4 $(top_srcdir)/gl/m4/ungetc.m4 \ + $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/vasnprintf.m4 \ + $(top_srcdir)/gl/m4/vasprintf.m4 \ $(top_srcdir)/gl/m4/version-etc.m4 \ + $(top_srcdir)/gl/m4/vsnprintf.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/warnings.m4 $(top_srcdir)/gl/m4/wchar_h.m4 \ - $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wint_t.m4 \ - $(top_srcdir)/gl/m4/xsize.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/guile.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/guile.m4 $(top_srcdir)/m4/hooks.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -178,8 +175,7 @@ am_eagain_cli_OBJECTS = mini-eagain2.$(OBJEXT) eagain_cli_OBJECTS = $(am_eagain_cli_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ../../lib/libgnutls.la ../../gl/libgnu.la \ - ../libutils.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + ../libutils.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) eagain_cli_DEPENDENCIES = $(am__DEPENDENCIES_2) libecore.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp @@ -222,7 +218,6 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ AS = @AS@ -ASM_SYMBOL_PREFIX = @ASM_SYMBOL_PREFIX@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -232,10 +227,10 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +BYTESWAP_H = @BYTESWAP_H@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -246,6 +241,7 @@ CXX_LT_AGE = @CXX_LT_AGE@ CXX_LT_CURRENT = @CXX_LT_CURRENT@ CXX_LT_REVISION = @CXX_LT_REVISION@ CYGPATH_W = @CYGPATH_W@ +DEFINE_SSIZE_T = @DEFINE_SSIZE_T@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ @@ -267,7 +263,9 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GAA = @GAA@ -GETADDRINFO_LIB = @GETADDRINFO_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ GNULIB_ACCEPT = @GNULIB_ACCEPT@ GNULIB_ACCEPT4 = @GNULIB_ACCEPT4@ GNULIB_ATOLL = @GNULIB_ATOLL@ @@ -288,6 +286,7 @@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FCLOSE = @GNULIB_FCLOSE@ +GNULIB_FCNTL = @GNULIB_FCNTL@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF = @GNULIB_FPRINTF@ @@ -324,9 +323,6 @@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_GRANTPT = @GNULIB_GRANTPT@ -GNULIB_INET_NTOP = @GNULIB_INET_NTOP@ -GNULIB_INET_PTON = @GNULIB_INET_PTON@ -GNULIB_IOCTL = @GNULIB_IOCTL@ GNULIB_LCHMOD = @GNULIB_LCHMOD@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ @@ -354,6 +350,7 @@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MBTOWC = @GNULIB_MBTOWC@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ @@ -372,7 +369,10 @@ GNULIB_MKTIME = @GNULIB_MKTIME@ GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ +GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_PERROR = @GNULIB_PERROR@ +GNULIB_PIPE = @GNULIB_PIPE@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_POPEN = @GNULIB_POPEN@ GNULIB_PREAD = @GNULIB_PREAD@ @@ -397,7 +397,6 @@ GNULIB_RENAME = @GNULIB_RENAME@ GNULIB_RENAMEAT = @GNULIB_RENAMEAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ -GNULIB_SELECT = @GNULIB_SELECT@ GNULIB_SEND = @GNULIB_SEND@ GNULIB_SENDTO = @GNULIB_SENDTO@ GNULIB_SETENV = @GNULIB_SETENV@ @@ -452,13 +451,43 @@ GNULIB_VPRINTF = @GNULIB_VPRINTF@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCPCPY = @GNULIB_WCPCPY@ +GNULIB_WCPNCPY = @GNULIB_WCPNCPY@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ +GNULIB_WCSCASECMP = @GNULIB_WCSCASECMP@ +GNULIB_WCSCAT = @GNULIB_WCSCAT@ +GNULIB_WCSCHR = @GNULIB_WCSCHR@ +GNULIB_WCSCMP = @GNULIB_WCSCMP@ +GNULIB_WCSCOLL = @GNULIB_WCSCOLL@ +GNULIB_WCSCPY = @GNULIB_WCSCPY@ +GNULIB_WCSCSPN = @GNULIB_WCSCSPN@ +GNULIB_WCSDUP = @GNULIB_WCSDUP@ +GNULIB_WCSLEN = @GNULIB_WCSLEN@ +GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@ +GNULIB_WCSNCAT = @GNULIB_WCSNCAT@ +GNULIB_WCSNCMP = @GNULIB_WCSNCMP@ +GNULIB_WCSNCPY = @GNULIB_WCSNCPY@ +GNULIB_WCSNLEN = @GNULIB_WCSNLEN@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ +GNULIB_WCSPBRK = @GNULIB_WCSPBRK@ +GNULIB_WCSRCHR = @GNULIB_WCSRCHR@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ +GNULIB_WCSSPN = @GNULIB_WCSSPN@ +GNULIB_WCSSTR = @GNULIB_WCSSTR@ +GNULIB_WCSTOK = @GNULIB_WCSTOK@ +GNULIB_WCSWIDTH = @GNULIB_WCSWIDTH@ +GNULIB_WCSXFRM = @GNULIB_WCSXFRM@ GNULIB_WCTOB = @GNULIB_WCTOB@ +GNULIB_WCTOMB = @GNULIB_WCTOMB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GNULIB_WMEMCHR = @GNULIB_WMEMCHR@ +GNULIB_WMEMCMP = @GNULIB_WMEMCMP@ +GNULIB_WMEMCPY = @GNULIB_WMEMCPY@ +GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@ +GNULIB_WMEMSET = @GNULIB_WMEMSET@ GNULIB_WRITE = @GNULIB_WRITE@ GNULIB__EXIT = @GNULIB__EXIT@ +GNUTLS_REQUIRES_PRIVATE = @GNUTLS_REQUIRES_PRIVATE@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -470,14 +499,16 @@ GUILE_LDFLAGS = @GUILE_LDFLAGS@ GUILE_SITE = @GUILE_SITE@ GUILE_TOOLS = @GUILE_TOOLS@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ -HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ HAVE_DECL_FREEADDRINFO = @HAVE_DECL_FREEADDRINFO@ +HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ +HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ HAVE_DECL_GAI_STRERROR = @HAVE_DECL_GAI_STRERROR@ HAVE_DECL_GETADDRINFO = @HAVE_DECL_GETADDRINFO@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ @@ -488,18 +519,21 @@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETNAMEINFO = @HAVE_DECL_GETNAMEINFO@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ -HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ -HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ +HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ +HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ +HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ +HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ @@ -511,6 +545,7 @@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ +HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ @@ -532,10 +567,11 @@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@ HAVE_LIBNETTLE = @HAVE_LIBNETTLE@ HAVE_LIBPAKCHOIS = @HAVE_LIBPAKCHOIS@ +HAVE_LIBPTHREAD = @HAVE_LIBPTHREAD@ HAVE_LIBTASN1 = @HAVE_LIBTASN1@ +HAVE_LIBZ = @HAVE_LIBZ@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ -HAVE_LOCALTIME_R = @HAVE_LOCALTIME_R@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MBRLEN = @HAVE_MBRLEN@ @@ -559,7 +595,9 @@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NETDB_H = @HAVE_NETDB_H@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ +HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE = @HAVE_PIPE@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PTSNAME = @HAVE_PTSNAME@ @@ -581,6 +619,7 @@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASECMP = @HAVE_STRCASECMP@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ @@ -599,19 +638,15 @@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ -HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ -HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ -HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ -HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ @@ -619,53 +654,90 @@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ +HAVE_WCPCPY = @HAVE_WCPCPY@ +HAVE_WCPNCPY = @HAVE_WCPNCPY@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ +HAVE_WCSCASECMP = @HAVE_WCSCASECMP@ +HAVE_WCSCAT = @HAVE_WCSCAT@ +HAVE_WCSCHR = @HAVE_WCSCHR@ +HAVE_WCSCMP = @HAVE_WCSCMP@ +HAVE_WCSCOLL = @HAVE_WCSCOLL@ +HAVE_WCSCPY = @HAVE_WCSCPY@ +HAVE_WCSCSPN = @HAVE_WCSCSPN@ +HAVE_WCSDUP = @HAVE_WCSDUP@ +HAVE_WCSLEN = @HAVE_WCSLEN@ +HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ +HAVE_WCSNCAT = @HAVE_WCSNCAT@ +HAVE_WCSNCMP = @HAVE_WCSNCMP@ +HAVE_WCSNCPY = @HAVE_WCSNCPY@ +HAVE_WCSNLEN = @HAVE_WCSNLEN@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ +HAVE_WCSPBRK = @HAVE_WCSPBRK@ +HAVE_WCSRCHR = @HAVE_WCSRCHR@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ +HAVE_WCSSPN = @HAVE_WCSSPN@ +HAVE_WCSSTR = @HAVE_WCSSTR@ +HAVE_WCSTOK = @HAVE_WCSTOK@ +HAVE_WCSWIDTH = @HAVE_WCSWIDTH@ +HAVE_WCSXFRM = @HAVE_WCSXFRM@ HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_WMEMCHR = @HAVE_WMEMCHR@ +HAVE_WMEMCMP = @HAVE_WMEMCMP@ +HAVE_WMEMCPY = @HAVE_WMEMCPY@ +HAVE_WMEMMOVE = @HAVE_WMEMMOVE@ +HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ -HOSTENT_LIB = @HOSTENT_LIB@ HTML_DIR = @HTML_DIR@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ -INET_NTOP_LIB = @INET_NTOP_LIB@ -INET_PTON_LIB = @INET_PTON_LIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBGCRYPT = @LIBGCRYPT@ LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@ +LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ +LIBGNUTLS_EXTRA_CFLAGS = @LIBGNUTLS_EXTRA_CFLAGS@ +LIBGNUTLS_EXTRA_LIBS = @LIBGNUTLS_EXTRA_LIBS@ +LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ +LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBNETTLE = @LIBNETTLE@ LIBNETTLE_PREFIX = @LIBNETTLE_PREFIX@ LIBOBJS = @LIBOBJS@ LIBPAKCHOIS = @LIBPAKCHOIS@ LIBPAKCHOIS_PREFIX = @LIBPAKCHOIS_PREFIX@ -LIBREADLINE = @LIBREADLINE@ +LIBPTHREAD = @LIBPTHREAD@ +LIBPTHREAD_PREFIX = @LIBPTHREAD_PREFIX@ LIBS = @LIBS@ LIBSOCKET = @LIBSOCKET@ LIBTASN1 = @LIBTASN1@ LIBTASN1_PREFIX = @LIBTASN1_PREFIX@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTOOL = @LIBTOOL@ +LIBZ = @LIBZ@ +LIBZ_PREFIX = @LIBZ_PREFIX@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LIPO = @LIPO@ LN_S = @LN_S@ LTALLOCA = @LTALLOCA@ LTLIBGCRYPT = @LTLIBGCRYPT@ +LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBNETTLE = @LTLIBNETTLE@ LTLIBOBJS = @LTLIBOBJS@ LTLIBPAKCHOIS = @LTLIBPAKCHOIS@ -LTLIBREADLINE = @LTLIBREADLINE@ +LTLIBPTHREAD = @LTLIBPTHREAD@ LTLIBTASN1 = @LTLIBTASN1@ +LTLIBZ = @LTLIBZ@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ @@ -673,13 +745,17 @@ LT_SSL_AGE = @LT_SSL_AGE@ LT_SSL_CURRENT = @LT_SSL_CURRENT@ LT_SSL_REVISION = @LT_SSL_REVISION@ LZO_LIBS = @LZO_LIBS@ +MAJOR_VERSION = @MAJOR_VERSION@ MAKEINFO = @MAKEINFO@ +MINOR_VERSION = @MINOR_VERSION@ MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ NETINET_IN_H = @NETINET_IN_H@ NETTLE_LIBS = @NETTLE_LIBS@ -NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ -NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ +NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_NETDB_H = @NEXT_AS_FIRST_DIRECTIVE_NETDB_H@ NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@ @@ -688,9 +764,8 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ +NEXT_AS_FIRST_DIRECTIVE_STRINGS_H = @NEXT_AS_FIRST_DIRECTIVE_STRINGS_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ -NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@ -NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ @@ -698,6 +773,7 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_NETDB_H = @NEXT_NETDB_H@ NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@ @@ -706,9 +782,8 @@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRINGS_H = @NEXT_STRINGS_H@ NEXT_STRING_H = @NEXT_STRING_H@ -NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@ -NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ @@ -717,6 +792,7 @@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NM = @NM@ NMEDIT = @NMEDIT@ +NUMBER_VERSION = @NUMBER_VERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ @@ -728,9 +804,10 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PATCH_VERSION = @PATCH_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ -PMCCABE = @PMCCABE@ +POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ @@ -746,6 +823,7 @@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ +REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ @@ -763,9 +841,9 @@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ -REPLACE_IOCTL = @REPLACE_IOCTL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ @@ -779,6 +857,7 @@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ +REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ @@ -789,6 +868,8 @@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ +REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_PERROR = @REPLACE_PERROR@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_PREAD = @REPLACE_PREAD@ @@ -802,7 +883,6 @@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ -REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ @@ -839,11 +919,12 @@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ +REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ +REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ -SERVENT_LIB = @SERVENT_LIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ @@ -853,21 +934,21 @@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ -SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@ -SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ -VALGRIND = @VALGRIND@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ WSTACK_CFLAGS = @WSTACK_CFLAGS@ -abs_aux_dir = @abs_aux_dir@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -922,7 +1003,6 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ -subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ |