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 **) { diff --git a/configure.json b/configure.json index 49586ed6b8..02d5f1a65e 100644 --- a/configure.json +++ b/configure.json @@ -406,11 +406,23 @@ "type": "compile", "test": "unix/posix_fallocate" }, - "alloca": { - "label": "alloca()", + "alloca_stdlib_h": { + "label": "alloca() in stdlib.h", "type": "compile", "test": "common/alloca" }, + "alloca_h": { + "label": "alloca() in alloca.h", + "type": "compile", + "test": "common/alloca", + "args": "DEFINES+=USE_ALLOCA_H" + }, + "alloca_malloc_h": { + "label": "alloca() in malloc.h", + "type": "compile", + "test": "common/alloca", + "args": "DEFINES+=USE_MALLOC_H" + }, "stack_protector": { "label": "stack protection", "type": "compilerSupportsFlag", @@ -900,9 +912,19 @@ "condition": "tests.posix_fallocate", "output": [ "privateFeature" ] }, + "alloca_h": { + "label": "alloca.h", + "condition": "tests.alloca_h", + "output": [ "privateFeature" ] + }, + "alloca_malloc_h": { + "label": "alloca() in malloc.h", + "condition": "!features.alloca_h && tests.alloca_malloc_h", + "output": [ "privateFeature" ] + }, "alloca": { "label": "alloca()", - "condition": "tests.alloca", + "condition": "features.alloca_h || features.alloca_malloc_h || tests.alloca_stdlib_h", "output": [ "privateFeature" ] }, "stack-protector-strong": { diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index bda8ad7916..0b02ecc8ec 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -68,6 +68,13 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_NO_DATASTREAM +#define QT_FEATURE_alloca 1 +#define QT_FEATURE_alloca_h -1 +#ifdef _WIN32 +# define QT_FEATURE_alloca_malloc_h 1 +#else +# define QT_FEATURE_alloca_malloc_h -1 +#endif #define QT_FEATURE_iconv -1 #define QT_FEATURE_icu -1 #define QT_FEATURE_journald -1