public: wscript: parallelize libc extension checks for faster reconfigure

This commit is contained in:
Alibek Omarov
2025-07-29 08:57:53 +05:00
parent 25e206f5ae
commit f4854dbcde

View File

@@ -106,25 +106,33 @@ def configure(conf):
conf.export_define('ALLOCA_H', '<stdlib.h>') conf.export_define('ALLOCA_H', '<stdlib.h>')
conf.export_define('STDINT_H', '<stdint.h>' if conf.simple_check(HEADER_TEST % 'stdint.h', 'stdint.h') else '<pstdint.h>') conf.export_define('STDINT_H', '<stdint.h>' if conf.simple_check(HEADER_TEST % 'stdint.h', 'stdint.h') else '<pstdint.h>')
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 # save some time on Windows, msvc is too slow
# these calls must be available with both msvc and mingw # these calls must be available with both msvc and mingw
if conf.env.DEST_OS == 'win32': 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_STRNICMP')
conf.export_define('HAVE_STRICMP') conf.export_define('HAVE_STRICMP')
else: else:
# TODO: multicheck for speed exports_list = []
def check_libc_extension(frag, msg, define):
conf.export_define(define, conf.simple_check(frag, msg, use='werror export'))
check_libc_extension(STRNCASECMP_TEST, 'strncasecmp', 'HAVE_STRNCASECMP') def check_libc_extension(frag, msg, define):
check_libc_extension(STRCASECMP_TEST, 'strcasecmp', 'HAVE_STRCASECMP') exports_list.append(define)
check_libc_extension(STRCASESTR_TEST, 'strcasestr', 'HAVE_STRCASESTR') return {'fragment': frag, 'msg': 'Checking for ' + msg, 'define_name': define, 'mandatory': False, 'use': 'M werror export'}
check_libc_extension(STRCHRNUL_TEST, 'strchrnul', 'HAVE_STRCHRNUL')
check_libc_extension(STRLCPY_TEST, 'strlcpy', 'HAVE_STRLCPY') conf.multicheck(
check_libc_extension(STRLCAT_TEST, 'strlcat', 'HAVE_STRLCAT') check_libc_extension(TGMATH_H_TEST, 'tgmath.h', 'HAVE_TGMATH_H'),
check_libc_extension(STRNLEN_TEST, 'strnlen', 'HAVE_STRNLEN') 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 # kill temporary uselib
del conf.env.DEFINES_export del conf.env.DEFINES_export