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.40-rc2~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7645148907592c0fb98373f07e1c887ebc9b376f;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 (cherry picked from commit 1eeabbb42649f8334b6330689fec54325591fe2f) --- diff --git a/meson.build b/meson.build index 13d78a4f4..b13c060dc 100644 --- a/meson.build +++ b/meson.build @@ -458,7 +458,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(''' @@ -642,6 +644,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 @@ -658,6 +661,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) @@ -667,6 +671,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)