Hi, I'm facing an issue with missing alloca.h + cross-compilation again:
On Sat, Oct 13, 2007 at 10:12:00PM +0200, Bruno Haible wrote: > Sylvain Beucler wrote: > > I'm cross-compiling an SDL application for i586-mingw32mscv. I > > imported the alloca module from Gnulib, as a dependency of strcasestr. > > You mean the 'alloca-opt' module, I guess? > > > When checking for SDL.h, > > > > AC_CHECK_HEADERS(SDL.h SDL_rotozoom.h SDL_framerate.h SDL_image.h, > > [], AC_MSG_ERROR([Could not find necessary SDL libs headers])) > > > > ../configure fails checking for SDL.h, because SDL.h (more exactly > > SDL_stdinc.h), seeing [HAVE_ALLOCA_H] set, tries to include <alloca.h>, > > and fails (mingw doesn't have alloca.h). > > > > How would you deal with this? > > Indeed gnulib defines HAVE_ALLOCA_H always: > > 2004-05-16 Paul Eggert <[EMAIL PROTECTED]> > > * m4/alloca.m4 (gl_FUNC_ALLOCA): Define HAVE_ALLOCA_H always, > for backward compatibility with older code. > > I think this is right. There are so many places in code which test > HAVE_ALLOCA_H. > > SDL_stdinc.h is also right: It can be used without or with gnulib. > It would be very ugly if it #included different files at configure time > than later, at build time. > > Therefore I agree with you that adding some temporary -I options to > CPPFLAGS while testing for SDL.h is the best workaround. And I did it: CPPFLAGS now includes 'gnulib/lib' (src and build dirs) during AC_CHECK_HEADERS tests. However, it seems alloca.h is not yet present at ./configure time (there's only gnulib/lib/alloca.in.h). So AC_CHECK_HEADERS fails anyway: configure:14417: checking SDL.h usability configure:14434: i586-mingw32msvc-gcc -c -g -O2 -I/usr/local/cross-tools/i386-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -I/usr/local/cross-tools/i386-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -I../gnulib/lib -I./gnulib/lib conftest.c >&5 In file included from /usr/local/cross-tools/i386-mingw32/include/SDL/SDL_main.h:26, from /usr/local/cross-tools/i386-mingw32/include/SDL/SDL.h:28, from conftest.c:117: /usr/local/cross-tools/i386-mingw32/include/SDL/SDL_stdinc.h:169:22: error: alloca.h: No such file or directory I guess I didn't clean my build directory correctly last time, I don't see how I missed alloca.h's absence. I didn't cross-compile again since then, hence why I only realize the problem now. How would you deal with this? Can we generate Gnulib's alloca.h before testing headers? Or should I just drop header tests? Thanks! -- Sylvain