summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2010-10-14 15:52:47 +0200
committerSimon Josefsson <simon@josefsson.org>2010-10-14 15:52:47 +0200
commitdbe767085787f5fdec183749a86c279a28676cc8 (patch)
treef618faa5de5488463a8715a410915cb0ddfec04a /gl
parent9b3338ea218a58adb2f573f023718be1f0372da4 (diff)
downloadgnutls-dbe767085787f5fdec183749a86c279a28676cc8.tar.gz
Update gnulib files.
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am56
-rw-r--r--gl/arpa_inet.in.h1
-rw-r--r--gl/errno.in.h7
-rw-r--r--gl/float.in.h1
-rw-r--r--gl/ftello.c77
-rw-r--r--gl/getaddrinfo.c5
-rw-r--r--gl/m4/errno_h.m47
-rw-r--r--gl/m4/error.m419
-rw-r--r--gl/m4/float_h.m44
-rw-r--r--gl/m4/ftello.m4130
-rw-r--r--gl/m4/getpagesize.m433
-rw-r--r--gl/m4/gnulib-cache.m44
-rw-r--r--gl/m4/gnulib-comp.m440
-rw-r--r--gl/m4/hostent.m412
-rw-r--r--gl/m4/include_next.m436
-rw-r--r--gl/m4/intmax_t.m413
-rw-r--r--gl/m4/inttypes_h.m417
-rw-r--r--gl/m4/lib-ld.m419
-rw-r--r--gl/m4/lib-link.m439
-rw-r--r--gl/m4/lseek.m414
-rw-r--r--gl/m4/malloc.m445
-rw-r--r--gl/m4/memchr.m44
-rw-r--r--gl/m4/minmax.m413
-rw-r--r--gl/m4/printf.m4736
-rw-r--r--gl/m4/realloc.m431
-rw-r--r--gl/m4/servent.m412
-rw-r--r--gl/m4/size_max.m414
-rw-r--r--gl/m4/socketlib.m486
-rw-r--r--gl/m4/sockets.m477
-rw-r--r--gl/m4/socklen.m47
-rw-r--r--gl/m4/sockpfaf.m43
-rw-r--r--gl/m4/stdarg.m422
-rw-r--r--gl/m4/stdbool.m4128
-rw-r--r--gl/m4/stdint.m414
-rw-r--r--gl/m4/stdint_h.m415
-rw-r--r--gl/m4/stdlib_h.m413
-rw-r--r--gl/m4/time_h.m419
-rw-r--r--gl/m4/wchar_t.m412
-rw-r--r--gl/m4/wint_t.m412
-rw-r--r--gl/malloc.c60
-rw-r--r--gl/netdb.in.h1
-rw-r--r--gl/netinet_in.in.h1
-rw-r--r--gl/read-file.c142
-rw-r--r--gl/realloc.c7
-rw-r--r--gl/select.c4
-rw-r--r--gl/stdarg.in.h1
-rw-r--r--gl/stddef.in.h1
-rw-r--r--gl/stdint.in.h6
-rw-r--r--gl/stdio.in.h6
-rw-r--r--gl/stdlib.in.h40
-rw-r--r--gl/strerror.c9
-rw-r--r--gl/string.in.h59
-rw-r--r--gl/sys_select.in.h1
-rw-r--r--gl/sys_socket.in.h5
-rw-r--r--gl/sys_stat.in.h4
-rw-r--r--gl/sys_time.in.h3
-rw-r--r--gl/tests/Makefile.am40
-rw-r--r--gl/tests/binary-io.h66
-rw-r--r--gl/tests/getpagesize.c39
-rw-r--r--gl/tests/init.sh173
-rw-r--r--gl/tests/sys_ioctl.in.h1
-rw-r--r--gl/tests/test-binary-io.c64
-rwxr-xr-xgl/tests/test-binary-io.sh11
-rw-r--r--gl/tests/test-ftello.c118
-rwxr-xr-xgl/tests/test-ftello.sh5
-rwxr-xr-xgl/tests/test-ftello2.sh3
-rw-r--r--gl/tests/test-ftello3.c78
-rw-r--r--gl/tests/test-getaddrinfo.c19
-rw-r--r--gl/tests/test-memchr.c19
-rw-r--r--gl/tests/test-netdb.c5
-rw-r--r--gl/tests/test-read-file.c20
-rw-r--r--gl/tests/test-stdbool.c51
-rw-r--r--gl/tests/test-stddef.c14
-rw-r--r--gl/tests/test-stdlib.c31
-rw-r--r--gl/tests/test-sys_socket.c9
-rw-r--r--gl/tests/test-sys_wait.h53
-rwxr-xr-xgl/tests/test-update-copyright.sh10
-rwxr-xr-xgl/tests/test-vc-list-files-cvs.sh2
-rwxr-xr-xgl/tests/test-vc-list-files-git.sh2
-rw-r--r--gl/tests/test-verify.c3
-rw-r--r--gl/time.in.h13
-rw-r--r--gl/timespec.h32
-rw-r--r--gl/unistd.in.h3
-rw-r--r--gl/wchar.in.h1
84 files changed, 2206 insertions, 826 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index ed9126174d..e1b67d75da 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -38,6 +38,16 @@ libgnu_la_LIBADD = $(gl_LTLIBOBJS)
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
@@ -120,6 +130,7 @@ arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
{ 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_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' \
@@ -214,6 +225,7 @@ errno.h: errno.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
-e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
-e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
@@ -259,6 +271,7 @@ float.h: float.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
< $(srcdir)/float.in.h; \
} > $@-t && \
@@ -278,6 +291,15 @@ EXTRA_libgnu_la_SOURCES += fseeko.c
## end gnulib module fseeko
+## begin gnulib module ftello
+
+
+EXTRA_DIST += ftello.c stdio-impl.h
+
+EXTRA_libgnu_la_SOURCES += ftello.c
+
+## end gnulib module ftello
+
## begin gnulib module gendocs
@@ -418,6 +440,15 @@ EXTRA_DIST += $(top_srcdir)/maint.mk
## end gnulib module maintainer-makefile
+## begin gnulib module malloc-posix
+
+
+EXTRA_DIST += malloc.c
+
+EXTRA_libgnu_la_SOURCES += malloc.c
+
+## end gnulib module malloc-posix
+
## begin gnulib module memchr
@@ -444,6 +475,7 @@ netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
-e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
@@ -475,6 +507,7 @@ netinet/in.h: netinet_in.in.h
{ 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_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
-e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
< $(srcdir)/netinet_in.in.h; \
@@ -624,6 +657,7 @@ stdarg.h: stdarg.in.h
{ 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_STDARG_H''@|$(NEXT_STDARG_H)|g' \
< $(srcdir)/stdarg.in.h; \
} > $@-t && \
@@ -663,6 +697,7 @@ stddef.h: stddef.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
@@ -687,6 +722,7 @@ stdint.h: stdint.in.h
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -728,6 +764,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
-e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
@@ -838,7 +875,9 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+ -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
-e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
-e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
-e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
@@ -861,15 +900,15 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
-e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
+ -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
-e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+ -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
- -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
- -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
@@ -878,7 +917,6 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
- -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
@@ -889,9 +927,12 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
-e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
+ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
@@ -928,6 +969,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
-e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
-e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
@@ -1019,6 +1061,7 @@ sys/select.h: sys_select.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
{ 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' \
@@ -1048,6 +1091,7 @@ sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
@@ -1096,6 +1140,7 @@ sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
@@ -1155,6 +1200,7 @@ sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_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_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
@@ -1183,6 +1229,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
-e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
@@ -1197,6 +1244,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -1230,6 +1278,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
@@ -1415,6 +1464,7 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
{ 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_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
-e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index f7c3bc728a..84a4006789 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -21,6 +21,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
under MinGW.
diff --git a/gl/errno.in.h b/gl/errno.in.h
index 140e5d1346..7ebaddcfc2 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -21,6 +21,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
@@ -98,6 +99,7 @@
/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
+ Likewise, on NonStop Kernel, EDQUOT is not defined.
Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
@@ -150,6 +152,11 @@
# define GNULIB_defined_ESTALE 1
# endif
+# ifndef EDQUOT
+# define EDQUOT 2010
+# define GNULIB_defined_EDQUOT 1
+# endif
+
# ifndef ECANCELED
# define ECANCELED 2008
# define GNULIB_defined_ECANCELED 1
diff --git a/gl/float.in.h b/gl/float.in.h
index caf822f1d0..a68ec61a96 100644
--- a/gl/float.in.h
+++ b/gl/float.in.h
@@ -20,6 +20,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
diff --git a/gl/ftello.c b/gl/ftello.c
new file mode 100644
index 0000000000..098e36ae58
--- /dev/null
+++ b/gl/ftello.c
@@ -0,0 +1,77 @@
+/* An ftello() function that works around platform bugs.
+ Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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>
+
+/* Get lseek. */
+#include <unistd.h>
+
+#include "stdio-impl.h"
+
+off_t
+ftello (FILE *fp)
+#undef ftello
+#if !HAVE_FTELLO
+# undef ftell
+# define ftello ftell
+#endif
+{
+#if LSEEK_PIPE_BROKEN
+ /* mingw gives bogus answers rather than failure on non-seekable files. */
+ if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+ return -1;
+#endif
+
+#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
+ /* The Solaris stdio leaves the _IOREAD flag set after reading from a file
+ reaches EOF and the program then starts writing to the file. ftello
+ gets confused by this. */
+ if (fp_->_flag & _IOWRT)
+ {
+ off_t pos;
+
+ /* Call ftello nevertheless, for the side effects that it does on fp. */
+ ftello (fp);
+
+ /* Compute the file position ourselves. */
+ pos = llseek (fileno (fp), (off_t) 0, SEEK_CUR);
+ if (pos >= 0)
+ {
+ if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
+ pos += fp_->_ptr - fp_->_base;
+ }
+ return pos;
+ }
+#endif
+
+#if defined __SL64 && defined __SCLE /* Cygwin */
+ if ((fp->_flags & __SL64) == 0)
+ {
+ /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+ mode; but has an ftello that requires 64-bit mode. */
+ FILE *tmp = fopen ("/dev/null", "r");
+ if (!tmp)
+ return -1;
+ fp->_flags |= __SL64;
+ fp->_seek64 = tmp->_seek64;
+ fclose (tmp);
+ }
+#endif
+ return ftello (fp);
+}
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index 6aa676c89c..4734606a47 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -59,6 +59,9 @@
# 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*,
@@ -101,6 +104,8 @@ use_win32_p (void)
return 0;
}
+ gl_sockets_startup (SOCKETS_1_1);
+
return 1;
}
#endif
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index d02a039363..e4325ac660 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,5 +1,5 @@
-# errno_h.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+# errno_h.m4 serial 7
+dnl Copyright (C) 2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -37,6 +37,9 @@ booboo
#if !defined ESTALE
booboo
#endif
+#if !defined EDQUOT
+booboo
+#endif
#if !defined ECANCELED
booboo
#endif
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 9f1307a428..dd5a197b6e 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,4 +1,4 @@
-#serial 12
+#serial 13
# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc.
#
@@ -13,6 +13,23 @@ AC_DEFUN([gl_ERROR],
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],
[
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index a74a0d957f..f6099db405 100644
--- a/gl/m4/float_h.m4
+++ b/gl/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 3
+# float_h.m4 serial 4
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H],
AC_REQUIRE([AC_CANONICAL_HOST])
FLOAT_H=
case "$host_os" in
- beos* | openbsd*)
+ beos* | openbsd* | mirbsd*)
FLOAT_H=float.h
gl_CHECK_NEXT_HEADERS([float.h])
;;
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
new file mode 100644
index 0000000000..33201a0107
--- /dev/null
+++ b/gl/m4/ftello.m4
@@ -0,0 +1,130 @@
+# ftello.m4 serial 8
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FTELLO],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+
+ dnl Persuade glibc <stdio.h> to declare ftello().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
+ [
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdio.h>]],
+ [[ftello (stdin);]])],
+ [gl_cv_func_ftello=yes],
+ [gl_cv_func_ftello=no])
+ ])
+ if test $gl_cv_func_ftello = no; then
+ HAVE_FTELLO=0
+ else
+ if test $gl_cv_var_stdin_large_offset = no; then
+ REPLACE_FTELLO=1
+ else
+ dnl Detect bug on Solaris.
+ dnl ftell and ftello produce incorrect results after putc that followed a
+ dnl getc call that reached EOF on Solaris. This is because the _IOREAD
+ dnl flag does not get cleared in this case, even though _IOWRT gets set,
+ dnl and ftell and ftello look whether the _IOREAD flag is set.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([whether ftello works],
+ [gl_cv_func_ftello_works],
+ [
+ dnl Initial guess, used when cross-compiling or when /dev/tty cannot
+ dnl be opened.
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on Solaris.
+ solaris*) gl_cv_func_ftello_works="guessing no" ;;
+ # Guess yes otherwise.
+ *) gl_cv_func_ftello_works="guessing yes" ;;
+ esac
+changequote([,])dnl
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define TESTFILE "conftest.tmp"
+int
+main (void)
+{
+ FILE *fp;
+
+ /* Create a file with some contents. */
+ fp = fopen (TESTFILE, "w");
+ if (fp == NULL)
+ return 70;
+ if (fwrite ("foogarsh", 1, 8, fp) < 8)
+ return 71;
+ if (fclose (fp))
+ return 72;
+
+ /* The file's contents is now "foogarsh". */
+
+ /* Try writing after reading to EOF. */
+ fp = fopen (TESTFILE, "r+");
+ if (fp == NULL)
+ return 73;
+ if (fseek (fp, -1, SEEK_END))
+ return 74;
+ if (!(getc (fp) == 'h'))
+ return 1;
+ if (!(getc (fp) == EOF))
+ return 2;
+ if (!(ftell (fp) == 8))
+ return 3;
+ if (!(ftell (fp) == 8))
+ return 4;
+ if (!(putc ('!', fp) == '!'))
+ return 5;
+ if (!(ftell (fp) == 9))
+ return 6;
+ if (!(fclose (fp) == 0))
+ return 7;
+ fp = fopen (TESTFILE, "r");
+ if (fp == NULL)
+ return 75;
+ {
+ char buf[10];
+ if (!(fread (buf, 1, 10, fp) == 9))
+ return 10;
+ if (!(memcmp (buf, "foogarsh!", 9) == 0))
+ return 11;
+ }
+ if (!(fclose (fp) == 0))
+ return 12;
+
+ /* The file's contents is now "foogarsh!". */
+
+ return 0;
+}]])],
+ [gl_cv_func_ftello_works=yes],
+ [gl_cv_func_ftello_works=no], [:])
+ ])
+ case "$gl_cv_func_ftello_works" in
+ *yes) ;;
+ *)
+ REPLACE_FTELLO=1
+ AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1],
+ [Define to 1 if the system's ftello function has the Solaris bug.])
+ ;;
+ esac
+ fi
+ fi
+ if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
+ gl_REPLACE_FTELLO
+ fi
+])
+
+AC_DEFUN([gl_REPLACE_FTELLO],
+[
+ AC_LIBOBJ([ftello])
+])
diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4
new file mode 100644
index 0000000000..313ad7fa26
--- /dev/null
+++ b/gl/m4/getpagesize.m4
@@ -0,0 +1,33 @@
+# getpagesize.m4 serial 8
+dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_GETPAGESIZE],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CHECK_FUNCS([getpagesize])
+ if test $ac_cv_func_getpagesize = no; then
+ HAVE_GETPAGESIZE=0
+ AC_CHECK_HEADERS([OS.h])
+ if test $ac_cv_header_OS_h = yes; then
+ HAVE_OS_H=1
+ fi
+ AC_CHECK_HEADERS([sys/param.h])
+ if test $ac_cv_header_sys_param_h = yes; then
+ HAVE_SYS_PARAM_H=1
+ fi
+ fi
+ case "$host_os" in
+ mingw*)
+ REPLACE_GETPAGESIZE=1
+ AC_LIBOBJ([getpagesize])
+ ;;
+ esac
+ dnl Also check whether it's declared.
+ dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
+ AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
+])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index a9cec83bc5..0987814cfe 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -10,8 +10,8 @@
#
# This file represents the specification of how gnulib-tool is used.
# It acts as a cache: It is written and read by gnulib-tool.
-# In projects using CVS, this file is meant to be stored in CVS,
-# like the configure.ac and various Makefile.am files.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
# Specification in the form of a command-line invocation:
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 3db9b2553b..201ec0f99a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -12,7 +12,8 @@
# This file represents the compiled summary of the specification in
# gnulib-cache.m4. It lists the computed macro invocations that need
# to be invoked from configure.ac.
-# In projects using CVS, this file can be treated like other built files.
+# In projects that use version control, this file can be treated like
+# other built files.
# This macro should be invoked from ./configure.ac, in the section
@@ -36,6 +37,8 @@ AC_DEFUN([gl_EARLY],
# 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 c++defs:
# Code from module c-ctype:
@@ -55,6 +58,9 @@ AC_DEFUN([gl_EARLY],
# Code from module fseeko:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module fseeko-tests:
+ # Code from module ftello:
+ AC_REQUIRE([AC_FUNC_FSEEKO])
+ # Code from module ftello-tests:
# Code from module gendocs:
# Code from module getaddrinfo:
# Code from module getaddrinfo-tests:
@@ -62,6 +68,7 @@ AC_DEFUN([gl_EARLY],
# 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 gettext-h:
# Code from module gettime:
@@ -84,6 +91,7 @@ AC_DEFUN([gl_EARLY],
# 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:
@@ -112,6 +120,7 @@ AC_DEFUN([gl_EARLY],
# 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:
# Code from module socklen:
@@ -240,6 +249,9 @@ AC_SUBST([LTALLOCA])
# Code from module fseeko:
gl_FUNC_FSEEKO
gl_STDIO_MODULE_INDICATOR([fseeko])
+ # Code from module ftello:
+ gl_FUNC_FTELLO
+ gl_STDIO_MODULE_INDICATOR([ftello])
# Code from module gendocs:
# Code from module getaddrinfo:
gl_GETADDRINFO
@@ -297,6 +309,9 @@ AC_SUBST([LTALLOCA])
# 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])
# Code from module manywarnings:
# Code from module memchr:
gl_FUNC_MEMCHR
@@ -374,6 +389,8 @@ AC_SUBST([LTALLOCA])
SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
fi
gl_SYS_SOCKET_MODULE_INDICATOR([socket])
+ # Code from module socketlib:
+ gl_SOCKETLIB
# Code from module sockets:
gl_SOCKETS
# Code from module socklen:
@@ -477,10 +494,17 @@ changequote([, ])dnl
gl_module_indicator_condition=$gltests_WITNESS
m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
gl_FUNC_UNGETC_WORKS
+ gl_FUNC_UNGETC_WORKS
+ gl_FUNC_GETPAGESIZE
+ gl_UNISTD_MODULE_INDICATOR([getpagesize])
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
@@ -619,6 +643,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/float+.h
lib/float.in.h
lib/fseeko.c
+ lib/ftello.c
lib/gai_strerror.c
lib/getaddrinfo.c
lib/getdelim.c
@@ -633,6 +658,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/intprops.h
lib/listen.c
lib/lseek.c
+ lib/malloc.c
lib/memchr.c
lib/memchr.valgrind
lib/minmax.h
@@ -698,9 +724,11 @@ AC_DEFUN([gl_FILE_LIST], [
m4/fclose.m4
m4/float_h.m4
m4/fseeko.m4
+ m4/ftello.m4
m4/getaddrinfo.m4
m4/getdelim.m4
m4/getline.m4
+ m4/getpagesize.m4
m4/getpass.m4
m4/gettime.m4
m4/gettimeofday.m4
@@ -734,6 +762,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/servent.m4
m4/size_max.m4
m4/snprintf.m4
+ m4/socketlib.m4
m4/sockets.m4
m4/socklen.m4
m4/sockpfaf.m4
@@ -770,11 +799,17 @@ AC_DEFUN([gl_FILE_LIST], [
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-c-ctype.c
tests/test-errno.c
tests/test-fseeko.c
tests/test-fseeko.sh
tests/test-fseeko2.sh
+ tests/test-ftello.c
+ tests/test-ftello.sh
+ tests/test-ftello2.sh
+ tests/test-ftello3.c
tests/test-getaddrinfo.c
tests/test-getdelim.c
tests/test-getline.c
@@ -808,6 +843,7 @@ AC_DEFUN([gl_FILE_LIST], [
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-unistd.c
tests/test-update-copyright.sh
@@ -820,7 +856,9 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-version-etc.sh
tests/test-wchar.c
tests/zerosize-ptr.h
+ tests=lib/binary-io.h
tests=lib/dummy.c
+ tests=lib/getpagesize.c
tests=lib/ioctl.c
tests=lib/sys_ioctl.in.h
tests=lib/verify.h
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4
index 1111041129..7104b3089a 100644
--- a/gl/m4/hostent.m4
+++ b/gl/m4/hostent.m4
@@ -1,5 +1,5 @@
-# hostent.m4 serial 1
-dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# 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.
@@ -28,12 +28,16 @@ AC_DEFUN([gl_HOSTENT],
[gl_cv_w32_gethostbyname=no
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
- AC_TRY_LINK([
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#include <stddef.h>
-], [gethostbyname(NULL);], [gl_cv_w32_gethostbyname=yes])
+ ]],
+ [[gethostbyname(NULL);]])],
+ [gl_cv_w32_gethostbyname=yes])
LIBS="$gl_save_LIBS"
])
if test "$gl_cv_w32_gethostbyname" = "yes"; then
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index c7e0672f60..e37eb0567d 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 14
+# include_next.m4 serial 16
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,13 @@ dnl does not warn about some things, and on some systems (Solaris and Interix)
dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
dnl of plain '__STDC__'.
+dnl
+dnl PRAGMA_COLUMNS can be used in files that override system header files, so
+dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
+dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
+dnl has the effect of truncating the lines of that file and all files that it
+dnl includes to 80 columns) and the gnulib file has lines longer than 80
+dnl columns.
AC_DEFUN([gl_INCLUDE_NEXT],
[
@@ -68,10 +75,11 @@ EOF
EOF
gl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+dnl We intentionally avoid using AC_LANG_SOURCE here.
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=yes],
[CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=buggy],
[gl_cv_have_include_next=no])
])
@@ -97,6 +105,24 @@ EOF
AC_SUBST([INCLUDE_NEXT])
AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
AC_SUBST([PRAGMA_SYSTEM_HEADER])
+ AC_CACHE_CHECK([whether system header files limit the line length],
+ [gl_cv_pragma_columns],
+ [dnl HP NonStop systems, which define __TANDEM, have this misfeature.
+ AC_EGREP_CPP([choke me],
+ [
+#ifdef __TANDEM
+choke me
+#endif
+ ],
+ [gl_cv_pragma_columns=yes],
+ [gl_cv_pragma_columns=no])
+ ])
+ if test $gl_cv_pragma_columns = yes; then
+ PRAGMA_COLUMNS="#pragma COLUMNS 10000"
+ else
+ PRAGMA_COLUMNS=
+ fi
+ AC_SUBST([PRAGMA_COLUMNS])
])
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
@@ -185,3 +211,7 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
[$gl_next_as_first_directive])
AS_VAR_POPDEF([gl_next_header])])
])
+
+# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
+# this fallback is safe for all earlier autoconf versions.
+m4_define_default([AC_LANG_DEFINES_PROVIDED])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 975caac506..493e4a9328 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,4 +1,4 @@
-# intmax_t.m4 serial 7
+# intmax_t.m4 serial 8
dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
-AC_PREREQ([2.13])
+AC_PREREQ([2.53])
# Define intmax_t to 'long' or 'long long'
# if it is not already defined in <stdint.h> or <inttypes.h>.
@@ -38,7 +38,9 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#include <stddef.h>
#include <stdlib.h>
#if HAVE_STDINT_H_WITH_UINTMAX
@@ -47,7 +49,10 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
#if HAVE_INTTYPES_H_WITH_UINTMAX
#include <inttypes.h>
#endif
-], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+ ]],
+ [[intmax_t x = -1; return !x;]])],
+ [gt_cv_c_intmax_t=yes],
+ [gt_cv_c_intmax_t=no])])
if test $gt_cv_c_intmax_t = yes; then
AC_DEFINE([HAVE_INTMAX_T], [1],
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4
index 782d77ed8b..9d8f926926 100644
--- a/gl/m4/inttypes_h.m4
+++ b/gl/m4/inttypes_h.m4
@@ -1,4 +1,4 @@
-# inttypes_h.m4 serial 9
+# inttypes_h.m4 serial 10
dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,12 +12,15 @@ dnl From Paul Eggert.
AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
[
AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <inttypes.h>],
- [uintmax_t i = (uintmax_t) -1; return !i;],
- [gl_cv_header_inttypes_h=yes],
- [gl_cv_header_inttypes_h=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <sys/types.h>
+#include <inttypes.h>
+ ]],
+ [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+ [gl_cv_header_inttypes_h=yes],
+ [gl_cv_header_inttypes_h=no])])
if test $gl_cv_header_inttypes_h = yes; then
AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
index ebb30528bd..294db72e13 100644
--- a/gl/m4/lib-ld.m4
+++ b/gl/m4/lib-ld.m4
@@ -1,4 +1,4 @@
-# lib-ld.m4 serial 4 (gettext-0.18)
+# lib-ld.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -31,15 +31,14 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
ac_prog=ld
if test "$GCC" = yes; then
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index c73bd8e3a4..2ea9d6d073 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 21 (gettext-0.18)
+# lib-link.m4 serial 25 (gettext-0.18.2)
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -18,9 +18,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
AC_LIB_LINKFLAGS_BODY([$1], [$2])
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
@@ -58,9 +58,9 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
dnl accordingly.
@@ -85,7 +85,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
*" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
*) LIBS="$LIB[]NAME $LIBS" ;;
esac
- AC_TRY_LINK([$3], [$4],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[$3]], [[$4]])],
[ac_cv_lib[]Name=yes],
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
LIBS="$ac_save_LIBS"
@@ -157,15 +158,15 @@ dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
dnl macro call that searches for libname.
AC_DEFUN([AC_LIB_FROMPACKAGE],
[
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
define([acl_frompackage_]NAME, [$2])
popdef([NAME])
pushdef([PACK],[$2])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
define([acl_libsinpackage_]PACKUP,
- m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
+ m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
popdef([PACKUP])
popdef([PACK])
])
@@ -178,14 +179,14 @@ dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
dnl Autoconf >= 2.61 supports dots in --with options.
- pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
+ pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
@@ -242,7 +243,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
names_already_handled="$names_already_handled $name"
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
dnl or AC_LIB_HAVE_LINKFLAGS call.
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
eval value=\"\$HAVE_LIB$uppername\"
if test -n "$value"; then
if test "$value" = yes; then
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index 9bf4dc2d04..b0612c7e17 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -1,4 +1,4 @@
-# lseek.m4 serial 5
+# lseek.m4 serial 6
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,15 +10,13 @@ AC_DEFUN([gl_FUNC_LSEEK],
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
[if test $cross_compiling = no; then
- AC_LINK_IFELSE([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> /* for off_t */
#include <stdio.h> /* for SEEK_CUR */
-#include <unistd.h>
-int main ()
-{
+#include <unistd.h>]], [[
/* Exit with success only if stdin is seekable. */
return lseek (0, (off_t)0, SEEK_CUR) < 0;
-}],
+]])],
[if test -s conftest$ac_exeext \
&& ./conftest$ac_exeext < conftest.$ac_ext \
&& test 1 = "`echo hi \
@@ -29,11 +27,11 @@ int main ()
fi],
[gl_cv_func_lseek_pipe=no])
else
- AC_COMPILE_IFELSE([
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */
Choke me.
-#endif],
+#endif]])],
[gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
fi])
if test $gl_cv_func_lseek_pipe = no; then
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 910ac92292..7a749254a1 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,25 +1,40 @@
-# malloc.m4 serial 9
+# malloc.m4 serial 12
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+# gl_FUNC_MALLOC_GNU
+# ------------------
+# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
+# it is not.
+AC_DEFUN([gl_FUNC_MALLOC_GNU],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
+ _AC_FUNC_MALLOC_IF(
+ [AC_DEFINE([HAVE_MALLOC_GNU], [1],
+ [Define to 1 if your system has a GNU libc compatible 'malloc'
+ function, and to 0 otherwise.])],
+ [AC_DEFINE([HAVE_MALLOC_GNU], [0])
+ gl_REPLACE_MALLOC
+ ])
+])
+
# gl_FUNC_MALLOC_POSIX
# --------------------
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace malloc if it is not.
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
- HAVE_MALLOC_POSIX=1
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
[Define if the 'malloc' function is POSIX compliant.])
else
- AC_LIBOBJ([malloc])
- HAVE_MALLOC_POSIX=0
+ gl_REPLACE_MALLOC
fi
- AC_SUBST([HAVE_MALLOC_POSIX])
])
# Test whether malloc, realloc, calloc are POSIX compliant,
@@ -32,10 +47,20 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
dnl It is too dangerous to try to allocate a large amount of memory:
dnl some systems go to their knees when you do that. So assume that
dnl all Unix implementations of the function are POSIX compliant.
- AC_TRY_COMPILE([],
- [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- choke me
- #endif
- ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[]],
+ [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ choke me
+ #endif
+ ]])],
+ [gl_cv_func_malloc_posix=yes],
+ [gl_cv_func_malloc_posix=no])
])
])
+
+AC_DEFUN([gl_REPLACE_MALLOC],
+[
+ AC_LIBOBJ([malloc])
+ REPLACE_MALLOC=1
+])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index ab773b8129..b05a79a026 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,4 +1,4 @@
-# memchr.m4 serial 8
+# memchr.m4 serial 9
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -62,6 +62,8 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
strcpy (fence - 9, "12345678");
if (memchr (fence - 9, 0, 79) != fence - 1)
return 2;
+ if (memchr (fence - 1, 0, 3) != fence - 1)
+ return 3;
}
return 0;
]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
index d9e9cecfd7..a5c42dea0f 100644
--- a/gl/m4/minmax.m4
+++ b/gl/m4/minmax.m4
@@ -1,10 +1,10 @@
-# minmax.m4 serial 3
-dnl Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+# minmax.m4 serial 4
+dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_PREREQ([2.52])
+AC_PREREQ([2.53])
AC_DEFUN([gl_MINMAX],
[
@@ -28,8 +28,11 @@ AC_DEFUN([gl_MINMAX_IN_HEADER],
m4_pushdef([HEADER], AS_TR_CPP([$1]))
AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
[gl_cv_minmax_in_]header,
- [AC_TRY_COMPILE([#include <$1>
-int x = MIN (42, 17);], [],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <$1>
+ int x = MIN (42, 17);]],
+ [[]])],
[gl_cv_minmax_in_]header[=yes],
[gl_cv_minmax_in_]header[=no])])
if test $gl_cv_minmax_in_[]header = yes; then
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index ebca5364c4..e850862c01 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 33
+# printf.m4 serial 35
dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,8 @@ AC_DEFUN([gl_PRINTF_SIZES_C99],
AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
[gl_cv_func_printf_sizes_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -50,34 +51,36 @@ int main ()
|| strcmp (buf, "1.5 33") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no],
- [
+}]])],
+ [gl_cv_func_printf_sizes_c99=yes],
+ [gl_cv_func_printf_sizes_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
- darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_sizes_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
+ darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_printf_sizes_c99="guessing no";;
+ openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.10.
+ solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";;
+ solaris*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_sizes_c99="guessing no";;
+ netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_sizes_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -92,7 +95,8 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
AC_CACHE_CHECK([whether printf supports 'long double' arguments],
[gl_cv_func_printf_long_double],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[10000];
@@ -111,16 +115,18 @@ int main ()
|| strcmp (buf, "1.75 33") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no],
- [
+}]])],
+ [gl_cv_func_printf_long_double=yes],
+ [gl_cv_func_printf_long_double=no],
+ [
changequote(,)dnl
- case "$host_os" in
- beos*) gl_cv_func_printf_long_double="guessing no";;
- mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
- *) gl_cv_func_printf_long_double="guessing yes";;
- esac
+ case "$host_os" in
+ beos*) gl_cv_func_printf_long_double="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
+ *) gl_cv_func_printf_long_double="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -136,7 +142,8 @@ AC_DEFUN([gl_PRINTF_INFINITE],
AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
[gl_cv_func_printf_infinite],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static int
@@ -201,32 +208,34 @@ int main ()
|| strcmp (buf, "-0") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no],
- [
+}]])],
+ [gl_cv_func_printf_infinite=yes],
+ [gl_cv_func_printf_infinite=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
- darwin*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
- hpux*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_infinite="guessing no";;
- netbsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_infinite="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
+ darwin*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
+ hpux*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_infinite="guessing no";;
+ netbsd*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_printf_infinite="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_infinite="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -252,7 +261,8 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
[gl_cv_func_printf_infinite_long_double],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
]GL_NOCRASH[
#include <float.h>
#include <stdio.h>
@@ -414,38 +424,38 @@ int main ()
}
#endif
return 0;
-}],
- [gl_cv_func_printf_infinite_long_double=yes],
- [gl_cv_func_printf_infinite_long_double=no],
- [
+}]])],
+ [gl_cv_func_printf_infinite_long_double=yes],
+ [gl_cv_func_printf_infinite_long_double=no],
+ [
changequote(,)dnl
- case "$host_cpu" in
- # Guess no on ia64, x86_64, i386.
- ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
- *)
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";;
- darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
- hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_infinite_long_double="guessing no";;
- netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite_long_double="guessing no";;
- esac
- ;;
- esac
+ case "$host_cpu" in
+ # Guess no on ia64, x86_64, i386.
+ ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
+ *)
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_infinite_long_double="guessing no";;
+ netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_infinite_long_double="guessing no";;
+ esac
+ ;;
+ esac
changequote([,])dnl
- ])
+ ])
])
;;
*)
@@ -466,7 +476,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
[gl_cv_func_printf_directive_a],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -512,26 +523,28 @@ int main ()
&& strcmp (buf, "0x8.0p-2") != 0))
return 1;
return 0;
-}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no],
- [
- case "$host_os" in
- # Guess yes on glibc >= 2.5 systems.
- *-gnu*)
- AC_EGREP_CPP([BZ2908], [
- #include <features.h>
- #ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
- BZ2908
- #endif
- #endif
- ],
- [gl_cv_func_printf_directive_a="guessing yes"],
- [gl_cv_func_printf_directive_a="guessing no"])
- ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_a="guessing no";;
- esac
- ])
+}]])],
+ [gl_cv_func_printf_directive_a=yes],
+ [gl_cv_func_printf_directive_a=no],
+ [
+ case "$host_os" in
+ # Guess yes on glibc >= 2.5 systems.
+ *-gnu*)
+ AC_EGREP_CPP([BZ2908], [
+ #include <features.h>
+ #ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
+ BZ2908
+ #endif
+ #endif
+ ],
+ [gl_cv_func_printf_directive_a="guessing yes"],
+ [gl_cv_func_printf_directive_a="guessing no"])
+ ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_directive_a="guessing no";;
+ esac
+ ])
])
])
@@ -546,7 +559,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
AC_CACHE_CHECK([whether printf supports the 'F' directive],
[gl_cv_func_printf_directive_f],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -563,26 +577,28 @@ int main ()
|| strcmp (buf, "1234") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_f=yes],
+ [gl_cv_func_printf_directive_f=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
- darwin*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";;
- solaris*) gl_cv_func_printf_directive_f="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_f="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
+ darwin*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on Solaris >= 2.10.
+ solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";;
+ solaris*) gl_cv_func_printf_directive_f="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_directive_f="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -597,7 +613,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
AC_CACHE_CHECK([whether printf supports the 'n' directive],
[gl_cv_func_printf_directive_n],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char fmtstring[10];
@@ -614,14 +631,16 @@ int main ()
|| count != 4)
return 1;
return 0;
-}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_n=yes],
+ [gl_cv_func_printf_directive_n=no],
+ [
changequote(,)dnl
- case "$host_os" in
- *) gl_cv_func_printf_directive_n="guessing yes";;
- esac
+ case "$host_os" in
+ *) gl_cv_func_printf_directive_n="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -639,7 +658,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
AC_CACHE_CHECK([whether printf supports the 'ls' directive],
[gl_cv_func_printf_directive_ls],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -687,19 +707,21 @@ int main ()
return 1;
}
return 0;
-}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_ls=yes],
+ [gl_cv_func_printf_directive_ls=no],
+ [
changequote(,)dnl
- case "$host_os" in
- openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
- irix*) gl_cv_func_printf_directive_ls="guessing no";;
- solaris*) gl_cv_func_printf_directive_ls="guessing no";;
- cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
- beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
- *) gl_cv_func_printf_directive_ls="guessing yes";;
- esac
+ case "$host_os" in
+ openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
+ irix*) gl_cv_func_printf_directive_ls="guessing no";;
+ solaris*) gl_cv_func_printf_directive_ls="guessing no";;
+ cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
+ beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
+ *) gl_cv_func_printf_directive_ls="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -714,7 +736,8 @@ AC_DEFUN([gl_PRINTF_POSITIONS],
AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
[gl_cv_func_printf_positions],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
/* The string "%2$d %1$d", with dollar characters protected from the shell's
@@ -725,18 +748,20 @@ int main ()
{
sprintf (buf, format, 33, 55);
return (strcmp (buf, "55 33") != 0);
-}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no],
- [
+}]])],
+ [gl_cv_func_printf_positions=yes],
+ [gl_cv_func_printf_positions=no],
+ [
changequote(,)dnl
- case "$host_os" in
- netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
- gl_cv_func_printf_positions="guessing no";;
- beos*) gl_cv_func_printf_positions="guessing no";;
- mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
- *) gl_cv_func_printf_positions="guessing yes";;
- esac
+ case "$host_os" in
+ netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
+ gl_cv_func_printf_positions="guessing no";;
+ beos*) gl_cv_func_printf_positions="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
+ *) gl_cv_func_printf_positions="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -751,7 +776,8 @@ AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
AC_CACHE_CHECK([whether printf supports the grouping flag],
[gl_cv_func_printf_flag_grouping],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -761,17 +787,19 @@ int main ()
|| buf[strlen (buf) - 1] != '9')
return 1;
return 0;
-}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no],
- [
+}]])],
+ [gl_cv_func_printf_flag_grouping=yes],
+ [gl_cv_func_printf_flag_grouping=no],
+ [
changequote(,)dnl
- case "$host_os" in
- cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
- netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
- mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
- *) gl_cv_func_printf_flag_grouping="guessing yes";;
- esac
+ case "$host_os" in
+ cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
+ netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
+ *) gl_cv_func_printf_flag_grouping="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -787,7 +815,8 @@ AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
[gl_cv_func_printf_flag_leftadjust],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -798,7 +827,7 @@ int main ()
|| strcmp (buf, "ab c") != 0)
return 1;
return 0;
-}],
+}]])],
[gl_cv_func_printf_flag_leftadjust=yes],
[gl_cv_func_printf_flag_leftadjust=no],
[
@@ -828,7 +857,8 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO],
AC_CACHE_CHECK([whether printf supports the zero flag correctly],
[gl_cv_func_printf_flag_zero],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -839,19 +869,21 @@ int main ()
&& strcmp (buf, " infinity") != 0))
return 1;
return 0;
-}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no],
- [
+}]])],
+ [gl_cv_func_printf_flag_zero=yes],
+ [gl_cv_func_printf_flag_zero=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_flag_zero="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_flag_zero="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_printf_flag_zero="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_flag_zero="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -868,7 +900,8 @@ AC_DEFUN([gl_PRINTF_PRECISION],
AC_CACHE_CHECK([whether printf supports large precisions],
[gl_cv_func_printf_precision],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[5000];
@@ -881,17 +914,19 @@ int main ()
if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
return 1;
return 0;
-}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no],
- [
+}]])],
+ [gl_cv_func_printf_precision=yes],
+ [gl_cv_func_printf_precision=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess no only on native Win32 and BeOS systems.
- mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
- beos*) gl_cv_func_printf_precision="guessing no" ;;
- *) gl_cv_func_printf_precision="guessing yes" ;;
- esac
+ case "$host_os" in
+ # Guess no only on native Win32 and BeOS systems.
+ mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
+ beos*) gl_cv_func_printf_precision="guessing no" ;;
+ *) gl_cv_func_printf_precision="guessing yes" ;;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -1031,7 +1066,8 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
[gl_cv_func_snprintf_truncation_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -1042,47 +1078,49 @@ int main ()
if (memcmp (buf, "45\0DEF", 6) != 0)
return 1;
return 0;
-}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no],
- [
+}]])],
+ [gl_cv_func_snprintf_truncation_c99=yes],
+ [gl_cv_func_snprintf_truncation_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_truncation_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_snprintf_truncation_c99="guessing no";;
+ openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on OSF/1 >= 5.
+ osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_truncation_c99="guessing no";;
+ netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -1101,14 +1139,15 @@ dnl }
dnl ---------------------------------------------------------------------
dnl Result is gl_cv_func_snprintf_retval_c99.
-AC_DEFUN([gl_SNPRINTF_RETVAL_C99],
+AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
[gl_cv_func_snprintf_retval_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
@@ -1118,39 +1157,41 @@ int main ()
if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
return 1;
return 0;
-}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no],
- [
+}]])],
+ [gl_cv_func_snprintf_retval_c99=yes],
+ [gl_cv_func_snprintf_retval_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_retval_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_snprintf_retval_c99="guessing no";;
+ openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_retval_c99="guessing no";;
+ netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_retval_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -1165,7 +1206,8 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
[gl_cv_func_snprintf_directive_n],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char fmtstring[10];
@@ -1181,40 +1223,42 @@ int main ()
if (count != 6)
return 1;
return 0;
-}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no],
- [
+}]])],
+ [gl_cv_func_snprintf_directive_n=yes],
+ [gl_cv_func_snprintf_directive_n=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
- darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";;
- solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
- aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
- osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_directive_n="guessing no";;
- netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_directive_n="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
+ darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on OSF/1 >= 5.
+ osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_directive_n="guessing no";;
+ netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_directive_n="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -1229,17 +1273,18 @@ AC_DEFUN([gl_SNPRINTF_SIZE1],
AC_CACHE_CHECK([whether snprintf respects a size of 1],
[gl_cv_func_snprintf_size1],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
int main()
{
static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
snprintf (buf, 1, "%d", 12345);
return buf[1] != 'E';
-}],
- [gl_cv_func_snprintf_size1=yes],
- [gl_cv_func_snprintf_size1=no],
- [gl_cv_func_snprintf_size1="guessing yes"])
+}]])],
+ [gl_cv_func_snprintf_size1=yes],
+ [gl_cv_func_snprintf_size1=no],
+ [gl_cv_func_snprintf_size1="guessing yes"])
])
])
@@ -1286,7 +1331,8 @@ AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
[gl_cv_func_vsnprintf_zerosize_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdarg.h>
#include <stdio.h>
static int my_snprintf (char *buf, int size, const char *format, ...)
@@ -1303,43 +1349,43 @@ int main()
static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
my_snprintf (buf, 0, "%d", 12345);
return buf[0] != 'D';
-}],
- [gl_cv_func_vsnprintf_zerosize_c99=yes],
- [gl_cv_func_vsnprintf_zerosize_c99=no],
- [
+}]])],
+ [gl_cv_func_vsnprintf_zerosize_c99=yes],
+ [gl_cv_func_vsnprintf_zerosize_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Cygwin.
- cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on mingw.
- mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on Cygwin.
+ cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on mingw.
+ mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
@@ -1401,7 +1447,7 @@ dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # .
dnl Solaris 10 . . # # # . . # . . . # . . . . . . . .
dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . .
dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
-dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
+dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . .
dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . .
dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index dc30235c17..01c1234f7e 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,23 +1,44 @@
-# realloc.m4 serial 9
+# realloc.m4 serial 11
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+# gl_FUNC_REALLOC_GNU
+# -------------------
+# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
+# realloc if it is not.
+AC_DEFUN([gl_FUNC_REALLOC_GNU],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
+ _AC_FUNC_REALLOC_IF(
+ [AC_DEFINE([HAVE_REALLOC_GNU], [1],
+ [Define to 1 if your system has a GNU libc compatible 'realloc'
+ function, and to 0 otherwise.])],
+ [AC_DEFINE([HAVE_REALLOC_GNU], [0])
+ gl_REPLACE_REALLOC
+ ])
+])# gl_FUNC_REALLOC_GNU
+
# gl_FUNC_REALLOC_POSIX
# ---------------------
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace realloc if it is not.
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
- HAVE_REALLOC_POSIX=1
AC_DEFINE([HAVE_REALLOC_POSIX], [1],
[Define if the 'realloc' function is POSIX compliant.])
else
- AC_LIBOBJ([realloc])
- HAVE_REALLOC_POSIX=0
+ gl_REPLACE_REALLOC
fi
- AC_SUBST([HAVE_REALLOC_POSIX])
+])
+
+AC_DEFUN([gl_REPLACE_REALLOC],
+[
+ AC_LIBOBJ([realloc])
+ REPLACE_REALLOC=1
])
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4
index 2ed961a439..2486511aad 100644
--- a/gl/m4/servent.m4
+++ b/gl/m4/servent.m4
@@ -1,5 +1,5 @@
-# servent.m4 serial 1
-dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# 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.
@@ -30,12 +30,16 @@ AC_DEFUN([gl_SERVENT],
[gl_cv_w32_getservbyname=no
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
- AC_TRY_LINK([
+ 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])
+ ]],
+ [[getservbyname(NULL,NULL);]])],
+ [gl_cv_w32_getservbyname=yes])
LIBS="$gl_save_LIBS"
])
if test "$gl_cv_w32_getservbyname" = "yes"; then
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4
index ce992db1f1..f3b1a9dfb2 100644
--- a/gl/m4/size_max.m4
+++ b/gl/m4/size_max.m4
@@ -1,4 +1,4 @@
-# size_max.m4 serial 9
+# size_max.m4 serial 10
dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -34,10 +34,14 @@ Found it
if test $fits_in_uint = 1; then
dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
- AC_TRY_COMPILE([#include <stddef.h>
- extern size_t foo;
- extern unsigned long foo;
- ], [], [fits_in_uint=0])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+ ]],
+ [[]])],
+ [fits_in_uint=0])
fi
dnl We cannot use 'expr' to simplify this expression, because 'expr'
dnl works only with 'long' integers in the host environment, while we
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4
new file mode 100644
index 0000000000..7bf02b5aee
--- /dev/null
+++ b/gl/m4/socketlib.m4
@@ -0,0 +1,86 @@
+# socketlib.m4 serial 1
+dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl gl_SOCKETLIB
+dnl Determines the library to use for socket functions.
+dnl Sets and AC_SUBSTs LIBSOCKET.
+
+AC_DEFUN([gl_SOCKETLIB],
+[
+ gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
+ LIBSOCKET=
+ if test $HAVE_WINSOCK2_H = 1; then
+ dnl Native Windows API (not Cygwin).
+ AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
+ [gl_cv_func_wsastartup], [
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS -lws2_32"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif]], [[
+ WORD wVersionRequested = MAKEWORD(1, 1);
+ WSADATA wsaData;
+ int err = WSAStartup(wVersionRequested, &wsaData);
+ WSACleanup ();]])],
+ gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
+ LIBS="$gl_save_LIBS"
+ ])
+ if test "$gl_cv_func_wsastartup" = "yes"; then
+ AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
+ LIBSOCKET='-lws2_32'
+ fi
+ else
+ dnl Unix API.
+ dnl Solaris has most socket functions in libsocket.
+ dnl Haiku has most socket functions in libnetwork.
+ dnl BeOS has most socket functions in libnet.
+ AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
+ gl_cv_lib_socket=
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [],
+ [gl_save_LIBS="$LIBS"
+ LIBS="$gl_save_LIBS -lsocket"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lsocket"])
+ if test -z "$gl_cv_lib_socket"; then
+ LIBS="$gl_save_LIBS -lnetwork"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lnetwork"])
+ if test -z "$gl_cv_lib_socket"; then
+ LIBS="$gl_save_LIBS -lnet"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lnet"])
+ fi
+ fi
+ LIBS="$gl_save_LIBS"
+ ])
+ if test -z "$gl_cv_lib_socket"; then
+ gl_cv_lib_socket="none needed"
+ fi
+ ])
+ if test "$gl_cv_lib_socket" != "none needed"; then
+ LIBSOCKET="$gl_cv_lib_socket"
+ fi
+ fi
+ AC_SUBST([LIBSOCKET])
+])
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
index aefb936079..ba9a563d8e 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,4 +1,4 @@
-# sockets.m4 serial 6
+# sockets.m4 serial 7
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,80 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_SOCKETS],
[
AC_REQUIRE([AC_C_INLINE])
-
- gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
- LIBSOCKET=
- if test $HAVE_WINSOCK2_H = 1; then
- dnl Native Windows API (not Cygwin).
- AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
- [gl_cv_func_wsastartup], [
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif]], [[
- WORD wVersionRequested = MAKEWORD(1, 1);
- WSADATA wsaData;
- int err = WSAStartup(wVersionRequested, &wsaData);
- WSACleanup ();]])],
- gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_func_wsastartup" = "yes"; then
- AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
- LIBSOCKET='-lws2_32'
- fi
- else
- dnl Unix API.
- dnl Solaris has most socket functions in libsocket.
- dnl Haiku has most socket functions in libnetwork.
- dnl BeOS has most socket functions in libnet.
- AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
- gl_cv_lib_socket=
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [],
- [gl_save_LIBS="$LIBS"
- LIBS="$gl_save_LIBS -lsocket"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lsocket"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnetwork"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnetwork"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnet"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnet"])
- fi
- fi
- LIBS="$gl_save_LIBS"
- ])
- if test -z "$gl_cv_lib_socket"; then
- gl_cv_lib_socket="none needed"
- fi
- ])
- if test "$gl_cv_lib_socket" != "none needed"; then
- LIBSOCKET="$gl_cv_lib_socket"
- fi
- fi
- AC_SUBST([LIBSOCKET])
+ AC_REQUIRE([gl_SOCKETLIB])
gl_PREREQ_SOCKETS
])
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index 2933d4b890..d0d6baab55 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,4 +1,4 @@
-# socklen.m4 serial 7
+# socklen.m4 serial 8
dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,8 +8,9 @@ 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. So we
-dnl have to test to find something that will work.
+dnl types for the argument to getsockopt, getpeername, etc.:
+dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.
+dnl So we have to test to find something that will work.
dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
dnl it there first. That file is included by gnulib's sys_socket.in.h, which
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index 8a0c236038..8806705ae2 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -47,6 +47,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
#endif]],
[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
if (&x && &y && &z) return 0;]])],
diff --git a/gl/m4/stdarg.m4 b/gl/m4/stdarg.m4
index 5c87bd8b5f..8a62f2e844 100644
--- a/gl/m4/stdarg.m4
+++ b/gl/m4/stdarg.m4
@@ -1,4 +1,4 @@
-# stdarg.m4 serial 3
+# stdarg.m4 serial 4
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,
@@ -13,12 +13,16 @@ AC_DEFUN([gl_STDARG_H],
NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
AC_MSG_CHECKING([for va_copy])
AC_CACHE_VAL([gl_cv_func_va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef va_copy
void (*func) (va_list, va_list) = va_copy;
#endif
-],
- [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
+ ]])],
+ [gl_cv_func_va_copy=yes],
+ [gl_cv_func_va_copy=no])])
AC_MSG_RESULT([$gl_cv_func_va_copy])
if test $gl_cv_func_va_copy = no; then
dnl Provide a substitute.
@@ -47,12 +51,16 @@ void (*func) (va_list, va_list) = va_copy;
dnl Provide a substitute in <config.h>, either __va_copy or as a simple
dnl assignment.
gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef __va_copy
error, bail out
#endif
-],
- [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
+ ]])],
+ [gl_cv_func___va_copy=yes],
+ [gl_cv_func___va_copy=no])])
if test $gl_cv_func___va_copy = yes; then
AC_DEFINE([va_copy], [__va_copy],
[Define as a macro for copying va_list variables.])
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
index 3d672d7476..1efe59ea1c 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -5,6 +5,8 @@ dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+#serial 3
+
# Prepare for substituting <stdbool.h> if it is not supported.
AC_DEFUN([AM_STDBOOL_H],
@@ -31,82 +33,68 @@ 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 macro is only needed in autoconf <= 2.59. Newer versions of autoconf
-# have this macro built-in.
+# This version of the macro is needed in autoconf <= 2.67. Autoconf has
+# it built in since 2.60, but we want the tweaks from the 2.68 version
+# to avoid rejecting xlc and clang due to relying on extensions.
AC_DEFUN([AC_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
- [AC_TRY_COMPILE(
- [
- #include <stdbool.h>
- #ifndef bool
- "error: bool is not defined"
- #endif
- #ifndef false
- "error: false is not defined"
- #endif
- #if false
- "error: false is not 0"
- #endif
- #ifndef true
- "error: true is not defined"
- #endif
- #if true != 1
- "error: true is not 1"
- #endif
- #ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
- #endif
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <stdbool.h>
+ #ifndef bool
+ "error: bool is not defined"
+ #endif
+ #ifndef false
+ "error: false is not defined"
+ #endif
+ #if false
+ "error: false is not 0"
+ #endif
+ #ifndef true
+ "error: true is not defined"
+ #endif
+ #if true != 1
+ "error: true is not 1"
+ #endif
+ #ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+ #endif
- struct s { _Bool s: 1; _Bool t; } s;
+ struct s { _Bool s: 1; _Bool t; } s;
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- bool e = &s;
- char f[(_Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (_Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- _Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
- #if defined __xlc__ || defined __GNUC__
- /* 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 test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a run-time
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
- #endif
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- _Bool q = true;
- _Bool *pq = &q;
- ],
- [
- *pq |= q;
- *pq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq);
- ],
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ /* See body of main program for 'e'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+ ]],
+ [[
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+ ]])],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
AC_CHECK_TYPES([_Bool])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index 1cc57e6e96..c5e813a96d 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 34
+# stdint.m4 serial 35
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -309,7 +309,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+ [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to the number of bits in type ']gltype['.])])
for gltype in $1 ; do
AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
@@ -334,7 +334,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
eval BITSIZEOF_${GLTYPE}=\$result
done
m4_foreach_w([gltype], [$1],
- [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+ [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
])
dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
@@ -347,7 +347,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+ [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to 1 if ']gltype[' is a signed integer type.])])
for gltype in $1 ; do
AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
@@ -367,7 +367,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
fi
done
m4_foreach_w([gltype], [$1],
- [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+ [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
])
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
@@ -380,7 +380,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
m4_foreach_w([gltype], [$1],
- [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
+ [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
[Define to l, ll, u, ul, ull, etc., as suitable for
constants of type ']gltype['.])])
for gltype in $1 ; do
@@ -419,7 +419,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
done
m4_foreach_w([gltype], [$1],
- [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
+ [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
])
dnl gl_STDINT_INCLUDES
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index b8e3c6cc71..670c0cc2bf 100644
--- a/gl/m4/stdint_h.m4
+++ b/gl/m4/stdint_h.m4
@@ -1,4 +1,4 @@
-# stdint_h.m4 serial 8
+# stdint_h.m4 serial 9
dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,12 +12,13 @@ dnl From Paul Eggert.
AC_DEFUN([gl_AC_HEADER_STDINT_H],
[
AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <stdint.h>],
- [uintmax_t i = (uintmax_t) -1; return !i;],
- [gl_cv_header_stdint_h=yes],
- [gl_cv_header_stdint_h=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <stdint.h>]],
+ [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+ [gl_cv_header_stdint_h=yes],
+ [gl_cv_header_stdint_h=no])])
if test $gl_cv_header_stdint_h = yes; then
AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index dd84796d2c..e4697ce213 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 28
+# stdlib_h.m4 serial 31
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -33,7 +33,7 @@ AC_DEFUN([gl_STDLIB_H],
#if HAVE_RANDOM_H
# include <random.h>
#endif
- ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
+ ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
unsetenv])
@@ -50,6 +50,7 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
+ GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
@@ -72,16 +73,16 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
+ GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
- HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
- HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
@@ -89,7 +90,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
- HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
@@ -100,9 +100,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
+ REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+ REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
+ REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index b88ba94da1..a45a10a9ee 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -2,6 +2,8 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
+# serial 2
+
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -24,7 +26,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
])
dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
-dnl in time.h or sys/time.h.
+dnl in time.h, sys/time.h, or pthread.h.
AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
[
@@ -41,6 +43,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
TIME_H_DEFINES_STRUCT_TIMESPEC=0
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
TIME_H_DEFINES_STRUCT_TIMESPEC=1
else
@@ -55,10 +58,24 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
[gl_cv_sys_struct_timespec_in_sys_time_h=no])])
if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ AC_CACHE_CHECK([for struct timespec in <pthread.h>],
+ [gl_cv_sys_struct_timespec_in_pthread_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_pthread_h=yes],
+ [gl_cv_sys_struct_timespec_in_pthread_h=no])])
+ if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+ fi
fi
fi
AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
+ AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
])
AC_DEFUN([gl_TIME_MODULE_INDICATOR],
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
index ed804e664b..a133e6ad58 100644
--- a/gl/m4/wchar_t.m4
+++ b/gl/m4/wchar_t.m4
@@ -1,4 +1,4 @@
-# wchar_t.m4 serial 3 (gettext-0.18)
+# wchar_t.m4 serial 4 (gettext-0.18.2)
dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,9 +11,13 @@ dnl Prerequisite: AC_PROG_CC
AC_DEFUN([gt_TYPE_WCHAR_T],
[
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_TRY_COMPILE([#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wchar_t=yes],
+ [gt_cv_c_wchar_t=no])])
if test $gt_cv_c_wchar_t = yes; then
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
fi
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index a6c7d15cb5..58ef865565 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 4 (gettext-0.18)
+# wint_t.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,9 @@ dnl Prerequisite: AC_PROG_CC
AC_DEFUN([gt_TYPE_WINT_T],
[
AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
@@ -20,8 +22,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
#include <stdio.h>
#include <time.h>
#include <wchar.h>
- wint_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
+ wint_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wint_t=yes],
+ [gt_cv_c_wint_t=no])])
if test $gt_cv_c_wint_t = yes; then
AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
fi
diff --git a/gl/malloc.c b/gl/malloc.c
new file mode 100644
index 0000000000..4fa38ee41b
--- /dev/null
+++ b/gl/malloc.c
@@ -0,0 +1,60 @@
+/* malloc() function that is glibc compatible.
+
+ Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU 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 Jim Meyering and Bruno Haible */
+
+#include <config.h>
+/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
+#ifdef malloc
+# define NEED_MALLOC_GNU 1
+# undef malloc
+/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
+#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
+# define NEED_MALLOC_GNU 1
+#endif
+
+/* Specification. */
+#include <stdlib.h>
+
+#include <errno.h>
+
+/* Call the system's malloc below. */
+#undef malloc
+
+/* Allocate an N-byte block of memory from the heap.
+ If N is zero, allocate a 1-byte block. */
+
+void *
+rpl_malloc (size_t n)
+{
+ void *result;
+
+#if NEED_MALLOC_GNU
+ if (n == 0)
+ n = 1;
+#endif
+
+ result = malloc (n);
+
+#if !HAVE_MALLOC_POSIX
+ if (result == NULL)
+ errno = ENOMEM;
+#endif
+
+ return result;
+}
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index f800cac876..b0c553ef0d 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -25,6 +25,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_NETDB_H@
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index 7f0ff42143..4b0710fb8d 100644
--- a/gl/netinet_in.in.h
+++ b/gl/netinet_in.in.h
@@ -20,6 +20,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_NETINET_IN_H@
diff --git a/gl/read-file.c b/gl/read-file.c
index cc82bab98c..8d70880e7d 100644
--- a/gl/read-file.c
+++ b/gl/read-file.c
@@ -20,7 +20,16 @@
#include "read-file.h"
-/* Get realloc, free. */
+/* Get fstat. */
+#include <sys/stat.h>
+
+/* Get ftello. */
+#include <stdio.h>
+
+/* Get SIZE_MAX. */
+#include <stdint.h>
+
+/* Get malloc, realloc, free. */
#include <stdlib.h>
/* Get errno. */
@@ -36,50 +45,99 @@ fread_file (FILE * stream, size_t * length)
{
char *buf = NULL;
size_t alloc = 0;
- size_t size = 0;
- int save_errno;
-
- for (;;)
- {
- size_t count;
- size_t requested;
-
- if (size + BUFSIZ + 1 > alloc)
- {
- char *new_buf;
-
- alloc += alloc / 2;
- if (alloc < size + BUFSIZ + 1)
- alloc = size + BUFSIZ + 1;
- new_buf = realloc (buf, alloc);
- if (!new_buf)
- {
- save_errno = errno;
+ /* For a regular file, allocate a buffer that has exactly the right
+ size. This avoids the need to do dynamic reallocations later. */
+ {
+ struct stat st;
+
+ if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode))
+ {
+ off_t pos = ftello (stream);
+
+ if (pos >= 0 && pos < st.st_size)
+ {
+ off_t alloc_off = st.st_size - pos;
+
+ if (SIZE_MAX <= alloc_off)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ alloc = alloc_off + 1;
+
+ buf = malloc (alloc);
+ if (!buf)
+ /* errno is ENOMEM. */
+ return NULL;
+ }
+ }
+ }
+
+ {
+ size_t size = 0; /* number of bytes read so far */
+ int save_errno;
+
+ for (;;)
+ {
+ size_t count;
+ size_t requested;
+
+ if (size + BUFSIZ + 1 > alloc)
+ {
+ char *new_buf;
+ size_t new_alloc = alloc + alloc / 2;
+
+ /* Check against overflow. */
+ if (new_alloc < alloc)
+ {
+ save_errno = ENOMEM;
+ break;
+ }
+
+ alloc = new_alloc;
+ if (alloc < size + BUFSIZ + 1)
+ alloc = size + BUFSIZ + 1;
+
+ new_buf = realloc (buf, alloc);
+ if (!new_buf)
+ {
+ save_errno = errno;
+ break;
+ }
+
+ buf = new_buf;
+ }
+
+ requested = alloc - size - 1;
+ count = fread (buf + size, 1, requested, stream);
+ size += count;
+
+ if (count != requested)
+ {
+ save_errno = errno;
+ if (ferror (stream))
break;
- }
- buf = new_buf;
- }
-
- requested = alloc - size - 1;
- count = fread (buf + size, 1, requested, stream);
- size += count;
-
- if (count != requested)
- {
- save_errno = errno;
- if (ferror (stream))
- break;
- buf[size] = '\0';
- *length = size;
- return buf;
- }
- }
-
- free (buf);
- errno = save_errno;
- return NULL;
+ /* Shrink the allocated memory if possible. */
+ if (size + 1 < alloc)
+ {
+ char *smaller_buf = realloc (buf, size + 1);
+ if (smaller_buf != NULL)
+ buf = smaller_buf;
+ }
+
+ buf[size] = '\0';
+ *length = size;
+ return buf;
+ }
+ }
+
+ free (buf);
+ errno = save_errno;
+ return NULL;
+ }
}
static char *
diff --git a/gl/realloc.c b/gl/realloc.c
index 36aeecc41b..053208f375 100644
--- a/gl/realloc.c
+++ b/gl/realloc.c
@@ -23,11 +23,14 @@
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
#ifdef realloc
# define NEED_REALLOC_GNU 1
+/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */
+#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
+# define NEED_REALLOC_GNU 1
#endif
/* Infer the properties of the system's malloc function.
- Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
-#if GNULIB_MALLOC_GNU && !defined malloc
+ The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
+#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
#endif
diff --git a/gl/select.c b/gl/select.c
index 0c0e3eefc9..2e99f96001 100644
--- a/gl/select.c
+++ b/gl/select.c
@@ -132,6 +132,8 @@ win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits,
if (avail)
read = TRUE;
}
+ else if (GetLastError () == ERROR_BROKEN_PIPE)
+ ;
else
{
@@ -246,7 +248,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
wait_timeout = INFINITE;
else
{
- wait_timeout = timeout->tv_sec + timeout->tv_usec / 1000;
+ wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
/* select is also used as a portable usleep. */
if (!rfds && !wfds && !xfds)
diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h
index 3e0c49d1cb..8b88449e2f 100644
--- a/gl/stdarg.in.h
+++ b/gl/stdarg.in.h
@@ -20,6 +20,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDARG_H@
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index 08778a2336..6642d49e2a 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -26,6 +26,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_wchar_t || defined __need_size_t \
|| defined __need_ptrdiff_t || defined __need_NULL \
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index 5da5f17886..9e81110ae3 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -26,6 +26,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* When including a system file that in turn includes <inttypes.h>,
use the system <inttypes.h>, not our substitute. This avoids
@@ -475,8 +476,9 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
/* wchar_t limits */
/* Get WCHAR_MIN, WCHAR_MAX.
- This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
- includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+ This include is not on the top, above, because on OSF/1 4.0 we have a
+ sequence of nested includes
+ <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
<stdint.h> and assumes its types are already defined. */
#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index c43848eeef..fedcdfcc25 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -19,6 +19,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_FILE || defined __need___FILE
/* Special invocation convention inside glibc header files. */
@@ -265,7 +266,8 @@ _GL_CXXALIASWARN (freopen);
#elif defined GNULIB_POSIXCHECK
# undef freopen
/* Assume freopen is always declared. */
-_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+_GL_WARN_ON_USE (freopen,
+ "freopen on Win32 platforms is not POSIX compatible - "
"use gnulib module freopen for portability");
#endif
@@ -661,7 +663,7 @@ _GL_FUNCDECL_RPL (printf, int,
(const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)))
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (printf, printf, int, (const char *format, ...));
+_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
# endif
# define GNULIB_overrides_printf 1
# else
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index d74c2518ba..6fe75d330f 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -18,6 +18,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_malloc_and_calloc
/* Special invocation convention inside glibc header files. */
@@ -38,6 +39,11 @@
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
+/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
+#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
+# include <sys/wait.h>
+#endif
+
/* Solaris declares getloadavg() in <sys/loadavg.h>. */
#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
# include <sys/loadavg.h>
@@ -74,6 +80,12 @@ struct random_data
# include <unistd.h>
#endif
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -95,6 +107,23 @@ struct random_data
#endif
+#if @GNULIB__EXIT@
+/* Terminate the current process with the given return code, without running
+ the 'atexit' handlers. */
+# if !@HAVE__EXIT@
+_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__)));
+# endif
+_GL_CXXALIAS_SYS (_Exit, void, (int status));
+_GL_CXXALIASWARN (_Exit);
+#elif defined GNULIB_POSIXCHECK
+# undef _Exit
+# if HAVE_RAW_DECL__EXIT
+_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
+ "use gnulib module _Exit for portability");
+# endif
+#endif
+
+
#if @GNULIB_ATOLL@
/* Parse a signed decimal integer.
Returns the value of the integer. Errors are not detected. */
@@ -112,7 +141,7 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
#endif
#if @GNULIB_CALLOC_POSIX@
-# if !@HAVE_CALLOC_POSIX@
+# if @REPLACE_CALLOC@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef calloc
# define calloc rpl_calloc
@@ -149,7 +178,8 @@ _GL_CXXALIASWARN (canonicalize_file_name);
#elif defined GNULIB_POSIXCHECK
# undef canonicalize_file_name
# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
-_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - "
+_GL_WARN_ON_USE (canonicalize_file_name,
+ "canonicalize_file_name is unportable - "
"use gnulib module canonicalize-lgpl for portability");
# endif
#endif
@@ -218,7 +248,7 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
#endif
#if @GNULIB_MALLOC_POSIX@
-# if !@HAVE_MALLOC_POSIX@
+# if @REPLACE_MALLOC@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef malloc
# define malloc rpl_malloc
@@ -477,7 +507,7 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@
-# if !@HAVE_REALLOC_POSIX@
+# if @REPLACE_REALLOC@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef realloc
# define realloc rpl_realloc
@@ -652,7 +682,7 @@ _GL_CXXALIASWARN (unlockpt);
#elif defined GNULIB_POSIXCHECK
# undef unlockpt
# if HAVE_RAW_DECL_UNLOCKPT
-_GL_WARN_ON_USE (ptsname, "unlockpt is not portable - "
+_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
"use gnulib module unlockpt for portability");
# endif
#endif
diff --git a/gl/strerror.c b/gl/strerror.c
index b0df778489..6e1c0b0ebb 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -32,6 +32,9 @@
# 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
@@ -319,6 +322,12 @@ rpl_strerror (int n)
break;
# endif
+# if GNULIB_defined_EDQUOT
+ case EDQUOT:
+ msg = "Disk quota exceeded";
+ break;
+# endif
+
# if GNULIB_defined_ECANCELED
case ECANCELED:
msg = "Operation canceled";
diff --git a/gl/string.in.h b/gl/string.in.h
index 13c0f09520..3d3af3349a 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -21,6 +21,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
@@ -41,12 +42,20 @@
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
+#endif
/* The attribute __pure__ was added in gcc 2.96. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
-# define __pure__ /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
#endif
+/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
+/* But avoid namespace pollution on glibc systems. */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) \
+ && ! defined __GLIBC__
+# include <unistd.h>
+#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -62,13 +71,13 @@
# define memchr rpl_memchr
# endif
_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
# else
# if ! @HAVE_MEMCHR@
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -102,7 +111,8 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
_GL_FUNCDECL_RPL (memmem, void *,
(void const *__haystack, size_t __haystack_len,
void const *__needle, size_t __needle_len)
- __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1, 3)));
_GL_CXXALIAS_RPL (memmem, void *,
(void const *__haystack, size_t __haystack_len,
void const *__needle, size_t __needle_len));
@@ -111,7 +121,8 @@ _GL_CXXALIAS_RPL (memmem, void *,
_GL_FUNCDECL_SYS (memmem, void *,
(void const *__haystack, size_t __haystack_len,
void const *__needle, size_t __needle_len)
- __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1, 3)));
# endif
_GL_CXXALIAS_SYS (memmem, void *,
(void const *__haystack, size_t __haystack_len,
@@ -152,7 +163,7 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
#if @GNULIB_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -182,7 +193,7 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
#if @GNULIB_RAWMEMCHR@
# if ! @HAVE_RAWMEMCHR@
_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -229,6 +240,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
#if @GNULIB_STPNCPY@
# if @REPLACE_STPNCPY@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef stpncpy
# define stpncpy rpl_stpncpy
# endif
_GL_FUNCDECL_RPL (stpncpy, char *,
@@ -272,7 +284,7 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
#if @GNULIB_STRCHRNUL@
# if ! @HAVE_STRCHRNUL@
_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -306,6 +318,10 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
# else
+# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+ /* strdup exists as a function and as a macro. Get rid of the macro. */
+# undef strdup
+# endif
# if !(@HAVE_DECL_STRDUP@ || defined strdup)
_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
# endif
@@ -378,13 +394,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
# define strnlen rpl_strnlen
# endif
_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
# else
# if ! @HAVE_DECL_STRNLEN@
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
@@ -414,7 +430,7 @@ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -514,7 +530,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - "
# define strstr rpl_strstr
# endif
_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
- __attribute__ ((__pure__))
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
# else
@@ -556,14 +572,16 @@ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
# endif
_GL_FUNCDECL_RPL (strcasestr, char *,
(const char *haystack, const char *needle)
- __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (strcasestr, char *,
(const char *haystack, const char *needle));
# else
# if ! @HAVE_STRCASESTR@
_GL_FUNCDECL_SYS (strcasestr, char *,
(const char *haystack, const char *needle)
- __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1, 2)));
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" { const char * strcasestr (const char *, const char *); }
@@ -764,11 +782,10 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
#if @GNULIB_MBSPCASECMP@
/* Compare the initial segment of the character string STRING consisting of
at most mbslen (PREFIX) characters with the character string PREFIX,
- ignoring case, returning less than, equal to or greater than zero if this
- initial segment is lexicographically less than, equal to or greater than
- PREFIX.
- Note: This function may, in multibyte locales, return 0 if STRING is of
- smaller length than PREFIX!
+ ignoring case. If the two match, return a pointer to the first byte
+ after this prefix in STRING. Otherwise, return NULL.
+ Note: This function may, in multibyte locales, return non-NULL if STRING
+ is of smaller length than PREFIX!
Unlike strncasecmp(), this function works correctly in multibyte
locales. */
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index 0f1bd370b2..4ce48e2f8d 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -18,6 +18,7 @@
# 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. */
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index fc105e63da..8fded705cf 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -26,6 +26,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
/* Special invocation convention:
@@ -122,8 +123,8 @@ struct sockaddr_storage
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is
- slightly confusing because:
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+ slightly confusing because
+ <http://msdn.microsoft.com/en-us/library/ms738520>
suggests that getaddrinfo should be available on all Windows
releases. */
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index dc7ef51171..f0c61c15c5 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -24,6 +24,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_system_sys_stat_h
/* Special invocation convention. */
@@ -594,7 +595,8 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
# else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
+_GL_EXTERN_C int stat (const char *name, struct stat *buf)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stat
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index c4c2eb5e87..0689bcb2e6 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -21,6 +21,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined _GL_SYS_TIME_H
@@ -88,7 +89,7 @@ _GL_CXXALIASWARN (gettimeofday);
# undef gettimeofday
# if HAVE_RAW_DECL_GETTIMEOFDAY
_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
- "use gnulib module gettimeofday for portability");
+ "use gnulib module gettimeofday for portability");
# endif
# endif
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index db45629f20..9aaf714ca7 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -96,6 +96,21 @@ EXTRA_DIST += test-arpa_inet.c
## end gnulib module arpa_inet-tests
+## begin gnulib module binary-io
+
+libtests_a_SOURCES += binary-io.h
+
+## end gnulib module binary-io
+
+## begin gnulib module binary-io-tests
+
+TESTS += test-binary-io.sh
+check_PROGRAMS += test-binary-io
+
+EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h
+
+## end gnulib module binary-io-tests
+
## begin gnulib module c++defs
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
@@ -146,6 +161,15 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h
## end gnulib module fseeko-tests
+## begin gnulib module ftello-tests
+
+TESTS += test-ftello.sh test-ftello2.sh test-ftello3
+check_PROGRAMS += test-ftello test-ftello3
+MOSTLYCLEANFILES += t-ftello3.tmp
+EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c signature.h macros.h
+
+## end gnulib module ftello-tests
+
## begin gnulib module getaddrinfo-tests
TESTS += test-getaddrinfo
@@ -173,6 +197,15 @@ EXTRA_DIST += test-getline.c signature.h macros.h
## end gnulib module getline-tests
+## begin gnulib module getpagesize
+
+
+EXTRA_DIST += getpagesize.c
+
+EXTRA_libtests_a_SOURCES += getpagesize.c
+
+## end gnulib module getpagesize
+
## begin gnulib module gettimeofday-tests
TESTS += test-gettimeofday
@@ -323,7 +356,7 @@ EXTRA_DIST += test-stdio.c
TESTS += test-stdlib
check_PROGRAMS += test-stdlib
-EXTRA_DIST += test-stdlib.c
+EXTRA_DIST += test-stdlib.c test-sys_wait.h
## end gnulib module stdlib-tests
@@ -356,6 +389,7 @@ sys/ioctl.h: sys_ioctl.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
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' \
@@ -432,7 +466,7 @@ EXTRA_DIST += test-unistd.c
## begin gnulib module update-copyright-tests
TESTS += test-update-copyright.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
EXTRA_DIST += test-update-copyright.sh
## end gnulib module update-copyright-tests
@@ -450,7 +484,7 @@ EXTRA_DIST += test-vasnprintf.c macros.h
TESTS += test-vc-list-files-git.sh
TESTS += test-vc-list-files-cvs.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh init.sh
## end gnulib module vc-list-files-tests
diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h
new file mode 100644
index 0000000000..5451fd48f4
--- /dev/null
+++ b/gl/tests/binary-io.h
@@ -0,0 +1,66 @@
+/* Binary mode I/O.
+ Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation,
+ Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _BINARY_H
+#define _BINARY_H
+
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is usually declared in <fcntl.h>. */
+#include <fcntl.h>
+
+/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
+ so we include it here first. */
+#include <stdio.h>
+
+#if !defined O_BINARY && defined _O_BINARY
+ /* For MSC-compatible compilers. */
+# define O_BINARY _O_BINARY
+# define O_TEXT _O_TEXT
+#endif
+#if defined __BEOS__ || defined __HAIKU__
+ /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
+# undef O_BINARY
+# undef O_TEXT
+#endif
+
+/* SET_BINARY (fd);
+ changes the file descriptor fd to perform binary I/O. */
+#if O_BINARY
+# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
+# include <io.h> /* declares setmode() */
+# else
+# define setmode _setmode
+# undef fileno
+# define fileno _fileno
+# endif
+# ifdef __DJGPP__
+# include <unistd.h> /* declares isatty() */
+ /* Avoid putting stdin/stdout in binary mode if it is connected to
+ the console, because that would make it impossible for the user
+ to interrupt the program through Ctrl-C or Ctrl-Break. */
+# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
+# else
+# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
+# endif
+#else
+ /* On reasonable systems, binary I/O is the default. */
+# undef O_BINARY
+# define O_BINARY 0
+# define SET_BINARY(fd) /* do nothing */ ((void) 0)
+#endif
+
+#endif /* _BINARY_H */
diff --git a/gl/tests/getpagesize.c b/gl/tests/getpagesize.c
new file mode 100644
index 0000000000..cc2526870f
--- /dev/null
+++ b/gl/tests/getpagesize.c
@@ -0,0 +1,39 @@
+/* getpagesize emulation for systems where it cannot be done in a C macro.
+
+ Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible and Martin Lambers. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+/* This implementation is only for native Win32 systems. */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+int
+getpagesize (void)
+{
+ SYSTEM_INFO system_info;
+ GetSystemInfo (&system_info);
+ return system_info.dwPageSize;
+}
+
+#endif
diff --git a/gl/tests/init.sh b/gl/tests/init.sh
index ef0957c1d8..a57de77a2f 100644
--- a/gl/tests/init.sh
+++ b/gl/tests/init.sh
@@ -57,6 +57,41 @@
# 4. Finally
# $ exit
+ME_=`expr "./$0" : '.*/\(.*\)$'`
+
+# We use a trap below for cleanup. This requires us to go through
+# hoops to get the right exit status transported through the handler.
+# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit () { set +e; (exit $1); exit $1; }
+
+# Print warnings (e.g., about skipped and failed tests) to this file number.
+# Override by defining to say, 9, in init.cfg, and putting say,
+# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
+# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# This is useful when using automake's parallel tests mode, to print
+# the reason for skip/failure to console, rather than to the .log files.
+: ${stderr_fileno_=2}
+
+warn_() { echo "$@" 1>&$stderr_fileno_; }
+fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
+skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
+framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; }
+
+# Sanitize this shell to POSIX mode, if possible.
+DUALCASE=1; export DUALCASE
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+ esac
+fi
+
# We require $(...) support unconditionally.
# We require a few additional shell features only when $EXEEXT is nonempty,
# in order to support automatic $EXEEXT emulation:
@@ -68,44 +103,90 @@
# shells until we find one that passes. If one is found, re-exec it.
# If no acceptable shell is found, skip the current test.
#
+# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
+# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
+#
# Use "9" to indicate success (rather than 0), in case some shell acts
# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
+# Eval this code in a subshell to determine a shell's suitability.
+# 10 - passes all tests; ok to use
+# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score
+# ? - not ok
gl_shell_test_script_='
test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 9
+score_=10
+if test "$VERBOSE" = yes; then
+ test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
+fi
+test -z "$EXEEXT" && exit $score_
shopt -s expand_aliases
alias a-b="echo zoo"
v=abx
test ${v%x} = ab \
&& test ${v#a} = bx \
&& test $(a-b) = zoo \
- && exit 9
+ && exit $score_
'
if test "x$1" = "x--no-reexec"; then
shift
else
- # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
- # It does not evaluate any of the code after the "unexpected" `('. Thus,
- # we must run it in a subshell.
- ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
- if test $? = 9; then
- : # The current shell is adequate. No re-exec required.
- else
- # Search for a shell that meets our requirements.
- for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
- do
- test "$re_shell_" = no_shell && continue
- test "$re_shell_" = fail && skip_ failed to find an adequate shell
+ # Assume a working shell. Export to subshells (setup_ needs this).
+ gl_set_x_corrupts_stderr_=false
+ export gl_set_x_corrupts_stderr_
+
+ # Record the first marginally acceptable shell.
+ marginal_=
+
+ # Search for a shell that meets our requirements.
+ for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \
+ /bin/sh bash dash zsh pdksh fail
+ do
+ test "$re_shell_" = no_shell && continue
+
+ # If we've made it all the way to the sentinel, "fail" without
+ # finding even a marginal shell, skip this test.
+ if test "$re_shell_" = fail; then
+ test -z "$marginal_" && skip_ failed to find an adequate shell
+ re_shell_=$marginal_
+ break
+ fi
+
+ # When testing the current shell, simply "eval" the test code.
+ # Otherwise, run it via $re_shell_ -c ...
+ if test "$re_shell_" = __current__; then
+ # 'eval'ing this code makes Solaris 10's /bin/sh exit with
+ # $? set to 2. It does not evaluate any of the code after the
+ # "unexpected" first `('. Thus, we must run it in a subshell.
+ ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+ else
"$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
- if test $? = 9; then
- # Found an acceptable shell.
- exec "$re_shell_" "$0" --no-reexec "$@"
- echo "$ME_: exec failed" 1>&2
- exit 127
- fi
- done
+ fi
+
+ st_=$?
+
+ # $re_shell_ works just fine. Use it.
+ test $st_ = 10 && break
+
+ # If this is our first marginally acceptable shell, remember it.
+ if test "$st_:$marginal_" = 9: ; then
+ marginal_="$re_shell_"
+ gl_set_x_corrupts_stderr_=true
+ fi
+ done
+
+ if test "$re_shell_" != __current__; then
+ # Found a usable shell. Preserve -v and -x.
+ case $- in
+ *v*x* | *x*v*) opts_=-vx ;;
+ *v*) opts_=-v ;;
+ *x*) opts_=-x ;;
+ *) opts_= ;;
+ esac
+ exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
+ echo "$ME_: exec failed" 1>&2
+ exit 127
fi
fi
@@ -118,26 +199,6 @@ test -n "$EXEEXT" && shopt -s expand_aliases
: ${MALLOC_PERTURB_=87}
export MALLOC_PERTURB_
-# We use a trap below for cleanup. This requires us to go through
-# hoops to get the right exit status transported through the handler.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit () { set +e; (exit $1); exit $1; }
-
-# Print warnings (e.g., about skipped and failed tests) to this file number.
-# Override by defining to say, 9, in init.cfg, and putting say,
-# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
-# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
-# This is useful when using automake's parallel tests mode, to print
-# the reason for skip/failure to console, rather than to the .log files.
-: ${stderr_fileno_=2}
-
-warn_() { echo "$@" 1>&$stderr_fileno_; }
-fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
-skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
-framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; }
-
# 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.
@@ -179,6 +240,11 @@ find_exe_basenames_()
feb_result_=
feb_sp_=
for feb_file_ in $feb_dir_/*.exe; do
+ # If there was no *.exe file, or there existed a file named "*.exe" that
+ # was deleted between the above glob expansion and the existence test
+ # below, just skip it.
+ test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+ && continue
case $feb_file_ in
*[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
*) # Remove leading file name components as well as the .exe suffix.
@@ -196,7 +262,7 @@ find_exe_basenames_()
# For each file name of the form PROG.exe, create an alias named
# PROG that simply invokes PROG.exe, then return 0. If any selected
# file name or the directory name, $1, contains an unexpected character,
-# define no function and return 1.
+# define no alias and return 1.
create_exe_shims_()
{
case $EXEEXT in
@@ -244,19 +310,29 @@ path_prepend_()
setup_()
{
- test "$VERBOSE" = yes && set -x
+ if test "$VERBOSE" = yes; then
+ # Test whether set -x may cause the selected shell to corrupt an
+ # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh
+ # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5.
+ # If enabling verbose output this way would cause trouble, simply
+ # issue a warning and refrain.
+ if $gl_set_x_corrupts_stderr_; then
+ warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr"
+ else
+ set -x
+ fi
+ fi
initial_cwd_=$PWD
- ME_=`expr "./$0" : '.*/\(.*\)$'`
pfx_=`testdir_prefix_`
test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
|| fail_ "failed to create temporary directory in $initial_cwd_"
cd "$test_dir_"
- # These trap statements ensure that the temporary directory, $test_dir_,
- # is removed upon exit as well as upon receipt of any of the listed signals.
- trap remove_tmp_ 0
+ # This trap statement, along with a trap on 0 below, ensure that the
+ # temporary directory, $test_dir_, is removed upon exit as well as
+ # upon receipt of any of the listed signals.
for sig_ in 1 2 3 13 15; do
eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
done
@@ -384,3 +460,6 @@ test -f "$srcdir/init.cfg" \
&& . "$srcdir/init.cfg"
setup_ "$@"
+# This trap is here, rather than in the setup_ function, because some
+# shells run the exit trap at shell function exit, rather than script exit.
+trap remove_tmp_ 0
diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h
index 7ff04391be..871b676981 100644
--- a/gl/tests/sys_ioctl.in.h
+++ b/gl/tests/sys_ioctl.in.h
@@ -20,6 +20,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_IOCTL_H@
diff --git a/gl/tests/test-binary-io.c b/gl/tests/test-binary-io.c
new file mode 100644
index 0000000000..125150b21f
--- /dev/null
+++ b/gl/tests/test-binary-io.c
@@ -0,0 +1,64 @@
+/* Test of binary mode I/O.
+ Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
+
+#include <config.h>
+
+#include "binary-io.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+ /* Test the O_BINARY macro. */
+ {
+ int fd =
+ open ("t-bin-out2.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600);
+ if (write (fd, "Hello\n", 6) < 0)
+ exit (1);
+ close (fd);
+ }
+ {
+ struct stat statbuf;
+ if (stat ("t-bin-out2.tmp", &statbuf) < 0)
+ exit (1);
+ ASSERT (statbuf.st_size == 6);
+ }
+ unlink ("t-bin-out2.tmp");
+
+ /* Test the SET_BINARY macro. */
+ SET_BINARY (1);
+ fputs ("Hello\n", stdout);
+ fclose (stdout);
+ fclose (stderr);
+ {
+ struct stat statbuf;
+ if (stat ("t-bin-out1.tmp", &statbuf) < 0)
+ exit (1);
+ ASSERT (statbuf.st_size == 6);
+ }
+
+ return 0;
+}
diff --git a/gl/tests/test-binary-io.sh b/gl/tests/test-binary-io.sh
new file mode 100755
index 0000000000..33e128c309
--- /dev/null
+++ b/gl/tests/test-binary-io.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp"
+./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1
+
+rm -fr $tmpfiles
+
+exit 0
diff --git a/gl/tests/test-ftello.c b/gl/tests/test-ftello.c
new file mode 100644
index 0000000000..5fae570f28
--- /dev/null
+++ b/gl/tests/test-ftello.c
@@ -0,0 +1,118 @@
+/* Test of ftello() function.
+ Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+ fseek link warning if we are not using the gnulib fseek module. */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ftello, off_t, (FILE *));
+
+#include "binary-io.h"
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, char **argv _GL_UNUSED)
+{
+ int ch;
+ /* Assume stdin is seekable iff argc > 1. */
+ if (argc == 1)
+ {
+ ASSERT (ftell (stdin) == -1);
+ ASSERT (ftello (stdin) == -1);
+ return 0;
+ }
+
+ /* mingw ftell is unreliable on text mode input. */
+ SET_BINARY (0);
+
+ /* Simple tests. For each test, make sure ftell and ftello agree. */
+ ASSERT (ftell (stdin) == 0);
+ ASSERT (ftello (stdin) == 0);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 1);
+ ASSERT (ftello (stdin) == 1);
+
+ /* Test ftell after ungetc of read input. */
+ ch = ungetc ('#', stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 0);
+ ASSERT (ftello (stdin) == 0);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '#');
+ ASSERT (ftell (stdin) == 1);
+ ASSERT (ftello (stdin) == 1);
+
+ /* Test ftell after fseek. */
+ ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+ ASSERT (ftell (stdin) == 2);
+ ASSERT (ftello (stdin) == 2);
+
+ /* Test ftell after random ungetc. */
+ ch = fgetc (stdin);
+ ASSERT (ch == '/');
+ ch = ungetc ('@', stdin);
+ ASSERT (ch == '@');
+ ASSERT (ftell (stdin) == 2);
+ ASSERT (ftello (stdin) == 2);
+
+ ch = fgetc (stdin);
+ ASSERT (ch == '@');
+ ASSERT (ftell (stdin) == 3);
+ ASSERT (ftello (stdin) == 3);
+
+ if (2 < argc)
+ {
+ if (FUNC_UNGETC_BROKEN)
+ {
+ fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+ stderr);
+ return 77;
+ }
+ /* Test ftell after ungetc without read. */
+ ASSERT (fseek (stdin, 0, SEEK_CUR) == 0);
+ ASSERT (ftell (stdin) == 3);
+ ASSERT (ftello (stdin) == 3);
+
+ ch = ungetc ('~', stdin);
+ ASSERT (ch == '~');
+ ASSERT (ftell (stdin) == 2);
+ ASSERT (ftello (stdin) == 2);
+ }
+
+#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */
+ /* Test ftell beyond end of file. */
+ ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+ ch = ftello (stdin);
+ ASSERT (fseek (stdin, 10, SEEK_END) == 0);
+ ASSERT (ftell (stdin) == ch + 10);
+ ASSERT (ftello (stdin) == ch + 10);
+#endif
+
+ return 0;
+}
diff --git a/gl/tests/test-ftello.sh b/gl/tests/test-ftello.sh
new file mode 100755
index 0000000000..33d2e838db
--- /dev/null
+++ b/gl/tests/test-ftello.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1
+echo hi | ./test-ftello${EXEEXT} || exit 1
+exit 0
diff --git a/gl/tests/test-ftello2.sh b/gl/tests/test-ftello2.sh
new file mode 100755
index 0000000000..ba750b003d
--- /dev/null
+++ b/gl/tests/test-ftello2.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./test-ftello${EXEEXT} 1 2 < "$srcdir/test-ftello2.sh"
diff --git a/gl/tests/test-ftello3.c b/gl/tests/test-ftello3.c
new file mode 100644
index 0000000000..b07ba64610
--- /dev/null
+++ b/gl/tests/test-ftello3.c
@@ -0,0 +1,78 @@
+/* Test of ftello() function.
+ Copyright (C) 2007-2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+ fseek link warning if we are not using the gnulib fseek module. */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include <string.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-ftello3.tmp"
+
+int
+main (void)
+{
+ FILE *fp;
+
+ /* Create a file with some contents. */
+ fp = fopen (TESTFILE, "w");
+ if (fp == NULL)
+ goto skip;
+ if (fwrite ("foogarsh", 1, 8, fp) < 8)
+ goto skip;
+ if (fclose (fp))
+ goto skip;
+
+ /* The file's contents is now "foogarsh". */
+
+ /* Try writing after reading to EOF. */
+ fp = fopen (TESTFILE, "r+");
+ if (fp == NULL)
+ goto skip;
+ if (fseek (fp, -1, SEEK_END))
+ goto skip;
+ ASSERT (getc (fp) == 'h');
+ ASSERT (getc (fp) == EOF);
+ ASSERT (ftello (fp) == 8);
+ ASSERT (ftello (fp) == 8);
+ ASSERT (putc ('!', fp) == '!');
+ ASSERT (ftello (fp) == 9);
+ ASSERT (fclose (fp) == 0);
+ fp = fopen (TESTFILE, "r");
+ if (fp == NULL)
+ goto skip;
+ {
+ char buf[10];
+ ASSERT (fread (buf, 1, 10, fp) == 9);
+ ASSERT (memcmp (buf, "foogarsh!", 9) == 0);
+ }
+ ASSERT (fclose (fp) == 0);
+
+ /* The file's contents is now "foogarsh!". */
+
+ remove (TESTFILE);
+ return 0;
+
+ skip:
+ fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
+ remove (TESTFILE);
+ return 77;
+}
diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c
index bd245b427b..15d6569b4a 100644
--- a/gl/tests/test-getaddrinfo.c
+++ b/gl/tests/test-getaddrinfo.c
@@ -161,25 +161,6 @@ simple (char const *host, char const *service)
int main (void)
{
-#if _WIN32
- {
- WORD requested;
- WSADATA data;
- int err;
-
- requested = MAKEWORD (1, 1);
- err = WSAStartup (requested, &data);
- if (err != 0)
- return 1;
-
- if (data.wVersion < requested)
- {
- WSACleanup ();
- return 2;
- }
- }
-#endif
-
return simple (HOST1, SERV1)
+ simple (HOST2, SERV2)
+ simple (HOST3, SERV3)
diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c
index a801614079..05e1bfaed2 100644
--- a/gl/tests/test-memchr.c
+++ b/gl/tests/test-memchr.c
@@ -57,6 +57,7 @@ main (void)
ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1);
ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2);
+ ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2);
ASSERT (MEMCHR (input, 'f', n) == NULL);
ASSERT (MEMCHR (input, '\0', n) == NULL);
@@ -87,25 +88,37 @@ main (void)
/* Check that memchr() does not read past the first occurrence of the
byte being searched. See the Austin Group's clarification
- <http://www.opengroup.org/austin/docs/austin_454.txt>. */
+ <http://www.opengroup.org/austin/docs/austin_454.txt>.
+ Test both '\0' and something else, since some implementations
+ special-case searching for NUL.
+ */
{
char *page_boundary = (char *) zerosize_ptr ();
+ /* Too small, and we miss cache line boundary tests; too large,
+ and the test takes cubically longer to complete. */
+ int limit = 257;
if (page_boundary != NULL)
{
- for (n = 1; n <= 500; n++)
+ for (n = 1; n <= limit; n++)
{
char *mem = page_boundary - n;
memset (mem, 'X', n);
ASSERT (MEMCHR (mem, 'U', n) == NULL);
+ ASSERT (MEMCHR (mem, 0, n) == NULL);
{
size_t i;
+ size_t k;
for (i = 0; i < n; i++)
{
mem[i] = 'U';
- ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
+ for (k = i + 1; k < n + limit; k++)
+ ASSERT (MEMCHR (mem, 'U', k) == mem + i);
+ mem[i] = 0;
+ for (k = i + 1; k < n + limit; k++)
+ ASSERT (MEMCHR (mem, 0, k) == mem + i);
mem[i] = 'X';
}
}
diff --git a/gl/tests/test-netdb.c b/gl/tests/test-netdb.c
index 5f2bcd4e52..697bbc8dbf 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-2010 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,6 +22,9 @@
/* Check that the 'struct hostent' type is defined. */
struct hostent t1;
+/* Check that the 'socklen_t' type is defined. */
+socklen_t t2;
+
int
main (void)
{
diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c
index 0a0bf6882e..daa61668c6 100644
--- a/gl/tests/test-read-file.c
+++ b/gl/tests/test-read-file.c
@@ -52,11 +52,23 @@ main (void)
err = 1;
}
- /* Assume FILE1 is a regular file or a symlink to a regular file. */
- if (len != statbuf.st_size)
+ if (S_ISREG (statbuf.st_mode))
{
- fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
- err = 1;
+ /* FILE1 is a regular file or a symlink to a regular file. */
+ if (len != statbuf.st_size)
+ {
+ fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
+ err = 1;
+ }
+ }
+ else
+ {
+ /* Assume FILE1 is not empty. */
+ if (len == 0)
+ {
+ fprintf (stderr, "Read nothing from %s\n", FILE1);
+ err = 1;
+ }
}
free (out);
}
diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c
index fcb534de4c..2103d8bab9 100644
--- a/gl/tests/test-stdbool.c
+++ b/gl/tests/test-stdbool.c
@@ -16,6 +16,17 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+/* We want this test to succeed even when using gcc's -Werror; but to
+ do that requires a pragma that didn't exist before 4.3.0. */
+#ifndef __GNUC__
+# define ADDRESS_CHECK_OKAY
+#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
+/* No way to silence -Waddress. */
+#else
+# pragma GCC diagnostic ignored "-Waddress"
+# define ADDRESS_CHECK_OKAY
+#endif
+
#include <config.h>
#include <stdbool.h>
@@ -39,49 +50,31 @@
"error: __bool_true_false_are_defined is not defined"
#endif
-#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */
+/* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at
+ least, not for all compilers and compiler options. */
+#if HAVE_STDBOOL_H || defined __GNUC__
struct s { _Bool s: 1; _Bool t; } s;
#endif
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, at least,
-not for all compilers. */
+#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */
char d[(bool) 0.5 == true ? 1 : -1];
+# ifdef ADDRESS_CHECK_OKAY
bool e = &s;
+# endif
char f[(_Bool) 0.0 == false ? 1 : -1];
#endif
char g[true];
char h[sizeof (_Bool)];
-#if 0 /* See above. */
+#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */
char i[sizeof s.t];
#endif
enum { j = false, k = true, l = false * true, m = true * 256 };
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */
-#if defined __xlc__ || defined __GNUC__
- /* 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 test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a run-time
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-#endif
-#endif
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -92,5 +85,11 @@ _Bool *pq = &q;
int
main ()
{
- return 0;
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This is a runtime test, since a corresponding compile-time
+ test would rely on initializer extensions. */
+ char digs[] = "0123456789";
+ return &(digs + 5)[-2 + (bool) 1] != &digs[4];
}
diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c
index d047e57b65..2c392c7547 100644
--- a/gl/tests/test-stddef.c
+++ b/gl/tests/test-stddef.c
@@ -31,6 +31,20 @@ size_t c = 2;
per POSIX 2008. */
verify (sizeof NULL == sizeof (void *));
+/* Check that offsetof produces integer constants with correct type. */
+struct d
+{
+ char e;
+ char f;
+};
+/* Solaris 10 has a bug where offsetof is under-parenthesized, and
+ cannot be used as an arbitrary expression. However, since it is
+ unlikely to bite real code, we ignore that short-coming. */
+/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */
+verify (sizeof (offsetof (struct d, e)) == sizeof (size_t));
+verify (offsetof (struct d, e) < -1); /* Must be unsigned. */
+verify (offsetof (struct d, f) == 1);
+
int
main (void)
{
diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c
index 4bd8715f3d..1e7956b68c 100644
--- a/gl/tests/test-stdlib.c
+++ b/gl/tests/test-stdlib.c
@@ -22,22 +22,33 @@
#include "verify.h"
-int exitcode;
+/* Check that EXIT_SUCCESS is 0, per POSIX. */
+static int exitcode = EXIT_SUCCESS;
+#if EXIT_SUCCESS
+"oops"
+#endif
+
+/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by
+ gnulib). */
+#if EXIT_FAILURE != 1
+"oops"
+#endif
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
verify (sizeof NULL == sizeof (void *));
+#if GNULIB_TEST_SYSTEM_POSIX
+# include "test-sys_wait.h"
+#else
+# define test_sys_wait_macros() 0
+#endif
+
int
main (void)
{
- /* Check that some macros are defined and different integer constants. */
- switch (exitcode)
- {
- case EXIT_SUCCESS:
- case EXIT_FAILURE:
- break;
- }
-
- return 0;
+ if (test_sys_wait_macros ())
+ return 1;
+
+ return exitcode;
}
diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c
index badf308b7a..e976ff6a7b 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-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
@@ -27,6 +27,9 @@
int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
#endif
+/* Check that the 'socklen_t' type is defined. */
+socklen_t t1;
+
int
main (void)
{
@@ -49,5 +52,9 @@ main (void)
x.ss_family = 42;
i = 42;
+ /* Tell the compiler that these variables are used. */
+ (void) x;
+ (void) i;
+
return 0;
}
diff --git a/gl/tests/test-sys_wait.h b/gl/tests/test-sys_wait.h
new file mode 100644
index 0000000000..bb10450867
--- /dev/null
+++ b/gl/tests/test-sys_wait.h
@@ -0,0 +1,53 @@
+/* Test of macros shared between <sys/wait.h> and <stdlib.h>.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2010. */
+
+static int
+test_sys_wait_macros (void)
+{
+ /* Check subset of <sys/wait.h> macros that must be visible here.
+ Note that some of these macros are only portable when operating
+ on an lvalue. */
+ int i;
+ for (i = 0; i < 0x8000; i = (i ? i << 1 : 1))
+ {
+ /* POSIX requires that for all valid process statuses, that
+ exactly one of these three macros is true. But not all
+ possible 16-bit values map to valid process status.
+ Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits
+ to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80
+ or 0x8000 to flag that core was also dumped. Since we don't
+ know which byte is WIFEXITED, we skip the both possible bits
+ that can signal core dump. */
+ if (i == 0x80)
+ continue;
+ if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1)
+ return 1;
+ }
+ i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i);
+
+ switch (i)
+ {
+#if 0
+ /* Gnulib doesn't guarantee these, yet. */
+ case WNOHANG:
+ case WUNTRACED:
+#endif
+ break;
+ }
+ return 0;
+}
diff --git a/gl/tests/test-update-copyright.sh b/gl/tests/test-update-copyright.sh
index 2d1022a999..fbf4f23bb4 100755
--- a/gl/tests/test-update-copyright.sh
+++ b/gl/tests/test-update-copyright.sh
@@ -23,6 +23,9 @@ else
compare() { cmp "$@"; }
fi
+# Ensure the update-copyright program gets found.
+PATH=$abs_aux_dir:$PATH
+
TMP_BASE=update-copyright.test
trap 'rm -f $TMP_BASE*' 0 1 2 3 15
@@ -47,6 +50,13 @@ echo a > $TMP-in
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
diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh
index 43a3b3fd36..017b8d2460 100755
--- a/gl/tests/test-vc-list-files-cvs.sh
+++ b/gl/tests/test-vc-list-files-cvs.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
tmpdir=vc-cvs
repo=`pwd`/$tmpdir/repo
diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh
index 47576258bc..262d2ea3d2 100755
--- a/gl/tests/test-vc-list-files-git.sh
+++ b/gl/tests/test-vc-list-files-git.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
tmpdir=vc-git-$$
GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c
index 47eae2b4f3..3f89ba9058 100644
--- a/gl/tests/test-verify.c
+++ b/gl/tests/test-verify.c
@@ -42,7 +42,8 @@ enum
item = verify_true (1 == 1) * 0 + 17 /* should be ok */
};
-int function (int n)
+static int
+function (int n)
{
#if EXP_FAIL == 3
verify (n >= 0); /* should give ERROR: non-constant expression */
diff --git a/gl/time.in.h b/gl/time.in.h
index 8e364feb82..1d34416f56 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -19,6 +19,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Don't get in the way of glibc when it includes time.h merely to
declare a few standard symbols, rather than to declare all the
@@ -48,10 +49,20 @@
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
Or they define it with the wrong member names or define it in <sys/time.h>
- (e.g., FreeBSD circa 1997). */
+ (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the
+ pthreads-win32 library defines it in <pthread.h>. */
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
# include <sys/time.h>
+# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
+# include <pthread.h>
+/* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */
+# undef asctime_r
+# undef ctime_r
+# undef gmtime_r
+# undef localtime_r
+# undef rand_r
+# undef strtok_r
# else
# ifdef __cplusplus
diff --git a/gl/timespec.h b/gl/timespec.h
index 81b342300e..175de7f263 100644
--- a/gl/timespec.h
+++ b/gl/timespec.h
@@ -22,15 +22,39 @@
# include <time.h>
/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
- Assume the nanosecond components are in range, or close to it. */
+
+ For each time stamp T, this code assumes that either:
+
+ * T.tv_nsec is in the range 0..999999999; or
+ * T.tv_sec corresponds to a valid leap second on a host that supports
+ leap seconds, and T.tv_nsec is in the range 1000000000..1999999999; or
+ * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or
+ T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000.
+ This allows for special struct timespec values that are less or
+ greater than all possible valid time stamps.
+
+ In all these cases, it is safe to subtract two tv_nsec values and
+ convert the result to integer without worrying about overflow on
+ any platform of interest to the GNU project, since all such
+ platforms have 32-bit int or wider.
+
+ Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like
+ "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause
+ this function to work in some cases where the above assumption is
+ violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2,
+ b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the
+ extra instructions. Using a subtraction has the advantage of
+ detecting some invalid cases on platforms that detect integer
+ overflow.
+
+ The (int) cast avoids a gcc -Wconversion warning. */
+
static inline int
timespec_cmp (struct timespec a, struct timespec b)
{
return (a.tv_sec < b.tv_sec ? -1
: a.tv_sec > b.tv_sec ? 1
- : a.tv_nsec < b.tv_nsec ? -1
- : a.tv_nsec > b.tv_nsec ? 1
- : 0);
+ : (int) (a.tv_nsec - b.tv_nsec));
}
void gettime (struct timespec *);
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 7914f22814..fb44e48158 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -18,6 +18,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Special invocation convention:
- On mingw, several headers, including <winsock2.h>, include <unistd.h>,
@@ -1097,7 +1098,7 @@ _GL_CXXALIASWARN (readlinkat);
# undef readlinkat
# if HAVE_RAW_DECL_READLINKAT
_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
- "use gnulib module symlinkat for portability");
+ "use gnulib module readlinkat for portability");
# endif
#endif
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index 88d47dbc09..c0ff224478 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -29,6 +29,7 @@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
/* Special invocation convention: