[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_CC: how to distinguish clang from gcc?
From: |
David A. Wheeler |
Subject: |
Re: AC_PROG_CC: how to distinguish clang from gcc? |
Date: |
Fri, 5 Feb 2021 11:40:47 -0500 |
> On Feb 5, 2021, at 9:51 AM, Todd C. Miller <Todd.Miller@sudo.ws> wrote:
>
> 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?
I would *discourage* trying to figure out if a C compiler is gcc or clang.
Instead, create separate detectors for whatever you’re looking for.
The gcc & clang groups coordinate with each other; they try to provide the same
flags & API for the same functionality, and occasionally copy from each other.
So trying to detect “do this if GCC” is generally wrong; clang may have that
interface & functionality
when someone compiles the code.
--- David A. Wheeler
- Re: Weird behaviour about system types, (continued)
- Re: Weird behaviour about system types, Nick Bowler, 2021/02/04
- Re: Weird behaviour about system types, Sébastien Hinderer, 2021/02/04
- Re: Weird behaviour about system types, Nick Bowler, 2021/02/04
- Re: Weird behaviour about system types, Sébastien Hinderer, 2021/02/05
- AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Todd C. Miller, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, David A . Wheeler, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clang from gcc?,
David A. Wheeler <=
- Re: AC_PROG_CC: how to distinguish clang from gcc?, Russ Allbery, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clang from gcc?, Sébastien Hinderer, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Russ Allbery, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Russ Allbery, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/09
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Paul Eggert, 2021/02/08