> This reminds me to clean up the AC_LIBOBJ invocations in this and related > *.m4 files... If it had already been cleaned up, this mistake would not > have happened.
Here comes the cleanup. A series of 12 small and innocent patches. Pushed. From 1a86c594b0d0e5c65899f1bbe1cca36d501ca5d3 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:23:14 +0200 Subject: [PATCH 01/12] fchdir: Start to remove gl_REPLACE_* idiom. * m4/fchdir.m4 (gl_TEST_FCHDIR): New macro. (gl_FUNC_FCHDIR): Invoke it. --- ChangeLog | 6 ++++++ m4/fchdir.m4 | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f999c04..5e27329 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-07-25 Bruno Haible <br...@clisp.org> + + fchdir: Start to remove gl_REPLACE_* idiom. + * m4/fchdir.m4 (gl_TEST_FCHDIR): New macro. + (gl_FUNC_FCHDIR): Invoke it. + 2011-07-25 Paul Eggert <egg...@cs.ucla.edu> * lib/ftell.c (ftell): Comment out cast. diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 829373a..92d0f53 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -1,4 +1,4 @@ -# fchdir.m4 serial 16 +# fchdir.m4 serial 17 dnl Copyright (C) 2006-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, @@ -15,9 +15,8 @@ AC_DEFUN([gl_FUNC_FCHDIR], HAVE_DECL_FCHDIR=0 fi - AC_CHECK_FUNCS_ONCE([fchdir]) - if test $ac_cv_func_fchdir = no; then - HAVE_FCHDIR=0 + AC_REQUIRE([gl_TEST_FCHDIR]) + if test $HAVE_FCHDIR = 0; then AC_LIBOBJ([fchdir]) gl_PREREQ_FCHDIR AC_DEFINE([REPLACE_FCHDIR], [1], @@ -48,5 +47,15 @@ work around the inability to open a directory.]) fi ]) +# Determine whether to use the overrides in lib/fchdir.c. +AC_DEFUN([gl_TEST_FCHDIR], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([fchdir]) + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi +]) + # Prerequisites of lib/fchdir.c. AC_DEFUN([gl_PREREQ_FCHDIR], [:]) -- 1.6.3.2 From 208e667b5f8c696e723da34171fbaa6f01246f3b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:31:54 +0200 Subject: [PATCH 02/12] open: Remove call-in from fchdir.m4. * m4/open.m4 (gl_FUNC_OPEN): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_OPEN. --- ChangeLog | 4 ++++ m4/fchdir.m4 | 1 - m4/open.m4 | 12 +++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e27329..0196acc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + open: Remove call-in from fchdir.m4. + * m4/open.m4 (gl_FUNC_OPEN): Conditionally invoke gl_TEST_FCHDIR. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_OPEN. + fchdir: Start to remove gl_REPLACE_* idiom. * m4/fchdir.m4 (gl_TEST_FCHDIR): New macro. (gl_FUNC_FCHDIR): Invoke it. diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 92d0f53..cc05267 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], REPLACE_OPENDIR=1 REPLACE_CLOSEDIR=1 REPLACE_DUP=1 - gl_REPLACE_OPEN gl_REPLACE_CLOSE gl_REPLACE_DUP2 dnl dup3 is already unconditionally replaced diff --git a/m4/open.m4 b/m4/open.m4 index 690cc64..454eb42 100644 --- a/m4/open.m4 +++ b/m4/open.m4 @@ -1,4 +1,4 @@ -# open.m4 serial 12 +# open.m4 serial 13 dnl Copyright (C) 2007-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, @@ -62,6 +62,16 @@ changequote([,])dnl esac ;; esac + dnl Replace open() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_OPEN = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_OPEN + fi + fi + ]) dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. m4_ifdef([gl_NONBLOCKING_IO], [ if test $REPLACE_OPEN = 0; then -- 1.6.3.2 From 668c68616b7d1158d7a2b357b34741713f10e405 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:38:11 +0200 Subject: [PATCH 03/12] open: Move AC_LIBOBJ invocation to module description. * m4/open.m4 (gl_REPLACE_OPEN): Remove macro. (gl_FUNC_OPEN): Instead of gl_REPLACE_OPEN, just set REPLACE_OPEN to 1. * modules/open (configure.ac): Invoke AC_LIBOBJ and gl_PREREQ_OPEN. --- ChangeLog | 5 +++++ m4/open.m4 | 16 ++++------------ modules/open | 4 ++++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0196acc..b454363 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + open: Move AC_LIBOBJ invocation to module description. + * m4/open.m4 (gl_REPLACE_OPEN): Remove macro. + (gl_FUNC_OPEN): Instead of gl_REPLACE_OPEN, just set REPLACE_OPEN to 1. + * modules/open (configure.ac): Invoke AC_LIBOBJ and gl_PREREQ_OPEN. + open: Remove call-in from fchdir.m4. * m4/open.m4 (gl_FUNC_OPEN): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_OPEN. diff --git a/m4/open.m4 b/m4/open.m4 index 454eb42..d819184 100644 --- a/m4/open.m4 +++ b/m4/open.m4 @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_OPEN], AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in mingw* | pw*) - gl_REPLACE_OPEN + REPLACE_OPEN=1 ;; *) dnl open("foo/") should not create a file when the file name has a @@ -57,7 +57,7 @@ changequote([,])dnl *no) AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], [Define to 1 if open() fails to recognize a trailing slash.]) - gl_REPLACE_OPEN + REPLACE_OPEN=1 ;; esac ;; @@ -68,7 +68,7 @@ changequote([,])dnl if test $REPLACE_OPEN = 0; then gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - gl_REPLACE_OPEN + REPLACE_OPEN=1 fi fi ]) @@ -77,20 +77,12 @@ changequote([,])dnl if test $REPLACE_OPEN = 0; then gl_NONBLOCKING_IO if test $gl_cv_have_open_O_NONBLOCK != yes; then - gl_REPLACE_OPEN + REPLACE_OPEN=1 fi fi ]) ]) -AC_DEFUN([gl_REPLACE_OPEN], -[ - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - REPLACE_OPEN=1 - AC_LIBOBJ([open]) - gl_PREREQ_OPEN -]) - # Prerequisites of lib/open.c. AC_DEFUN([gl_PREREQ_OPEN], [ diff --git a/modules/open b/modules/open index ea0f5ae..bf47138 100644 --- a/modules/open +++ b/modules/open @@ -12,6 +12,10 @@ stat [test $REPLACE_OPEN = 1] configure.ac: gl_FUNC_OPEN +if test $REPLACE_OPEN = 1; then + AC_LIBOBJ([open]) + gl_PREREQ_OPEN +fi gl_FCNTL_MODULE_INDICATOR([open]) Makefile.am: -- 1.6.3.2 From b6a7ab350dba501b3d8f6527865cdb43cc0e2520 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:42:28 +0200 Subject: [PATCH 04/12] close: Remove call-in from fchdir.m4. * m4/close.m4 (gl_FUNC_CLOSE): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_CLOSE. --- ChangeLog | 4 ++++ m4/close.m4 | 12 +++++++++++- m4/fchdir.m4 | 1 - 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b454363..048a284 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + close: Remove call-in from fchdir.m4. + * m4/close.m4 (gl_FUNC_CLOSE): Conditionally invoke gl_TEST_FCHDIR. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_CLOSE. + open: Move AC_LIBOBJ invocation to module description. * m4/open.m4 (gl_REPLACE_OPEN): Remove macro. (gl_FUNC_OPEN): Instead of gl_REPLACE_OPEN, just set REPLACE_OPEN to 1. diff --git a/m4/close.m4 b/m4/close.m4 index 0d8f67a..8f33dfe 100644 --- a/m4/close.m4 +++ b/m4/close.m4 @@ -1,4 +1,4 @@ -# close.m4 serial 6 +# close.m4 serial 7 dnl Copyright (C) 2008-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, @@ -15,6 +15,16 @@ AC_DEFUN([gl_FUNC_CLOSE], gl_REPLACE_CLOSE fi ]) + dnl Replace close() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_CLOSE = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_CLOSE + fi + fi + ]) ]) AC_DEFUN([gl_REPLACE_CLOSE], diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index cc05267..612c98f 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], REPLACE_OPENDIR=1 REPLACE_CLOSEDIR=1 REPLACE_DUP=1 - gl_REPLACE_CLOSE gl_REPLACE_DUP2 dnl dup3 is already unconditionally replaced gl_REPLACE_FCNTL -- 1.6.3.2 From 1ed055e3d9cc6e80839fa0b56cca2a5b97462524 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:47:31 +0200 Subject: [PATCH 05/12] close: Move AC_LIBOBJ invocation to module description. * m4/close.m4 (gl_REPLACE_CLOSE): Remove macro. (gl_FUNC_CLOSE): Instead of gl_REPLACE_CLOSE, just set REPLACE_CLOSE to 1. * modules/close (configure.ac): Invoke AC_LIBOBJ. --- ChangeLog | 6 ++++++ m4/close.m4 | 16 ++++++---------- modules/close | 3 +++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 048a284..5626264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + close: Move AC_LIBOBJ invocation to module description. + * m4/close.m4 (gl_REPLACE_CLOSE): Remove macro. + (gl_FUNC_CLOSE): Instead of gl_REPLACE_CLOSE, just set REPLACE_CLOSE to + 1. + * modules/close (configure.ac): Invoke AC_LIBOBJ. + close: Remove call-in from fchdir.m4. * m4/close.m4 (gl_FUNC_CLOSE): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_CLOSE. diff --git a/m4/close.m4 b/m4/close.m4 index 8f33dfe..f2e1ac6 100644 --- a/m4/close.m4 +++ b/m4/close.m4 @@ -6,13 +6,14 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSE], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 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 + REPLACE_CLOSE=1 fi ]) dnl Replace close() for supporting the gnulib-defined fchdir() function, @@ -21,16 +22,11 @@ AC_DEFUN([gl_FUNC_CLOSE], if test $REPLACE_CLOSE = 0; then gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - gl_REPLACE_CLOSE + REPLACE_CLOSE=1 fi fi ]) -]) - -AC_DEFUN([gl_REPLACE_CLOSE], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - REPLACE_CLOSE=1 - AC_LIBOBJ([close]) - m4_ifdef([gl_REPLACE_FCLOSE], [gl_REPLACE_FCLOSE]) + if test $REPLACE_CLOSE = 1; then + m4_ifdef([gl_REPLACE_FCLOSE], [gl_REPLACE_FCLOSE], [:]) + fi ]) diff --git a/modules/close b/modules/close index 9f1028b..adec040 100644 --- a/modules/close +++ b/modules/close @@ -11,6 +11,9 @@ fd-hook [test $REPLACE_CLOSE = 1] configure.ac: gl_FUNC_CLOSE +if test $REPLACE_CLOSE = 1; then + AC_LIBOBJ([close]) +fi gl_UNISTD_MODULE_INDICATOR([close]) Makefile.am: -- 1.6.3.2 From ecfb73db2daf5f2d2babeae18785c0e850c8c685 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 25 Jul 2011 23:53:06 +0200 Subject: [PATCH 06/12] fclose: Remove call-in from close.m4. * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_CLOSE. * m4/close.m4 (gl_FUNC_CLOSE): Don't invoke gl_REPLACE_FCLOSE. --- ChangeLog | 4 ++++ m4/close.m4 | 3 --- m4/fclose.m4 | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5626264..ca420ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + fclose: Remove call-in from close.m4. + * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_CLOSE. + * m4/close.m4 (gl_FUNC_CLOSE): Don't invoke gl_REPLACE_FCLOSE. + close: Move AC_LIBOBJ invocation to module description. * m4/close.m4 (gl_REPLACE_CLOSE): Remove macro. (gl_FUNC_CLOSE): Instead of gl_REPLACE_CLOSE, just set REPLACE_CLOSE to diff --git a/m4/close.m4 b/m4/close.m4 index f2e1ac6..cd30d08 100644 --- a/m4/close.m4 +++ b/m4/close.m4 @@ -26,7 +26,4 @@ AC_DEFUN([gl_FUNC_CLOSE], fi fi ]) - if test $REPLACE_CLOSE = 1; then - m4_ifdef([gl_REPLACE_FCLOSE], [gl_REPLACE_FCLOSE], [:]) - fi ]) diff --git a/m4/fclose.m4 b/m4/fclose.m4 index 349b5f1..32f2e26 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -1,4 +1,4 @@ -# fclose.m4 serial 4 +# fclose.m4 serial 5 dnl Copyright (C) 2008-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, @@ -10,6 +10,11 @@ AC_DEFUN([gl_FUNC_FCLOSE], if test $gl_cv_func_fflush_stdin = no; then gl_REPLACE_FCLOSE fi + + AC_REQUIRE([gl_FUNC_CLOSE]) + if test $REPLACE_CLOSE = 1; then + gl_REPLACE_FCLOSE + fi ]) AC_DEFUN([gl_REPLACE_FCLOSE], -- 1.6.3.2 From f8d9634f9cf2e26fcada6a663e28bfb1bc7d531c Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:01:49 +0200 Subject: [PATCH 07/12] fclose: Move AC_LIBOBJ invocation to module description. * m4/fclose.m4 (gl_REPLACE_FCLOSE): Remove macro. (gl_FUNC_FCLOSE): Instead of gl_REPLACE_FCLOSE, just set REPLACE_FCLOSE to 1. * modules/fclose (configure.ac): Invoke AC_LIBOBJ. --- ChangeLog | 6 ++++++ m4/fclose.m4 | 13 ++++--------- modules/fclose | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca420ae..4eff46f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + fclose: Move AC_LIBOBJ invocation to module description. + * m4/fclose.m4 (gl_REPLACE_FCLOSE): Remove macro. + (gl_FUNC_FCLOSE): Instead of gl_REPLACE_FCLOSE, just set REPLACE_FCLOSE + to 1. + * modules/fclose (configure.ac): Invoke AC_LIBOBJ. + fclose: Remove call-in from close.m4. * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_CLOSE. * m4/close.m4 (gl_FUNC_CLOSE): Don't invoke gl_REPLACE_FCLOSE. diff --git a/m4/fclose.m4 b/m4/fclose.m4 index 32f2e26..92fa072 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -6,20 +6,15 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FCLOSE], [ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + gl_FUNC_FFLUSH_STDIN if test $gl_cv_func_fflush_stdin = no; then - gl_REPLACE_FCLOSE + REPLACE_FCLOSE=1 fi AC_REQUIRE([gl_FUNC_CLOSE]) if test $REPLACE_CLOSE = 1; then - gl_REPLACE_FCLOSE + REPLACE_FCLOSE=1 fi ]) - -AC_DEFUN([gl_REPLACE_FCLOSE], -[ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - REPLACE_FCLOSE=1 - AC_LIBOBJ([fclose]) -]) diff --git a/modules/fclose b/modules/fclose index e6493c9..85f63fe 100644 --- a/modules/fclose +++ b/modules/fclose @@ -14,6 +14,9 @@ lseek [test $REPLACE_FCLOSE = 1] configure.ac: gl_FUNC_FCLOSE +if test $REPLACE_FCLOSE = 1; then + AC_LIBOBJ([fclose]) +fi gl_STDIO_MODULE_INDICATOR([fclose]) Makefile.am: -- 1.6.3.2 From 01bf66e06a26009d0ff3b0173db77389165f2e99 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:12:55 +0200 Subject: [PATCH 08/12] dup2: Remove call-in from fchdir.m4. * m4/dup2.m4 (gl_FUNC_DUP2): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_DUP2. --- ChangeLog | 4 ++++ m4/dup2.m4 | 10 +++++++++- m4/fchdir.m4 | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eff46f..056717e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + dup2: Remove call-in from fchdir.m4. + * m4/dup2.m4 (gl_FUNC_DUP2): Conditionally invoke gl_TEST_FCHDIR. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_DUP2. + fclose: Move AC_LIBOBJ invocation to module description. * m4/fclose.m4 (gl_REPLACE_FCLOSE): Remove macro. (gl_FUNC_FCLOSE): Instead of gl_REPLACE_FCLOSE, just set REPLACE_FCLOSE diff --git a/m4/dup2.m4 b/m4/dup2.m4 index 8d7f62c..b4a2219 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -1,4 +1,4 @@ -#serial 13 +#serial 14 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, @@ -63,6 +63,14 @@ AC_DEFUN([gl_FUNC_DUP2], gl_REPLACE_DUP2 fi fi + dnl Replace dup2() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_DUP2 + fi + ]) ]) AC_DEFUN([gl_REPLACE_DUP2], diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 612c98f..26604e2 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], REPLACE_OPENDIR=1 REPLACE_CLOSEDIR=1 REPLACE_DUP=1 - gl_REPLACE_DUP2 dnl dup3 is already unconditionally replaced gl_REPLACE_FCNTL AC_CACHE_CHECK([whether open can visit directories], -- 1.6.3.2 From 59f778ae23f86ab0ff7a8cdd0fb6463233284a49 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:28:07 +0200 Subject: [PATCH 09/12] dup2: Move AC_LIBOBJ invocation to module description. * m4/dup2.m4 (gl_REPLACE_DUP2): Remove macro. (gl_FUNC_DUP2): Instead of gl_REPLACE_DUP2, just set REPLACE_DUP2 to 1. Don't invoke AC_LIBOBJ. * modules/dup2 (configure.ac): Invoke AC_LIBOBJ. --- ChangeLog | 6 ++++++ m4/dup2.m4 | 15 ++------------- modules/dup2 | 3 +++ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 056717e..74c1158 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + dup2: Move AC_LIBOBJ invocation to module description. + * m4/dup2.m4 (gl_REPLACE_DUP2): Remove macro. + (gl_FUNC_DUP2): Instead of gl_REPLACE_DUP2, just set REPLACE_DUP2 to 1. + Don't invoke AC_LIBOBJ. + * modules/dup2 (configure.ac): Invoke AC_LIBOBJ. + dup2: Remove call-in from fchdir.m4. * m4/dup2.m4 (gl_FUNC_DUP2): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_DUP2. diff --git a/m4/dup2.m4 b/m4/dup2.m4 index b4a2219..5c2cc96 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -12,7 +12,6 @@ AC_DEFUN([gl_FUNC_DUP2], 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.]) @@ -60,7 +59,7 @@ AC_DEFUN([gl_FUNC_DUP2], esac]) ]) if test "$gl_cv_func_dup2_works" = no; then - gl_REPLACE_DUP2 + REPLACE_DUP2=1 fi fi dnl Replace dup2() for supporting the gnulib-defined fchdir() function, @@ -68,17 +67,7 @@ AC_DEFUN([gl_FUNC_DUP2], m4_ifdef([gl_FUNC_FCHDIR], [ gl_TEST_FCHDIR if test $HAVE_FCHDIR = 0; then - gl_REPLACE_DUP2 + REPLACE_DUP2=1 fi ]) ]) - -AC_DEFUN([gl_REPLACE_DUP2], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([dup2]) - if test $ac_cv_func_dup2 = yes; then - REPLACE_DUP2=1 - fi - AC_LIBOBJ([dup2]) -]) diff --git a/modules/dup2 b/modules/dup2 index 17cafd1..f9a1ee3 100644 --- a/modules/dup2 +++ b/modules/dup2 @@ -11,6 +11,9 @@ dup2-obsolete configure.ac: gl_FUNC_DUP2 +if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then + AC_LIBOBJ([dup2]) +fi gl_UNISTD_MODULE_INDICATOR([dup2]) Makefile.am: -- 1.6.3.2 From 7782dda23150ffa38818f92810506fbefc21903d Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:33:07 +0200 Subject: [PATCH 10/12] dup3: Remove potential call-in from fchdir.m4. * m4/dup3.m4 (gl_FUNC_DUP3): Add comment about fchdir. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Remove comment about dup3. --- ChangeLog | 4 ++++ m4/dup3.m4 | 12 +++++++++++- m4/fchdir.m4 | 1 - 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74c1158..ed1c1f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + dup3: Remove potential call-in from fchdir.m4. + * m4/dup3.m4 (gl_FUNC_DUP3): Add comment about fchdir. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Remove comment about dup3. + dup2: Move AC_LIBOBJ invocation to module description. * m4/dup2.m4 (gl_REPLACE_DUP2): Remove macro. (gl_FUNC_DUP2): Instead of gl_REPLACE_DUP2, just set REPLACE_DUP2 to 1. diff --git a/m4/dup3.m4 b/m4/dup3.m4 index f53d14e..29b8dc0 100644 --- a/m4/dup3.m4 +++ b/m4/dup3.m4 @@ -1,4 +1,4 @@ -# dup3.m4 serial 2 +# dup3.m4 serial 3 dnl Copyright (C) 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, @@ -15,4 +15,14 @@ AC_DEFUN([gl_FUNC_DUP3], if test $ac_cv_func_dup3 != yes; then HAVE_DUP3=0 fi + +dnl Not needed yet, because dup3 is unconditionally replaced. +dnl dnl Replace dup3() for supporting the gnulib-defined fchdir() function, +dnl dnl to keep fchdir's bookkeeping up-to-date. +dnl m4_ifdef([gl_FUNC_FCHDIR], [ +dnl gl_TEST_FCHDIR +dnl if test $HAVE_FCHDIR = 0; then +dnl REPLACE_DUP3=1 +dnl fi +dnl ]) ]) diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 26604e2..502f62e 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], REPLACE_OPENDIR=1 REPLACE_CLOSEDIR=1 REPLACE_DUP=1 - dnl dup3 is already unconditionally replaced gl_REPLACE_FCNTL AC_CACHE_CHECK([whether open can visit directories], [gl_cv_func_open_directory_works], -- 1.6.3.2 From 75d6952a6726fce261a1757825fb0491fa195acf Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:37:05 +0200 Subject: [PATCH 11/12] fcntl: Remove call-in from fchdir.m4. * m4/fcntl.m4 (gl_FUNC_FCNTL): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_FCNTL. --- ChangeLog | 4 ++++ m4/fchdir.m4 | 1 - m4/fcntl.m4 | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed1c1f7..f776929 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + fcntl: Remove call-in from fchdir.m4. + * m4/fcntl.m4 (gl_FUNC_FCNTL): Conditionally invoke gl_TEST_FCHDIR. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_FCNTL. + dup3: Remove potential call-in from fchdir.m4. * m4/dup3.m4 (gl_FUNC_DUP3): Add comment about fchdir. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Remove comment about dup3. diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 502f62e..a387dbb 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], REPLACE_OPENDIR=1 REPLACE_CLOSEDIR=1 REPLACE_DUP=1 - gl_REPLACE_FCNTL AC_CACHE_CHECK([whether open can visit directories], [gl_cv_func_open_directory_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h> diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 index a93ed85..1970446 100644 --- a/m4/fcntl.m4 +++ b/m4/fcntl.m4 @@ -1,4 +1,4 @@ -# fcntl.m4 serial 4 +# fcntl.m4 serial 5 dnl Copyright (C) 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, @@ -73,6 +73,14 @@ choke me dnl No witness macro needed for this bug. fi fi + dnl Replace fcntl() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_FCNTL + fi + ]) ]) AC_DEFUN([gl_REPLACE_FCNTL], -- 1.6.3.2 From 2949b7fd942e2dc3470dfcc42fd6b77e6b27418a Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Tue, 26 Jul 2011 00:39:35 +0200 Subject: [PATCH 12/12] fcntl: Move AC_LIBOBJ invocation to module description. * m4/fcntl.m4 (gl_REPLACE_FCNTL): Don't invoke AC_LIBOBJ. * modules/fcntl (configure.ac): Invoke AC_LIBOBJ. --- ChangeLog | 4 ++++ m4/fcntl.m4 | 1 - modules/fcntl | 3 +++ 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index f776929..3ba89e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-07-25 Bruno Haible <br...@clisp.org> + fcntl: Move AC_LIBOBJ invocation to module description. + * m4/fcntl.m4 (gl_REPLACE_FCNTL): Don't invoke AC_LIBOBJ. + * modules/fcntl (configure.ac): Invoke AC_LIBOBJ. + fcntl: Remove call-in from fchdir.m4. * m4/fcntl.m4 (gl_FUNC_FCNTL): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_FCNTL. diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 index 1970446..a92e51c 100644 --- a/m4/fcntl.m4 +++ b/m4/fcntl.m4 @@ -92,5 +92,4 @@ AC_DEFUN([gl_REPLACE_FCNTL], else REPLACE_FCNTL=1 fi - AC_LIBOBJ([fcntl]) ]) diff --git a/modules/fcntl b/modules/fcntl index 855ee9f..4c30e9e 100644 --- a/modules/fcntl +++ b/modules/fcntl @@ -13,6 +13,9 @@ getdtablesize [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] configure.ac: gl_FUNC_FCNTL +if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then + AC_LIBOBJ([fcntl]) +fi gl_FCNTL_MODULE_INDICATOR([fcntl]) Makefile.am: -- 1.6.3.2 -- In memoriam André Chénier <http://en.wikipedia.org/wiki/André_Chénier>