]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: try to always use 64bit time support on glibc
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 16 Apr 2023 07:11:41 +0000 (09:11 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 22 Dec 2023 20:23:22 +0000 (21:23 +0100)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
meson.build
meson_options.txt

index 3992846ae5b1d75ca7df0ee29562b4ef4b4166e0..5007ceb2abeed61f23578bf43dd15ee4bd1158ab 100644 (file)
@@ -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 <time.h>')
+if have < 8
+  add_global_arguments('-D_TIME_BITS=64', language : 'c')
+  have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
+  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)
index a60f7bdb4f989ebe417751c2248ec8ada5bcc474..5555f50d4b0a294f91ed297be651d7bc2aa4a5b8 100644 (file)
@@ -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',