diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-04-08 13:57:59 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-04-08 14:21:27 +0200 |
commit | ea5d1884419d58892540c0b77c8bc329c7cb0ca9 (patch) | |
tree | 045060edea80358bc9bba8508eb631bd20590fbe /gl | |
parent | 35239632fdba3ee96d9d98bbf38c2263d08626cb (diff) | |
download | gnutls-ea5d1884419d58892540c0b77c8bc329c7cb0ca9.tar.gz |
Use a single configure.ac. This speed ups compilation and
reduces duplication of code (multiple gl/ libraries etc.).
This saves about 2mb in distributed size (compressed).
Diffstat (limited to 'gl')
242 files changed, 2778 insertions, 7936 deletions
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/gl/tests/test-sys_select.c b/gl/tests/test-fcntl-h.c index 3a06c64828..dd20fbb406 100644 --- a/gl/tests/test-sys_select.c +++ b/gl/tests/test-fcntl-h.c @@ -1,5 +1,5 @@ -/* Test of <sys/select.h> substitute. - Copyright (C) 2007-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,18 +18,21 @@ #include <config.h> -#include <sys/select.h> +#include <fcntl.h> -/* Check that the 'struct timeval' type is defined. */ -struct timeval t1; +/* 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 the FD_* macros are defined. */ +int fd = FD_CLOEXEC; 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-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_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 |