Autoconf 2.72 [1] automatically checks if the compiler supports the C23
language standard with GNU extensions. This would be fine if it didn't
then go on to force that language version as default, resulting in this
in the configure log (note that I run configure on macOS with explicit
CC=clang):
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether clang accepts -g... yes
checking for clang option to enable C23 features... -std=gnu23
checking if clang -std=gnu23 accepts -std=c90... yes
^^^^^^^^^^^^^^^^
Note in the last line: evidently autoconf sets CC='clang -std=gnu23' and
I find this unhelpful. It should just leave $CC alone unless I
explicitly ask it to change it. So now I get silly compile command lines
that look like this:
/bin/sh "./libtool" --tag=CC --silent --mode=compile clang -std=gnu23 -std=c90
...
with -std=gnu23 coming from $CC and -std=c90 coming from $CFLAGS. Whilst
this doesn't change the semantics and we end up compiling as C90 anyway,
I'm worried that it might have side effects. One of them is this
harmless but unwelcome warning from configure:
==================================================================
WARNING: You have chosen to compile Subversion with a different
compiler than the one used to compile Apache.
Current compiler: clang -std=gnu23
Apache's compiler: clang
This could cause some problems.
==================================================================
Anyway, I've been looking at autoconf documentation trying to find a way
to prevent it from changing $CC like that, with no luck. If anyone has
any pointers, please let me know. I know we could always save $CC before
calling AC_PROG_CC but that could have other, worse side effects, such
as completely crippling cross-compilation.
-- Brane
[1]
https://lists.gnu.org/archive/html/autotools-announce/2023-12/msg00003.html