Subject: pkgsrc and non-gcc compile flags
To: None <tech-pkg@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 03/13/2003 15:38:21
Hi,

I just realized that on some platforms ${CC} is not necessarily gcc.
Some of the flags passed to ${CC} by some packages may not work if the
compiler does not support them.  An example is archivers/bzip2.

As a quick hack around this, on IRIX I added

.include "../../mk/bsd.prefs.mk"

CCVERS!=       ${CC} --version 2>/dev/null || ${ECHO} "notgcc"

.if ${CCVERS} != "notgcc"
BZIP_CFLAGS=           -Wall -Winline -fomit-frame-pointer -fno-strength-reduce
.endif

MAKE_ENV+=             BZIP_CFLAGS="${BZIP_CFLAGS}"

to the Makefile (Irix' MIPSpro compiler does not like -Wall, for
instance), but obviously that is not the correct way.

We should determine a way to find out what kind of compiler and what
version is present or used.  In theory this might also be helpful when
fighting gcc>3.0 issues etc.

Should a proper test go into defs.<opsys>.mk or into bsd.pkg.mk?

-Jan

-- 
"`Oh dear,' says God, `I hadn't thought of  that,'  and  promptly
vanished in a puff of logic.