From: Thomas Weißschuh Date: Sun, 16 Apr 2023 07:11:41 +0000 (+0200) Subject: meson: try to always use 64bit time support on glibc X-Git-Tag: v2.40-rc1~47^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a31f4c4f47219f1e2c1c970efbcc069bf5986b67;p=thirdparty%2Futil-linux.git meson: try to always use 64bit time support on glibc Signed-off-by: Thomas Weißschuh --- diff --git a/meson.build b/meson.build index 3992846ae5..5007ceb2ab 100644 --- a/meson.build +++ b/meson.build @@ -681,6 +681,19 @@ int main(void) { have = cc.compiles(code, name : 'using tzname[]') conf.set('HAVE_TZNAME', have ? 1 : false) +have = cc.sizeof('time_t', prefix : '#include ') +if have < 8 + add_global_arguments('-D_TIME_BITS=64', language : 'c') + have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include ') + if have < 8 + if get_option('allow-32bit-time') + warning('Could not make time_t 64bits wide') + else + error('Could not make time_t 64bits wide') + endif + endif +endif + socket_libs = [] if not cc.has_function('socket') socket_libs += cc.find_library('socket', required : true) diff --git a/meson_options.txt b/meson_options.txt index a60f7bdb4f..5555f50d4b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -201,6 +201,8 @@ option('pg-bell', description : 'should pg ring the bell on invalid keys?') option('colors-default', type: 'boolean', value: true, description: 'Enables colorized output from utils by default') +option('allow-32bit-time', type: 'boolean', value: false, + description: 'Allow 32bit time_t type') option('fs-search-path', type : 'string',