aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-01-23 12:06:25 -0800
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-01-23 12:06:25 -0800
commit61c419d59a8f62e854e0c6834da64db4c9014401 (patch)
tree602616e79eb47cb094348f486c3d842780150993 /meson.build
parent4f1a929fed98173f35da2d95263037c921a7ff6e (diff)
Pass _GNU_SOURCE as compiler argument
Defining it in the file causes trouble because Meson sometimes inserts includes before the first line.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build11
1 files changed, 6 insertions, 5 deletions
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 <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -22,6 +21,7 @@ include_default = '
#include <sys/stat.h>
#include <fcntl.h>
'
+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 <sys/xattr.h>'))
@@ -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
#