diff --git a/SConstruct b/SConstruct index 1fd962b..c2fd47f 100644 --- a/SConstruct +++ b/SConstruct @@ -62,6 +62,7 @@ from mandir import autodetectMandir from clients import checkForBuildingClients from sysconfdir import checkForUserSysconfdir from sgmldoc import checkForSGMLFMT +from largefiles import enableLargeFiles conf = Configure(env,{'checkForCCOption':checkForCCOption, 'MAINTAINER_MODE':checkForMaintainerMode, @@ -100,9 +101,6 @@ SGML=conf.checkForSGMLFMT() # Portability build time config if conf.CheckFunc('srandomdev'): conf.env.Append(CPPFLAGS = '-DHAVE_SRANDOMDEV') -fseeko=conf.CheckFunc('fseeko') -if fseeko: - conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO') if conf.CheckFunc('random'): conf.env.Append(CPPFLAGS = '-DHAVE_RANDOM') if conf.CheckFunc('fork'): @@ -128,13 +126,9 @@ env.Append(CPPFLAGS = '-DSIZEOF_LONG='+conf.sizeOf("long")) env.Append(CPPFLAGS = '-DSIZEOF_SHORT='+conf.sizeOf("short")) env.Append(CPPFLAGS = '-DSIZEOF_UNSIGNED='+conf.sizeOf("unsigned")) env.Append(CPPFLAGS = '-DSIZEOF_VOID='+conf.sizeOf("void")) -offt=conf.sizeOf("off_t") -env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+offt) -if fseeko and int(offt)>=8: - conf.env.Append(CPPFLAGS = '-DNATIVE_LARGEFILES') if not conf.CheckType("union semun", "#include \n#include \n#include ",'c'): conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") - +enableLargeFiles(conf) conf.checkForLockingType(conf) if conf.checkReliableSignals(): conf.env.Append(CPPFLAGS = '-DRELIABLE_SIGNALS') diff --git a/site_scons/largefiles.py b/site_scons/largefiles.py new file mode 100644 index 0000000..1ac2a95 --- /dev/null +++ b/site_scons/largefiles.py @@ -0,0 +1,26 @@ +# +# SCons Largefile enablement +# +# Version 1.0 +# 21-Sep-2009 +# + +def enableLargeFiles(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 ') + if offt<8 and offt>0: + flags=conf.env.Dictionary()['CPPFLAGS'] + conf.env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64') + offt=conf.CheckTypeSize('off_t','#include ') + if offt < 8: + env.Replace(CPPFLAGS=flags) + conf.env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+str(offt)) + if fseeko and int(offt)>=8: + conf.env.Append(CPPFLAGS = '-DNATIVE_LARGEFILES') + rc=True + else: + rc=False + return rc