Subject: Re: need a C++ compiler? (was: CVS commit: pkgsrc)
To: Alan Barrett <apb@cequrux.com>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 02/03/2004 03:53:33
On Tue, Feb 03, 2004 at 12:52:18AM +0200, Alan Barrett wrote:
> On Mon, 02 Feb 2004, Alan Barrett wrote:
> > If you want just the first word from ${CC}, then why not use ${CC:[1]}?
>
> [Answer: because that doesn't work in all versions of make that we care
> about.]
>
> OK, here's something that should work in a version of make that has :C///1
> and :M, even if it does not have :[] or :C///W.
>
> ${CC:C/^xyzzy//:C/^/xyzzy/1:Mxyzzy*:C/^xyzzy//}
>
> Unlike ${CC:C/^-.*//}, the above should work with things like
>
> CC= /some/path/cc -foo bar
>
> It should even work if some word other than the first word of $CC begins
> with xyzzy, but it will not work if the first word begins with xyzzy,
> or if any other word begins with xyzzyxyzzy.
Yes, I've been using this trick in buildlink[23] to get the name of
the command to search for in the PATH.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>