[libsoup/master.novcproj] meson: Define the _DEFAULT_SOURCE macro



commit ecdfc962a7d582a0084a1789e8f6d13d9d4bc7f7
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Sep 13 16:27:05 2018 +0200

    meson: Define the _DEFAULT_SOURCE macro
    
    It's needed for the gmtime_r check and also for some system types
    availability.
    
    Fixes compilation in gnome-continuous (used Ubuntu 16.04 for testing).

 meson.build | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9b0a9f14..9f603f19 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,6 @@ project('libsoup', 'c',
         default_options : 'c_std=c89')
 
 gnome = import('gnome')
-cc = meson.get_compiler('c')
 
 soup_version = meson.project_version()
 version_arr = soup_version.split('.')
@@ -20,10 +19,18 @@ libsoup_api_name = '@0@-@1@'.format(meson.project_name(), apiversion)
 
 host_system = host_machine.system()
 
+# Needed for the gmtime_r check and for some system types availability.
+default_source_flag = [
+  '-D_DEFAULT_SOURCE'
+]
+
+add_project_arguments(default_source_flag, language: 'c')
+
 common_flags = [
   '-DHAVE_CONFIG_H',
 ]
 
+cc = meson.get_compiler('c')
 # Enable extra warnings if compiler supports them.
 if cc.get_id() == 'msvc'
   common_flags += ['/FImsvc_recommended_pragmas.h']
@@ -94,7 +101,7 @@ endif
 libpsl_required_version = '>= 0.20'
 libpsl_dep = dependency('libpsl', version : libpsl_required_version)
 
-if cc.has_function('gmtime_r', prefix : '#include <time.h>', args : ['-D_POSIX_SOURCE'])
+if cc.has_function('gmtime_r', prefix : '#include <time.h>', args : default_source_flag)
     cdata.set('HAVE_GMTIME_R', '1')
 endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]