Re: kconfig/build question..

From: Adrian Bunk
Date: Tue Nov 09 2004 - 21:14:28 EST

On Wed, Nov 10, 2004 at 01:16:10AM +0000, Dave Airlie wrote:
> I've come across something that I'm not sure Kconfig can do but I'll
> explain what I need and see what others can come up with...
> The DRM has a weak dependency on AGP, it does not require AGP for all
> situations but can use it in most...
> So what I want to do and what I think Kbuild can't do is:
> if CONFIG_AGP=n then CONFIG_DRM can be n,m,y
> if CONFIG_AGP=m then CONFIG_DRM can be m but not y
> if CONFIG_AGP=y then CONFIG_DRM can be m,y

The second case is bad because enabling a module shouldn't change the
static parts of the kernel [1].

Let me suggest a slightly different solution:

I assume a "weak dependency" dependency means you can enable some AGP
specific code in the DRM code?

config DRM_AGP
depends on ((DRM = "m" && AGP) || (DRM = "y" && AGP = "y"))
default y

In the DRM code, you #ifdef CONFIG_DRM_AGP the AGP specific code.

This way, CONFIG_AGP=m and CONFIG_DRM=y is a legal configuration but
doesn't enable the AGP specific code in the DRM code.

> Dave.


[1] yes, this isn't always true in the current kernel


"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at