summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am2
-rw-r--r--gl/m4/close.m49
-rw-r--r--gl/m4/fclose.m48
-rw-r--r--gl/m4/gnulib-comp.m412
-rw-r--r--gl/m4/sys_ioctl_h.m46
-rw-r--r--gl/m4/sys_socket_h.m42
-rw-r--r--gl/m4/unistd_h.m45
-rw-r--r--gl/tests/Makefile.am1
-rw-r--r--gl/tests/sys_ioctl.in.h4
-rw-r--r--gl/tests/test-stdio.c2
-rw-r--r--gl/tests/test-stdlib.c2
-rw-r--r--gl/tests/test-string.c2
-rw-r--r--gl/tests/test-unistd.c2
-rwxr-xr-xgl/tests/test-version-etc.sh7
-rw-r--r--gl/unistd.in.h7
-rw-r--r--gl/vasnprintf.c1
16 files changed, 48 insertions, 24 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 28f1560f39..95489dd196 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1041,6 +1041,7 @@ unistd.h: unistd.in.h
-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_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|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' \
@@ -1069,6 +1070,7 @@ unistd.h: unistd.in.h
-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 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/unistd.in.h; \
} > $@-t
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4
index b1189f5f50..fdcc96b673 100644
--- a/gl/m4/close.m4
+++ b/gl/m4/close.m4
@@ -1,4 +1,4 @@
-# close.m4 serial 3
+# close.m4 serial 5
dnl Copyright (C) 2008-2009 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,6 +9,9 @@ AC_DEFUN([gl_FUNC_CLOSE],
m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
gl_PREREQ_SYS_H_WINSOCK2
if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
+ dnl Even if the 'socket' module is not used here, another part of the
+ dnl application may use it and pass file descriptors that refer to
+ dnl sockets to the close() function. So enable the support for sockets.
gl_REPLACE_CLOSE
fi
])
@@ -17,9 +20,7 @@ AC_DEFUN([gl_FUNC_CLOSE],
AC_DEFUN([gl_REPLACE_CLOSE],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- if test $REPLACE_CLOSE != 1; then
- AC_LIBOBJ([close])
- fi
REPLACE_CLOSE=1
+ AC_LIBOBJ([close])
gl_REPLACE_FCLOSE
])
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4
index d10c104fa9..ab2986fd11 100644
--- a/gl/m4/fclose.m4
+++ b/gl/m4/fclose.m4
@@ -1,5 +1,5 @@
-# fclose.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# fclose.m4 serial 2
+dnl Copyright (C) 2008-2009 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.
@@ -11,8 +11,6 @@ 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
+ AC_LIBOBJ([fclose])
])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index e39c73a4d4..88719afb8a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -159,6 +159,15 @@ AC_SUBST([LTALLOCA])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([socket])
fi
+ # When this module is used, sockets may actually occur as file descriptors,
+ # hence it is worth warning if the modules 'close' and 'ioctl' are not used.
+ m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+ m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
+ AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
+ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
+ fi
gl_SYS_SOCKET_MODULE_INDICATOR([socket])
gl_SOCKETS
gl_TYPE_SOCKLEN_T
@@ -227,6 +236,9 @@ AC_SUBST([LTALLOCA])
gl_FUNC_GETTIMEOFDAY
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
+ dnl Even if the 'socket' module is not used here, another part of the
+ dnl application may use it and pass file descriptors that refer to
+ dnl sockets to the ioctl() function. So enable the support for sockets.
AC_LIBOBJ([ioctl])
gl_REPLACE_SYS_IOCTL_H
fi
diff --git a/gl/m4/sys_ioctl_h.m4 b/gl/m4/sys_ioctl_h.m4
index e0396de850..22aa83ee59 100644
--- a/gl/m4/sys_ioctl_h.m4
+++ b/gl/m4/sys_ioctl_h.m4
@@ -1,5 +1,5 @@
-# sys_ioctl_h.m4 serial 2
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# sys_ioctl_h.m4 serial 3
+dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -59,5 +59,7 @@ AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
GNULIB_IOCTL=0; AC_SUBST([GNULIB_IOCTL])
dnl Assume proper GNU behavior unless another module says otherwise.
SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
+ SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
+ AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
SYS_IOCTL_H=''; AC_SUBST([SYS_IOCTL_H])
])
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 74e8110c05..d4873fa810 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -92,7 +92,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
AC_SUBST([HAVE_WS2TCPIP_H])
])
-# Common prerequisites of of the <sys/socket.h> replacement and of the
+# Common prerequisites of the <sys/socket.h> replacement and of the
# <sys/select.h> replacement.
# Sets and substitutes HAVE_WINSOCK2_H.
AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 96fddba7fe..d7a89e1302 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 18
+# unistd_h.m4 serial 19
dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -52,6 +52,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
+ GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
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.
@@ -81,4 +82,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
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])
+ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
+ AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
])
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 0b753ae949..4c3bcb5b9e 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -304,6 +304,7 @@ sys/ioctl.h: sys_ioctl.in.h
-e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \
-e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
-e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
+ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/sys_ioctl.in.h; \
} > $@-t
diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h
index 65c2c4a452..ae98f88ba5 100644
--- a/gl/tests/sys_ioctl.in.h
+++ b/gl/tests/sys_ioctl.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <sys/ioctl.h>.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ extern "C" {
# define ioctl rpl_ioctl
extern int ioctl (int fd, int request, ... /* {void *,char *} arg */);
# endif
-#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H@
+#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
# undef ioctl
# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
#elif defined GNULIB_POSIXCHECK
diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c
index dcfe38dd51..41299e2159 100644
--- a/gl/tests/test-stdio.c
+++ b/gl/tests/test-stdio.c
@@ -27,7 +27,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+verify (sizeof (NULL) == sizeof (void *));
int
main ()
diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c
index ae46ba1662..711cfa6315 100644
--- a/gl/tests/test-stdlib.c
+++ b/gl/tests/test-stdlib.c
@@ -26,7 +26,7 @@ int exitcode;
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+verify (sizeof (NULL) == sizeof (void *));
int
main ()
diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c
index fe53cd9b15..688d0d31c3 100644
--- a/gl/tests/test-string.c
+++ b/gl/tests/test-string.c
@@ -24,7 +24,7 @@
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+verify (sizeof (NULL) == sizeof (void *));
int
main ()
diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c
index 129367b4d7..e0b82918a9 100644
--- a/gl/tests/test-unistd.c
+++ b/gl/tests/test-unistd.c
@@ -24,7 +24,7 @@
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+verify (sizeof (NULL) == sizeof (void *));
/* Check that the various SEEK_* macros are defined. */
int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh
index 032e10e34e..528fadd9ec 100755
--- a/gl/tests/test-version-etc.sh
+++ b/gl/tests/test-version-etc.sh
@@ -32,10 +32,9 @@ Written by Sergey Poznyakoff and Eric Blake.
EOT
./test-version-etc${EXEEXT} --version |
- sed \
- -e '2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' \
- -e '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/' \
- -e 's/\r//g' |
+ sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/
+ 2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
+ tr -d '\015' |
diff -c $TMP - || ERR=1
rm $TMP
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 09e90392df..578121e328 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -43,6 +43,11 @@
# include <sys/types.h>
#endif
+/* Get getopt(), optarg, optind, opterr, optopt. */
+#if @GNULIB_UNISTD_H_GETOPT@
+# include <getopt.h>
+#endif
+
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@
@@ -137,7 +142,7 @@ extern int chown (const char *file, uid_t uid, gid_t gid);
# define close rpl_close
extern int close (int);
# endif
-#elif @UNISTD_H_HAVE_WINSOCK2_H@
+#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
# undef close
# define close close_used_without_requesting_gnulib_module_close
#elif defined GNULIB_POSIXCHECK
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index 7ac9f436ce..82b4b2c0e8 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -5476,6 +5476,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#undef TCHARS_PER_DCHAR
#undef SNPRINTF
#undef USE_SNPRINTF
+#undef DCHAR_SET
#undef DCHAR_CPY
#undef PRINTF_PARSE
#undef DIRECTIVES