# # SCons Largefile enablement # # Version 1.4 # 08-Jul-2024 # def enableLargeFiles(check,conf): """Tries to enable 64-bit off_t on linux platform""" fseeko=conf.CheckFunc('fseeko') if fseeko: conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO') offt=conf.CheckTypeSize('off_t','#include \n#include ') ulong=conf.CheckTypeSize('unsigned long') if fseeko and offt<8 and offt>0: # we have off_t but its not 8 byte long saved_flags=conf.env.Dictionary()['CPPFLAGS'] # we try to use some defs to make off_t longer conf.env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64') offt=conf.CheckTypeSize('off_t','#include \n#include ') if offt < 8: env.Replace(CPPFLAGS=saved_flags) if not fseeko: # no fseeko we do not need off_t for anything offt = 0 check.Message("Checking for effective size of off_t ... ") check.Result(str(offt)+" bytes") conf.env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+str(offt)) check.Message("Checking if we have native large files ... ") if fseeko and int(offt)>=8 and int(ulong)>=8: conf.env.Append(CPPFLAGS = '-DNATIVE_LARGEFILES') rc=True else: rc=False check.Result(rc)