@@ -257,37 +257,6 @@ foreach filefunc_maybe: optional_file_funcs
257
257
endif
258
258
endforeach
259
259
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
-
291
260
# Other optional functions
292
261
optional_misc_funcs = [
293
262
' backtrace' ,
@@ -305,7 +274,7 @@ endforeach
305
274
# SSE headers only enabled automatically on amd64/x32 builds
306
275
optional_headers = [
307
276
' 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
309
278
' dlfcn.h' , # dladdr
310
279
' execinfo.h' , # backtrace
311
280
' libunwind.h' , # backtrace for LLVM/Clang using libunwind
@@ -317,6 +286,19 @@ foreach header: optional_headers
317
286
endif
318
287
endforeach
319
288
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
+
320
302
# Optional compiler attributes
321
303
# TODO: this doesn't work with cc.has_function_attribute, see
322
304
# https://github.com/mesonbuild/meson/issues/10732
0 commit comments