[LLVMdev] Need for HAVE_MALLOC_H and a rewrite of../Config/alloca.h to handle this define

Henrik Bach henrik_bach_llvm at hotmail.com
Sat Sep 18 17:26:51 PDT 2004


Hi

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.

Henrik

_________________________________________________________________
Få alle de nye og sjove ikoner med MSN Messenger http://messenger.msn.dk/




More information about the llvm-dev mailing list