Re: IS_BUILTIN vs USE_BUILTIN

Thomas Klausner <[email protected]>
Newsgroups gmane.os.netbsd.devel.packages
Message-ID <[email protected]>
On Fri, Aug 14, 2026 at 07:52:09AM +0100, Greg Troxel wrote:
> I'm finding confusion in the builtin scheme, specifically looking at
> expat.
> 
> There is
> 
>   IS_BUILTIN.expat
>   USE_BUILTIN.expat
> 
> As I understand from mk/, IS_BUILTIN is about whether there is some
> implementation of expat in the base system, *regardless of whether it is
> good enough*.
>
> Then, USE_BUILTIN should be set to yes if expat's builtin.mk decides
> that the base version is good enough.

I think that's correct.

> However textproc/expat/builtin.mk seems to check if IS_BUILTIN is not
> set, and then set it conditionally.

It sets it to 'yes' or 'no' to avoid having to look for the relevant
header each time this file is parsed.

> My question is:
> 
>   Is IS_BUILTIN supposed to include "good enough" and USE_BUILTIN
>   supposed to include "PREFER machinery says use it"?
> 
> or is the good enough check supposed to be in IS_BUILTIN?

I think you misunderstood the IS_BUILTIN code in expat/builtin.mk (or
I misunderstood your question).

BUILTIN_FIND_HEADERS_VAR:=      H_EXPAT
BUILTIN_FIND_HEADERS.H_EXPAT=   expat.h

.include "../../mk/buildlink3/bsd.builtin.mk"
...
.if !defined(IS_BUILTIN.expat)
.  if empty(H_EXPAT:M__nonexistent__)
IS_BUILTIN.expat=       yes
.  else
IS_BUILTIN.expat=       no
.  endif
.endif

The H_EXPAT variable contains a path to expat.h when
../../mk/buildlink3/bsd.builtin.mk is done, and IS_BUILTIN.expat is
just a yes-no variable saying if such a header was found or not.
 Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.