From aa7bfb48194dbac2658c65c09ca0b76480e7dd15 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 3 Dec 2021 09:22:19 +0300 Subject: [PATCH] engine: check for non-standard alloca header --- engine/common/common.c | 3 +++ wscript | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/engine/common/common.c b/engine/common/common.c index 06634937..c8baf28b 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -13,6 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#if defined( ALLOCA_H ) +#include ALLOCA_H +#endif #include "common.h" #include "studio.h" #include "xash3d_mathlib.h" diff --git a/wscript b/wscript index 7836ebf5..c283d47a 100644 --- a/wscript +++ b/wscript @@ -290,6 +290,12 @@ def configure(conf): else: conf.undefine('HAVE_TGMATH_H') + # check if we can use alloca.h or malloc.h + if conf.check_cc(header_name='alloca.h', mandatory=False): + conf.define('ALLOCA_H', 'alloca.h') + elif conf.check_cc(header_name='malloc.h', mandatory=False): + conf.define('ALLOCA_H', 'malloc.h') + # indicate if we are packaging for Linux/BSD if conf.options.PACKAGING: conf.env.LIBDIR = conf.env.BINDIR = '${PREFIX}/lib/xash3d'