From: Thomas Weißschuh Date: Fri, 23 Feb 2024 07:15:32 +0000 (+0100) Subject: meson: run compiler checks with -D_GNU_SOURCE when necessary X-Git-Tag: v2.42-start~516^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1eeabbb42649f8334b6330689fec54325591fe2f;p=thirdparty%2Futil-linux.git meson: run compiler checks with -D_GNU_SOURCE when necessary Through the addition of default_options: c_std=c99 some build-time checks were incorrect. Explicitly add -D_GNU_SOURCE where necessary. Fixes: 6240e4458cdf ("build: use -std=c99 and -std=c++11 by default") Signed-off-by: Thomas Weißschuh --- diff --git a/meson.build b/meson.build index 307c23654..ffa959b40 100644 --- a/meson.build +++ b/meson.build @@ -462,7 +462,9 @@ conf.set10('HAVE_STRSIGNAL_DECL', have) have = cc.sizeof('union semun', prefix : '#include ') > 0 conf.set('HAVE_UNION_SEMUN', have ? 1 : false) -have = cc.has_type('loff_t', prefix : '#include ') +have = cc.has_type('loff_t', + args : '-D_GNU_SOURCE', + prefix : '#include ') conf.set('HAVE_LOFF_T', have ? 1 : false) have = cc.compiles(''' @@ -646,6 +648,7 @@ have_ddfd = cc.has_member('DIR', 'dd_fd', conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false) have = cc.has_member('struct tm', 'tm_gmtoff', + args : '-D_GNU_SOURCE', prefix : ''' #include #include @@ -662,6 +665,7 @@ have = cc.has_member('struct termios', 'c_line', conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false) have = cc.has_member('struct stat', 'st_mtim.tv_nsec', + args : '-D_GNU_SOURCE', prefix : '#include ') conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false) @@ -671,6 +675,7 @@ conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false) # replacement for AC_STRUCT_TIMEZONE have = cc.has_member('struct tm', 'tm_zone', + args : '-D_GNU_SOURCE', prefix : '#include ') conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)