From 98c1d516b7f7624f7fcd7b9046783e3903a6a42b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Apr 2017 13:27:43 +0200 Subject: alloca: detect whether alloca.h exists We can't depend on QT_HAS_INCLUDE for such an important functionality in QtQml, so detect at configure time. alloca() is not a POSIX function (it apparently first appeared in Version 32V AT&T UNIX), so the actual header that defines it varies from system to system. Clearly, if alloca.h exists, that's the one, so we try it first. On most other systems that don't define it, it's in stdlib.h. The only exception is Windows, where it's actually defined in malloc.h. Task-number: QTBUG-59700 Started-by: Thiago Macieira Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4b2b389a4684e Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- config.tests/common/alloca/alloca.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'config.tests/common') diff --git a/config.tests/common/alloca/alloca.cpp b/config.tests/common/alloca/alloca.cpp index d839b381ef..500bdb9ba2 100644 --- a/config.tests/common/alloca/alloca.cpp +++ b/config.tests/common/alloca/alloca.cpp @@ -37,10 +37,17 @@ ** ****************************************************************************/ -#include - +#if defined(USE_ALLOCA_H) +# include +# ifdef __QNXNTO__ // extra include needed in QNX7 to define NULL for the alloca() macro -#include +# include +# endif +#elif defined(USE_MALLOC_H) +# include +#else +# include +#endif int main(int, char **) { -- cgit v1.2.3