Re: Use $CC instead of gcc

Jeffrey Walton <[email protected]> Fri, 3 Apr 2015 12:12:25 -0400
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <CAH8yC8k5cviqbB8Gy_hhPMtry997ZD3BoYNu=L8Qq7uyEvM8fA@mail.gmail.com>
> Note that "$CC -dumpversion" produces the value "4.2.1"
> when used with any version of the clang compiler, presumably
> on the grounds that clang understands code somewhat similarly
> to gcc 4.2.1.

They also define __GNUC__. Its really annoying behavior at times
because Clang can't consume the same set of programs that GCC can. For
example, you can't build Asterisk with Clang because the project uses
trampolines.

> ... but the user may have changed this, so assuming "gcc" is any
> particular compiler is not very reliable and you should be
> consistent in always using $CC.

Yes. I regularly test against Intel's ICC/ICPC, too. ICC/ICPC is a
good test case because it produces the fastest code of all the
compilers. Its also ruthless about removing undefined behavior.

Intel offers a free academic license at
https://software.intel.com/en-us/articles/non-commercial-software-development.

On Thu, Apr 2, 2015 at 11:50 PM, Ryan Schmidt <[email protected]> wrote:
> In MacPorts we have for years used this patch for the tools/ccopts.sh script:
>
> https://trac.macports.org/browser/trunk/dports/devel/cryptlib/files/patch-tools-ccopts.sh.diff?rev=85985
>
> It just replaces a hardcoded invocation of "gcc" with "$CC". In MacPorts we want to be in control of what compiler is used, and for cryptlib we do this by specifying the CC environment variable when running make, which has the desired effect everywhere but this one line of this one script.
>
> CC may need to be set to a default value such as "gcc" earlier in this script, as is already done in the companion script ccopts-crosscompile.sh.
>
> Note that "$CC -dumpversion" produces the value "4.2.1" when used with any version of the clang compiler, presumably on the grounds that clang understands code somewhat similarly to gcc 4.2.1. I see you already have code earlier in this file to detect whether clang is being used, however this line with "gcc" was still being run. On recent OS X versions, where clang is the only compiler, "gcc" is usually a symlink to "clang", but the user may have changed this, so assuming "gcc" is any particular compiler is not very reliable and you should be consistent in always using $CC.
>

_______________________________________________
Cryptlib mailing list
[email protected] via Mail: [email protected]
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.