gnulib-tool-py
[Top][All Lists]
Advanced

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

Re: [gnulib-tool-py] Dependencies with different conditions


From: Bruno Haible
Subject: Re: [gnulib-tool-py] Dependencies with different conditions
Date: Sat, 07 Jul 2012 18:10:07 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

> as I've understood we need to store three things for each module:
> 1) module itself (namely module 1);
> 2) condition on which it is added (if module 1 was specified by user or
> it is an unconditional dependency, its condition is None);
> 3) parent of module, which is a module too (if module 1 was specified by
> user, then its parent is None).

Incorrect.

Ad tertium.
There is no such thing as a "parent" of a module, when the
transitive closure algorithm implicitly creates a Directed Acyclic Graph [1]
(not a Tree [2]!).

For example, say, module M was given on the command line. M depends on A and B.
module A depends on D with condition cond_A_D,
and module B depends on D, with condition cond_B_D.

Then D has no "parent" - because is included by way of A or B, and there
is no sense in saying that A or B is the "parent" and ignoring the other
one.

You don't even need to store the fact that D was triggered by way of A or B.
The generation of the .m4 and .am files does not need this.

Ad secundum.
There is, in theory, a formula which tells the condition under which a
module is needed, in absolute terms. For example, in the case above,
M depends on A with condition cond_M_A,
M depends on B with condition cond_M_B,
module A depends on D with condition cond_A_D,
module B depends on D, with condition cond_B_D,
the condition for D is
  { cond_M_A && cond_A_D; } || { cond_M_B && cond_B_D; }
These are complex formulas, which get the more complicated the longer
the deependency chain gets.

But there is no need to keep track of these conditions in gnulib-tool,
fortunately. The only thing that it needs to store, regarding module D, is
  - from A to D - condition cond_A_D,
  - from B to D - condition cond_B_D.
Because the program flow through the configure file that gets generated
in the end implicitly will obey the complex condition. All we need to
make sure is to put the (small) cond_A_D, cond_B_D strings into the .m4
file at the right place when generating it.

Please read again section 2 here:
http://lists.gnu.org/archive/html/gnulib-tool-py/2012-06/msg00028.html

Bruno

[1] http://en.wikipedia.org/wiki/Directed_acyclic_graph
[2] http://en.wikipedia.org/wiki/Tree_%28graph_theory%29




reply via email to

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