-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 AFAIK, alloca.h is not POSIX. Here's a patch that includes alloca.h only when it's really there. It also includes malloc.h, which is where mingw-w64 defines the alloca() macro, mapping it to gcc __builtin_alloca() or to msvcrt _alloca(). - -- O< ascii ribbon - stop html email! - www.asciiribbon.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) iQEcBAEBAgAGBQJSlZK/AAoJEOs4Jb6SI2CwQDcIAKGk45RjPmcu4zwgZslFATk8 0vRxrdNmmfO+kOfd+ugh7AYkxUnD94uWVYn3uIxMu1hBXPAo1H74ItFP9TX9D3qg ELJzCN4DpZt8HlICRmCxwW9ATGop3jK8m+UPsmC2HS6QknS2rRIZOY9G5XO/O1nA yblTn6fe+avVjrGz172fAMDWtCai/UNfYL+am1MEX5nP8hHvctfZd9k+JsRMFeW9 GT9WPOuv7V7B0+AUgZB2Y5oCBkLNYUjo7Q/jsH3lESAH/lWWs/1ZLjNjQzx8f+0B CK5tRUo0k1WlGe5oPHEuIBce3spqdeR5Npsj/A1cz5sxpwxINyAfPgjJB7QiysU=Zjgt -----END PGP SIGNATURE----- -------------- next part -------------- --- opus-1.1-beta/configure.ac.orig 2013-07-31 06:27:54.930255200 +0000 +++ opus-1.1-beta/configure.ac 2013-07-31 06:28:56.746104800 +0000 @@ -99,9 +99,13 @@ AS_IF([test "$has_var_arrays" = "no"], [ AC_CHECK_HEADERS([alloca.h]) + AC_CHECK_HEADERS([malloc.h]) AC_MSG_CHECKING(for alloca) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alloca.h>]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_ALLOCA_H + #include <alloca.h> + #endif + #include <malloc.h>]], [[int foo=10; int *array = alloca(foo);]])], [ use_alloca=yes; AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
On Tue, Nov 26, 2013 at 10:35 PM, LRN <lrn1986 at gmail.com> wrote:> AFAIK, alloca.h is not POSIX. Here's a patch that includes alloca.h > only when it's really there. > It also includes malloc.h, which is where mingw-w64 defines the > alloca() macro, mapping it to gcc __builtin_alloca() or to msvcrt > _alloca().This whole path is only triggered when the compiler is unable to use C99 var arrays. Did you actually bump into this with something that can use configure? (e.g. do we have a problem with the var array test someplace)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 27.11.2013 10:40, Gregory Maxwell wrote:> On Tue, Nov 26, 2013 at 10:35 PM, LRN wrote: >> AFAIK, alloca.h is not POSIX. Here's a patch that includes >> alloca.h only when it's really there. It also includes malloc.h, >> which is where mingw-w64 defines the alloca() macro, mapping it >> to gcc __builtin_alloca() or to msvcrt _alloca(). > > This whole path is only triggered when the compiler is unable to > use C99 var arrays. Did you actually bump into this with something > that can use configure? (e.g. do we have a problem with the var > array test someplace) >I do understand that C99 var-arrays are preferred (and are available). However, i don't really remember whether alloca.h trips or doesn't trip the configure process. I came up with this patch some time ago, but didn't submit it. I also don't have a non-C99-var-array-compliant toolchain at hand to test the alloca path (well, i did try to patch configure.ac to pretend that var-arrays are not available; results were as expected - opus failed to build since [it thought] it had neither var-arrays, nor alloca()), and i don't know at which point gcc started to support var-arrays by default (without a --std=*99). [1] says it's been there since 0.9, or maybe 4.5... [1] http://gcc.gnu.org/c99status.html - -- O< ascii ribbon - stop html email! - www.asciiribbon.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) iQEcBAEBAgAGBQJSlZf5AAoJEOs4Jb6SI2CwgOsH/impg4olyM54AZRSeuYxSSuO aMdYENNi3ofFOOin9Mp6LzPe1cCKwyE9+CVfDOb9KtoKo8Jm8FLGZdc4do2iBru6 EYSaGCRXNEDtqDqLL4k25y+KT+XDOO+OrbhbqdwZXMmFEDwlz5CRo9geET5KMD4l 3H8HAvEtV3U54RXKp+lil93SdubuZCVGCfWZFryUvB/3aco7byik091kSEDqgQqa J2XEc3rBrebOQCL0+hkfo9YKXxY2fPd+ybMdJw37n2x52cvGVyNJh0DEeOB2WCXn RrnkuQsPsdSiZ1UywRWdshWi+VHjYpAL2m4acXFnk6AnPllUpY5+p+Gr90P/s6c=VoE9 -----END PGP SIGNATURE-----