Re: [PATCH] Documentation: kbuild: explain handling optional dependencies

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

 



On Wed, Sep 13, 2023, at 22:34, Nicolas Schier wrote:
> On Wed, Sep 13, 2023 at 09:55:36PM +0200 Arnd Bergmann wrote:

>>    config FOO
>> -       bool "Support for foo hardware"
>> +       tristate "Support for foo hardware"
>>         depends on BAR || !BAR
>
> ah, thanks, tristate kconfig symbols are really more interesting.  But I am
> still not sure, whether this works as proposed:
>
> With the 'config FOO' above and
>
>   config BAR
>   	tristate "Support for bar feature"
>
> kconfig allows me to choose between these:
>
> BAR=y  => FOO={N/m/y}
> BAR=m  => FOO={N/m}
> BAR=n  => FOO={N/m/y}
>
> But with
>
>   config FOO
>   	tristate "Support for foo hardware"
>   	depends on !BAR=m
>
> I can choose between:
>
> BAR=y  => FOO={N/m/y}
> BAR=m  => FOO is not selectable
> BAR=n  => FOO={N/m/y}

That is indeed the point: if BAR=m, we want to be able to pick FOO=m
here, otherwise it is impossible to enabled everything as modules.

Another correct way to express the same thing as the first would
be 

config FOO
      tristate "Support for foo hardware"
      depends on !BAR=m || m

which I find even more confusing than the 'BAR || !BAR'
convention, though we have that in a couple of places.

I just found another variant that I had not seen before:

> (Re-checked with BAR=IPV6 and FOO=WIREGUARD; CONFIG_WIREGUARD as 'depends on
> IPV6 || !IPV6' in its kconfig definition, and both are tristate kconfig
> symbols.)
>
> Thus, it seems to me, that the intuitive way is the way forward (and several
> Kconfigs are out-of-date with regard to 'depends on !X=m'.  Or do I still miss
> your point?

I'm not sure what you mean here, but it appears that one of us
is missing the point ;-)

      Arnd



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux