From: "Henrik Bach" <henrik_bach_llvm@hotmail.com>
Date: Sun, 19 Sep 2004 02:26:51 +0200Hi
On win32 the alloca function is prototyped in <malloc.h>.
The configure script checks the precence of this header file:
-----------------------
...
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
...
-----------------------Later in the configure script, it checks:
-----------------------
...
checking for working alloca.h... no
checking for alloca... yes
...
-----------------------It also checks for presence of stdlib:
-----------------------
...
checking for stdlib.h... yes
...
-----------------------This gives us these defines in llvm/Config/config.h:
-----------------------
#define HAVE_ALLOCA 1
#define HAVE_STDLIB_H 1
-----------------------On the mingw platform it results in that we get this error when compiling:
-----------------------
C:/MinGW/msys/local/src/llvm/lib/Support/FileUtilities.cpp: In function `bool
llvm::CheckMagic(const std::string&, const std::string&)':
C:/MinGW/msys/local/src/llvm/lib/Support/FileUtilities.cpp:33: error: `alloca'
undeclared (first use this function)
-----------------------I don't know whether on certain unix systems that the alloc function is prototyped in stdlib.h. But, when HAVE_STDLIB_H is set on mingw systems we get above error rather than this:
-----------------------
The function alloca() is required but not found!
-----------------------This leaves us, that we need a test in the configure script that gives us a define like:
HAVE_MALLOC_H and to rewrite llvm/Config/alloca.h to handle this define appropriately.
Sorry, HAVE_MALLOC_H *is* a valid define in llvm/Config/config.h. This leaves, that llvm/Config/alloca.h has to be fixed accordingly. I'll try to come up with a patch.
Henrik