[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proto patch for circular dependencies
From: |
Akim Demaille |
Subject: |
Proto patch for circular dependencies |
Date: |
11 Oct 2000 11:46:12 +0200 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
Hi!
This is only a proto patch, it's not really ready. I present it here
mainly to get some feedback, I need help to finalize it. First of
all, here is the patch at work:
/tmp % cat configure.in nostromo 11:43
AC_INIT
AC_PROG_CC
/tmp % ace nostromo 11:43
autoconf: warning: --macrodir is obsolete, use --autoconf-dir
configure.in:2: AC_REQUIRE: circular dependency of AC_LANG_COMPILER(C)
configure.in:2: AC_LANG_COMPILER(C) is required by...
configure.in:2: AC_LANG_COMPILER_REQUIRE is expanded from...
configure.in:2: AC_LINK_IFELSE is expanded from...
configure.in:2: AC_PROG_CC is expanded from...
configure.in:2: AC_LANG_COMPILER(C) is expanded from...
configure.in:2: AC_LANG_COMPILER(C) is required by...
configure.in:2: AC_LANG_COMPILER_REQUIRE is expanded from...
configure.in:2: AC_LINK_IFELSE is expanded from...
configure.in:2: AC_PROG_CC is expanded from...
configure.in:2: the top level
/tmp % cat configure.in nostromo Err 1
AC_DEFUN([TOTO], [AC_REQUIRE([TOTO])])
AC_INIT
TOTO
/tmp % ace nostromo 11:43
autoconf: warning: --macrodir is obsolete, use --autoconf-dir
configure.in:3: AC_REQUIRE: circular dependency of TOTO
configure.in:3: TOTO is required by...
configure.in:3: TOTO is expanded from...
configure.in:3: the top level
I'd like to improve the quality of the presentation, but when I try, I
actually lose information. If you find some means to improve it...
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.563
diff -u -r1.563 acgeneral.m4
--- acgeneral.m4 2000/10/02 13:11:28 1.563
+++ acgeneral.m4 2000/10/11 09:32:16
@@ -497,6 +497,8 @@
# The prologue for Autoconf macros.
define([_AC_DEFUN_PRO],
[AC_PROVIDE([$1])dnl
+pushdef([_AC_EXPANSION_STACK], [$1 is expanded from...])dnl
+pushdef([_AC_EXPANDING($1)], [$1])dnl
ifdef([_AC_DIVERT_DUMP],
[AC_DIVERT_PUSH(defn([_AC_DIVERT_DIVERSION]))],
[define([_AC_DIVERT_DUMP], defn([_AC_DIVERT_DIVERSION]))dnl
@@ -513,6 +515,8 @@
ifelse(_AC_DIVERT_DUMP, _AC_DIVERT_DIVERSION,
[undivert(_AC_DIVERT([PREPARE]))dnl
undefine([_AC_DIVERT_DUMP])])dnl
+popdef([_AC_EXPANSION_STACK])dnl
+popdef([_AC_EXPANDING($1)])dnl
])
@@ -562,6 +566,17 @@
[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
+# _AC_REQUIRE_STACK_DUMP(NAME-TO-CHECK)
+# -------------------------------------
+define([_AC_EXPANSION_STACK_DUMP],
+[ifdef([_AC_EXPANSION_STACK],
+ [m4_errprint([ ]defn([_AC_EXPANSION_STACK]))dnl
+popdef([_AC_EXPANSION_STACK])dnl
+_AC_EXPANSION_STACK_DUMP()],
+ [m4_errprint([ the top level])dnl
+m4exit(1)])])
+
+
# _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
# ------------------------------------------
# If NAME-TO-CHECK has never been expanded (actually, if it is not
@@ -591,8 +606,13 @@
# `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
# it passes to `AC_LANG_COMPILER(C)'.
define([_AC_REQUIRE],
-[ifndef([_AC_DIVERT_DUMP],
- [AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl
+[pushdef([_AC_EXPANSION_STACK],
+ [$1 is required by...])dnl
+ifdef([_AC_EXPANDING($1)],
+ [m4_errprint([AC_REQUIRE: circular dependency of $1])dnl
+_AC_REQUIRE_STACK_DUMP()])dnl
+ifndef([_AC_DIVERT_DUMP],
+ [AC_FATAL([AC_REQUIRE: cannot be used outside of an AC_DEFUN'd macro])])dnl
AC_PROVIDE_IFELSE([$1],
[],
[AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl
@@ -603,6 +623,7 @@
[],
[AC_DIAGNOSE([syntax],
[$1 is AC_REQUIRE'd but is not AC_DEFUN'd])])dnl
+popdef([_AC_EXPANSION_STACK])dnl
])
Index: libm4.m4
===================================================================
RCS file: /cvs/autoconf/libm4.m4,v
retrieving revision 1.23
diff -u -r1.23 libm4.m4
--- libm4.m4 2000/09/28 14:26:51 1.23
+++ libm4.m4 2000/10/11 09:32:16
@@ -276,16 +276,43 @@
regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))],
[$3])])
+
# m4_do(STRING, ...)
# ------------------
# This macro invokes all its arguments (in sequence, of course). It is
# useful for making your macros more structured and readable by dropping
# unecessary dnl's and have the macros indented properly.
-
define([m4_do],
[ifelse($#, 0, [],
$#, 1, [$1],
[$1[]m4_do(m4_shift($@))])])
+
+
+# _m4_dumpdefs_up(NAME)
+# -----------------
+define([_m4_dumpdefs_up],
+[ifdef([$1],
+ [pushdef([_m4_dumpdefs], defn([$1]))dnl
+dumpdef([$1])dnl
+popdef([$1])dnl
+_m4_dumpdefs_up([$1])])])
+
+
+# _m4_dumpdefs_down(NAME)
+# -----------------
+define([_m4_dumpdefs_down],
+[ifdef([_m4_dumpdefs],
+ [pushdef([$1], defn([_m4_dumpdefs]))dnl
+popdef([_m4_dumpdefs])dnl
+_m4_dumpdefs_down([$1])])])
+
+
+# m4_dumpdefs(NAME)
+# -----------------
+define([m4_dumpdefs],
+[_m4_dumpdefs_up([$1])dnl
+_m4_dumpdefs_down([$1])])
+
## --------------------- ##
## Implementing m4 loops ##
- Proto patch for circular dependencies,
Akim Demaille <=
- Re: Proto patch for circular dependencies, Alexandre Oliva, 2000/10/11
- Re: Proto patch for circular dependencies, Akim Demaille, 2000/10/12
- Re: Proto patch for circular dependencies, Alexandre Oliva, 2000/10/12
- Re: Proto patch for circular dependencies, Akim Demaille, 2000/10/12
- Re: Proto patch for circular dependencies, Alexandre Oliva, 2000/10/12
- Re: Proto patch for circular dependencies, Akim Demaille, 2000/10/12
- Re: Proto patch for circular dependencies, Alexandre Oliva, 2000/10/12
- Re: Proto patch for circular dependencies, Pavel Roskin, 2000/10/12
- Re: Proto patch for circular dependencies, Akim Demaille, 2000/10/13