Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Oct 2015 21:31:41 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        Patrick Powell <papowell@astart.com>
Cc:        FreeBSD Ports ML <freebsd-ports@freebsd.org>
Subject:   Re: 9.3 to 10.2 migration, determining if clang is used
Message-ID:  <20151013213141.GE9354@spindle.one-eyed-alien.net>
In-Reply-To: <561D49B7.9070900@astart.com>
References:  <561D49B7.9070900@astart.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ZInfyf7laFu/Kiw7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=
=20
> and discovered that some of the options used
> to generate the applications were slightly different.   I just know that=
=20
> this has been covered before,  but I could not
> find a definitive method or set of methods to use to determine if the=20
> old GCC compiler or the new CLANG compiler
> is being used.   Could the ports wizards (and/or autoconf experts) help=
=20
> me a bit?
>
> (Aside:  the clang compiler diagnostics and warnings are very thorough=20
> and quite clear.  Nicely done, especially
> the addition of the information about the flag to turn this warning=20
> off.  I also like the pragmas to
> control warnings and the push/pop pragma facility.  This may have been=20
> in the GCC compiler but I missed it.)
>=20
> 1. If the application is to be generated via the PORT infrastructure, =20
> what do you
>      put in the port Makefile to determine if CLANG (10.2) or GCC (9.3)=
=20
> is being used?
>=20
>=20
>     Something like below.  Note: the examples below are a bit contrived,=
=20
> but the idea is to set
>     some MAKE variable to different values depending on CLANG or GCC in u=
se.
>=20
>     .if defined(CC_IS_CLANG)
>     MYFLAGS+=3D -Wall -Werror -Wno-error=3Dunused
>     .else
>     .if defined(CC_IS_GCC)
>     MYFLAGS+=3D -Wall -Werror -Wno-unused
>     .endif
>     .endif

For ports, I think you are looking for USES=3Dcompiler:features (see
ports/Mk/Uses/compiler.mk).  I don't know the answer for autoconf.

-- Brooks

--ZInfyf7laFu/Kiw7
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJWHXg8AAoJEKzQXbSebgfAZyYH/3D0pPlkCibkdgdtrlDi1SFT
gcVwjpCSVcBc1sMeIYzA13NdOIlbiVI2004eo+04QFTt++jrIai6UmlvrU3Fkj1F
4QsxYQYhw2DtYZIp67kDdSEuT9bClHuAw4f255oTxH14gs6OHWdtkkoEq1MRpcL/
llL5aIcErZ8u9rJgupMdr8OhLjXyvF6NaR4qPBKp8kzLKA357Ci3accNC1Mbl9qO
EvEqAzwqhkDsUPLkhvYKdzwGqb+lZFDvz6MgH1mibyyh84dh1me263JaGrj7n0EO
BgC5FtBb0ImJfy1wHQ86ATh+xuBZpz+6SEQ7ya8pXVvOqJv7CDfylQpJMoPfr50=
=I50k
-----END PGP SIGNATURE-----

--ZInfyf7laFu/Kiw7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151013213141.GE9354>