Mercurial > gnulib
changeset 14614:284da5defc58
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 25 Apr 2011 19:45:09 +0200 |
parents | 2683cd2b0569 |
children | e0fa0556c63e |
files | ChangeLog doc/posix-functions/dup2.texi m4/dup2-obsolete.m4 m4/dup2.m4 modules/dup2 modules/dup2-obsolete |
diffstat | 6 files changed, 66 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Apr 25 19:43:59 2011 +0200 +++ b/ChangeLog Mon Apr 25 19:45:09 2011 +0200 @@ -1,3 +1,13 @@ +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.
--- a/doc/posix-functions/dup2.texi Mon Apr 25 19:43:59 2011 +0200 +++ b/doc/posix-functions/dup2.texi Mon Apr 25 19:45:09 2011 +0200 @@ -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 @@ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/dup2-obsolete.m4 Mon Apr 25 19:45:09 2011 +0200 @@ -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. + : +])
--- a/m4/dup2.m4 Mon Apr 25 19:43:59 2011 +0200 +++ b/m4/dup2.m4 Mon Apr 25 19:45:09 2011 +0200 @@ -8,11 +8,17 @@ [ 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>
--- a/modules/dup2 Mon Apr 25 19:43:59 2011 +0200 +++ b/modules/dup2 Mon Apr 25 19:45:09 2011 +0200 @@ -7,6 +7,7 @@ Depends-on: unistd +dup2-obsolete configure.ac: gl_FUNC_DUP2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/dup2-obsolete Mon Apr 25 19:45:09 2011 +0200 @@ -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