Re: [PATCH] Support conditional deps using "depends on X if Y"
From: Graham Roff
Date: Mon Nov 10 2025 - 23:15:57 EST
> On 11/10/25 1:15 PM, Nathan Chancellor wrote:
> > Support for this change has been expressed by a number of developers
> > since the original patch was proposed back in 2020, and has recently
> > also been raised as a patch to the Zephyr kconfig system.
>
> Do you have a link to this Zephyr Kconfig change?
Link: https://github.com/zephyrproject-rtos/Kconfiglib/pull/21
> > On Mon, Nov 10, 2025 at 10:48:59AM +0200, Jani Nikula wrote:
> >> "depends on A || !A" (or A=n) is the most common pattern in Kconfig,
> >> which literally means "depends on A if A".
> >
> > That is totally fair, I did not try to actually search for the idiom. I
> > will say I do not find that either expression in Kconfig easily
> > translates in my head to "this dependency must be built in if the symbol
> > is built in, modular if the symbol is modular, or disabled" but I guess
> > that is just lack of familiarity with these idioms. I just want it to be
> > obvious to folks writing Kconfig when something like this is appropriate
> > to use but I guess with that being the most common usage in the tree, it
> > is fine as is.
>
> I haven't tested it but it looks reasonable to me.
I will update the documentation to make the initial example
more understandable ("depends on A if B" is actually easier to follow
than the more strange "depends on A if A"). Then also add a note in the
section on Optional Dependencies about using the new "A if A" form.
>
> > I think my point about tests still stands, at least something very
> > basic.
>
> Ack.
Agree, will include tests in the updated patch.
Graham