Bugzilla – Bug 972
1.9.6p1 uses C99 features without configuring for them
Last modified: 2021-09-11 15:59:41 MDT
sudo 1.9.6p1 (possibly also 1.9.6, but not 1.9.5p2) uses C99 features and fails to compile when built with a toolchain that defaults to C89/ANSI C. ./sendlog.c: In function 'main': ./sendlog.c:1835: error: 'for' loop initial declarations are only allowed in C99 mode ./sendlog.c:1835: note: use option -std=c99 or -std=gnu99 to compile your code Building with CFLAGS="-std=c99" fixes this. I believe configure.ac should include a call to AC_PROG_CC_C99
The configure script checks for options needed for C11 and if C11 is not supported, checks for C99 options. You should see output like this from configure: checking whether the compiler supports GNU C... yes checking whether gcc accepts -g... yes checking for gcc option to enable C11 features... unsupported checking for gcc option to enable C99 features... -std=gnu99 Can you check your configure output to see what it says for the C11 and C99 checks? It's possible this is a bug in autoconf 2.71.
This definitely does appear to be an autoconf issue of some kind. The configure script in the tarball checks for C99, but a new configure script generated after autoreconf doesn't. There are some warnings on autoreconf but no fatal errors, so I'm kind of at a loss where the issue is. This is with autoconf 2.69, for what it's worth; maybe some stanza you use requires a newer autoconf? There's actually no reason for me to be running autoreconf, since I'm not patching anything in the build system, so I won't worry about it for now.
I've bumped the autoconf minimum version in configure.ac to 2.70 which should avoid this kind of problem in the future. Some of the macros deprecated in 2.70 are required by older versions. For example, AC_PROG_CC now does the work of AC_PROG_CC_STDC.
Fixed in sudo 1.9.7