Author: yoann
Date: 2008-10-17 11:38:49 +0200 (Fri, 17 Oct 2008)
New Revision: 11070
Added:
prelude-lml/trunk/libmissing/close.c
prelude-lml/trunk/libmissing/errno.in.h
prelude-lml/trunk/libmissing/fclose.c
prelude-lml/trunk/libmissing/m4/close.m4
prelude-lml/trunk/libmissing/m4/errno_h.m4
prelude-lml/trunk/libmissing/m4/fclose.m4
prelude-lml/trunk/libmissing/m4/sys_ioctl_h.m4
prelude-lml/trunk/libmissing/stdio-write.c
prelude-lml/trunk/libmissing/tests/test-errno.c
prelude-lml/trunk/libmissing/winsock.c
Removed:
prelude-lml/trunk/libmissing/m4/eoverflow.m4
prelude-lml/trunk/libmissing/tests/test-EOVERFLOW.c
Modified:
prelude-lml/trunk/libmissing/Makefile.am
prelude-lml/trunk/libmissing/arpa_inet.in.h
prelude-lml/trunk/libmissing/getaddrinfo.c
prelude-lml/trunk/libmissing/glob.c
prelude-lml/trunk/libmissing/m4/arpa_inet_h.m4
prelude-lml/trunk/libmissing/m4/getaddrinfo.m4
prelude-lml/trunk/libmissing/m4/gnulib-cache.m4
prelude-lml/trunk/libmissing/m4/gnulib-comp.m4
prelude-lml/trunk/libmissing/m4/inet_ntop.m4
prelude-lml/trunk/libmissing/m4/sigaction.m4
prelude-lml/trunk/libmissing/m4/signal_h.m4
prelude-lml/trunk/libmissing/m4/sleep.m4
prelude-lml/trunk/libmissing/m4/stdio_h.m4
prelude-lml/trunk/libmissing/m4/strdup.m4
prelude-lml/trunk/libmissing/m4/string_h.m4
prelude-lml/trunk/libmissing/m4/sys_select_h.m4
prelude-lml/trunk/libmissing/m4/sys_socket_h.m4
prelude-lml/trunk/libmissing/m4/unistd_h.m4
prelude-lml/trunk/libmissing/m4/wchar.m4
prelude-lml/trunk/libmissing/signal.in.h
prelude-lml/trunk/libmissing/sigprocmask.c
prelude-lml/trunk/libmissing/stdio.in.h
prelude-lml/trunk/libmissing/string.in.h
prelude-lml/trunk/libmissing/sys_select.in.h
prelude-lml/trunk/libmissing/sys_socket.in.h
prelude-lml/trunk/libmissing/tests/Makefile.am
prelude-lml/trunk/libmissing/tests/test-sigaction.c
prelude-lml/trunk/libmissing/tests/test-sys_select.c
prelude-lml/trunk/libmissing/tests/test-wchar.c
prelude-lml/trunk/libmissing/tests/test-wctype.c
prelude-lml/trunk/libmissing/unistd.in.h
prelude-lml/trunk/libmissing/vasnprintf.c
prelude-lml/trunk/libmissing/wchar.in.h
prelude-lml/trunk/libmissing/wctype.in.h
Log:
GnuLib code update.
Modified: prelude-lml/trunk/libmissing/Makefile.am
===================================================================
--- prelude-lml/trunk/libmissing/Makefile.am 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/Makefile.am 2008-10-17 09:38:49 UTC (rev 11070)
@@ -9,10 +9,11 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libmissing --source-base=libmissing --m4-base=libmissing/m4 --doc-base=libmissing/doc --aux-dir=. --with-tests --lgpl --libtool --macro-prefix=gl --no-vc-files fnmatch-gnu getaddrinfo glob inet_ntop memset mktime pathmax sigaction sleep snprintf socklen strdup strptime strsep sys_select
+# Reproduce by: gnulib-tool --import --dir=. --lib=libmissing --source-base=libmissing --m4-base=libmissing/m4 --doc-base=libmissing/doc --tests-base=libmissing/tests --aux-dir=. --with-tests --lgpl --libtool --macro-prefix=gl --no-vc-files bind close fnmatch-gnu getaddrinfo glob inet_ntop memset mktime pathmax recvfrom sigaction sleep snprintf socket socklen strdup strptime strsep sys_select
AUTOMAKE_OPTIONS = 1.5 gnits
+SUBDIRS =
noinst_HEADERS =
noinst_LIBRARIES =
noinst_LTLIBRARIES =
@@ -24,6 +25,8 @@
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
+SUBDIRS += tests
+EXTRA_DIST += m4/gnulib-cache.m4
AM_CPPFLAGS =
@@ -81,6 +84,7 @@
-e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/arpa_inet.in.h; \
} > $@-t
mv $@-t $@
@@ -91,6 +95,24 @@
## end gnulib module arpa_inet
+## begin gnulib module bind
+
+
+EXTRA_DIST += winsock.c
+
+EXTRA_libmissing_la_SOURCES += winsock.c
+
+## end gnulib module bind
+
+## begin gnulib module close
+
+
+EXTRA_DIST += close.c
+
+EXTRA_libmissing_la_SOURCES += close.c
+
+## end gnulib module close
+
## begin gnulib module dirfd
@@ -100,6 +122,42 @@
## end gnulib module dirfd
+## begin gnulib module errno
+
+BUILT_SOURCES += $(ERRNO_H)
+
+# We need the following in order to create <errno.h> when the system
+# doesn't have one that is POSIX compliant.
+errno.h: errno.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
+ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
+ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
+ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
+ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
+ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
+ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
+ < $(srcdir)/errno.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += errno.h errno.h-t
+
+EXTRA_DIST += errno.in.h
+
+## end gnulib module errno
+
+## begin gnulib module fclose
+
+
+EXTRA_DIST += fclose.c
+
+EXTRA_libmissing_la_SOURCES += fclose.c
+
+## end gnulib module fclose
+
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
@@ -158,6 +216,15 @@
## end gnulib module getlogin_r
+## begin gnulib module getpeername
+
+
+EXTRA_DIST += winsock.c
+
+EXTRA_libmissing_la_SOURCES += winsock.c
+
+## end gnulib module getpeername
+
## begin gnulib module gettext-h
libmissing_la_SOURCES += gettext.h
@@ -277,6 +344,15 @@
## end gnulib module raise
+## begin gnulib module recvfrom
+
+
+EXTRA_DIST += winsock.c
+
+EXTRA_libmissing_la_SOURCES += winsock.c
+
+## end gnulib module recvfrom
+
## begin gnulib module sigaction
@@ -298,6 +374,7 @@
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
+ -e 's|@''GNULIB_SIGNAL_H_SIGPIPE''@|$(GNULIB_SIGNAL_H_SIGPIPE)|g' \
-e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \
-e 's|@''GNULIB_SIGACTION''@|$(GNULIB_SIGACTION)|g' \
-e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
@@ -348,6 +425,15 @@
## end gnulib module snprintf
+## begin gnulib module socket
+
+
+EXTRA_DIST += winsock.c
+
+EXTRA_libmissing_la_SOURCES += winsock.c
+
+## end gnulib module socket
+
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
@@ -419,17 +505,21 @@
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
+ -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
-e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+ -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
-e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
-e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
-e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+ -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
-e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+ -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
-e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
-e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+ -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
+ -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
-e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
-e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
-e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
@@ -437,8 +527,18 @@
-e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
-e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
-e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+ -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
+ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
+ -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
+ -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
+ -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
+ -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
+ -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
-e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
-e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
+ -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
+ -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
+ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
-e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
-e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
@@ -451,6 +551,8 @@
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
+ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
-e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
-e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
@@ -458,19 +560,21 @@
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
-e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
-e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
-e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
- -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
- -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
+ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdio.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdio.h stdio.h-t
-EXTRA_DIST += stdio.in.h
+EXTRA_DIST += stdio-write.c stdio.in.h
+EXTRA_libmissing_la_SOURCES += stdio-write.c
+
## end gnulib module stdio
## begin gnulib module stdlib
@@ -601,6 +705,7 @@
-e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
-e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
-e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
@@ -679,6 +784,9 @@
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
+ -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
+ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/sys_select.in.h; \
} > $@-t
mv $@-t $@
@@ -702,16 +810,34 @@
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
+ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
+ -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \
+ -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \
+ -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \
+ -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \
+ -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \
+ -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \
+ -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \
+ -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \
+ -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \
+ -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \
+ -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \
+ -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
+ -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
+ -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/sys_socket.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
MOSTLYCLEANDIRS += sys
-EXTRA_DIST += sys_socket.in.h
+EXTRA_DIST += sys_socket.in.h winsock.c
+EXTRA_libmissing_la_SOURCES += winsock.c
+
## end gnulib module sys_socket
## begin gnulib module sys_stat
@@ -814,19 +940,26 @@
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
-e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
-e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
-e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
-e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
-e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
-e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
-e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
-e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
+ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
@@ -835,11 +968,15 @@
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
+ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/unistd.in.h; \
} > $@-t
mv $@-t $@
@@ -872,6 +1009,7 @@
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
Modified: prelude-lml/trunk/libmissing/arpa_inet.in.h
===================================================================
--- prelude-lml/trunk/libmissing/arpa_inet.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/arpa_inet.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -34,6 +34,8 @@
#ifndef _GL_ARPA_INET_H
#define _GL_ARPA_INET_H
+/* The definition of GL_LINK_WARNING is copied here. */
+
#if @GNULIB_INET_NTOP@
# if !@HAVE_DECL_INET_NTOP@
/* Converts an internet address from internal format to a printable,
Added: prelude-lml/trunk/libmissing/close.c
===================================================================
--- prelude-lml/trunk/libmissing/close.c (rev 0)
+++ prelude-lml/trunk/libmissing/close.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,45 @@
+/* close replacement.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#if GNULIB_SYS_SOCKET
+# include <sys/socket.h>
+#endif
+
+
+/* Override close() to call into other gnulib modules. */
+
+int
+rpl_close (int fd)
+#undef close
+{
+#if HAVE__GL_CLOSE_FD_MAYBE_SOCKET
+ int retval = _gl_close_fd_maybe_socket (fd);
+#else
+ int retval = close (fd);
+#endif
+
+#ifdef FCHDIR_REPLACEMENT
+ if (retval >= 0)
+ _gl_unregister_fd (fd);
+#endif
+
+ return retval;
+}
Added: prelude-lml/trunk/libmissing/errno.in.h
===================================================================
--- prelude-lml/trunk/libmissing/errno.in.h (rev 0)
+++ prelude-lml/trunk/libmissing/errno.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,153 @@
+/* A POSIX-like <errno.h>.
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _GL_ERRNO_H
+
+@PRAGMA_SYSTEM_HEADER@
+
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
+
+#ifndef _GL_ERRNO_H
+#define _GL_ERRNO_H
+
+
+/* On native Windows platforms, many macros are not defined. */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */
+# define EWOULDBLOCK EAGAIN
+
+/* Values >= 100 seem safe to use. */
+# define ETXTBSY 100
+# define GNULIB_defined_ETXTBSY 1
+
+/* These are intentionally the same values as the WSA* error numbers, defined
+ in <winsock2.h>. */
+# define EINPROGRESS 10036
+# define EALREADY 10037
+# define ENOTSOCK 10038
+# define EDESTADDRREQ 10039
+# define EMSGSIZE 10040
+# define EPROTOTYPE 10041
+# define ENOPROTOOPT 10042
+# define EPROTONOSUPPORT 10043
+# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
+# define EOPNOTSUPP 10045
+# define EPFNOSUPPORT 10046 /* not required by POSIX */
+# define EAFNOSUPPORT 10047
+# define EADDRINUSE 10048
+# define EADDRNOTAVAIL 10049
+# define ENETDOWN 10050
+# define ENETUNREACH 10051
+# define ENETRESET 10052
+# define ECONNABORTED 10053
+# define ECONNRESET 10054
+# define ENOBUFS 10055
+# define EISCONN 10056
+# define ENOTCONN 10057
+# define ESHUTDOWN 10058 /* not required by POSIX */
+# define ETOOMANYREFS 10059 /* not required by POSIX */
+# define ETIMEDOUT 10060
+# define ECONNREFUSED 10061
+# define ELOOP 10062
+# define EHOSTDOWN 10064 /* not required by POSIX */
+# define EHOSTUNREACH 10065
+# define EPROCLIM 10067 /* not required by POSIX */
+# define EUSERS 10068 /* not required by POSIX */
+# define EDQUOT 10069
+# define ESTALE 10070
+# define EREMOTE 10071 /* not required by POSIX */
+# define GNULIB_defined_ESOCK 1
+
+# endif
+
+
+/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
+ EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */
+# if @EMULTIHOP_HIDDEN@
+# define EMULTIHOP @EMULTIHOP_VALUE@
+# define GNULIB_defined_EMULTIHOP 1
+# endif
+# if @ENOLINK_HIDDEN@
+# define ENOLINK @ENOLINK_VALUE@
+# define GNULIB_defined_ENOLINK 1
+# endif
+# if @EOVERFLOW_HIDDEN@
+# define EOVERFLOW @EOVERFLOW_VALUE@
+# define GNULIB_defined_EOVERFLOW 1
+# endif
+
+
+/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
+ EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
+ Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
+ HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
+
+ Note: When one of these systems defines some of these macros some day,
+ binaries will have to be recompiled so that they recognizes the new
+ errno values from the system. */
+
+# ifndef ENOMSG
+# define ENOMSG 2000
+# define GNULIB_defined_ENOMSG 1
+# endif
+
+# ifndef EIDRM
+# define EIDRM 2001
+# define GNULIB_defined_EIDRM 1
+# endif
+
+# ifndef ENOLINK
+# define ENOLINK 2002
+# define GNULIB_defined_ENOLINK 1
+# endif
+
+# ifndef EPROTO
+# define EPROTO 2003
+# define GNULIB_defined_EPROTO 1
+# endif
+
+# ifndef EMULTIHOP
+# define EMULTIHOP 2004
+# define GNULIB_defined_EMULTIHOP 1
+# endif
+
+# ifndef EBADMSG
+# define EBADMSG 2005
+# define GNULIB_defined_EBADMSG 1
+# endif
+
+# ifndef EOVERFLOW
+# define EOVERFLOW 2006
+# define GNULIB_defined_EOVERFLOW 1
+# endif
+
+# ifndef ENOTSUP
+# define ENOTSUP 2007
+# define GNULIB_defined_ENOTSUP 1
+# endif
+
+# ifndef ECANCELED
+# define ECANCELED 2008
+# define GNULIB_defined_ECANCELED 1
+# endif
+
+
+#endif /* _GL_ERRNO_H */
+#endif /* _GL_ERRNO_H */
Added: prelude-lml/trunk/libmissing/fclose.c
===================================================================
--- prelude-lml/trunk/libmissing/fclose.c (rev 0)
+++ prelude-lml/trunk/libmissing/fclose.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,47 @@
+/* fclose replacement.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Override fclose() to call the overridden close(). */
+
+int
+rpl_fclose (FILE *fp)
+#undef fclose
+{
+ int saved_errno = 0;
+
+ if (fflush (fp))
+ saved_errno = errno;
+
+ if (close (fileno (fp)) < 0 && saved_errno == 0)
+ saved_errno = errno;
+
+ fclose (fp); /* will fail with errno = EBADF */
+
+ if (saved_errno != 0)
+ {
+ errno = saved_errno;
+ return EOF;
+ }
+ return 0;
+}
Modified: prelude-lml/trunk/libmissing/getaddrinfo.c
===================================================================
--- prelude-lml/trunk/libmissing/getaddrinfo.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/getaddrinfo.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -301,6 +301,22 @@
tmp->ai_addr->sa_family = he->h_addrtype;
tmp->ai_family = he->h_addrtype;
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+ switch (he->h_addrtype)
+ {
+#if HAVE_IPV4
+ case AF_INET:
+ tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
+ break;
+#endif
+#if HAVE_IPV6
+ case AF_INET6:
+ tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
+ break;
+#endif
+ }
+#endif
+
/* FIXME: If more than one address, create linked list of addrinfo's. */
*res = tmp;
Modified: prelude-lml/trunk/libmissing/glob.c
===================================================================
--- prelude-lml/trunk/libmissing/glob.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/glob.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -44,10 +44,10 @@
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# define USE_WIN32
+# define WINDOWS32
#endif
-#ifndef USE_WIN32
+#ifndef WINDOWS32
# include <pwd.h>
#endif
@@ -87,7 +87,7 @@
/* If the system has the `struct dirent64' type we use it internally. */
#if defined _LIBC && !defined COMPILE_GLOB64
-# if (defined POSIX || defined USE_WIN32) && !defined __GNU_LIBRARY__
+# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
# define CONVERT_D_INO(d64, d32)
# else
# define CONVERT_D_INO(d64, d32) \
@@ -108,7 +108,7 @@
#endif
-#if (defined POSIX || defined USE_WIN32) && !defined __GNU_LIBRARY__
+#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
/* Posix does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
@@ -429,14 +429,14 @@
/* Find the filename. */
filename = strrchr (pattern, '/');
-#if defined __MSDOS__ || defined USE_WIN32
+#if defined __MSDOS__ || defined WINDOWS32
/* The case of "d:pattern". Since `:' is not allowed in
file names, we can safely assume that wherever it
happens in pattern, it signals the filename part. This
is so we could some day support patterns like "[a-z]:foo". */
if (filename == NULL)
filename = strchr (pattern, ':');
-#endif /* __MSDOS__ || USE_WIN32 */
+#endif /* __MSDOS__ || WINDOWS32 */
dirname_modified = 0;
if (filename == NULL)
{
@@ -476,7 +476,7 @@
{
char *newp;
dirlen = filename - pattern;
-#if defined __MSDOS__ || defined USE_WIN32
+#if defined __MSDOS__ || defined WINDOWS32
if (*filename == ':'
|| (filename > pattern + 1 && filename[-1] == ':'))
{
@@ -500,7 +500,7 @@
++filename;
if (filename[0] == '\0'
-#if defined __MSDOS__ || defined USE_WIN32
+#if defined __MSDOS__ || defined WINDOWS32
&& dirname[dirlen - 1] != ':'
&& (dirlen < 3 || dirname[dirlen - 2] != ':'
|| dirname[dirlen - 1] != '/')
@@ -566,27 +566,31 @@
{
/* Look up home directory. */
const char *home_dir = getenv ("HOME");
-#ifdef USE_WIN32
- char win_homedir[PATH_MAX];
-#endif
-
# ifdef _AMIGA
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "SYS:";
# else
-# ifdef USE_WIN32
- if (home_dir == NULL || home_dir[0] == '\0') {
- char *hdrv, *hpath;
- hdrv = getenv("HOMEDRIVE");
- hpath = getenv("HOMEPATH");
- if ( hdrv && hpath ) {
- snprintf(win_homedir, sizeof(win_homedir), "%s%s", hdrv, hpath);
- home_dir = win_homedir;
- }
-
- else
- home_dir = "c:/users/default"; /* poor default */
- }
+# ifdef WINDOWS32
+ /* Windows NT defines HOMEDRIVE and HOMEPATH. But give preference
+ to HOME, because the user can change HOME. */
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ const char *home_drive = getenv ("HOMEDRIVE");
+ const char *home_path = getenv ("HOMEPATH");
+
+ if (home_drive != NULL && home_path != NULL)
+ {
+ size_t home_drive_len = strlen (home_drive);
+ size_t home_path_len = strlen (home_path);
+ char *mem = alloca (home_drive_len + home_path_len + 1);
+
+ memcpy (mem, home_drive, home_drive_len);
+ memcpy (mem + home_drive_len, home_path, home_path_len + 1);
+ home_dir = mem;
+ }
+ else
+ home_dir = "c:/users/default"; /* poor default */
+ }
# else
if (home_dir == NULL || home_dir[0] == '\0')
{
@@ -649,7 +653,7 @@
else
home_dir = "~"; /* No luck. */
}
-# endif /* USE_WIN32 */
+# endif /* WINDOWS32 */
# endif
/* Now construct the full directory. */
if (dirname[1] == '\0')
@@ -669,7 +673,7 @@
}
dirname_modified = 1;
}
-# if !defined _AMIGA && !defined USE_WIN32
+# if !defined _AMIGA && !defined WINDOWS32
else
{
char *end_name = strchr (dirname, '/');
@@ -785,7 +789,7 @@
home directory. */
return GLOB_NOMATCH;
}
-# endif /* Not Amiga && not USE_WIN32. */
+# endif /* Not Amiga && not WINDOWS32. */
}
/* Now test whether we looked for "~" or "~NAME". In this case we
@@ -1133,7 +1137,7 @@
{
register size_t i;
size_t dirlen = strlen (dirname);
-#if defined __MSDOS__ || defined USE_WIN32
+#if defined __MSDOS__ || defined WINDOWS32
int sep_char = '/';
# define DIRSEP_CHAR sep_char
#else
@@ -1144,7 +1148,7 @@
/* DIRNAME is just "/", so normal prepending would get us "//foo".
We want "/foo" instead, so don't prepend any chars from DIRNAME. */
dirlen = 0;
-#if defined __MSDOS__ || defined USE_WIN32
+#if defined __MSDOS__ || defined WINDOWS32
else if (dirlen > 1)
{
if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
Modified: prelude-lml/trunk/libmissing/m4/arpa_inet_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/arpa_inet_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/arpa_inet_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 4
+# arpa_inet_h.m4 serial 5
dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,13 @@
gl_CHECK_NEXT_HEADERS([arpa/inet.h])
])
+dnl Unconditionally enables the replacement of <arpa/inet.h>.
+AC_DEFUN([gl_REPLACE_ARPA_INET_H],
+[
+ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+ ARPA_INET_H='arpa/inet.h'
+])
+
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
Added: prelude-lml/trunk/libmissing/m4/close.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/close.m4 (rev 0)
+++ prelude-lml/trunk/libmissing/m4/close.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,25 @@
+# close.m4 serial 2
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_CLOSE],
+[
+ m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
+ gl_PREREQ_SYS_H_WINSOCK2
+ if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
+ gl_REPLACE_CLOSE
+ fi
+ ])
+])
+
+AC_DEFUN([gl_REPLACE_CLOSE],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ if test $REPLACE_CLOSE != 1; then
+ AC_LIBOBJ([close])
+ fi
+ REPLACE_CLOSE=1
+ gl_REPLACE_FCLOSE
+])
Deleted: prelude-lml/trunk/libmissing/m4/eoverflow.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/eoverflow.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/eoverflow.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,70 +0,0 @@
-# eoverflow.m4 serial 2
-dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
-# POSIX. But some systems (like AIX 3) don't define it, and some systems
-# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
-
-# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
-# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
-# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
-# value.
-
-AC_DEFUN([gl_EOVERFLOW],
-[
- AC_REQUIRE([AC_PROG_CC])dnl
-
- AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
- AC_EGREP_CPP(yes,[
-#include <errno.h>
-#ifdef EOVERFLOW
-yes
-#endif
- ], have_eoverflow=1)
- if test -n "$have_eoverflow"; then
- dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
- ac_cv_decl_EOVERFLOW=yes
- else
- AC_EGREP_CPP(yes,[
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-#ifdef EOVERFLOW
-yes
-#endif
- ], have_eoverflow=1)
- if test -n "$have_eoverflow"; then
- dnl EOVERFLOW exists but is hidden.
- dnl Define it to the same value.
- AC_COMPUTE_INT([ac_cv_decl_EOVERFLOW], [EOVERFLOW], [
-#define _XOPEN_SOURCE_EXTENDED 1
-#include <errno.h>
-/* The following two lines are a workaround against an autoconf-2.52 bug. */
-#include <stdio.h>
-#include <stdlib.h>
-])
- else
- dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
- dnl don't define it as EINVAL, because snprintf() callers want to
- dnl distinguish EINVAL and EOVERFLOW.
- ac_cv_decl_EOVERFLOW=E2BIG
- fi
- fi
- ])
- if test "$ac_cv_decl_EOVERFLOW" != yes; then
- AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
- [Define as good substitute value for EOVERFLOW.])
- EOVERFLOW="$ac_cv_decl_EOVERFLOW"
- AC_SUBST(EOVERFLOW)
- fi
-])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
- AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
Added: prelude-lml/trunk/libmissing/m4/errno_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/errno_h.m4 (rev 0)
+++ prelude-lml/trunk/libmissing/m4/errno_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,113 @@
+# errno_h.m4 serial 1
+dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HEADER_ERRNO_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_HEADER_ERRNO_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_ERRNO_H_BODY],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_CACHE_CHECK([for complete errno.h], gl_cv_header_errno_h_complete, [
+ AC_EGREP_CPP(booboo,[
+#include <errno.h>
+#if !defined ENOMSG
+booboo
+#endif
+#if !defined EIDRM
+booboo
+#endif
+#if !defined ENOLINK
+booboo
+#endif
+#if !defined EPROTO
+booboo
+#endif
+#if !defined EMULTIHOP
+booboo
+#endif
+#if !defined EBADMSG
+booboo
+#endif
+#if !defined EOVERFLOW
+booboo
+#endif
+#if !defined ENOTSUP
+booboo
+#endif
+#if !defined ECANCELED
+booboo
+#endif
+ ],
+ [gl_cv_header_errno_h_complete=no],
+ [gl_cv_header_errno_h_complete=yes])
+ ])
+ if test $gl_cv_header_errno_h_complete = yes; then
+ ERRNO_H=''
+ else
+ gl_CHECK_NEXT_HEADERS([errno.h])
+ ERRNO_H='errno.h'
+ fi
+ AC_SUBST([ERRNO_H])
+ gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
+ gl_REPLACE_ERRNO_VALUE([ENOLINK])
+ gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
+])
+
+# Assuming $1 = EOVERFLOW.
+# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
+# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
+# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
+# Check for the value of EOVERFLOW.
+# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
+AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
+[
+ if test -n "$ERRNO_H"; then
+ AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
+ AC_EGREP_CPP(yes,[
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+ ],
+ [gl_cv_header_errno_h_]$1[=yes],
+ [gl_cv_header_errno_h_]$1[=no])
+ if test $gl_cv_header_errno_h_]$1[ = no; then
+ AC_EGREP_CPP(yes,[
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+ ], [gl_cv_header_errno_h_]$1[=hidden])
+ if test $gl_cv_header_errno_h_]$1[ = hidden; then
+ dnl The macro exists but is hidden.
+ dnl Define it to the same value.
+ AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+/* The following two lines are a workaround against an autoconf-2.52 bug. */
+#include <stdio.h>
+#include <stdlib.h>
+])
+ fi
+ fi
+ ])
+ case $gl_cv_header_errno_h_]$1[ in
+ yes | no)
+ ]$1[_HIDDEN=0; ]$1[_VALUE=
+ ;;
+ *)
+ ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
+ ;;
+ esac
+ AC_SUBST($1[_HIDDEN])
+ AC_SUBST($1[_VALUE])
+ fi
+])
Added: prelude-lml/trunk/libmissing/m4/fclose.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/fclose.m4 (rev 0)
+++ prelude-lml/trunk/libmissing/m4/fclose.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,18 @@
+# fclose.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FCLOSE],
+[
+])
+
+AC_DEFUN([gl_REPLACE_FCLOSE],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ if test $REPLACE_FCLOSE != 1; then
+ AC_LIBOBJ([fclose])
+ fi
+ REPLACE_FCLOSE=1
+])
Modified: prelude-lml/trunk/libmissing/m4/getaddrinfo.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/getaddrinfo.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/getaddrinfo.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -99,6 +99,11 @@
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ dnl Including sys/socket.h is wrong for Windows, but Windows does not
+ dnl have sa_len so the result is correct anyway.
+ AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])
+
AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
/* sys/types.h is not needed according to POSIX, but the
Modified: prelude-lml/trunk/libmissing/m4/gnulib-cache.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/gnulib-cache.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/gnulib-cache.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -15,11 +15,13 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libmissing --source-base=libmissing --m4-base=libmissing/m4 --doc-base=libmissing/doc --aux-dir=. --with-tests --lgpl --libtool --macro-prefix=gl --no-vc-files fnmatch-gnu getaddrinfo glob inet_ntop memset mktime pathmax sigaction sleep snprintf socklen strdup strptime strsep sys_select
+# gnulib-tool --import --dir=. --lib=libmissing --source-base=libmissing --m4-base=libmissing/m4 --doc-base=libmissing/doc --tests-base=libmissing/tests --aux-dir=. --with-tests --lgpl --libtool --macro-prefix=gl --no-vc-files bind close fnmatch-gnu getaddrinfo glob inet_ntop memset mktime pathmax recvfrom sigaction sleep snprintf socket socklen strdup strptime strsep sys_select
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
+ bind
+ close
fnmatch-gnu
getaddrinfo
glob
@@ -27,9 +29,11 @@
memset
mktime
pathmax
+ recvfrom
sigaction
sleep
snprintf
+ socket
socklen
strdup
strptime
Modified: prelude-lml/trunk/libmissing/m4/gnulib-comp.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/gnulib-comp.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/gnulib-comp.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -41,7 +41,6 @@
m4_pushdef([gl_LIBSOURCES_DIR], [])
gl_COMMON
gl_source_base='libmissing'
- gl_EOVERFLOW
changequote(,)dnl
LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
changequote([, ])dnl
@@ -49,14 +48,29 @@
gl_FUNC_ALLOCA
gl_HEADER_ARPA_INET
AC_PROG_MKDIR_P
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ AC_LIBOBJ([winsock])
+ fi
+ gl_SYS_SOCKET_MODULE_INDICATOR([bind])
+ gl_FUNC_CLOSE
+ gl_UNISTD_MODULE_INDICATOR([close])
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
gl_FUNC_DIRFD
+ gl_HEADER_ERRNO_H
+ gl_FUNC_FCLOSE
+ gl_STDIO_MODULE_INDICATOR([fclose])
gl_FLOAT_H
# No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
gl_FUNC_FNMATCH_GNU
gl_GETADDRINFO
gl_GETLOGIN_R
gl_UNISTD_MODULE_INDICATOR([getlogin_r])
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ AC_LIBOBJ([winsock])
+ fi
+ gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
gl_GLOB
@@ -72,6 +86,11 @@
AC_PROG_MKDIR_P
gl_PATHMAX
AC_REPLACE_FUNCS(raise)
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ AC_LIBOBJ([winsock])
+ fi
+ gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
gl_SIGACTION
gl_SIGNAL_MODULE_INDICATOR([sigaction])
gl_SIGNAL_H
@@ -82,6 +101,11 @@
gl_UNISTD_MODULE_INDICATOR([sleep])
gl_FUNC_SNPRINTF
gl_STDIO_MODULE_INDICATOR([snprintf])
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ AC_LIBOBJ([winsock])
+ fi
+ gl_SYS_SOCKET_MODULE_INDICATOR([socket])
gl_TYPE_SOCKLEN_T
AM_STDBOOL_H
gl_STDINT_H
@@ -100,6 +124,7 @@
gl_HEADER_SYS_SELECT
AC_PROG_MKDIR_P
gl_HEADER_SYS_SOCKET
+ gl_MODULE_INDICATOR([sys_socket])
AC_PROG_MKDIR_P
gl_HEADER_SYS_STAT_H
AC_PROG_MKDIR_P
@@ -250,9 +275,12 @@
lib/alloca.in.h
lib/arpa_inet.in.h
lib/asnprintf.c
+ lib/close.c
lib/dirfd.c
lib/dirfd.h
lib/dummy.c
+ lib/errno.in.h
+ lib/fclose.c
lib/float+.h
lib/float.in.h
lib/fnmatch.c
@@ -287,6 +315,7 @@
lib/snprintf.c
lib/stdbool.in.h
lib/stdint.in.h
+ lib/stdio-write.c
lib/stdio.in.h
lib/stdlib.in.h
lib/strcasecmp.c
@@ -308,13 +337,16 @@
lib/vasnprintf.h
lib/wchar.in.h
lib/wctype.in.h
+ lib/winsock.c
lib/xsize.h
m4/alloca.m4
m4/arpa_inet_h.m4
+ m4/close.m4
m4/d-type.m4
m4/dirfd.m4
- m4/eoverflow.m4
+ m4/errno_h.m4
m4/extensions.m4
+ m4/fclose.m4
m4/float_h.m4
m4/fnmatch.m4
m4/getaddrinfo.m4
@@ -355,6 +387,7 @@
m4/strpbrk.m4
m4/strptime.m4
m4/strsep.m4
+ m4/sys_ioctl_h.m4
m4/sys_select_h.m4
m4/sys_socket_h.m4
m4/sys_stat_h.m4
@@ -369,9 +402,9 @@
m4/wctype.m4
m4/wint_t.m4
m4/xsize.m4
- tests/test-EOVERFLOW.c
tests/test-alloca-opt.c
tests/test-arpa_inet.c
+ tests/test-errno.c
tests/test-getaddrinfo.c
tests/test-netinet_in.c
tests/test-sigaction.c
Modified: prelude-lml/trunk/libmissing/m4/inet_ntop.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/inet_ntop.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/inet_ntop.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 6
+# inet_ntop.m4 serial 7
dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,7 @@
dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
- ARPA_INET_H='arpa/inet.h'
+ gl_REPLACE_ARPA_INET_H
AC_REPLACE_FUNCS(inet_ntop)
gl_PREREQ_INET_NTOP
Modified: prelude-lml/trunk/libmissing/m4/sigaction.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/sigaction.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/sigaction.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# sigaction.m4 serial 4
+# sigaction.m4 serial 5
dnl Copyright (C) 2008 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,10 +8,16 @@
AC_DEFUN([gl_SIGACTION],
[
AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
- AC_REPLACE_FUNCS([sigaction])
- if test $ac_cv_func_sigaction = no ; then
+ AC_CHECK_FUNCS_ONCE([sigaction])
+ if test $ac_cv_func_sigaction = yes; then
+ AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , ,
+ [[#include <signal.h>]])
+ if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then
+ HAVE_STRUCT_SIGACTION_SA_SIGACTION=0
+ fi
+ else
HAVE_SIGACTION=0
- AC_SUBST([HAVE_SIGACTION])
+ AC_LIBOBJ([sigaction])
gl_PREREQ_SIGACTION
fi
])
@@ -29,7 +35,6 @@
]])
if test $ac_cv_type_siginfo_t = no; then
HAVE_SIGINFO_T=0
- AC_SUBST([HAVE_SIGINFO_T])
fi
])
@@ -37,10 +42,4 @@
AC_DEFUN([gl_PREREQ_SIG_HANDLER_H],
[
AC_REQUIRE([AC_C_INLINE])
- AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , ,
- [[#include <signal.h>]])
- if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then
- HAVE_STRUCT_SIGACTION_SA_SIGACTION=0
- AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
- fi
])
Modified: prelude-lml/trunk/libmissing/m4/signal_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/signal_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/signal_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 5
+# signal_h.m4 serial 6
dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,7 @@
AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
[
+ GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
dnl Assume proper GNU behavior unless another module says otherwise.
Modified: prelude-lml/trunk/libmissing/m4/sleep.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/sleep.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/sleep.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,5 +1,5 @@
-# sleep.m4 serial 1
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# sleep.m4 serial 2
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,13 @@
AC_DEFUN([gl_FUNC_SLEEP],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([sleep])
- if test $ac_cv_func_sleep = no; then
+ dnl We expect to see the declaration of sleep() in a header file.
+ dnl Older versions of mingw have a sleep() function that is an alias to
+ dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep():
+ dnl it takes the number of milliseconds as argument and returns void.
+ dnl mingw does not declare this function.
+ AC_CHECK_DECLS([sleep], , , [#include <unistd.h>])
+ if test $ac_cv_have_decl_sleep != yes; then
HAVE_SLEEP=0
AC_LIBOBJ([sleep])
gl_PREREQ_SLEEP
Modified: prelude-lml/trunk/libmissing/m4/stdio_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/stdio_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/stdio_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 11
+# stdio_h.m4 serial 14
dnl Copyright (C) 2007-2008 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,6 +8,28 @@
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([stdio.h])
+ dnl No need to create extra modules for these functions. Everyone who uses
+ dnl <stdio.h> likely needs them.
+ GNULIB_FPRINTF=1
+ GNULIB_PRINTF=1
+ GNULIB_VFPRINTF=1
+ GNULIB_VPRINTF=1
+ GNULIB_FPUTC=1
+ GNULIB_PUTC=1
+ GNULIB_PUTCHAR=1
+ GNULIB_FPUTS=1
+ GNULIB_PUTS=1
+ GNULIB_FWRITE=1
+ dnl This ifdef is just an optimization, to avoid performing a configure
+ dnl check whose result is not used. It does not make the test of
+ dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+ m4_ifdef([gl_SIGNAL_SIGPIPE], [
+ gl_SIGNAL_SIGPIPE
+ if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+ REPLACE_STDIO_WRITE_FUNCS=1
+ AC_LIBOBJ([stdio-write])
+ fi
+ ])
])
AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -19,53 +41,69 @@
AC_DEFUN([gl_STDIO_H_DEFAULTS],
[
- GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
- GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
- GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
- GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
- GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
- GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
- GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
- GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
- GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
- GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
- GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
- GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
- GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
- GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
- GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
- GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
- GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
- GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
- GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
- GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
+ GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
+ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
+ GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
+ GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
+ GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
+ GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
+ GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
+ GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
+ GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
+ GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
+ GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
+ GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
+ GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
+ GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
+ GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
+ GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
+ GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
+ GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
+ GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
+ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
+ GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
+ GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
+ GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
+ GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
+ GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
+ GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
+ GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
+ GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
+ GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
+ GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
+ GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
+ GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
+ GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
dnl Assume proper GNU behavior unless another module says otherwise.
- REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
- REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
- REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
- REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
- REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
- HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
- REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
- HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
- REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
- REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
- HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
- REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
- REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
- REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
- HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
- REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
- REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
- HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
- REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
- REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
- REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
- HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
- HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
- REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
- HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
- REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
+ REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
+ REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
+ REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
+ REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
+ REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
+ REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
+ HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
+ REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
+ HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
+ REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
+ REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
+ HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
+ REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
+ HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
+ REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
+ REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
+ REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
+ HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
+ REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
+ REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
+ HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
+ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
+ REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
+ REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
+ REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
+ HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
+ HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
+ REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
+ REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
])
dnl Code shared by fseeko and ftello. Determine if large files are supported,
Modified: prelude-lml/trunk/libmissing/m4/strdup.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/strdup.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/strdup.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,7 +1,6 @@
-# strdup.m4 serial 9
+# strdup.m4 serial 10
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
-dnl Foundation, Inc.
+dnl Copyright (C) 2002-2008 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,5 +17,22 @@
gl_PREREQ_STRDUP
])
+AC_DEFUN([gl_FUNC_STRDUP_POSIX],
+[
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+ if test $gl_cv_func_malloc_posix != yes; then
+ REPLACE_STRDUP=1
+ AC_LIBOBJ([strdup])
+ else
+ AC_REPLACE_FUNCS(strdup)
+ fi
+ AC_CHECK_DECLS_ONCE(strdup)
+ if test $ac_cv_have_decl_strdup = no; then
+ HAVE_DECL_STRDUP=0
+ fi
+ gl_PREREQ_STRDUP
+])
+
# Prerequisites of lib/strdup.c.
AC_DEFUN([gl_PREREQ_STRDUP], [:])
Modified: prelude-lml/trunk/libmissing/m4/string_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/string_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/string_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
+# serial 6
# Written by Paul Eggert.
@@ -83,9 +83,10 @@
HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
+ REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
+ REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
+ REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
+ REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
- REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
- REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
- REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
])
Added: prelude-lml/trunk/libmissing/m4/sys_ioctl_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/sys_ioctl_h.m4 (rev 0)
+++ prelude-lml/trunk/libmissing/m4/sys_ioctl_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,60 @@
+# sys_ioctl_h.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Bruno Haible.
+
+AC_DEFUN([gl_SYS_IOCTL_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+
+ AC_CHECK_HEADERS_ONCE([sys/ioctl.h])
+ if test $ac_cv_header_sys_ioctl_h = yes; then
+ HAVE_SYS_IOCTL_H=1
+ dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other
+ dnl header file, such as <unistd.h> or <stropts.h>, is needed for that.
+ AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl],
+ [gl_cv_decl_ioctl_in_sys_ioctl_h],
+ [AC_CHECK_DECL([ioctl],
+ [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
+ [gl_cv_decl_ioctl_in_sys_ioctl_h=no],
+ [#include <sys/ioctl.h>])
+ ])
+ if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then
+ SYS_IOCTL_H='sys/ioctl.h'
+ fi
+ else
+ HAVE_SYS_IOCTL_H=0
+ SYS_IOCTL_H='sys/ioctl.h'
+ fi
+ AC_SUBST([HAVE_SYS_IOCTL_H])
+ dnl Execute this unconditionally, because SYS_IOCTL_H may be set by other
+ dnl modules, after this code is executed.
+ gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
+])
+
+dnl Unconditionally enables the replacement of <sys/ioctl.h>.
+AC_DEFUN([gl_REPLACE_SYS_IOCTL_H],
+[
+ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+ SYS_IOCTL_H='sys/ioctl.h'
+])
+
+AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
+[
+ GNULIB_IOCTL=0; AC_SUBST([GNULIB_IOCTL])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
+ SYS_IOCTL_H=''; AC_SUBST([SYS_IOCTL_H])
+])
Modified: prelude-lml/trunk/libmissing/m4/sys_select_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/sys_select_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/sys_select_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 4
+# sys_select_h.m4 serial 6
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,13 @@
AC_DEFUN([gl_HEADER_SYS_SELECT],
[
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
[gl_cv_header_sys_select_h_selfcontained],
[
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], [[]])],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
+ [[struct timeval b;]])],
[gl_cv_header_sys_select_h_selfcontained=yes],
[gl_cv_header_sys_select_h_selfcontained=no])
])
@@ -24,6 +27,19 @@
HAVE_SYS_SELECT_H=0
fi
AC_SUBST([HAVE_SYS_SELECT_H])
+ gl_PREREQ_SYS_H_WINSOCK2
fi
AC_SUBST([SYS_SELECT_H])
])
+
+AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
+[
+ GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT])
+])
Modified: prelude-lml/trunk/libmissing/m4/sys_socket_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/sys_socket_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/sys_socket_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 6
+# sys_socket_h.m4 serial 11
dnl Copyright (C) 2005-2008 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,6 +8,7 @@
AC_DEFUN([gl_HEADER_SYS_SOCKET],
[
+ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
AC_REQUIRE([AC_C_INLINE])
AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
@@ -44,7 +45,6 @@
gl_CHECK_NEXT_HEADERS([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
HAVE_SYS_SOCKET_H=1
- HAVE_WINSOCK2_H=0
HAVE_WS2TCPIP_H=0
else
HAVE_SYS_SOCKET_H=0
@@ -52,21 +52,68 @@
dnl the check for those headers unconditional; yet cygwin reports
dnl that the headers are present but cannot be compiled (since on
dnl cygwin, all socket information should come from sys/socket.h).
- AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
- if test $ac_cv_header_winsock2_h = yes; then
- HAVE_WINSOCK2_H=1
- else
- HAVE_WINSOCK2_H=0
- fi
+ AC_CHECK_HEADERS([ws2tcpip.h])
if test $ac_cv_header_ws2tcpip_h = yes; then
HAVE_WS2TCPIP_H=1
else
HAVE_WS2TCPIP_H=0
fi
fi
+ gl_PREREQ_SYS_H_WINSOCK2
AC_SUBST([HAVE_SYS_SOCKET_H])
- AC_SUBST([HAVE_WINSOCK2_H])
AC_SUBST([HAVE_WS2TCPIP_H])
fi
AC_SUBST([SYS_SOCKET_H])
])
+
+# Common prerequisites of of the <sys/socket.h> replacement and of the
+# <sys/select.h> replacement.
+# Sets and substitutes HAVE_WINSOCK2_H.
+AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+ AC_CHECK_HEADERS_ONCE([sys/socket.h])
+ if test $ac_cv_header_sys_socket_h != yes; then
+ dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+ dnl the check for those headers unconditional; yet cygwin reports
+ dnl that the headers are present but cannot be compiled (since on
+ dnl cygwin, all socket information should come from sys/socket.h).
+ AC_CHECK_HEADERS([winsock2.h])
+ fi
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ HAVE_WINSOCK2_H=1
+ UNISTD_H_HAVE_WINSOCK2_H=1
+ SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+ else
+ HAVE_WINSOCK2_H=0
+ fi
+ AC_SUBST([HAVE_WINSOCK2_H])
+])
+
+AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+ gl_MODULE_INDICATOR([$1])
+])
+
+AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for GNULIB_CLOSE
+ GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET])
+ GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT])
+ GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT])
+ GNULIB_BIND=0; AC_SUBST([GNULIB_BIND])
+ GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
+ GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
+ GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT])
+ GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN])
+ GNULIB_RECV=0; AC_SUBST([GNULIB_RECV])
+ GNULIB_SEND=0; AC_SUBST([GNULIB_SEND])
+ GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM])
+ GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
+ GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
+ GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
+])
Modified: prelude-lml/trunk/libmissing/m4/unistd_h.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/unistd_h.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/unistd_h.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 11
+# unistd_h.m4 serial 14
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -32,21 +32,28 @@
AC_DEFUN([gl_UNISTD_H_DEFAULTS],
[
- GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
- GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
- GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
- GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
- GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
- GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
- GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
- GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
- GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
- GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
- GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
- GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
+ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
+ GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
+ GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
+ GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
+ GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
+ GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
+ GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
+ GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
+ GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
+ GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
+ GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
+ GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
+ GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
+ GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
+ GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
+ GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
+ GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
+ HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
+ HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
@@ -55,9 +62,12 @@
HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
+ REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
+ REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
+ UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
])
Modified: prelude-lml/trunk/libmissing/m4/wchar.m4
===================================================================
--- prelude-lml/trunk/libmissing/m4/wchar.m4 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/m4/wchar.m4 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,13 +1,13 @@
dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar.m4 serial 4
+# wchar.m4 serial 6
AC_DEFUN([gl_WCHAR_H],
[
@@ -18,7 +18,16 @@
wchar_t w;]],
[gl_cv_header_wchar_h_standalone=yes],
[gl_cv_header_wchar_h_standalone=no])])
- if test $gl_cv_header_wchar_h_standalone != yes; then
+
+ AC_REQUIRE([gt_TYPE_WINT_T])
+ if test $gt_cv_c_wint_t = yes; then
+ HAVE_WINT_T=1
+ else
+ HAVE_WINT_T=0
+ fi
+ AC_SUBST([HAVE_WINT_T])
+
+ if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
WCHAR_H=wchar.h
fi
@@ -36,6 +45,13 @@
gl_CHECK_NEXT_HEADERS([wchar.h])
])
+dnl Unconditionally enables the replacement of <wchar.h>.
+AC_DEFUN([gl_REPLACE_WCHAR_H],
+[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ WCHAR_H=wchar.h
+])
+
AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -49,6 +65,5 @@
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
- WCHAR_H=
- AC_SUBST([WCHAR_H])
+ WCHAR_H=''; AC_SUBST([WCHAR_H])
])
Modified: prelude-lml/trunk/libmissing/signal.in.h
===================================================================
--- prelude-lml/trunk/libmissing/signal.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/signal.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -44,6 +44,17 @@
#endif
+#if @GNULIB_SIGNAL_H_SIGPIPE@
+# ifndef SIGPIPE
+/* Define SIGPIPE to a value that does not overlap with other signals. */
+# define SIGPIPE 13
+# define GNULIB_defined_SIGPIPE 1
+/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
+ 'write', 'stdio'. */
+# endif
+#endif
+
+
#if !@HAVE_POSIX_SIGNALBLOCKING@
/* Maximum signal number + 1. */
@@ -92,8 +103,18 @@
handler. */
extern void (*signal (int sig, void (*func) (int))) (int);
+# if GNULIB_defined_SIGPIPE
+
+/* Raise signal SIG. */
+# undef raise
+# define raise rpl_raise
+extern int raise (int sig);
+
+# endif
+
#endif /* !@HAVE_POSIX_SIGNALBLOCKING@ */
+
#if !@HAVE_SIGACTION@
# if !@HAVE_SIGINFO_T@
Modified: prelude-lml/trunk/libmissing/sigprocmask.c
===================================================================
--- prelude-lml/trunk/libmissing/sigprocmask.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/sigprocmask.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -45,6 +45,31 @@
typedef void (*handler_t) (int);
+/* Handling of gnulib defined signals. */
+
+#if GNULIB_defined_SIGPIPE
+static handler_t SIGPIPE_handler = SIG_DFL;
+#endif
+
+#if GNULIB_defined_SIGPIPE
+static handler_t
+ext_signal (int sig, handler_t handler)
+{
+ switch (sig)
+ {
+ case SIGPIPE:
+ {
+ handler_t old_handler = SIGPIPE_handler;
+ SIGPIPE_handler = handler;
+ return old_handler;
+ }
+ default: /* System defined signal */
+ return signal (sig, handler);
+ }
+}
+# define signal ext_signal
+#endif
+
int
sigismember (const sigset_t *set, int sig)
{
@@ -240,3 +265,29 @@
return SIG_ERR;
}
}
+
+#if GNULIB_defined_SIGPIPE
+/* Raise the signal SIG. */
+int
+rpl_raise (int sig)
+# undef raise
+{
+ switch (sig)
+ {
+ case SIGPIPE:
+ if (blocked_set & (1U << sig))
+ pending_array[sig] = 1;
+ else
+ {
+ handler_t handler = SIGPIPE_handler;
+ if (handler == SIG_DFL)
+ exit (128 + SIGPIPE);
+ else if (handler != SIG_IGN)
+ (*handler) (sig);
+ }
+ return 0;
+ default: /* System defined signal */
+ return raise (sig);
+ }
+}
+#endif
Added: prelude-lml/trunk/libmissing/stdio-write.c
===================================================================
--- prelude-lml/trunk/libmissing/stdio-write.c (rev 0)
+++ prelude-lml/trunk/libmissing/stdio-write.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,148 @@
+/* POSIX compatible FILE stream write function.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Written by Bruno Haible <[email protected]>, 2008.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+/* Replace these functions only if module 'sigpipe' is requested. */
+#if GNULIB_SIGPIPE
+
+/* On native Windows platforms, SIGPIPE does not exist. When write() is
+ called on a pipe with no readers, WriteFile() fails with error
+ GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
+ error EINVAL. This write() function is at the basis of the function
+ which flushes the buffer of a FILE stream. */
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+# include <errno.h>
+# include <signal.h>
+# include <io.h>
+
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+
+# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
+ if (ferror (stream)) \
+ return (EXPRESSION); \
+ else \
+ { \
+ RETTYPE ret; \
+ SetLastError (0); \
+ ret = (EXPRESSION); \
+ if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \
+ { \
+ int fd = fileno (stream); \
+ if (fd >= 0 \
+ && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
+ { \
+ /* Try to raise signal SIGPIPE. */ \
+ raise (SIGPIPE); \
+ /* If it is currently blocked or ignored, change errno from \
+ EINVAL to EPIPE. */ \
+ errno = EPIPE; \
+ } \
+ } \
+ return ret; \
+ }
+
+# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
+int
+printf (const char *format, ...)
+{
+ int retval;
+ va_list args;
+
+ va_start (args, format);
+ retval = vfprintf (stdout, format, args);
+ va_end (args);
+
+ return retval;
+}
+# endif
+
+# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
+int
+fprintf (FILE *stream, const char *format, ...)
+{
+ int retval;
+ va_list args;
+
+ va_start (args, format);
+ retval = vfprintf (stream, format, args);
+ va_end (args);
+
+ return retval;
+}
+# endif
+
+# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */
+int
+vprintf (const char *format, va_list args)
+{
+ return vfprintf (stdout, format, args);
+}
+# endif
+
+# if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */
+int
+vfprintf (FILE *stream, const char *format, va_list args)
+#undef vfprintf
+{
+ CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
+}
+# endif
+
+int
+putchar (int c)
+{
+ return fputc (c, stdout);
+}
+
+int
+fputc (int c, FILE *stream)
+#undef fputc
+{
+ CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
+}
+
+int
+fputs (const char *string, FILE *stream)
+#undef fputs
+{
+ CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
+}
+
+int
+puts (const char *string)
+#undef puts
+{
+ FILE *stream = stdout;
+ CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
+}
+
+size_t
+fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+#undef fwrite
+{
+ CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
+}
+
+# endif
+#endif
Modified: prelude-lml/trunk/libmissing/stdio.in.h
===================================================================
--- prelude-lml/trunk/libmissing/stdio.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/stdio.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -73,6 +73,10 @@
extern int fprintf (FILE *fp, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
# endif
+#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
#elif defined GNULIB_POSIXCHECK
# undef fprintf
# define fprintf \
@@ -88,6 +92,10 @@
extern int vfprintf (FILE *fp, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 2, 0)));
# endif
+#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#elif defined GNULIB_POSIXCHECK
# undef vfprintf
# define vfprintf(s,f,a) \
@@ -104,6 +112,11 @@
extern int printf (const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
# endif
+#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+/* Don't break __attribute__((format(printf,M,N))). */
+# define printf __printf__
+extern int printf (const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
#elif defined GNULIB_POSIXCHECK
# undef printf
# define printf \
@@ -126,6 +139,10 @@
extern int vprintf (const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 1, 0)));
# endif
+#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+ __attribute__ ((__format__ (__printf__, 1, 0)));
#elif defined GNULIB_POSIXCHECK
# undef vprintf
# define vprintf(f,a) \
@@ -236,6 +253,7 @@
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
+# undef fopen
# define fopen rpl_fopen
extern FILE * fopen (const char *filename, const char *mode);
# endif
@@ -249,6 +267,7 @@
#if @GNULIB_FREOPEN@
# if @REPLACE_FREOPEN@
+# undef freopen
# define freopen rpl_freopen
extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
# endif
@@ -354,6 +373,57 @@
fflush (f))
#endif
+#if @GNULIB_FCLOSE@
+# if @REPLACE_FCLOSE@
+# define fclose rpl_fclose
+ /* Close STREAM and its underlying file descriptor. */
+extern int fclose (FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fclose
+# define fclose(f) \
+ (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
+ "use gnulib module fclose for portable " \
+ "POSIX compliance"), \
+ fclose (f))
+#endif
+
+#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputc
+# define fputc rpl_fputc
+extern int fputc (int c, FILE *stream);
+#endif
+
+#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putc
+# define putc rpl_fputc
+extern int putc (int c, FILE *stream);
+#endif
+
+#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putchar
+# define putchar rpl_putchar
+extern int putchar (int c);
+#endif
+
+#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputs
+# define fputs rpl_fputs
+extern int fputs (const char *string, FILE *stream);
+#endif
+
+#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef puts
+# define puts rpl_puts
+extern int puts (const char *string);
+#endif
+
+#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fwrite
+# define fwrite rpl_fwrite
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+#endif
+
#if @GNULIB_GETDELIM@
# if !@HAVE_DECL_GETDELIM@
/* Read input, up to (and including) the next occurrence of DELIMITER, from
@@ -395,6 +465,22 @@
getline (l, s, f))
#endif
+#if @GNULIB_PERROR@
+# if @REPLACE_PERROR@
+# define perror rpl_perror
+/* Print a message to standard error, describing the value of ERRNO,
+ (if STRING is not NULL and not empty) prefixed with STRING and ": ",
+ and terminated with a newline. */
+extern void perror (const char *string);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef perror
+# define perror(s) \
+ (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
+ "use gnulib module perror for portability"), \
+ perror (s))
+#endif
+
#ifdef __cplusplus
}
#endif
Modified: prelude-lml/trunk/libmissing/string.in.h
===================================================================
--- prelude-lml/trunk/libmissing/string.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/string.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -167,7 +167,11 @@
/* Duplicate S, returning an identical malloc'd string. */
#if @GNULIB_STRDUP@
-# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
+# if @REPLACE_STRDUP@
+# undef strdup
+# define strdup rpl_strdup
+# endif
+# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
extern char *strdup (char const *__s);
# endif
#elif defined GNULIB_POSIXCHECK
Modified: prelude-lml/trunk/libmissing/sys_select.in.h
===================================================================
--- prelude-lml/trunk/libmissing/sys_select.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/sys_select.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -25,6 +25,10 @@
<sys/types.h>. */
# include <sys/types.h>
+/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+ of 'struct timeval', and no definition of this type.. */
+# include <sys/time.h>
+
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
@@ -39,6 +43,33 @@
# include <sys/socket.h>
+/* The definition of GL_LINK_WARNING is copied here. */
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if @GNULIB_SELECT@
+# if @HAVE_WINSOCK2_H@
+# undef select
+# define select rpl_select
+extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef select
+# define select select_used_without_requesting_gnulib_module_select
+# elif defined GNULIB_POSIXCHECK
+# undef select
+# define select(n,r,w,e,t) \
+ (GL_LINK_WARNING ("select is not always POSIX compliant - " \
+ "use gnulib module select for portability"), \
+ select (n, r, w, e, t))
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
#endif
#endif /* _GL_SYS_SELECT_H */
Modified: prelude-lml/trunk/libmissing/sys_socket.in.h
===================================================================
--- prelude-lml/trunk/libmissing/sys_socket.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/sys_socket.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -58,6 +58,10 @@
#else
+# ifdef __CYGWIN__
+# error "Cygwin does have a sys/socket.h, doesn't it?!?"
+# endif
+
/* A platform that lacks <sys/socket.h>.
Currently only MinGW is supported. See the gnulib manual regarding
@@ -94,26 +98,304 @@
# define SHUT_RDWR SD_BOTH
# endif
-# if defined _WIN32 || defined __WIN32__
-# define ENOTSOCK WSAENOTSOCK
-# define EADDRINUSE WSAEADDRINUSE
-# define ENETRESET WSAENETRESET
-# define ECONNABORTED WSAECONNABORTED
-# define ECONNRESET WSAECONNRESET
-# define ENOTCONN WSAENOTCONN
-# define ESHUTDOWN WSAESHUTDOWN
+/* The definition of GL_LINK_WARNING is copied here. */
+
+# if @HAVE_WINSOCK2_H@
+/* Include headers needed by the emulation code. */
+# include <sys/types.h>
+# include <io.h>
+
+typedef int socklen_t;
+
# endif
-# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-# define setsockopt(a,b,c,d,e) rpl_setsockopt(a,b,c,d,e)
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if @HAVE_WINSOCK2_H@
+
+/* Re-define FD_ISSET to avoid a WSA call while we are not using
+ network sockets. */
static inline int
-rpl_setsockopt(int socket, int level, int optname, const void *optval,
- socklen_t optlen)
+rpl_fd_isset (int fd, fd_set * set)
{
- return (setsockopt)(socket, level, optname, optval, optlen);
+ int i;
+ if (set == NULL)
+ return 0;
+
+ for (i = 0; i < set->fd_count; i++)
+ if (set->fd_array[i] == fd)
+ return 1;
+
+ return 0;
}
+
+# undef FD_ISSET
+# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
+
# endif
+/* Wrap everything else to use libc file descriptors for sockets. */
+
+# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
+# undef close
+# define close close_used_without_including_unistd_h
+# endif
+
+# if @GNULIB_SOCKET@
+# if @HAVE_WINSOCK2_H@
+# undef socket
+# define socket rpl_socket
+extern int rpl_socket (int, int, int protocol);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef socket
+# define socket socket_used_without_requesting_gnulib_module_socket
+# elif defined GNULIB_POSIXCHECK
+# undef socket
+# define socket(d,t,p) \
+ (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
+ "use gnulib module socket for portability"), \
+ socket (d, t, p))
+# endif
+
+# if @GNULIB_CONNECT@
+# if @HAVE_WINSOCK2_H@
+# undef connect
+# define connect rpl_connect
+extern int rpl_connect (int, struct sockaddr *, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef connect
+# define connect socket_used_without_requesting_gnulib_module_connect
+# elif defined GNULIB_POSIXCHECK
+# undef connect
+# define connect(s,a,l) \
+ (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
+ "use gnulib module connect for portability"), \
+ connect (s, a, l))
+# endif
+
+# if @GNULIB_ACCEPT@
+# if @HAVE_WINSOCK2_H@
+# undef accept
+# define accept rpl_accept
+extern int rpl_accept (int, struct sockaddr *, int *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef accept
+# define accept accept_used_without_requesting_gnulib_module_accept
+# elif defined GNULIB_POSIXCHECK
+# undef accept
+# define accept(s,a,l) \
+ (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
+ "use gnulib module accept for portability"), \
+ accept (s, a, l))
+# endif
+
+# if @GNULIB_BIND@
+# if @HAVE_WINSOCK2_H@
+# undef bind
+# define bind rpl_bind
+extern int rpl_bind (int, struct sockaddr *, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef bind
+# define bind bind_used_without_requesting_gnulib_module_bind
+# elif defined GNULIB_POSIXCHECK
+# undef bind
+# define bind(s,a,l) \
+ (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
+ "use gnulib module bind for portability"), \
+ bind (s, a, l))
+# endif
+
+# if @GNULIB_GETPEERNAME@
+# if @HAVE_WINSOCK2_H@
+# undef getpeername
+# define getpeername rpl_getpeername
+extern int rpl_getpeername (int, struct sockaddr *, int *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef getpeername
+# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
+# elif defined GNULIB_POSIXCHECK
+# undef getpeername
+# define getpeername(s,a,l) \
+ (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
+ "use gnulib module getpeername for portability"), \
+ getpeername (s, a, l))
+# endif
+
+# if @GNULIB_GETSOCKNAME@
+# if @HAVE_WINSOCK2_H@
+# undef getsockname
+# define getsockname rpl_getsockname
+extern int rpl_getsockname (int, struct sockaddr *, int *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef getsockname
+# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
+# elif defined GNULIB_POSIXCHECK
+# undef getsockname
+# define getsockname(s,a,l) \
+ (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
+ "use gnulib module getsockname for portability"), \
+ getsockname (s, a, l))
+# endif
+
+# if @GNULIB_GETSOCKOPT@
+# if @HAVE_WINSOCK2_H@
+# undef getsockopt
+# define getsockopt rpl_getsockopt
+extern int rpl_getsockopt (int, int, int, void *, int *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef getsockopt
+# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
+# elif defined GNULIB_POSIXCHECK
+# undef getsockopt
+# define getsockopt(s,lvl,o,v,l) \
+ (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
+ "use gnulib module getsockopt for portability"), \
+ getsockopt (s, lvl, o, v, l))
+# endif
+
+# if @GNULIB_LISTEN@
+# if @HAVE_WINSOCK2_H@
+# undef listen
+# define listen rpl_listen
+extern int rpl_listen (int, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef listen
+# define listen listen_used_without_requesting_gnulib_module_listen
+# elif defined GNULIB_POSIXCHECK
+# undef listen
+# define listen(s,b) \
+ (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
+ "use gnulib module listen for portability"), \
+ listen (s, b))
+# endif
+
+# if @GNULIB_RECV@
+# if @HAVE_WINSOCK2_H@
+# undef recv
+# define recv rpl_recv
+extern int rpl_recv (int, void *, int, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef recv
+# define recv recv_used_without_requesting_gnulib_module_recv
+# elif defined GNULIB_POSIXCHECK
+# undef recv
+# define recv(s,b,n,f) \
+ (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
+ "use gnulib module recv for portability"), \
+ recv (s, b, n, f))
+# endif
+
+# if @GNULIB_SEND@
+# if @HAVE_WINSOCK2_H@
+# undef send
+# define send rpl_send
+extern int rpl_send (int, const void *, int, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef send
+# define send send_used_without_requesting_gnulib_module_send
+# elif defined GNULIB_POSIXCHECK
+# undef send
+# define send(s,b,n,f) \
+ (GL_LINK_WARNING ("send is not always POSIX compliant - " \
+ "use gnulib module send for portability"), \
+ send (s, b, n, f))
+# endif
+
+# if @GNULIB_RECVFROM@
+# if @HAVE_WINSOCK2_H@
+# undef recvfrom
+# define recvfrom rpl_recvfrom
+extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef recvfrom
+# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
+# elif defined GNULIB_POSIXCHECK
+# undef recvfrom
+# define recvfrom(s,b,n,f,a,l) \
+ (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
+ "use gnulib module recvfrom for portability"), \
+ recvfrom (s, b, n, f, a, l))
+# endif
+
+# if @GNULIB_SENDTO@
+# if @HAVE_WINSOCK2_H@
+# undef sendto
+# define sendto rpl_sendto
+extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef sendto
+# define sendto sendto_used_without_requesting_gnulib_module_sendto
+# elif defined GNULIB_POSIXCHECK
+# undef sendto
+# define sendto(s,b,n,f,a,l) \
+ (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
+ "use gnulib module sendto for portability"), \
+ sendto (s, b, n, f, a, l))
+# endif
+
+# if @GNULIB_SETSOCKOPT@
+# if @HAVE_WINSOCK2_H@
+# undef setsockopt
+# define setsockopt rpl_setsockopt
+extern int rpl_setsockopt (int, int, int, const void *, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef setsockopt
+# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
+# elif defined GNULIB_POSIXCHECK
+# undef setsockopt
+# define setsockopt(s,lvl,o,v,l) \
+ (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
+ "use gnulib module setsockopt for portability"), \
+ setsockopt (s, lvl, o, v, l))
+# endif
+
+# if @GNULIB_SHUTDOWN@
+# if @HAVE_WINSOCK2_H@
+# undef shutdown
+# define shutdown rpl_shutdown
+extern int rpl_shutdown (int, int);
+# endif
+# elif @HAVE_WINSOCK2_H@
+# undef shutdown
+# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
+# elif defined GNULIB_POSIXCHECK
+# undef shutdown
+# define shutdown(s,h) \
+ (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
+ "use gnulib module shutdown for portability"), \
+ shutdown (s, h))
+# endif
+
+# if @HAVE_WINSOCK2_H@
+# undef select
+# define select select_used_without_including_sys_select_h
+# endif
+
+# if @GNULIB_CLOSE@ && @HAVE_WINSOCK2_H@
+/* gnulib internal function. */
+# define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1
+extern int _gl_close_fd_maybe_socket (int fd);
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
Modified: prelude-lml/trunk/libmissing/tests/Makefile.am
===================================================================
--- prelude-lml/trunk/libmissing/tests/Makefile.am 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/Makefile.am 2008-10-17 09:38:49 UTC (rev 11070)
@@ -42,14 +42,6 @@
EXTRA_libtests_a_SOURCES =
AM_LIBTOOLFLAGS = --preserve-dup-deps
-## begin gnulib module EOVERFLOW-tests
-
-TESTS += test-EOVERFLOW
-check_PROGRAMS += test-EOVERFLOW
-EXTRA_DIST += test-EOVERFLOW.c
-
-## end gnulib module EOVERFLOW-tests
-
## begin gnulib module alloca-opt-tests
TESTS += test-alloca-opt
@@ -68,6 +60,15 @@
## end gnulib module arpa_inet-tests
+## begin gnulib module errno-tests
+
+TESTS += test-errno
+check_PROGRAMS += test-errno
+
+EXTRA_DIST += test-errno.c
+
+## end gnulib module errno-tests
+
## begin gnulib module getaddrinfo-tests
TESTS += test-getaddrinfo
Deleted: prelude-lml/trunk/libmissing/tests/test-EOVERFLOW.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-EOVERFLOW.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/test-EOVERFLOW.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,32 +0,0 @@
-/* Test of EOVERFLOW macro.
- Copyright (C) 2008 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <errno.h>
-
-/* Check that it can be used as an initializer outside of a function. */
-static int err = EOVERFLOW;
-
-int
-main ()
-{
- /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */
- if (err == EINVAL)
- return 1;
-
- return 0;
-}
Added: prelude-lml/trunk/libmissing/tests/test-errno.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-errno.c (rev 0)
+++ prelude-lml/trunk/libmissing/tests/test-errno.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,117 @@
+/* Test of <errno.h> substitute.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This 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 <[email protected]>, 2008. */
+
+#include <config.h>
+
+#include <errno.h>
+
+/* Verify that the POSIX mandated errno values exist and can be used as
+ initializers outside of a function.
+ The variable names happen to match the Linux/x86 error numbers. */
+int e1 = EPERM;
+int e2 = ENOENT;
+int e3 = ESRCH;
+int e4 = EINTR;
+int e5 = EIO;
+int e6 = ENXIO;
+int e7 = E2BIG;
+int e8 = ENOEXEC;
+int e9 = EBADF;
+int e10 = ECHILD;
+int e11 = EAGAIN;
+int e11a = EWOULDBLOCK;
+int e12 = ENOMEM;
+int e13 = EACCES;
+int e14 = EFAULT;
+int e16 = EBUSY;
+int e17 = EEXIST;
+int e18 = EXDEV;
+int e19 = ENODEV;
+int e20 = ENOTDIR;
+int e21 = EISDIR;
+int e22 = EINVAL;
+int e23 = ENFILE;
+int e24 = EMFILE;
+int e25 = ENOTTY;
+int e26 = ETXTBSY;
+int e27 = EFBIG;
+int e28 = ENOSPC;
+int e29 = ESPIPE;
+int e30 = EROFS;
+int e31 = EMLINK;
+int e32 = EPIPE;
+int e33 = EDOM;
+int e34 = ERANGE;
+int e35 = EDEADLK;
+int e36 = ENAMETOOLONG;
+int e37 = ENOLCK;
+int e38 = ENOSYS;
+int e39 = ENOTEMPTY;
+int e40 = ELOOP;
+int e42 = ENOMSG;
+int e43 = EIDRM;
+int e67 = ENOLINK;
+int e71 = EPROTO;
+int e72 = EMULTIHOP;
+int e74 = EBADMSG;
+int e75 = EOVERFLOW;
+int e84 = EILSEQ;
+int e88 = ENOTSOCK;
+int e89 = EDESTADDRREQ;
+int e90 = EMSGSIZE;
+int e91 = EPROTOTYPE;
+int e92 = ENOPROTOOPT;
+int e93 = EPROTONOSUPPORT;
+int e95 = EOPNOTSUPP;
+int e95a = ENOTSUP;
+int e97 = EAFNOSUPPORT;
+int e98 = EADDRINUSE;
+int e99 = EADDRNOTAVAIL;
+int e100 = ENETDOWN;
+int e101 = ENETUNREACH;
+int e102 = ENETRESET;
+int e103 = ECONNABORTED;
+int e104 = ECONNRESET;
+int e105 = ENOBUFS;
+int e106 = EISCONN;
+int e107 = ENOTCONN;
+int e110 = ETIMEDOUT;
+int e111 = ECONNREFUSED;
+int e113 = EHOSTUNREACH;
+int e114 = EALREADY;
+int e115 = EINPROGRESS;
+int e116 = ESTALE;
+int e122 = EDQUOT;
+int e125 = ECANCELED;
+
+/* Don't verify that these errno values are all different, except for possibly
+ EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has
+ ENOTSUP == EOPNOTSUPP. */
+
+int
+main ()
+{
+ /* Verify that errno can be assigned. */
+ errno = EOVERFLOW;
+
+ /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */
+ if (errno == EINVAL)
+ return 1;
+
+ return 0;
+}
Modified: prelude-lml/trunk/libmissing/tests/test-sigaction.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-sigaction.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/test-sigaction.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -76,7 +76,12 @@
ASSERT (sa.sa_handler == handler);
break;
case 1:
+ /* This assertion fails on glibc-2.3.6 systems with LinuxThreads,
+ when this program is linked with -lpthread, due to the sigaction()
+ override in libpthread.so. */
+#if !defined __GLIBC__
ASSERT (sa.sa_handler == SIG_DFL);
+#endif
break;
default:
ASSERT (0);
@@ -89,24 +94,31 @@
struct sigaction sa;
struct sigaction old_sa;
sa.sa_handler = handler;
+
sa.sa_flags = 0;
ASSERT (sigemptyset (&sa.sa_mask) == 0);
ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
ASSERT (raise (SIGABRT) == 0);
+
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0);
ASSERT (old_sa.sa_handler == handler);
ASSERT (raise (SIGABRT) == 0);
+
sa.sa_handler = SIG_DFL;
ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0);
+#if !defined __GLIBC__ /* see above */
ASSERT (old_sa.sa_handler == SIG_DFL);
+#endif
+
sa.sa_handler = SIG_IGN;
ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
ASSERT (raise (SIGABRT) == 0);
ASSERT (sigaction (SIGABRT, NULL, &old_sa) == 0);
ASSERT (old_sa.sa_handler == SIG_IGN);
ASSERT (raise (SIGABRT) == 0);
+
return 0;
}
Modified: prelude-lml/trunk/libmissing/tests/test-sys_select.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-sys_select.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/test-sys_select.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,5 +1,5 @@
/* Test of <sys/select.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,9 @@
#include <sys/select.h>
+/* Check that the 'struct timeval' type is defined. */
+struct timeval t1;
+
int
main ()
{
Modified: prelude-lml/trunk/libmissing/tests/test-wchar.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-wchar.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/test-wchar.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -1,5 +1,5 @@
/* Test of <wchar.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,10 @@
#include <wchar.h>
+/* Check that the types wchar_t and wint_t are defined. */
+wchar_t a = 'c';
+wint_t b = 'x';
+
int
main ()
{
Modified: prelude-lml/trunk/libmissing/tests/test-wctype.c
===================================================================
--- prelude-lml/trunk/libmissing/tests/test-wctype.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/tests/test-wctype.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -20,6 +20,9 @@
#include <wctype.h>
+/* Check that the type wint_t is defined. */
+wint_t a = 'x';
+
int
main ()
{
Modified: prelude-lml/trunk/libmissing/unistd.in.h
===================================================================
--- prelude-lml/trunk/libmissing/unistd.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/unistd.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -35,6 +35,11 @@
/* mingw fails to declare _exit in <unistd.h>. */
#include <stdlib.h>
+#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+/* Get ssize_t. */
+# include <sys/types.h>
+#endif
+
/* The definition of GL_LINK_WARNING is copied here. */
@@ -70,6 +75,25 @@
#endif
+#if @GNULIB_CLOSE@
+# if @REPLACE_CLOSE@
+/* Automatically included by modules that need a replacement for close. */
+# undef close
+# define close rpl_close
+extern int close (int);
+# endif
+#elif @UNISTD_H_HAVE_WINSOCK2_H@
+# undef close
+# define close close_used_without_requesting_gnulib_module_close
+#elif defined GNULIB_POSIXCHECK
+# undef close
+# define close(f) \
+ (GL_LINK_WARNING ("close does not portably work on sockets - " \
+ "use gnulib module close for portability"), \
+ close (f))
+#endif
+
+
#if @GNULIB_DUP2@
# if !@HAVE_DUP2@
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
@@ -118,8 +142,6 @@
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
extern int fchdir (int /*fd*/);
-# define close rpl_close
-extern int close (int);
# define dup rpl_dup
extern int dup (int);
# define dup2 rpl_dup2
@@ -135,6 +157,23 @@
#endif
+#if @GNULIB_FSYNC@
+/* Synchronize changes to a file.
+ Return 0 if successful, otherwise -1 and errno set.
+ See POSIX:2001 specification
+ <http://www.opengroup.org/susv3xsh/fsync.html>. */
+# if !@HAVE_FSYNC@
+extern int fsync (int fd);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fsync
+# define fsync(fd) \
+ (GL_LINK_WARNING ("fsync is unportable - " \
+ "use gnulib module fsync for portability"), \
+ fsync (fd))
+#endif
+
+
#if @GNULIB_FTRUNCATE@
# if !@HAVE_FTRUNCATE@
/* Change the size of the file to which FD is opened to become equal to LENGTH.
@@ -179,6 +218,20 @@
#endif
+#if @GNULIB_GETDTABLESIZE@
+# if !@HAVE_GETDTABLESIZE@
+/* Return the maximum number of file descriptors in the current process. */
+extern int getdtablesize (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdtablesize
+# define getdtablesize() \
+ (GL_LINK_WARNING ("getdtablesize is unportable - " \
+ "use gnulib module getdtablesize for portability"), \
+ getdtablesize ())
+#endif
+
+
#if @GNULIB_GETLOGIN_R@
/* Copies the user's login name to NAME.
The array pointed to by NAME has room for SIZE bytes.
@@ -333,6 +386,22 @@
#endif
+#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+/* Write up to COUNT bytes starting at BUF to file descriptor FD.
+ See the POSIX:2001 specification
+ <http://www.opengroup.org/susv3xsh/write.html>. */
+# undef write
+# define write rpl_write
+extern ssize_t write (int fd, const void *buf, size_t count);
+#endif
+
+
+#ifdef FCHDIR_REPLACEMENT
+/* gnulib internal function. */
+extern void _gl_unregister_fd (int fd);
+#endif
+
+
#ifdef __cplusplus
}
#endif
Modified: prelude-lml/trunk/libmissing/vasnprintf.c
===================================================================
--- prelude-lml/trunk/libmissing/vasnprintf.c 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/vasnprintf.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -215,7 +215,7 @@
#undef remainder
#define remainder rem
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
/* Determine the decimal-point character according to the current locale. */
# ifndef decimal_point_char_defined
# define decimal_point_char_defined 1
@@ -255,11 +255,11 @@
#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
-/* Equivalent to !isfinite(x), but does not require libm. */
+/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
static int
-is_infinitel (long double x)
+is_infinite_or_zerol (long double x)
{
- return isnanl (x) || (x + x == x && x != 0.0L);
+ return isnanl (x) || x + x == x;
}
#endif
@@ -2578,8 +2578,10 @@
# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
|| (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
/* Some systems produce wrong output for Inf,
- -Inf, and NaN. */
- && is_infinitel (a.arg[dp->arg_index].a.a_longdouble))
+ -Inf, and NaN. Some systems in this category
+ (IRIX 5.3) also do so for -0.0. Therefore we
+ treat this case here as well. */
+ && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
# endif
))
{
@@ -2661,9 +2663,11 @@
/* POSIX specifies the default precision to be 6 for %f, %F,
%e, %E, but not for %g, %G. Implementations appear to use
- the same default precision also for %g, %G. */
+ the same default precision also for %g, %G. But for %a, %A,
+ the default precision is 0. */
if (!has_precision)
- precision = 6;
+ if (!(dp->conversion == 'a' || dp->conversion == 'A'))
+ precision = 6;
/* Allocate a temporary buffer of sufficient size. */
# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
@@ -3139,7 +3143,65 @@
abort ();
# else
/* arg is finite. */
- abort ();
+ if (!(arg == 0.0L))
+ abort ();
+
+ pad_ptr = p;
+
+ if (dp->conversion == 'f' || dp->conversion == 'F')
+ {
+ *p++ = '0';
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ for (; precision > 0; precision--)
+ *p++ = '0';
+ }
+ }
+ else if (dp->conversion == 'e' || dp->conversion == 'E')
+ {
+ *p++ = '0';
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ for (; precision > 0; precision--)
+ *p++ = '0';
+ }
+ *p++ = dp->conversion; /* 'e' or 'E' */
+ *p++ = '+';
+ *p++ = '0';
+ *p++ = '0';
+ }
+ else if (dp->conversion == 'g' || dp->conversion == 'G')
+ {
+ *p++ = '0';
+ if (flags & FLAG_ALT)
+ {
+ size_t ndigits =
+ (precision > 0 ? precision - 1 : 0);
+ *p++ = decimal_point_char ();
+ for (; ndigits > 0; --ndigits)
+ *p++ = '0';
+ }
+ }
+ else if (dp->conversion == 'a' || dp->conversion == 'A')
+ {
+ *p++ = '0';
+ *p++ = dp->conversion - 'A' + 'X';
+ pad_ptr = p;
+ *p++ = '0';
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ for (; precision > 0; precision--)
+ *p++ = '0';
+ }
+ *p++ = dp->conversion - 'A' + 'P';
+ *p++ = '+';
+ *p++ = '0';
+ }
+ else
+ abort ();
# endif
}
Modified: prelude-lml/trunk/libmissing/wchar.in.h
===================================================================
--- prelude-lml/trunk/libmissing/wchar.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/wchar.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -63,6 +63,12 @@
#endif
+/* Define wint_t. (Also done in wctype.in.h.) */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+#endif
+
+
/* Return the number of screen columns needed for WC. */
#if @GNULIB_WCWIDTH@
# if @REPLACE_WCWIDTH@
Modified: prelude-lml/trunk/libmissing/wctype.in.h
===================================================================
--- prelude-lml/trunk/libmissing/wctype.in.h 2008-10-17 09:38:43 UTC (rev 11069)
+++ prelude-lml/trunk/libmissing/wctype.in.h 2008-10-17 09:38:49 UTC (rev 11070)
@@ -52,10 +52,9 @@
#ifndef _GL_WCTYPE_H
#define _GL_WCTYPE_H
-#if @HAVE_WINT_T@
-typedef wint_t __wctype_wint_t;
-#else
-typedef int __wctype_wint_t;
+/* Define wint_t. (Also done in wchar.in.h.) */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
#endif
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
@@ -98,56 +97,56 @@
# endif
static inline int
-iswalnum (__wctype_wint_t wc)
+iswalnum (wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
}
static inline int
-iswalpha (__wctype_wint_t wc)
+iswalpha (wint_t wc)
{
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
}
static inline int
-iswblank (__wctype_wint_t wc)
+iswblank (wint_t wc)
{
return wc == ' ' || wc == '\t';
}
static inline int
-iswcntrl (__wctype_wint_t wc)
+iswcntrl (wint_t wc)
{
return (wc & ~0x1f) == 0 || wc == 0x7f;
}
static inline int
-iswdigit (__wctype_wint_t wc)
+iswdigit (wint_t wc)
{
return wc >= '0' && wc <= '9';
}
static inline int
-iswgraph (__wctype_wint_t wc)
+iswgraph (wint_t wc)
{
return wc >= '!' && wc <= '~';
}
static inline int
-iswlower (__wctype_wint_t wc)
+iswlower (wint_t wc)
{
return wc >= 'a' && wc <= 'z';
}
static inline int
-iswprint (__wctype_wint_t wc)
+iswprint (wint_t wc)
{
return wc >= ' ' && wc <= '~';
}
static inline int
-iswpunct (__wctype_wint_t wc)
+iswpunct (wint_t wc)
{
return (wc >= '!' && wc <= '~'
&& !((wc >= '0' && wc <= '9')
@@ -155,20 +154,20 @@
}
static inline int
-iswspace (__wctype_wint_t wc)
+iswspace (wint_t wc)
{
return (wc == ' ' || wc == '\t'
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
}
static inline int
-iswupper (__wctype_wint_t wc)
+iswupper (wint_t wc)
{
return wc >= 'A' && wc <= 'Z';
}
static inline int
-iswxdigit (__wctype_wint_t wc)
+iswxdigit (wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
Added: prelude-lml/trunk/libmissing/winsock.c
===================================================================
--- prelude-lml/trunk/libmissing/winsock.c (rev 0)
+++ prelude-lml/trunk/libmissing/winsock.c 2008-10-17 09:38:49 UTC (rev 11070)
@@ -0,0 +1,348 @@
+/* winsock.c --- wrappers for Windows socket functions
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <sys/socket.h>
+#if GNULIB_IOCTL
+#include <sys/ioctl.h>
+#endif
+
+#undef socket
+#undef connect
+#undef accept
+#undef bind
+#undef getpeername
+#undef getsockname
+#undef getsockopt
+#undef listen
+#undef recv
+#undef send
+#undef recvfrom
+#undef sendto
+#undef setsockopt
+#undef shutdown
+
+#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
+#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
+
+
+static inline void
+set_winsock_errno (void)
+{
+ int err = WSAGetLastError ();
+ WSASetLastError (0);
+
+ /* Map some WSAE* errors to the runtime library's error codes. */
+ switch (err)
+ {
+ case WSA_INVALID_HANDLE:
+ errno = EBADF;
+ break;
+ case WSA_NOT_ENOUGH_MEMORY:
+ errno = ENOMEM;
+ break;
+ case WSA_INVALID_PARAMETER:
+ errno = EINVAL;
+ break;
+ case WSAEWOULDBLOCK:
+ errno = EWOULDBLOCK;
+ break;
+ case WSAENAMETOOLONG:
+ errno = ENAMETOOLONG;
+ break;
+ case WSAENOTEMPTY:
+ errno = ENOTEMPTY;
+ break;
+ default:
+ errno = (err > 10000 && err < 10025) ? err - 10000 : err;
+ break;
+ }
+}
+
+
+/* Hook for gnulib module close. */
+
+#if HAVE__GL_CLOSE_FD_MAYBE_SOCKET
+int
+_gl_close_fd_maybe_socket (int fd)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ WSANETWORKEVENTS ev;
+
+ ev.lNetworkEvents = 0xDEADBEEF;
+ WSAEnumNetworkEvents (sock, NULL, &ev);
+ if (ev.lNetworkEvents != 0xDEADBEEF)
+ {
+ /* FIXME: other applications, like squid, use an undocumented
+ _free_osfhnd free function. But this is not enough: The 'osfile'
+ flags for fd also needs to be cleared, but it is hard to access it.
+ Instead, here we just close twice the file descriptor. */
+ if (closesocket (sock))
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ {
+ /* This call frees the file descriptor and does a
+ CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
+ _close (fd);
+ return 0;
+ }
+ }
+ else
+ return _close (fd);
+}
+#endif
+
+
+/* Wrappers for WinSock functions. */
+
+#if GNULIB_SOCKET
+int
+rpl_socket (int domain, int type, int protocol)
+{
+ /* We have to use WSASocket() to create non-overlapped IO sockets.
+ Overlapped IO sockets cannot be used with read/write. */
+ SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
+#endif
+
+#if GNULIB_CONNECT
+int
+rpl_connect (int fd, struct sockaddr *sockaddr, int len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = connect (sock, sockaddr, len);
+ if (r < 0)
+ {
+ /* EINPROGRESS is not returned by WinSock 2.0; for backwards
+ compatibility, connect(2) uses EWOULDBLOCK. */
+ if (WSAGetLastError () == WSAEWOULDBLOCK)
+ WSASetLastError (WSAEINPROGRESS);
+
+ set_winsock_errno ();
+ }
+
+ return r;
+}
+#endif
+
+#if GNULIB_ACCEPT
+int
+rpl_accept (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
+#endif
+
+#if GNULIB_BIND
+int
+rpl_bind (int fd, struct sockaddr *sockaddr, int len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = bind (sock, sockaddr, len);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_GETPEERNAME
+int
+rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getpeername (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_GETSOCKNAME
+int
+rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getsockname (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_GETSOCKOPT
+int
+rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getsockopt (sock, level, optname, optval, optlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_LISTEN
+int
+rpl_listen (int fd, int backlog)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = listen (sock, backlog);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_IOCTL
+int
+rpl_ioctl (int fd, int req, ...)
+{
+ void *buf;
+ va_list args;
+ SOCKET sock;
+ int r;
+
+ va_start (args, req);
+ buf = va_arg (args, void *);
+ va_end (args);
+
+ sock = FD_TO_SOCKET (fd);
+ r = ioctlsocket (sock, req, buf);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_RECV
+int
+rpl_recv (int fd, void *buf, int len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recv (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_SEND
+int
+rpl_send (int fd, const void *buf, int len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = send (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_RECVFROM
+int
+rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
+ int *fromlen)
+{
+ int frombufsize = *fromlen;
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recvfrom (sock, buf, len, flags, from, fromlen);
+
+ if (r < 0)
+ set_winsock_errno ();
+
+ /* Winsock recvfrom() only returns a valid 'from' when the socket is
+ connectionless. POSIX gives a valid 'from' for all types of sockets. */
+ else if (*fromlen == frombufsize)
+ rpl_getpeername (fd, from, fromlen);
+
+ return r;
+}
+#endif
+
+#if GNULIB_SENDTO
+int
+rpl_sendto (int fd, const void *buf, int len, int flags,
+ struct sockaddr *to, int tolen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = sendto (sock, buf, len, flags, to, tolen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_SETSOCKOPT
+int
+rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = setsockopt (sock, level, optname, optval, optlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
+
+#if GNULIB_SHUTDOWN
+int
+rpl_shutdown (int fd, int how)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = shutdown (sock, how);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
+#endif
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.