For reasons explained in [1], I'm starting to move all AC_LIBOBJ invocations to the module description. In particular, this will make it possible again to use AC_REQUIRE in an unlimited way without introducing subtle bugs.
Here are the proposed first 7 patches, along with a normal bug fix. [1] http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00174.html -- In memoriam Peter van Pels <http://en.wikipedia.org/wiki/Peter_van_Pels>
From a7d659efb40f34533716fd8c1ff90a5a5f208b16 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 00:59:02 +0200 Subject: [PATCH 1/8] alphasort: Move AC_LIBOBJ invocations to module description. * m4/alphasort.m4 (gl_FUNC_ALPHASORT): Move AC_LIBOBJ and gl_PREREQ_ALPHASORT invocations from here... * modules/alphasort (configure.ac): ... to here. --- ChangeLog | 7 +++++++ m4/alphasort.m4 | 4 +--- modules/alphasort | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c60a4e..635d739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + alphasort: Move AC_LIBOBJ invocations to module description. + * m4/alphasort.m4 (gl_FUNC_ALPHASORT): Move AC_LIBOBJ and + gl_PREREQ_ALPHASORT invocations from here... + * modules/alphasort (configure.ac): ... to here. + +2011-05-05 Bruno Haible <br...@clisp.org> + fclose, fflush: Respect rules for use of AC_LIBOBJ. * m4/fflush.m4 (gl_FUNC_FFLUSH): Don't invoke gl_REPLACE_FCLOSE. * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_FFLUSH_STDIN and diff --git a/m4/alphasort.m4 b/m4/alphasort.m4 index 3863f39..e59aa74 100644 --- a/m4/alphasort.m4 +++ b/m4/alphasort.m4 @@ -1,4 +1,4 @@ -# alphasort.m4 serial 1 +# alphasort.m4 serial 2 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, @@ -14,8 +14,6 @@ AC_DEFUN([gl_FUNC_ALPHASORT], AC_CHECK_FUNCS([alphasort]) if test $ac_cv_func_alphasort = no; then HAVE_ALPHASORT=0 - AC_LIBOBJ([alphasort]) - gl_PREREQ_ALPHASORT fi ]) diff --git a/modules/alphasort b/modules/alphasort index 319eccc..e567057 100644 --- a/modules/alphasort +++ b/modules/alphasort @@ -11,6 +11,10 @@ extensions configure.ac: gl_FUNC_ALPHASORT +if test $HAVE_ALPHASORT = 0; then + AC_LIBOBJ([alphasort]) + gl_PREREQ_ALPHASORT +fi gl_DIRENT_MODULE_INDICATOR([alphasort]) Makefile.am: -- 1.6.3.2
From 9e905c9630c9cbdce1b66086eeec10f53e82048f Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:09:53 +0200 Subject: [PATCH 4/8] btowc: Move AC_LIBOBJ invocations to module description. * m4/btowc.m4 (gl_FUNC_BTOWC): Move AC_LIBOBJ and gl_PREREQ_BTOWC invocations from here... * modules/btowc (configure.ac): ... to here. --- ChangeLog | 5 +++++ m4/btowc.m4 | 6 +----- modules/btowc | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b69d79..1a69cdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + btowc: Move AC_LIBOBJ invocations to module description. + * m4/btowc.m4 (gl_FUNC_BTOWC): Move AC_LIBOBJ and gl_PREREQ_BTOWC + invocations from here... + * modules/btowc (configure.ac): ... to here. + atoll: Move AC_LIBOBJ invocations to module description. * m4/atoll.m4 (gl_FUNC_ATOLL): Move AC_LIBOBJ and gl_PREREQ_ATOLL invocations from here... diff --git a/m4/btowc.m4 b/m4/btowc.m4 index 32bf0cf..2b845e7 100644 --- a/m4/btowc.m4 +++ b/m4/btowc.m4 @@ -1,4 +1,4 @@ -# btowc.m4 serial 9 +# btowc.m4 serial 10 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, @@ -108,10 +108,6 @@ int main () *) REPLACE_BTOWC=1 ;; esac fi - if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then - AC_LIBOBJ([btowc]) - gl_PREREQ_BTOWC - fi ]) # Prerequisites of lib/btowc.c. diff --git a/modules/btowc b/modules/btowc index 1566a2f..b9572a6 100644 --- a/modules/btowc +++ b/modules/btowc @@ -12,6 +12,10 @@ mbtowc [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1] configure.ac: gl_FUNC_BTOWC +if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then + AC_LIBOBJ([btowc]) + gl_PREREQ_BTOWC +fi gl_WCHAR_MODULE_INDICATOR([btowc]) Makefile.am: -- 1.6.3.2
From 4f5d6e3303187de7b1c3e41609f798de1f47f219 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:06:05 +0200 Subject: [PATCH 3/8] atoll: Move AC_LIBOBJ invocations to module description. * m4/atoll.m4 (gl_FUNC_ATOLL): Move AC_LIBOBJ and gl_PREREQ_ATOLL invocations from here... * modules/atoll (configure.ac): ... to here. --- ChangeLog | 5 +++++ m4/atoll.m4 | 4 +--- modules/atoll | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44da525..5b69d79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + atoll: Move AC_LIBOBJ invocations to module description. + * m4/atoll.m4 (gl_FUNC_ATOLL): Move AC_LIBOBJ and gl_PREREQ_ATOLL + invocations from here... + * modules/atoll (configure.ac): ... to here. + argz: Move AC_LIBOBJ invocations to module description. * m4/argz.m4 (gl_FUNC_ARGZ): Move AC_LIBOBJ invocation from here... * modules/argz (configure.ac): ... to here. diff --git a/m4/atoll.m4 b/m4/atoll.m4 index f504542..6cb4dd1 100644 --- a/m4/atoll.m4 +++ b/m4/atoll.m4 @@ -1,4 +1,4 @@ -# atoll.m4 serial 1 +# atoll.m4 serial 2 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, @@ -14,8 +14,6 @@ AC_DEFUN([gl_FUNC_ATOLL], AC_CHECK_FUNCS([atoll]) if test $ac_cv_func_atoll = no; then HAVE_ATOLL=0 - AC_LIBOBJ([atoll]) - gl_PREREQ_ATOLL fi fi ]) diff --git a/modules/atoll b/modules/atoll index d979a00..d1a5364 100644 --- a/modules/atoll +++ b/modules/atoll @@ -11,6 +11,10 @@ strtoll [test $HAVE_ATOLL = 0] configure.ac: gl_FUNC_ATOLL +if test $HAVE_ATOLL = 0; then + AC_LIBOBJ([atoll]) + gl_PREREQ_ATOLL +fi gl_STDLIB_MODULE_INDICATOR([atoll]) Makefile.am: -- 1.6.3.2
From b79beade410262f774c68398a4c659478c7f511e Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:03:00 +0200 Subject: [PATCH 2/8] argz: Move AC_LIBOBJ invocations to module description. * m4/argz.m4 (gl_FUNC_ARGZ): Move AC_LIBOBJ invocation from here... * modules/argz (configure.ac): ... to here. --- ChangeLog | 4 ++++ m4/argz.m4 | 7 +++---- modules/argz | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 635d739..44da525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + argz: Move AC_LIBOBJ invocations to module description. + * m4/argz.m4 (gl_FUNC_ARGZ): Move AC_LIBOBJ invocation from here... + * modules/argz (configure.ac): ... to here. + alphasort: Move AC_LIBOBJ invocations to module description. * m4/alphasort.m4 (gl_FUNC_ALPHASORT): Move AC_LIBOBJ and gl_PREREQ_ALPHASORT invocations from here... diff --git a/m4/argz.m4 b/m4/argz.m4 index 0248a45..503301e 100644 --- a/m4/argz.m4 +++ b/m4/argz.m4 @@ -7,7 +7,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 9 argz.m4 +# serial 10 argz.m4 AC_DEFUN([gl_FUNC_ARGZ], [gl_PREREQ_ARGZ @@ -27,7 +27,7 @@ AC_CHECK_TYPES([error_t], #endif]) ARGZ_H= -AC_CHECK_FUNC([argz_replace], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) +AC_CHECK_FUNC([argz_replace], [], [ARGZ_H=argz.h]) dnl if have system argz functions, allow forced use of dnl libltdl-supplied implementation (and default to do so @@ -70,8 +70,7 @@ AS_IF([test -z "$ARGZ_H"], AS_IF([test "$lt_cv_sys_argz_works" = yes], [AC_DEFINE([HAVE_WORKING_ARGZ], [1], [This value is set to 1 to indicate that the system argz facility works])], - [ARGZ_H=argz.h - AC_LIBOBJ([argz])])]) + [ARGZ_H=argz.h])]) AC_SUBST([ARGZ_H]) AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"]) diff --git a/modules/argz b/modules/argz index 2cbb212..a8eb55e 100644 --- a/modules/argz +++ b/modules/argz @@ -16,6 +16,9 @@ strstr [test -n "$ARGZ_H"] configure.ac: gl_FUNC_ARGZ +if test -n "$ARGZ_H"; then + AC_LIBOBJ([argz]) +fi Makefile.am: BUILT_SOURCES += $(ARGZ_H) -- 1.6.3.2
From 0b92d9129eb07cc9721fb771b8e0c7c43f2895e5 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:15:44 +0200 Subject: [PATCH 5/8] calloc-posix, calloc-gnu: Move AC_LIBOBJs to module description. * m4/calloc.m4 (gl_REPLACE_CALLOC): Remove macro. (gl_FUNC_CALLOC_GNU, gl_FUNC_CALLOC_POSIX): Instead, just set REPLACE_CALLOC. * modules/calloc-posix (configure.ac): Invoke AC_LIBOBJ here. * modules/calloc-gnu (configure.ac): Likewise. --- ChangeLog | 7 +++++++ m4/calloc.m4 | 12 +++--------- modules/calloc-gnu | 3 +++ modules/calloc-posix | 3 +++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a69cdc..8f61104 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + calloc-posix, calloc-gnu: Move AC_LIBOBJs to module description. + * m4/calloc.m4 (gl_REPLACE_CALLOC): Remove macro. + (gl_FUNC_CALLOC_GNU, gl_FUNC_CALLOC_POSIX): Instead, just set + REPLACE_CALLOC. + * modules/calloc-posix (configure.ac): Invoke AC_LIBOBJ here. + * modules/calloc-gnu (configure.ac): Likewise. + btowc: Move AC_LIBOBJ invocations to module description. * m4/btowc.m4 (gl_FUNC_BTOWC): Move AC_LIBOBJ and gl_PREREQ_BTOWC invocations from here... diff --git a/m4/calloc.m4 b/m4/calloc.m4 index 8f462b3..3bab709 100644 --- a/m4/calloc.m4 +++ b/m4/calloc.m4 @@ -1,4 +1,4 @@ -# calloc.m4 serial 12 +# calloc.m4 serial 13 # Copyright (C) 2004-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -49,7 +49,7 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU], [Define to 1 if your system has a GNU libc compatible `calloc' function, and to 0 otherwise.])], [AC_DEFINE([HAVE_CALLOC_GNU], [0]) - gl_REPLACE_CALLOC + REPLACE_CALLOC=1 ]) ])# gl_FUNC_CALLOC_GNU @@ -66,12 +66,6 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX], AC_DEFINE([HAVE_CALLOC_POSIX], [1], [Define if the 'calloc' function is POSIX compliant.]) else - gl_REPLACE_CALLOC + REPLACE_CALLOC=1 fi ]) - -AC_DEFUN([gl_REPLACE_CALLOC], -[ - AC_LIBOBJ([calloc]) - REPLACE_CALLOC=1 -]) diff --git a/modules/calloc-gnu b/modules/calloc-gnu index 734d973..ffc8b50 100644 --- a/modules/calloc-gnu +++ b/modules/calloc-gnu @@ -10,6 +10,9 @@ calloc-posix configure.ac: gl_FUNC_CALLOC_GNU +if test $REPLACE_CALLOC = 1; then + AC_LIBOBJ([calloc]) +fi gl_MODULE_INDICATOR([calloc-gnu]) Makefile.am: diff --git a/modules/calloc-posix b/modules/calloc-posix index f93b90e..ef274ed 100644 --- a/modules/calloc-posix +++ b/modules/calloc-posix @@ -11,6 +11,9 @@ stdlib configure.ac: gl_FUNC_CALLOC_POSIX +if test $REPLACE_CALLOC = 1; then + AC_LIBOBJ([calloc]) +fi gl_STDLIB_MODULE_INDICATOR([calloc-posix]) Makefile.am: -- 1.6.3.2
From 2819ff6e3ee0822aeafdc8f2ace81de3d75ef05b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:47:42 +0200 Subject: [PATCH 8/8] chdir-long: Move AC_LIBOBJ invocations to module description. * m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Move AC_LIBOBJ and gl_PREREQ_CHDIR_LONG invocations from here... * modules/chdir-long (configure.ac): ... to here. --- ChangeLog | 5 +++++ m4/chdir-long.m4 | 7 +------ modules/chdir-long | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8b2a0e..cb5efec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + chdir-long: Move AC_LIBOBJ invocations to module description. + * m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Move AC_LIBOBJ and + gl_PREREQ_CHDIR_LONG invocations from here... + * modules/chdir-long (configure.ac): ... to here. + canonicalize-lgpl: Fix autoconf macro ordering bug. * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Require gl_STDLIB_H_DEFAULTS. diff --git a/m4/chdir-long.m4 b/m4/chdir-long.m4 index 27c61d2..9a343ac 100644 --- a/m4/chdir-long.m4 +++ b/m4/chdir-long.m4 @@ -1,4 +1,4 @@ -#serial 11 +#serial 12 # Use Gnulib's robust chdir function. # It can handle arbitrarily long directory names, which means @@ -25,11 +25,6 @@ have_arbitrary_file_name_length_limit #endif], gl_cv_have_arbitrary_file_name_length_limit=yes, gl_cv_have_arbitrary_file_name_length_limit=no)]) - - if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then - AC_LIBOBJ([chdir-long]) - gl_PREREQ_CHDIR_LONG - fi ]) AC_DEFUN([gl_PREREQ_CHDIR_LONG], diff --git a/modules/chdir-long b/modules/chdir-long index 0c8e792..22236c6 100644 --- a/modules/chdir-long +++ b/modules/chdir-long @@ -20,6 +20,10 @@ stdlib [test $gl_cv_have_arbitrary_file_name_length_limit = yes] configure.ac: gl_FUNC_CHDIR_LONG +if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then + AC_LIBOBJ([chdir-long]) + gl_PREREQ_CHDIR_LONG +fi Makefile.am: -- 1.6.3.2
From 5c53c99d90c1fbcac37fb3b2dfe85d374a212b5a Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:29:37 +0200 Subject: [PATCH 6/8] canonicalize-lgpl: Move AC_LIBOBJ invocations to module description. * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Move AC_LIBOBJ invocation from here... * modules/canonicalize-lgpl (configure.ac): ... to here. --- ChangeLog | 5 +++++ m4/canonicalize.m4 | 6 ++---- modules/canonicalize-lgpl | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f61104..9b2f047 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + canonicalize-lgpl: Move AC_LIBOBJ invocations to module description. + * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Move AC_LIBOBJ invocation + from here... + * modules/canonicalize-lgpl (configure.ac): ... to here. + calloc-posix, calloc-gnu: Move AC_LIBOBJs to module description. * m4/calloc.m4 (gl_REPLACE_CALLOC): Remove macro. (gl_FUNC_CALLOC_GNU, gl_FUNC_CALLOC_POSIX): Instead, just set diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index dcc6039..b1d9e95 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -1,4 +1,4 @@ -# canonicalize.m4 serial 17 +# canonicalize.m4 serial 18 dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. @@ -29,16 +29,14 @@ AC_DEFUN([gl_CANONICALIZE_LGPL], AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE]) if test $ac_cv_func_canonicalize_file_name = no; then HAVE_CANONICALIZE_FILE_NAME=0 - AC_LIBOBJ([canonicalize-lgpl]) if test $ac_cv_func_realpath = no; then HAVE_REALPATH=0 elif test "$gl_cv_func_realpath_works" != yes; then REPLACE_REALPATH=1 fi elif test "$gl_cv_func_realpath_works" != yes; then - AC_LIBOBJ([canonicalize-lgpl]) - REPLACE_REALPATH=1 REPLACE_CANONICALIZE_FILE_NAME=1 + REPLACE_REALPATH=1 fi ]) diff --git a/modules/canonicalize-lgpl b/modules/canonicalize-lgpl index 1fb23c2..6e6833c 100644 --- a/modules/canonicalize-lgpl +++ b/modules/canonicalize-lgpl @@ -20,6 +20,9 @@ sys_stat [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICA configure.ac: gl_CANONICALIZE_LGPL +if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then + AC_LIBOBJ([canonicalize-lgpl]) +fi gl_MODULE_INDICATOR([canonicalize-lgpl]) gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name]) gl_STDLIB_MODULE_INDICATOR([realpath]) -- 1.6.3.2
From 3a24364b483e274b6baf1763d6c8691a9a53920a Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 6 May 2011 01:37:49 +0200 Subject: [PATCH 7/8] canonicalize-lgpl: Fix autoconf macro ordering bug. * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Require gl_STDLIB_H_DEFAULTS. --- ChangeLog | 4 ++++ m4/canonicalize.m4 | 1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b2f047..a8b2a0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-05-05 Bruno Haible <br...@clisp.org> + canonicalize-lgpl: Fix autoconf macro ordering bug. + * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Require + gl_STDLIB_H_DEFAULTS. + canonicalize-lgpl: Move AC_LIBOBJ invocations to module description. * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Move AC_LIBOBJ invocation from here... diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index b1d9e95..b157170 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -26,6 +26,7 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE], # Provides canonicalize_file_name and realpath. AC_DEFUN([gl_CANONICALIZE_LGPL], [ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE]) if test $ac_cv_func_canonicalize_file_name = no; then HAVE_CANONICALIZE_FILE_NAME=0 -- 1.6.3.2