[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_PROG_CC: how to distinguish clnag from gcc?

From: Todd C. Miller
Subject: Re: AC_PROG_CC: how to distinguish clnag from gcc?
Date: Fri, 05 Feb 2021 07:51:15 -0700

On Fri, 05 Feb 2021 15:42:28 +0100, =?utf-8?Q?S=C3=A9bastien?= Hinderer wrote:

> It seems AC_PROG_CC wrongly believes clang is gcc and that may cause problems
> when clang is passed a warning which is only supposrted by gcc, as is
> the case e.g. for -Wno-stringop-truncation.

clang also defines __GNUC__ and the related defines, which is why
it is identified as gcc.

> Is there a recommended way to determine for sure from a configure script
> whether the detected C compiler is clang or gcc?

You need to test whether the specific warning flag is supported by
the compiler.  These flags also vary based on gcc version so this
is not a problem specific to clang.  I like to use AX_CHECK_COMPILE_FLAG
for this, see:

 - todd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]