diff options
author | mdejong <mdejong> | 2003-01-25 12:48:12 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2003-01-25 12:48:12 (GMT) |
commit | 758234180a856302c7aa063a7fbb6cb06145cd56 (patch) | |
tree | 218e72ad308897b4b323ce9ce00ba395738f37c9 /win/configure.in | |
parent | f9b9d749cefde03a0e20c3fe82fd51cb3298e0f0 (diff) | |
download | tcl-758234180a856302c7aa063a7fbb6cb06145cd56.zip tcl-758234180a856302c7aa063a7fbb6cb06145cd56.tar.gz tcl-758234180a856302c7aa063a7fbb6cb06145cd56.tar.bz2 |
* win/configure:
* win/configure.in: Define HAVE_ALLOCA_GCC_INLINE
when we detect that no alloca function is found
in malloc.h and we are compiling with GCC.
Remove HAVE_NO_ALLOC_DECL define.
* win/tclWin32Dll.c (TclpCheckStackSpace):
Don't define alloca as a cdecl function.
Doing this caused a tricky runtime bug because
the _alloca function expects the size argument
to be passed in a register and not on the stack.
To fix this problem, we use inline ASM when
compiling with gcc to invoke _alloca with the
size argument loaded into a register.
Diffstat (limited to 'win/configure.in')
-rw-r--r-- | win/configure.in | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/win/configure.in b/win/configure.in index 0b99959..16591e6 100644 --- a/win/configure.in +++ b/win/configure.in @@ -3,7 +3,7 @@ # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.63 2003/01/24 08:04:28 mdejong Exp $ +# RCS: @(#) $Id: configure.in,v 1.64 2003/01/25 12:48:12 mdejong Exp $ AC_INIT(../generic/tcl.h) AC_PREREQ(2.13) @@ -196,6 +196,13 @@ fi # Check to see if malloc.h is missing the alloca function # declaration. This is known to be a problem with Mingw. +# If we compiled without the function declaration, it +# would work but we would get a warning message from gcc. +# If we add the function declaration ourselves, it +# would not compile correctly because the _alloca +# function expects the argument to be passed in a +# register and not on the stack. Instead, we just +# call it from inline asm code. AC_CACHE_CHECK(for alloca declaration in malloc.h, tcl_cv_malloc_decl_alloca, @@ -211,12 +218,12 @@ AC_TRY_COMPILE([ tcl_cv_malloc_decl_alloca=yes, tcl_cv_malloc_decl_alloca=no) ) -if test "$tcl_cv_malloc_decl_alloca" = "no" ; then - AC_DEFINE(HAVE_NO_ALLOC_DECL, 1, - [Defined when alloca decl is missing from malloc.h]) +if test "$tcl_cv_malloc_decl_alloca" = "no" && + test "${GCC}" = "yes" ; then + AC_DEFINE(HAVE_ALLOCA_GCC_INLINE, 1, + [Defined when gcc should use inline ASM to call alloca.]) fi - #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- |