summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-04-25 19:45:09 +0200
committerBruno Haible <bruno@clisp.org>2011-04-25 19:45:09 +0200
commit4a2a66e4454be259d3c6c29a34e625dc1b70bd7f (patch)
tree54308983b1c244fedc6a9603df6b83836222d347
parente3a7a9fd96b0ae812052466af59b55fa1c37bd98 (diff)
downloadgnulib-4a2a66e4454be259d3c6c29a34e625dc1b70bd7f.tar.gz
dup2: Remove check for dup2, unless supporting old obsolete platforms.
* modules/dup2-obsolete: New file. * m4/dup2-obsolete.m4: New file. * m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if gl_FUNC_DUP2_OBSOLETE is not also defined. * modules/dup2 (Depends-on): Add dup2-obsolete. * doc/posix-functions/dup2.texi: Mention module dup2-obsolete.
-rw-r--r--ChangeLog10
-rw-r--r--doc/posix-functions/dup2.texi7
-rw-r--r--m4/dup2-obsolete.m411
-rw-r--r--m4/dup2.m416
-rw-r--r--modules/dup21
-rw-r--r--modules/dup2-obsolete28
6 files changed, 66 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a4d9fedfd..d35d077b8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-04-25 Bruno Haible <bruno@clisp.org>
+ dup2: Remove check for dup2, unless supporting old obsolete platforms.
+ * modules/dup2-obsolete: New file.
+ * m4/dup2-obsolete.m4: New file.
+ * m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if
+ gl_FUNC_DUP2_OBSOLETE is not also defined.
+ * modules/dup2 (Depends-on): Add dup2-obsolete.
+ * doc/posix-functions/dup2.texi: Mention module dup2-obsolete.
+
+2011-04-25 Bruno Haible <bruno@clisp.org>
+
strnlen: Avoid memchr related link error on old obsolete platforms.
* modules/memchr-obsolete: New file.
* m4/memchr-obsolete.m4: New file.
diff --git a/doc/posix-functions/dup2.texi b/doc/posix-functions/dup2.texi
index fc1e3595a9..6054c303ba 100644
--- a/doc/posix-functions/dup2.texi
+++ b/doc/posix-functions/dup2.texi
@@ -4,9 +4,9 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html}
-Gnulib module: dup2
+Gnulib module: dup2 or dup2-obsolete
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{dup2} or @code{dup2-obsolete}:
@itemize
@item
This function always returns 0 for success on some platforms:
@@ -34,7 +34,10 @@ This function returns @code{EMFILE} instead of @code{EBADF} for
extremely large targets, which interferes with using
@code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter:
FreeBSD 6.1, Cygwin 1.5.
+@end itemize
+Portability problems fixed by Gnulib module @code{dup2-obsolete}:
+@itemize
@item
This function is missing on some older platforms.
@end itemize
diff --git a/m4/dup2-obsolete.m4 b/m4/dup2-obsolete.m4
new file mode 100644
index 0000000000..881649882c
--- /dev/null
+++ b/m4/dup2-obsolete.m4
@@ -0,0 +1,11 @@
+# dup2-obsolete.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_DUP2_OBSOLETE],
+[
+ dnl The real code is in dup2.m4.
+ :
+])
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index def263b87a..b8794c27b0 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -8,11 +8,17 @@ AC_DEFUN([gl_FUNC_DUP2],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CHECK_FUNCS_ONCE([dup2 fcntl])
- if test $ac_cv_func_dup2 = no; then
- HAVE_DUP2=0
- AC_LIBOBJ([dup2])
- else
+ m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [
+ AC_CHECK_FUNCS_ONCE([dup2])
+ if test $ac_cv_func_dup2 = no; then
+ HAVE_DUP2=0
+ AC_LIBOBJ([dup2])
+ fi
+ ], [
+ AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.])
+ ])
+ AC_CHECK_FUNCS_ONCE([fcntl])
+ if test $HAVE_DUP2 = 1; then
AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
[AC_RUN_IFELSE([
AC_LANG_PROGRAM([[#include <unistd.h>
diff --git a/modules/dup2 b/modules/dup2
index cea1a974b5..17cafd1c6a 100644
--- a/modules/dup2
+++ b/modules/dup2
@@ -7,6 +7,7 @@ m4/dup2.m4
Depends-on:
unistd
+dup2-obsolete
configure.ac:
gl_FUNC_DUP2
diff --git a/modules/dup2-obsolete b/modules/dup2-obsolete
new file mode 100644
index 0000000000..ba71bb97cf
--- /dev/null
+++ b/modules/dup2-obsolete
@@ -0,0 +1,28 @@
+Description:
+dup2() function for old platforms.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+m4/dup2-obsolete.m4
+
+Depends-on:
+dup2
+
+configure.ac:
+gl_FUNC_DUP2_OBSOLETE
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible