dup2: remove test for existence of fcntl
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Jun 2011 08:56:52 +0000 (01:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Jun 2011 08:56:52 +0000 (01:56 -0700)
* m4/dup2.m4 (gl_FUNC_DUP2): Use "#ifdef FD_CLOEXEC", not
"#if HAVE_FCNTL", in the configure-time test program.
This removes the need for the AC_CHECK_FUNCS_ONCE([fcntl]),
and therefore speeds up "configure" a bit.  Found while
adding the dup2 module to Emacs.

ChangeLog
m4/dup2.m4

index 686d7a5..14d3b0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-06-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dup2: remove test for existence of fcntl
+       * m4/dup2.m4 (gl_FUNC_DUP2): Use "#ifdef FD_CLOEXEC", not
+       "#if HAVE_FCNTL", in the configure-time test program.
+       This removes the need for the AC_CHECK_FUNCS_ONCE([fcntl]),
+       and therefore speeds up "configure" a bit.  Found while
+       adding the dup2 module to Emacs.
+
 2011-06-24  Eric Blake  <eblake@redhat.com>
 
        maint.mk: enhance useless header checks
index 62e31a8..8d7f62c 100644 (file)
@@ -1,4 +1,4 @@
-#serial 12
+#serial 13
 dnl Copyright (C) 2002, 2005, 2007, 2009-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,
@@ -17,7 +17,6 @@ AC_DEFUN([gl_FUNC_DUP2],
   ], [
     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([
@@ -25,13 +24,13 @@ AC_DEFUN([gl_FUNC_DUP2],
 #include <fcntl.h>
 #include <errno.h>]],
            [int result = 0;
-#if HAVE_FCNTL
+#ifdef FD_CLOEXEC
             if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1)
               result |= 1;
-#endif HAVE_FCNTL
+#endif
             if (dup2 (1, 1) == 0)
               result |= 2;
-#if HAVE_FCNTL
+#ifdef FD_CLOEXEC
             if (fcntl (1, F_GETFD) != FD_CLOEXEC)
               result |= 4;
 #endif