-
Problem report
-
Resolution: Fixed
-
Major
-
5.0.40, 5.0.41rc1, 6.0.25, 6.0.26rc1, 6.4.10, 6.4.11rc1, 7.0.0beta1
-
None
-
S24-W34/35, S24-W36/37, S24-W38/39
-
0.1
In a04e4948 (ZBX-12793), the AC_PROG_CC macro in the autoconf template (configure.ac) was given a list of specific compilers to test and prefer for compilation.
The commit message for the change reads:
Add to the main configuration script the explicit checks for cc
and c99. The cc utility is, in theory, deprecated, but it's much
more common to find than c99 in supported systems.
So add a check for both the standard commands (cc first, c99
second) and after that for the two specific compilers we test
(gcc and clang).
No changes on the usage of the CC and CFLAGS environment
and the given change lists the compilers in the following order
cc c99 gcc clang
A couple of things are wrong with this.
cc and c99, in contrast to the authors assumption, are standardized utilities, and will be present on IEEE Std 1003.1 (POSIX) compliant systems. cc is "an interface to an unspecified C-language compilation system", while c99 is an interface to a C99 standard compliant C compilation system. Although cc is marked as LEGACY, and by POSIX' advise, should not be used anymore, is often present on modern day unices and clones.
The list is evaluated in order, meaning cc is tested first, then c99, then gcc, and only then clang. The first one found wins, meaning we will virtually always end up compiling with whatever compiler cc points towards, when in reality, we prefer clang as the default compiler.
The list should be in the order of preference, with c99 and cc being used as fallbacks when all other preferred options have been exhausted.