From owner-freebsd-ports@freebsd.org Tue Oct 13 21:31:49 2015 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C318A12A71 for ; Tue, 13 Oct 2015 21:31:49 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E3D98DA for ; Tue, 13 Oct 2015 21:31:48 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 8E05D5A9F12; Tue, 13 Oct 2015 21:31:41 +0000 (UTC) Date: Tue, 13 Oct 2015 21:31:41 +0000 From: Brooks Davis To: Patrick Powell Cc: FreeBSD Ports ML Subject: Re: 9.3 to 10.2 migration, determining if clang is used Message-ID: <20151013213141.GE9354@spindle.one-eyed-alien.net> References: <561D49B7.9070900@astart.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZInfyf7laFu/Kiw7" Content-Disposition: inline In-Reply-To: <561D49B7.9070900@astart.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 21:31:49 -0000 --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--