From 61c419d59a8f62e854e0c6834da64db4c9014401 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 23 Jan 2017 12:06:25 -0800 Subject: Pass _GNU_SOURCE as compiler argument Defining it in the file causes trouble because Meson sometimes inserts includes before the first line. --- meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 0cce4af..a1e9b80 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,6 @@ cc = meson.get_compiler('c') # Default includes when checking for presence of functions and # struct members include_default = ' -#define _GNU_SOURCE #include #include #include @@ -22,6 +21,7 @@ include_default = ' #include #include ' +args_default = [ '-D_GNU_SOURCE' ] cfg.set_quoted('PACKAGE_VERSION', meson.project_version()) @@ -31,7 +31,7 @@ test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2', 'utimensat' ] foreach func : test_funcs cfg.set('HAVE_' + func.to_upper(), - cc.has_function(func, prefix: include_default)) + cc.has_function(func, prefix: include_default, args: args_default)) endforeach cfg.set('HAVE_SETXATTR', cc.has_function('setxattr', prefix: '#include ')) @@ -41,16 +41,17 @@ cfg.set('HAVE_ICONV', # Test if structs have specific member cfg.set('HAVE_STRUCT_STAT_ST_ATIM', cc.has_member('struct stat', 'st_atim', - prefix: include_default)) + prefix: include_default, + args: args_default)) cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC', cc.has_member('struct stat', 'st_atimespec', - prefix: include_default)) + prefix: include_default, + args: args_default)) # Write the test results into config.h (stored in build directory) configure_file(output: 'config.h', configuration : cfg) - # # Compiler configuration # -- cgit v1.2.3