bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: an autoconf expert challenge


From: Bruno Haible
Subject: Re: an autoconf expert challenge
Date: Wed, 24 Jan 2007 03:04:35 +0100 (MET)
User-agent: KMail/1.5.4

Hello Ralf,

> Dunno if the general issue is still relevant for gnulib.

Yes, absolutely! Each of the 11 warnings that you found would be a problem
for people who use 2 instances of gnulib from within the same configure file.
(Simon's and my projects do this.)

> > Does anyone know how to write an automatic check for this rule: that
> > autoconf macros that directly or indirectly invoke AC_LIBOBJ are not
> > AC_REQUIREd?
> 
> They may not be directly nor indirectly required, yes?

Yes.

> # M4 code to put before or right after AC_INIT:
> m4_ifdef([_m4_require_call],
> [m4_rename([_m4_require_call], [_m4_require_call_orig])dnl
> m4_define([_m4_require_call],
> [m4_pushdef([AC_LIBOBJ],
>   [m4_warning([AC_LIBOBJ called inside a require chain])dnl
>    m4_expansion_stack_dump()])dnl
> _m4_require_call_orig($@)[]dnl
> m4_popdef([AC_LIBOBJ])])dnl
> ])

Excellent!!

> configure.ac:921: warning: AC_LIBOBJ called inside a require chain
> glm4/getopt.m4:11: gl_GETOPT_SUBSTITUTE is expanded from...
> glm4/argp.m4:7: gl_ARGP is expanded from...
> configure.ac:47: gl_INIT is expanded from...
> configure.ac:921: the top level
> ...

Here is a proposed patch that should fix all 11 problems. The dependencies
to gl_GETADDRINFO and gl_SAVE_CWD can be removed, since the module dependencies
already ensure the macros get called. For the other 9 cases, invoking
instead of requiring the macro is the solution.

Jim, is this OK to commit (mostly your territory)?

2007-01-23  Bruno Haible  <address@hidden>

        Don't AC_REQUIRE autoconf macros that invoke AC_LIBOBJ. See
        <http://lists.gnu.org/archive/html/bug-gnulib/2006-10/msg00279.html>.
        * m4/argp.m4 (gl_ARGP): Invoke, don't require, gl_GETOPT_SUBSTITUTE.
        * m4/canon-host.m4 (gl_PREREQ_CANON_HOST): Don't require
        gl_GETADDRINFO.
        * m4/fts.m4 (gl_FUNC_FTS, gl_FUNC_FTS_LGPL): Invoke, don't require,
        gl_FUNC_FTS_CORE.
        (gl_FUNC_FTS_CORE): Invoke, don't require, gl_FUNC_OPENAT.
        * m4/lstat.m4 (gl_FUNC_LSTAT): Invoke, don't require,
        AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
        * m4/memcmp.m4 (gl_FUNC_MEMCMP): Invoke, don't require, AC_FUNC_MEMCMP.
        * m4/mktime.m4 (gl_FUNC_MKTIME): Invoke, don't require, AC_FUNC_MKTIME.
        * m4/openat.m4 (gl_FUNC_OPENAT): Invoke, don't require,
        gl_FUNC_FCHOWNAT.
        (gl_PREREQ_OPENAT): Don't require gl_SAVE_CWD.
        * m4/strftime.m4 (gl_FUNC_GNU_STRFTIME): Invoke, don't require,
        gl_FUNC_STRFTIME.
        * m4/strtod.m4 (gl_FUNC_STRTOD): Invoke, don't require, AC_FUNC_STRTOD.
        Reported by Ralf Wildenhues.

--- m4/argp.m4  10 Sep 2006 11:52:44 -0000      1.11
+++ m4/argp.m4  24 Jan 2007 01:45:33 -0000
@@ -1,5 +1,5 @@
-# argp.m4 serial 7
-dnl Copyright (C) 2003-2006 Free Software Foundation, Inc.
+# argp.m4 serial 8
+dnl Copyright (C) 2003-2007 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.
@@ -9,7 +9,10 @@
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_REQUIRE([gl_GETOPT_SUBSTITUTE])
+  dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt
+  dnl always.
+  gl_GETOPT_SUBSTITUTE
+  dnl Note: gl_GETOPT_SUBSTITUTE does AC_LIBOBJ(getopt), AC_LIBOBJ(getopt1).
 
   AC_CHECK_DECL([program_invocation_name],
                 [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1,
--- m4/canon-host.m4    21 Aug 2006 21:46:31 -0000      1.9
+++ m4/canon-host.m4    24 Jan 2007 01:45:33 -0000
@@ -1,5 +1,5 @@
-# canon-host.m4 serial 8
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# canon-host.m4 serial 9
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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.
@@ -11,5 +11,5 @@
 ])
 
 AC_DEFUN([gl_PREREQ_CANON_HOST], [
-  AC_REQUIRE([gl_GETADDRINFO])
+  :
 ])
--- m4/fts.m4   8 Jan 2007 21:28:13 -0000       1.11
+++ m4/fts.m4   24 Jan 2007 01:45:33 -0000
@@ -1,4 +1,4 @@
-#serial 12
+#serial 13
 dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,12 +6,12 @@
 
 AC_DEFUN([gl_FUNC_FTS],
 [
-  AC_REQUIRE([gl_FUNC_FTS_CORE])
+  gl_FUNC_FTS_CORE
 ])
 
 AC_DEFUN([gl_FUNC_FTS_LGPL],
 [
-  AC_REQUIRE([gl_FUNC_FTS_CORE])
+  gl_FUNC_FTS_CORE
 ])
 
 AC_DEFUN([gl_FUNC_FTS_CORE],
@@ -21,7 +21,7 @@
   AC_LIBOBJ([fts])
 
   dnl Prerequisites of lib/fts.c.
-  AC_REQUIRE([gl_FUNC_OPENAT])
+  gl_FUNC_OPENAT
 
   # Checks for header files.
   AC_CHECK_HEADERS_ONCE([sys/param.h])dnl
--- m4/lstat.m4 21 Aug 2006 21:46:31 -0000      1.23
+++ m4/lstat.m4 24 Jan 2007 01:45:33 -0000
@@ -1,6 +1,6 @@
-#serial 15
+#serial 16
 
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -11,7 +11,7 @@
 
 AC_DEFUN([gl_FUNC_LSTAT],
 [
-  AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
   dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat).
   :
 ])
--- m4/memcmp.m4        23 Jan 2005 08:06:57 -0000      1.15
+++ m4/memcmp.m4        24 Jan 2007 01:45:33 -0000
@@ -1,12 +1,13 @@
-# memcmp.m4 serial 11
-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# memcmp.m4 serial 12
+dnl Copyright (C) 2002, 2003, 2004, 2007 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_MEMCMP],
 [
-  AC_REQUIRE([AC_FUNC_MEMCMP])
+  AC_FUNC_MEMCMP
+  dnl Note: AC_FUNC_MEMCMP does AC_LIBOBJ(memcmp).
   if test $ac_cv_func_memcmp_working = no; then
     AC_DEFINE(memcmp, rpl_memcmp,
       [Define to rpl_memcmp if the replacement function should be used.])
--- m4/mktime.m4        19 Jan 2007 02:14:42 -0000      1.28
+++ m4/mktime.m4        24 Jan 2007 01:45:34 -0000
@@ -1,4 +1,4 @@
-#serial 11
+#serial 12
 dnl Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -211,7 +211,8 @@
 
 AC_DEFUN([gl_FUNC_MKTIME],
 [
-  AC_REQUIRE([AC_FUNC_MKTIME])
+  AC_FUNC_MKTIME
+  dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ(mktime).
   if test $ac_cv_func_working_mktime = no; then
     AC_DEFINE(mktime, rpl_mktime,
       [Define to rpl_mktime if the replacement function should be used.])
--- m4/openat.m4        24 Dec 2006 17:08:04 -0000      1.11
+++ m4/openat.m4        24 Jan 2007 01:45:34 -0000
@@ -1,7 +1,7 @@
-#serial 13
+#serial 14
 # See if we need to use our replacement for Solaris' openat et al functions.
 
-dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2005, 2006, 2007 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.
@@ -24,7 +24,7 @@
       [Define to rpl_ if the openat replacement function should be used.])
     gl_PREREQ_OPENAT;;
   esac
-  AC_REQUIRE([gl_FUNC_FCHOWNAT])
+  gl_FUNC_FCHOWNAT
 ])
 
 # gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
@@ -89,5 +89,5 @@
 
 AC_DEFUN([gl_PREREQ_OPENAT],
 [
-  AC_REQUIRE([gl_SAVE_CWD])
+  :
 ])
--- m4/strftime.m4      19 Jan 2007 02:14:42 -0000      1.39
+++ m4/strftime.m4      24 Jan 2007 01:45:34 -0000
@@ -1,4 +1,4 @@
-#serial 28
+#serial 29
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 # 2006, 2007 Free Software Foundation, Inc.
@@ -10,7 +10,8 @@
 # Written by Jim Meyering and Paul Eggert.
 
 AC_DEFUN([gl_FUNC_GNU_STRFTIME],
-[AC_REQUIRE([gl_FUNC_STRFTIME])dnl
+[
+  gl_FUNC_STRFTIME
 ])
 
 # These are the prerequisite macros for GNU's strftime.c replacement.
--- m4/strtod.m4        5 Jul 2006 23:35:19 -0000       1.7
+++ m4/strtod.m4        24 Jan 2007 01:45:34 -0000
@@ -1,12 +1,13 @@
-# strtod.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+# strtod.m4 serial 6
+dnl Copyright (C) 2002, 2003, 2006, 2007 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_STRTOD],
 [
-  AC_REQUIRE([AC_FUNC_STRTOD])
+  AC_FUNC_STRTOD
+  dnl Note: AC_FUNC_STRTOD does AC_LIBOBJ(strtod).
   if test $ac_cv_func_strtod = no; then
     AC_DEFINE(strtod, rpl_strtod,
       [Define to rpl_strtod if the replacement function should be used.])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]