From ba547e3895397e3710e7eb14faafbabbd7e3a077 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 20 Nov 2021 21:24:56 +0100 Subject: [PATCH] Configure feature test macros in meson Refs #2807 Co-authored-by: RipleyTom --- app/meson.build | 12 ++++++++++-- app/src/compat.h | 7 ------- app/src/sys/win/process.c | 3 --- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/meson.build b/app/meson.build index 4894babc..befe1658 100644 --- a/app/meson.build +++ b/app/meson.build @@ -39,16 +39,26 @@ src = [ 'src/util/tick.c', ] +conf = configuration_data() + if host_machine.system() == 'windows' src += [ 'src/sys/win/file.c', 'src/sys/win/process.c', ] + conf.set('_WIN32_WINNT', '0x0600') + conf.set('WINVER', '0x0600') else src += [ 'src/sys/unix/file.c', 'src/sys/unix/process.c', ] + conf.set('_POSIX_C_SOURCE', '200809L') + conf.set('_XOPEN_SOURCE', '700') + conf.set('_GNU_SOURCE', true) + if host_machine.system() == 'darwin' + conf.set('_DARWIN_C_SOURCE', true) + endif endif v4l2_support = host_machine.system() == 'linux' @@ -128,8 +138,6 @@ if host_machine.system() == 'windows' dependencies += cc.find_library('ws2_32') endif -conf = configuration_data() - foreach f : check_functions if cc.has_function(f) define = 'HAVE_' + f.underscorify().to_upper() diff --git a/app/src/compat.h b/app/src/compat.h index 92b0c43f..32759c01 100644 --- a/app/src/compat.h +++ b/app/src/compat.h @@ -1,13 +1,6 @@ #ifndef COMPAT_H #define COMPAT_H -#define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 -#define _GNU_SOURCE -#ifdef __APPLE__ -# define _DARWIN_C_SOURCE -#endif - #include "config.h" #include diff --git a/app/src/sys/win/process.c b/app/src/sys/win/process.c index 6566b80e..326a3d99 100644 --- a/app/src/sys/win/process.c +++ b/app/src/sys/win/process.c @@ -1,6 +1,3 @@ -// -#define _WIN32_WINNT 0x0600 // For extended process API - #include "util/process.h" #include