On 2020-07-16, Ross Burton <invalid.nore...@gnu.org> wrote: [...]] > libSDL2 fails to configure with autoconf 2.70 but works with 2.69: > > | checking for size_t... yes > | checking for M_PI in math.h... ../SDL2-2.0.12/configure: line 13202: CPP: > command not found > | checking how to run the C preprocessor... gcc -E > | ../SDL2-2.0.12/configure: line 13328: ac_fn_c_try_cpp: command not found > | ../SDL2-2.0.12/configure: line 13328: ac_fn_c_try_cpp: command not found > | configure: error: in > `/home/pokybuild/yocto-worker/qemux86-64/build/build/tmp/work/x86_64-linux/libsdl2-native/2.0.12-r0/build': > | configure: error: C preprocessor "gcc -E" fails sanity check > | See `config.log' for more details > | WARNING: exit code 1 from a shell command. > > The configure.ac is just a very badly named macro: > > AC_CHECK_DEFINE(M_PI, math.h) > > Which is implemented here: > > https://github.com/spurious/SDL-mirror/blob/master/acinclude/ac_check_define.m4 > > This uses AC_EGREP_CPP but it doesn't appear to explicitly look for a cpp. > My workaround is to explicltly call AC_PROG_CPP earlier: should AC_EGREP_CPP > be doing this, or should this requirement be documented?
This is a classic M4 quoting bug. The macro should quote the third argument to AC_CACHE_CHECK (and really, should quote all the arguments). The problem is that diversions do not work properly during arugment collection so AC_REQUIRE (which depends on diversions) and many other macros will not work properly if it is expanded during argument collection. Quote the arguments to AC_CACHE_CHECK and the prerequisite macros will get expanded in the correct order. (also WTF is with that stray AC_DEFINE outside of the macro definition?) Cheers, Nick