summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-24 17:38:12 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:38 +1000
commit24511472a344749f67fd90ca5c7e76d6c290f93a (patch)
tree4a263de48e9dff990cc2182ef3a913853363bc18
parent07eeed33f63754b4fa4ab629e52e423b04b59bb6 (diff)
downloadsamba-24511472a344749f67fd90ca5c7e76d6c290f93a.tar.gz
samba-24511472a344749f67fd90ca5c7e76d6c290f93a.tar.bz2
samba-24511472a344749f67fd90ca5c7e76d6c290f93a.zip
build: DEFUN->DEFINE, and fixed CFLAGS handling
-rw-r--r--lib/replace/wafsamba.py50
-rw-r--r--lib/replace/wscript24
-rw-r--r--source4/wscript7
3 files changed, 62 insertions, 19 deletions
diff --git a/lib/replace/wafsamba.py b/lib/replace/wafsamba.py
index 80190f3904..a836eed86d 100644
--- a/lib/replace/wafsamba.py
+++ b/lib/replace/wafsamba.py
@@ -29,7 +29,7 @@ def runonce(function):
# m4 files
@runonce
@conf
-def DEFUN(conf, d, v):
+def DEFINE(conf, d, v):
conf.define(d, v, quote=False)
conf.env.append_value('CCDEFINES', d + '=' + str(v))
@@ -56,7 +56,18 @@ def CHECK_TYPE_IN(conf, t, hdr):
@conf
def CHECK_TYPE(conf, t, alternate):
if not conf.check(type_name=t, header_name=conf.env.hlist):
- conf.DEFUN(t, alternate)
+ conf.DEFINE(t, alternate)
+
+@conf
+def CHECK_VARIABLE(conf, v):
+ hdrs=''
+ for h in conf.env.hlist:
+ hdrs += '#include <%s>\n' % h
+ if conf.check(fragment=
+ '%s\nint main(void) {void *_x; _x=(void *)&%s; return 0;}\n' % (hdrs, v),
+ execute=0,
+ msg="Checking for variable %s" % v):
+ conf.DEFINE('HAVE_%s' % v.upper(), 1)
@runonce
def CHECK_FUNC(conf, f):
@@ -69,6 +80,14 @@ def CHECK_FUNCS(conf, list):
CHECK_FUNC(conf, f)
+#################################################
+# return True if a configuration option was found
+@conf
+def CONFIG_SET(conf, option):
+ return (option in conf.env) and (conf.env[option] != ())
+Build.BuildContext.CONFIG_SET = CONFIG_SET
+
+
###########################################################
# check that the functions in 'list' are available in 'library'
# if they are, then make that library available as a dependency
@@ -117,7 +136,21 @@ def CONFIG_PATH(conf, name, default):
# add some CFLAGS to the command line
@conf
def ADD_CFLAGS(conf, flags):
- conf.env.append_value('CCFLAGS', flags.split())
+ if not 'EXTRA_CFLAGS' in conf.env:
+ conf.env['EXTRA_CFLAGS'] = []
+ conf.env['EXTRA_CFLAGS'].extend(flags.split())
+
+
+##############################################################
+# work out the current flags. local flags are added first
+def CURRENT_CFLAGS(bld, cflags):
+ if not 'EXTRA_CFLAGS' in bld.env:
+ list = []
+ else:
+ list = bld.env['EXTRA_CFLAGS'];
+ ret = cflags.split()
+ ret.extend(list)
+ return ret
################################################################
@@ -362,7 +395,7 @@ def SAMBA_LIBRARY(bld, libname, source_list,
include_list='.',
public_headers=None,
vnum=None,
- cflags=None,
+ cflags='',
autoproto=None):
if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
return
@@ -612,12 +645,19 @@ def SAMBA_SUBSYSTEM(bld, modname, source_list,
include_list='.',
public_headers=None,
autoproto=None,
- cflags=None,
+ cflags='',
+ group='main',
+ config_option=None,
init_function_sentinal=None):
if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
return
+ # if the caller specifies a config_option, then we create a blank
+ # subsystem if that configuration option was found at configure time
+ if (config_option is not None) and bld.CONFIG_SET(config_option):
+ source_list = ''
+
# remember empty subsystems, so we can strip the dependencies
if (source_list == '') or (source_list == []):
LOCAL_CACHE_SET(bld, 'EMPTY_TARGETS', modname, True)
diff --git a/lib/replace/wscript b/lib/replace/wscript
index ee7965f12d..06ea09d564 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -36,9 +36,9 @@ def configure(conf):
conf.env['RPATH_ON_INSTALL'] = Options.options.enable_rpath
- conf.DEFUN('_GNU_SOURCE', 1)
- conf.DEFUN('_XOPEN_SOURCE_EXTENDED', 1)
- conf.DEFUN('LIBREPLACE_NETWORK_CHECKS', 1)
+ conf.DEFINE('_GNU_SOURCE', 1)
+ conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1)
+ conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
conf.CHECK_HEADERS('unistd.h sys/types.h stdlib.h stdio.h stddef.h')
conf.CHECK_HEADERS('ctype.h locale.h acl/libacl.h compat.h')
@@ -63,10 +63,10 @@ def configure(conf):
conf.CHECK_HEADERS('resolv.h libintl.h')
if 'HAVE_STDDEF_H' in conf.env and 'HAVE_STDLIB_H' in conf.env:
- conf.DEFUN('STDC_HEADERS', 1)
+ conf.DEFINE('STDC_HEADERS', 1)
if 'HAVE_SYS_TIME_H' in conf.env and 'HAVE_TIME_H' in conf.env:
- conf.DEFUN('TIME_WITH_SYS_TIME', 1)
+ conf.DEFINE('TIME_WITH_SYS_TIME', 1)
conf.define('SHLIBEXT', "so", quote=True)
@@ -102,8 +102,9 @@ def configure(conf):
conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull')
conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memmem printf memset memcpy')
conf.CHECK_FUNCS('connect gethostbyname if_nametoindex socketpair')
- conf.CHECK_FUNCS('inet_ntoa inet_ntop dirfd getdirentries getdents syslog')
- conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs inet_aton inet_atop crypt')
+ conf.CHECK_FUNCS('inet_ntoa inet_aton inet_ntop inet_pton')
+ conf.CHECK_FUNCS('dirfd getdirentries getdents syslog')
+ conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs crypt')
conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl')
conf.CHECK_FUNCS_IN('poptGetContext', 'popt')
@@ -188,10 +189,11 @@ def build(bld):
'replace')
NET_SOURCES = []
- if not 'HAVE_INET_NTOA' in bld.env: NET_SOURCES.append('inet_ntoa.c')
- if not 'HAVE_INET_ATON' in bld.env: NET_SOURCES.append('inet_aton.c')
- if not 'HAVE_INET_ATOP' in bld.env: NET_SOURCES.append('inet_atop.c')
- if not 'HAVE_SOCKETPAIR' in bld.env: NET_SOURCES.append('socketpair.c')
+ if bld.CONFIG_SET('HAVE_INET_NTOA'): NET_SOURCES.append('inet_ntoa.c')
+ if bld.CONFIG_SET('HAVE_INET_ATON'): NET_SOURCES.append('inet_aton.c')
+ if bld.CONFIG_SET('HAVE_INET_NTOP'): NET_SOURCES.append('inet_ntop.c')
+ if bld.CONFIG_SET('HAVE_INET_PTON'): NET_SOURCES.append('inet_pton.c')
+ if bld.CONFIG_SET('HAVE_SOCKETPAIR'): NET_SOURCES.append('socketpair.c')
bld.SAMBA_SUBSYSTEM('LIBREPLACE_NETWORK', NET_SOURCES)
diff --git a/source4/wscript b/source4/wscript
index 16f49ad040..211f30b157 100644
--- a/source4/wscript
+++ b/source4/wscript
@@ -9,14 +9,15 @@ def set_options(opt):
opt.recurse(LIBLDB_DIR)
def configure(conf):
- conf.DEFUN('_SAMBA_BUILD_', 4)
+ conf.DEFINE('_SAMBA_BUILD_', 4)
conf.sub_config(LIBREPLACE_DIR)
conf.sub_config(LIBLDB_DIR)
+ conf.sub_config('heimdal_build')
- conf.DEFUN('CONFIG_H_IS_FROM_SAMBA', 1)
+ conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
conf.ADD_CFLAGS('-I.. -I../lib -I../../lib -I../.. -I../include -Idefault/source4')
conf.ADD_CFLAGS('-I../../lib/socket_wrapper -I../../lib/talloc -I../../lib/replace -I../../lib/tevent')
conf.ADD_CFLAGS('-I../heimdal_build -I../heimdal/lib/krb5 -I../heimdal/lib/asn1 -I../heimdal/lib/com_err -I -I../heimdal/lib/hx509 -I../heimdal/lib/roken -I../heimdal/lib/hx509 -I../heimdal/lib/asn1 -I../heimdal/lib/hcrypto -I../heimdal/lib -I../heimdal/lib/hcrypto/imath -I../heimdal/lib/wind')
- conf.DEFUN('HAVE_KRB5', 1)
+
conf.SAMBA_CONFIG_H('include/config.h')