Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de58f45

Browse files
committed
apply 24979.diff
1 parent 31fbe2d commit de58f45

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

numpy/core/meson.build

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -257,37 +257,6 @@ foreach filefunc_maybe: optional_file_funcs
257257
endif
258258
endforeach
259259

260-
# Optional locale function
261-
have_strtold_l = cc.has_function('strtold_l', include_directories: inc_curdir,
262-
prefix:'''
263-
#include <stdlib.h>
264-
#include <xlocale.h>
265-
#include "feature_detection_locale.h"
266-
''')
267-
if not have_strtold_l
268-
# Retry with locale.h, seems to vary across Linux distros
269-
have_strtold_l = cc.has_function('strtold_l', include_directories: inc_curdir,
270-
prefix:'''
271-
#include <stdlib.h>
272-
#include <locale.h>
273-
#include "feature_detection_locale.h"
274-
''')
275-
endif
276-
if have_strtold_l
277-
cdata.set10('HAVE_STRTOLD_L', true)
278-
else
279-
# FIXME: this is wrong! the HAVE_ define should not exist, or it'll be
280-
# interpreted as the function being available (true/false does nothing, see
281-
# note on HAVE_ defines higher up). This is necessary though in order to make
282-
# the Linux CI job pass. So either the check is wrong somehow, or this
283-
# function is not available in CI. For the latter there is a fallback path,
284-
# but that is broken because we don't have the exact long double
285-
# representation checks.
286-
if cc.get_argument_syntax() != 'msvc'
287-
cdata.set10('HAVE_STRTOLD_L', false)
288-
endif
289-
endif
290-
291260
# Other optional functions
292261
optional_misc_funcs = [
293262
'backtrace',
@@ -305,7 +274,7 @@ endforeach
305274
# SSE headers only enabled automatically on amd64/x32 builds
306275
optional_headers = [
307276
'features.h', # for glibc version linux
308-
'xlocale.h', # see GH#8367
277+
'xlocale.h', # removed in glibc 2.26, but may still be useful - see gh-8367
309278
'dlfcn.h', # dladdr
310279
'execinfo.h', # backtrace
311280
'libunwind.h', # backtrace for LLVM/Clang using libunwind
@@ -317,6 +286,19 @@ foreach header: optional_headers
317286
endif
318287
endforeach
319288

289+
# Optional locale function - GNU-specific
290+
_strtold_prefix = '''
291+
#define _GNU_SOURCE
292+
#include <locale.h>
293+
#include <stdlib.h>
294+
'''
295+
if cdata.get('HAVE_XLOCALE_H', 0) == 1
296+
_strtold_prefix += '#include <xlocale.h>'
297+
endif
298+
if cc.has_function('strtold_l', include_directories: inc_curdir, prefix: _strtold_prefix)
299+
cdata.set10('HAVE_STRTOLD_L', true)
300+
endif
301+
320302
# Optional compiler attributes
321303
# TODO: this doesn't work with cc.has_function_attribute, see
322304
# https://github.com/mesonbuild/meson/issues/10732

numpy/core/src/common/numpyos.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
#include "npy_pycompat.h"
1313

14+
#if defined(HAVE_STRTOLD_L) && !defined(_GNU_SOURCE)
15+
# define _GNU_SOURCE
16+
#endif
1417
#include <locale.h>
1518
#include <stdio.h>
1619

0 commit comments

Comments
 (0)