From 9d44a9a351e6c830ca18a0129bb11b3f99d53c4b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 Sep 2005 00:38:23 +0000 Subject: r10374: Add HAVE_* defines (on command-line or in config.h file) for scons + some other minor updates (This used to be commit f142c15de1afb2f13a5e23ceb40ce70f0115c8bf) --- source4/SConstruct | 26 +++++++++++++++++++++----- source4/client/SConscript | 4 ++-- source4/gtk/SConscript | 8 ++++---- source4/lib/SConscript | 20 ++++++++++++++++---- source4/lib/cmdline/SConscript | 4 ++-- source4/lib/socket_wrapper/SConscript | 11 +++++++++-- source4/param/SConscript | 6 +++--- 7 files changed, 57 insertions(+), 22 deletions(-) diff --git a/source4/SConstruct b/source4/SConstruct index a5d02038eb..1d1a945d73 100644 --- a/source4/SConstruct +++ b/source4/SConstruct @@ -7,10 +7,13 @@ # Copyright (C) 2005 Jelmer Vernooij # Published under the GNU GPL +# 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') + PathOption('prefix','installation prefix','/usr/local/samba'), + BoolOption('configh','use config.h file', 0) ) hostenv = Environment( @@ -21,6 +24,8 @@ hostenv = Environment( CPPDEFINES={'_SAMBA_BUILD_': None}, ) +hostenv.SetOption('max_drift', 1) + if hostenv['developer']: hostenv.Append(CCFLAGS='-Wall') hostenv.Append(CCFLAGS='-Wshadow') @@ -35,7 +40,8 @@ if hostenv['developer']: hostenv.Append(CCFLAGS='-Wno-format-y2k') hostenv.Append(CCFLAGS='-Wno-declaration-after-statement') - +defines = {} +Export('defines') hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5', '#heimdal/lib/hdb', '#heimdal/lib/gssapi', @@ -88,7 +94,8 @@ for h in ['sys/select.h','fcntl.h','sys/fcntl.h','sys/time.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']: - conf.CheckCHeader(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'] + \ @@ -99,7 +106,8 @@ for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \ ['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \ ['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \ ['backtrace','setbuffer','pread','pwrite']: - conf.CheckFunc(f) + if conf.CheckFunc(f): + defines['HAVE_' + f.upper()] = 1 conf.Finish() @@ -112,9 +120,17 @@ proto_files = [] Export('proto_files') SConscript( - dirs=['param','lib','torture','rpc_server','cldap_server','libcli', + dirs=['lib','torture','rpc_server','cldap_server','libcli', 'nbt_server','client','ldap_server','libnet','nsswitch','web_server', 'smbd','dsdb','heimdal_build','ntptr','kdc','smb_server','ntvfs', 'winbind','scripting','auth']) hostenv.CProtoHeader(target='include/proto.h',source=proto_files) + +if hostenv['configh']: + def create_config_h(env,target,source): + pass #FIXME + hostenv.Command('include/config.h',[],create_config_h) + hostenv.Append(CPPDEFINES = {HAVE_CONFIG_H: 1}) +else: + [hostenv.Append(CPPDEFINES = {p: defines[p]}) for p in defines] diff --git a/source4/client/SConscript b/source4/client/SConscript index 40b81e23c8..4ba6deedc5 100644 --- a/source4/client/SConscript +++ b/source4/client/SConscript @@ -1,2 +1,2 @@ -Import('hostenv') -hostenv.Program('smbclient', ['client.c']) +Import('hostenv popt_common basic talloc param') +hostenv.Program('smbclient', ['client.c',popt_common,talloc,basic,param]) diff --git a/source4/gtk/SConscript b/source4/gtk/SConscript index 97caf4db56..4c45991c86 100644 --- a/source4/gtk/SConscript +++ b/source4/gtk/SConscript @@ -3,7 +3,7 @@ gtksmb = hostenv.StaticLibrary('gtksmb', ['common/gtk-smb.c','common/select.c', 'common/gtk_events.c','common/credentials.c']) -hostenv.Program('gregedit', [gtksmb,'tools/gregedit.c']) -hostenv.Program('gepdump', [gtksmb,'tools/gepdump.c']) -hostenv.Program('gwcrontab', [gtksmb,'tools/gwcrontab.c']) -hostenv.Program('gwsam', [gtksmb,'tools/gwsam.c','tools/gwsam_user.c']) +hostenv.Program('gregedit', [gtksmb,'tools/gregedit.c',gtksmb]) +hostenv.Program('gepdump', [gtksmb,'tools/gepdump.c',gtksmb]) +hostenv.Program('gwcrontab', [gtksmb,'tools/gwcrontab.c',gtksmb]) +hostenv.Program('gwsam', [gtksmb,'tools/gwsam.c','tools/gwsam_user.c',gtksmb]) diff --git a/source4/lib/SConscript b/source4/lib/SConscript index 9c56310829..387f557932 100644 --- a/source4/lib/SConscript +++ b/source4/lib/SConscript @@ -1,13 +1,16 @@ Import('hostenv') # tastes like -*- python -*- +SConscript(dirs=['talloc','charset']) +Import('talloc dynconfig charset') + basic_files = ['version.c', 'xfile.c', 'debug.c', 'fault.c', 'signal.c', 'system.c', 'time.c', 'genrand.c', 'dprintf.c', 'util_str.c', 'util_strlist.c', 'util_unistr.c', 'util_file.c', 'data_blob.c', 'util.c', 'util_sock.c', 'substitute.c', 'fsusage.c', 'ms_fnmatch.c', 'select.c', 'mutex.c', 'idtree.c', - 'db_wrap.c', 'gendb.c', 'credentials.c'] -basic = hostenv.StaticLibrary('basic', basic_files) + 'db_wrap.c'] +basic = hostenv.StaticLibrary('basic', [dynconfig,charset,talloc,basic_files]) Export('basic') hostenv.StaticLibrary('netif', ['netif/interface.c', 'netif/netif.c']) @@ -20,5 +23,14 @@ hostenv.StaticLibrary('gencache',['gencache.c']) hostenv.StaticLibrary('pidfile',['pidfile.c']) hostenv.StaticLibrary('unix_privs',['unix_privs.c']) -SConscript(dirs=['replace','tdb','popt','cmdline','talloc','registry','charset', 'ldb','tls','samba3','socket','socket_wrapper','messaging','com','events', - 'appweb']) +SConscript(dirs=['ldb']) + +Import('ldb') +gendb = hostenv.StaticLibrary('gendb', ['gendb.c',ldb]) +Export('gendb') + +credentials = hostenv.StaticLibrary('credentials',['credentials.c',basic,gendb]) +Export('credentials') + +SConscript(dirs=['../param/','replace','tdb','popt','cmdline','registry', 'tls','samba3','socket','socket_wrapper','messaging','com','events', 'appweb']) + diff --git a/source4/lib/cmdline/SConscript b/source4/lib/cmdline/SConscript index a99a2b4892..12f4f7c11c 100644 --- a/source4/lib/cmdline/SConscript +++ b/source4/lib/cmdline/SConscript @@ -1,6 +1,6 @@ Import('hostenv') # tastes like -*- python -*- -Import('basic param') -popt_common = hostenv.StaticLibrary('popt_common',['popt_common.c',basic,param]) +Import('basic param credentials') +popt_common = hostenv.StaticLibrary('popt_common',['popt_common.c',basic,param,credentials]) Export('popt_common') diff --git a/source4/lib/socket_wrapper/SConscript b/source4/lib/socket_wrapper/SConscript index ac9e0466b2..1c0253a0d4 100644 --- a/source4/lib/socket_wrapper/SConscript +++ b/source4/lib/socket_wrapper/SConscript @@ -1,7 +1,14 @@ Import('hostenv') -hostenv.StaticLibrary('socket_wrapper',['socket_wrapper.c']) opts = Options(None, ARGUMENTS) opts.AddOptions( - BoolOption('socket-wrapper','enable socket wrapper',0) + BoolOption('socket_wrapper','enable socket wrapper',0) ) + +opts.Update(hostenv) + +if hostenv['socket_wrapper']: + hostenv.Append(CPPDEFINES = {'HAVE_SOCKET_WRAPPER': 1}) + socket_wrapper = hostenv.StaticLibrary('socket_wrapper',['socket_wrapper.c']) +else: + socket_wrapper = [] diff --git a/source4/param/SConscript b/source4/param/SConscript index a959351e90..4dfca40d4a 100644 --- a/source4/param/SConscript +++ b/source4/param/SConscript @@ -1,8 +1,8 @@ Import('hostenv') # tastes like -*- python -*- -Import('dynconfig') -param = StaticLibrary('loadparm',['loadparm.c','params.c',dynconfig]) +Import('dynconfig basic') +param = hostenv.StaticLibrary('loadparm',['loadparm.c','params.c',dynconfig,basic]) Export('param') -generic = StaticLibrary('generic',['generic.c']) +generic = hostenv.StaticLibrary('generic',['generic.c']) Export('generic') -- cgit