From f4854dbcde1e8a9e8862cc183b2fbad870022cc3 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 29 Jul 2025 08:57:53 +0500 Subject: [PATCH] public: wscript: parallelize libc extension checks for faster reconfigure --- public/wscript | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/public/wscript b/public/wscript index e3cda663..3840b7b0 100644 --- a/public/wscript +++ b/public/wscript @@ -106,25 +106,33 @@ def configure(conf): conf.export_define('ALLOCA_H', '') conf.export_define('STDINT_H', '' if conf.simple_check(HEADER_TEST % 'stdint.h', 'stdint.h') else '') - conf.export_define('HAVE_TGMATH_H', conf.simple_check(TGMATH_H_TEST, 'tgmath.h', use='M werror export')) # save some time on Windows, msvc is too slow # these calls must be available with both msvc and mingw if conf.env.DEST_OS == 'win32': + conf.export_define('HAVE_TGMATH_H', conf.simple_check(TGMATH_H_TEST, 'tgmath.h', use='M werror export')) conf.export_define('HAVE_STRNICMP') conf.export_define('HAVE_STRICMP') else: - # TODO: multicheck for speed - def check_libc_extension(frag, msg, define): - conf.export_define(define, conf.simple_check(frag, msg, use='werror export')) + exports_list = [] - check_libc_extension(STRNCASECMP_TEST, 'strncasecmp', 'HAVE_STRNCASECMP') - check_libc_extension(STRCASECMP_TEST, 'strcasecmp', 'HAVE_STRCASECMP') - check_libc_extension(STRCASESTR_TEST, 'strcasestr', 'HAVE_STRCASESTR') - check_libc_extension(STRCHRNUL_TEST, 'strchrnul', 'HAVE_STRCHRNUL') - check_libc_extension(STRLCPY_TEST, 'strlcpy', 'HAVE_STRLCPY') - check_libc_extension(STRLCAT_TEST, 'strlcat', 'HAVE_STRLCAT') - check_libc_extension(STRNLEN_TEST, 'strnlen', 'HAVE_STRNLEN') + def check_libc_extension(frag, msg, define): + exports_list.append(define) + return {'fragment': frag, 'msg': 'Checking for ' + msg, 'define_name': define, 'mandatory': False, 'use': 'M werror export'} + + conf.multicheck( + check_libc_extension(TGMATH_H_TEST, 'tgmath.h', 'HAVE_TGMATH_H'), + check_libc_extension(STRNCASECMP_TEST, 'strncasecmp', 'HAVE_STRNCASECMP'), + check_libc_extension(STRCASECMP_TEST, 'strcasecmp', 'HAVE_STRCASECMP'), + check_libc_extension(STRCASESTR_TEST, 'strcasestr', 'HAVE_STRCASESTR'), + check_libc_extension(STRCHRNUL_TEST, 'strchrnul', 'HAVE_STRCHRNUL'), + check_libc_extension(STRLCPY_TEST, 'strlcpy', 'HAVE_STRLCPY'), + check_libc_extension(STRLCAT_TEST, 'strlcat', 'HAVE_STRLCAT'), + check_libc_extension(STRNLEN_TEST, 'strnlen', 'HAVE_STRNLEN'), + ) + + for export in exports_list: + conf.export_define(export) # kill temporary uselib del conf.env.DEFINES_export