From d191c7d9932b8e8ad96c4345a6ceca67326806ac Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 21 Sep 2005 05:39:18 +0000 Subject: r10377: Save configuration stuff to sconf.cache so it isn't annoyingly run at every single build. Run 'scons configure=1' or delete sconf.cache to force checks to be re-run. Jelmer, I think this stuff is cached in the .sconf_cache directory but the message is still displayed and it looks like it caches the compiled test object file not the actual result of the test. (This used to be commit 9d001dc083937bbf5642af90bc8a8b1a27825de0) --- source4/SConstruct | 93 +++++++++++++++++++++++++++--------------- source4/auth/SConscript | 7 ++-- source4/lib/ldb/SConscript | 13 +++--- source4/lib/popt/SConscript | 10 +++-- source4/lib/replace/SConscript | 13 +++--- source4/lib/tls/SConscript | 7 ++-- source4/librpc/SConscript | 3 +- 7 files changed, 92 insertions(+), 54 deletions(-) diff --git a/source4/SConstruct b/source4/SConstruct index 9a219bf036..58f2640d09 100644 --- a/source4/SConstruct +++ b/source4/SConstruct @@ -7,13 +7,16 @@ # Copyright (C) 2005 Jelmer Vernooij # Published under the GNU GPL +import cPickle + # We don't care about NFS builds... opts = Options(None, ARGUMENTS) opts.AddOptions( BoolOption('developer','enable developer flags', 0), PathOption('prefix','installation prefix','/usr/local/samba'), - BoolOption('configh','use config.h file', 0) + BoolOption('configh','use config.h file', 0), + BoolOption('configure','run configure checks', False), ) hostenv = Environment( @@ -40,7 +43,25 @@ if hostenv['developer']: hostenv.Append(CCFLAGS='-Wno-format-y2k') hostenv.Append(CCFLAGS='-Wno-declaration-after-statement') -defines = {} +# Store configuration data in a dictionary. + +def saveconfig(data): + """Save configuration dict to a file.""" + cached = cPickle.dump(data, open('sconf.cache', 'w')) + +def loadconfig(): + """Load configuration dict from a file.""" + try: + return cPickle.load(open('sconf.cache', 'r')) + except IOError: + return None + +defines = loadconfig() + +if defines == None: + hostenv['configure'] = 1 + defines = {} + Export('defines') hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5', @@ -80,36 +101,39 @@ paths = { Export('paths') -conf = hostenv.Configure() -for h in ['sys/select.h','fcntl.h','sys/fcntl.h','sys/time.h'] + \ - ['utime.h','grp.h','sys/id.h','limits.h','memory.h'] + \ - ['compat.h','math.h','sys/param.h','ctype.h','sys/wait.h'] + \ - ['sys/resource.h','sys/ioctl.h','sys/ipc.h','sys/mode.h'] + \ - ['sys/mman.h','sys/filio.h','sys/priv.h','sys/shm.h','string.h'] + \ - ['strings.h','stdlib.h','sys/vfs.h','sys/fs/s5param.h','sys/filsys.h'] + \ - ['termios.h','termio.h','fnmatch.h','pwd.h','sys/termio.h'] + \ - ['sys/time.h','sys/statfs.h','sys/statvfs.h','stdarg.h'] + \ - ['security/pam_modules.h','security/_pam_macros.h','dlfcn.h'] + \ - ['sys/syslog.h','syslog.h','stdint.h','inttypes.h','locale.h'] + \ - ['shadow.h','nss.h','nss_common.h','ns_api.h','sys/security.h'] + \ - ['security/pam_appl.h','sys/capability.h','syscall.h','sys/syscall.h'] + \ - ['sys/acl.h']: - if conf.CheckCHeader(h): - defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1 - -for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \ - ['strndup','strnlen','strerror','chroot','bzero','memset','strlcpy'] + \ - ['strlcat','memmove','vsnprintf','snprintf','asprintf','vasprintf'] + \ - ['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask'] + \ - ['sigblock','sigaction','innetgr','setnetgrent','getnetgrent'] + \ - ['endnetgrent','initgroups','setgroups','sysconf','mktime','rename'] + \ - ['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \ - ['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \ - ['backtrace','setbuffer','pread','pwrite']: - if conf.CheckFunc(f): - defines['HAVE_' + f.upper()] = 1 - -conf.Finish() +if hostenv['configure']: + + conf = hostenv.Configure() + + for h in ['sys/select.h','fcntl.h','sys/fcntl.h','sys/time.h'] + \ + ['utime.h','grp.h','sys/id.h','limits.h','memory.h'] + \ + ['compat.h','math.h','sys/param.h','ctype.h','sys/wait.h'] + \ + ['sys/resource.h','sys/ioctl.h','sys/ipc.h','sys/mode.h'] + \ + ['sys/mman.h','sys/filio.h','sys/priv.h','sys/shm.h','string.h'] + \ + ['strings.h','stdlib.h','sys/vfs.h','sys/fs/s5param.h','sys/filsys.h'] + \ + ['termios.h','termio.h','fnmatch.h','pwd.h','sys/termio.h'] + \ + ['sys/time.h','sys/statfs.h','sys/statvfs.h','stdarg.h'] + \ + ['security/pam_modules.h','security/_pam_macros.h','dlfcn.h'] + \ + ['sys/syslog.h','syslog.h','stdint.h','inttypes.h','locale.h'] + \ + ['shadow.h','nss.h','nss_common.h','ns_api.h','sys/security.h'] + \ + ['security/pam_appl.h','sys/capability.h','syscall.h','sys/syscall.h'] + \ + ['sys/acl.h']: + if conf.CheckCHeader(h): + defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1 + + for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \ + ['strndup','strnlen','strerror','chroot','bzero','memset','strlcpy'] + \ + ['strlcat','memmove','vsnprintf','snprintf','asprintf','vasprintf'] + \ + ['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask'] + \ + ['sigblock','sigaction','innetgr','setnetgrent','getnetgrent'] + \ + ['endnetgrent','initgroups','setgroups','sysconf','mktime','rename'] + \ + ['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \ + ['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \ + ['backtrace','setbuffer','pread','pwrite']: + if conf.CheckFunc(f): + defines['HAVE_' + f.upper()] = 1 + + conf.Finish() [dynenv.Append(CPPDEFINES = {p: '\\"%s\\"' % paths[p]}) for p in paths] @@ -127,6 +151,11 @@ SConscript( hostenv.CProtoHeader(target='include/proto.h',source=proto_files) +# Save configuration + +if hostenv['configure']: + saveconfig(defines) + if hostenv['configh']: def create_config_h(env,target,source): pass #FIXME diff --git a/source4/auth/SConscript b/source4/auth/SConscript index 34cff89bb3..557690cfdb 100644 --- a/source4/auth/SConscript +++ b/source4/auth/SConscript @@ -7,9 +7,10 @@ hostenv.StaticLibrary('auth_domain.c') hostenv.StaticLibrary('auth_developer.c') hostenv.StaticLibrary('auth_unix.c') -conf = hostenv.Configure() -have_pam = conf.CheckLibWithHeader('pam', 'security/pam_appl.h', 'c', 'pam_start') -conf.Finish() +if hostenv['configure']: + conf = hostenv.Configure() + have_pam = conf.CheckLibWithHeader('pam', 'security/pam_appl.h', 'c', 'pam_start') + conf.Finish() hostenv.StaticLibrary('pam_errors.c') hostenv.StaticLibrary('auth',['auth.c','auth_util.c','auth_sam_reply.c','ntlm_check.c']) diff --git a/source4/lib/ldb/SConscript b/source4/lib/ldb/SConscript index 1079a441d8..b726d0ebc9 100644 --- a/source4/lib/ldb/SConscript +++ b/source4/lib/ldb/SConscript @@ -1,5 +1,6 @@ Import('hostenv') Import('talloc') +Import('defines') hostenv.StaticLibrary('modules/timestamps.c') hostenv.StaticLibrary('modules/rdn_name.c') @@ -7,12 +8,14 @@ hostenv.StaticLibrary('modules/schema.c') hostenv.StaticLibrary('ldb_ildap/ldb_ildap.c') hostenv.StaticLibrary('modules/ldb_map.c') -conf = Configure(hostenv) -have_sqlite3 = conf.CheckLibWithHeader("sqlite3","sqlite3.h",'c',"sqlite3_open()") -have_popt = conf.CheckLibWithHeader("popt","popt.h",'c',"poptGetArgs(NULL);") -conf.Finish() +if hostenv['configure']: + conf = Configure(hostenv) + if conf.CheckLibWithHeader("sqlite3","sqlite3.h",'c',"sqlite3_open()"): + defines['HAVE_SQLITE3'] = 1 + conf.CheckLibWithHeader("popt","popt.h",'c',"poptGetArgs(NULL);") + conf.Finish() -if have_sqlite3: +if defines.has_key('HAVE_SQLITE3'): hostenv.StaticLibrary('ldb_sqlite3/ldb_sqlite3.c') hostenv.StaticLibrary('ldb_tdb', diff --git a/source4/lib/popt/SConscript b/source4/lib/popt/SConscript index 78496e7e1a..85f9c9b7e0 100644 --- a/source4/lib/popt/SConscript +++ b/source4/lib/popt/SConscript @@ -1,9 +1,11 @@ -Import('hostenv') # tastes like -*- python -*- +Import('hostenv') + -conf = hostenv.Configure() -conf.env['HAVE_EXTERNAL_POPT'] = conf.CheckLibWithHeader('popt', 'popt.h', 'c', 'poptGetArgs(NULL);') -conf.Finish() +if hostenv['configure']: + conf = hostenv.Configure() + conf.env['HAVE_EXTERNAL_POPT'] = conf.CheckLibWithHeader('popt', 'popt.h', 'c', 'poptGetArgs(NULL);') + conf.Finish() popt = hostenv.StaticLibrary('popt', ['findme.c','popt.c','poptconfig.c','popthelp.c','poptparse.c']) Export('popt') diff --git a/source4/lib/replace/SConscript b/source4/lib/replace/SConscript index b63b544f8a..84088db162 100644 --- a/source4/lib/replace/SConscript +++ b/source4/lib/replace/SConscript @@ -1,11 +1,12 @@ Import('hostenv') -conf = Configure(hostenv) -#FIXME: conf.CheckBrokenInetNtoa() -for f in ['strtoull','__strtoull','strtouq','strtoll','__strtoll','strtoq', - 'seteuid','setresuid','setegid','setresgid']: - conf.CheckFunc(f,'c') -conf.Finish() +if hostenv['configure']: + conf = Configure(hostenv) + #FIXME: conf.CheckBrokenInetNtoa() + for f in ['strtoull','__strtoull','strtouq','strtoll','__strtoll','strtoq', + 'seteuid','setresuid','setegid','setresgid']: + conf.CheckFunc(f,'c') + conf.Finish() hostenv.StaticLibrary('repdir', ['repdir/repdir.c']) hostenv.StaticLibrary('replace', ['replace.c', 'snprintf.c']) diff --git a/source4/lib/tls/SConscript b/source4/lib/tls/SConscript index 3b1a1d7d4e..941955e9e3 100644 --- a/source4/lib/tls/SConscript +++ b/source4/lib/tls/SConscript @@ -1,6 +1,7 @@ Import('hostenv') hostenv.StaticLibrary('tls', ['tls.c', 'tlscert.c']) -conf = hostenv.Configure() -conf.CheckLibWithHeader('gnutls', 'gnutls/gnutls.h', 'c', 'gnutls_global_init()') -conf.Finish() +if hostenv['configure']: + conf = hostenv.Configure() + conf.CheckLibWithHeader('gnutls', 'gnutls/gnutls.h', 'c', 'gnutls_global_init()') + conf.Finish() diff --git a/source4/librpc/SConscript b/source4/librpc/SConscript index be33ad44ad..4de611dfc9 100644 --- a/source4/librpc/SConscript +++ b/source4/librpc/SConscript @@ -12,7 +12,7 @@ hostenv.StaticLibrary('rpc_base', 'rpc/dcerpc_sock.c']) - +''' [SUBSYSTEM::NDR_AUDIOSRV] INIT_FUNCTION = dcerpc_audiosrv_init INIT_OBJ_FILES = librpc/gen_ndr/ndr_audiosrv.o @@ -631,3 +631,4 @@ REQUIRED_SUBSYSTEMS = RPC_EJS_ECHO RPC_EJS_MISC RPC_EJS_SAMR RPC_EJS_SECURITY \ RPC_EJS_INITSHUTDOWN # End SUBSYSTEM RPC_EJS ################################################ +''' -- cgit