Subject: HAVE_ variables
To: None <tech-toolchain@netbsd.org>
From: Nick Hudson <skrll@netbsd.org>
List: tech-toolchain
Date: 03/10/2004 08:38:11
I was presented with a problem recently in gnu/usr.bin/gcc3/Makefile.inc where 
the CPPFLAGS is dependent on the value of MKPIC. The complication was that 
gnu/usr.bin/gcc/frontend/Makefile defines NOPIC which meant MKPIC was set to 
"no".

A solution was suggested to me (thanks luke) along these lines:

	gnu/usr.bin/gcc/frontend/Makefile
 		NOLINKLIB=	# defined
		NOLINT=		# defined
		NOPROFILE=	# defined
 		.include <bsd.init.mk>  # for Makefile.inc && <bsd.own.mk>

		LIB=		frontend
                # [...]

		MKPIC:= no
		.include <bsd.lib.mk>
                # [...]

It seems to me that this can be avoided by introducing a new HAVE_PIC variable 
that is defined by the platform. 

	MKPIC?=	${HAVE_PIC}

Other candidates for HAVE_* variables are

	HAVE_EXTERNAL_TOOLCHAIN	replaces defined(EXTERNAL_TOOLCHAIN)
	HAVE_GCC3		already exists
	HAVE_GDB		for MKGDB
	HAVE_LINT		for MKLINT
	HAVE_PIC		for MKPIC
	HAVE_PICLIB		for MKPICLIB
	HAVE_PROFILE		for MKPROFILE
        HAVE_TOOLCHAIN		replaces TOOLCHAIN_MISSING; global
				control for stuff like GCC3, GDB, ...

Thoughts?

Nick