On Tue, Oct 13, 2015 at 11:13:11AM -0700, Patrick Powell wrote: > I just started doing a 9.3 to 10.2 migration of a bunch of applications > and discovered that some of the options used > to generate the applications were slightly different. I just know that > this has been covered before, but I could not > find a definitive method or set of methods to use to determine if the > old GCC compiler or the new CLANG compiler > is being used. Could the ports wizards (and/or autoconf experts) help > me a bit? > > (Aside: the clang compiler diagnostics and warnings are very thorough > and quite clear. Nicely done, especially > the addition of the information about the flag to turn this warning > off. I also like the pragmas to > control warnings and the push/pop pragma facility. This may have been > in the GCC compiler but I missed it.) > > 1. If the application is to be generated via the PORT infrastructure, > what do you > put in the port Makefile to determine if CLANG (10.2) or GCC (9.3) > is being used? > > > Something like below. Note: the examples below are a bit contrived, > but the idea is to set > some MAKE variable to different values depending on CLANG or GCC in use. > > .if defined(CC_IS_CLANG) > MYFLAGS+= -Wall -Werror -Wno-error=unused > .else > .if defined(CC_IS_GCC) > MYFLAGS+= -Wall -Werror -Wno-unused > .endif > .endif
For ports, I think you are looking for USES=compiler:features (see ports/Mk/Uses/compiler.mk). I don't know the answer for autoconf. -- Brooks
signature.asc
Description: PGP signature