summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-20 19:26:32 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:57 +1000
commitdb8115f687a5d51a7e487db5db9687c5aad1f4b3 (patch)
tree8c3f6df61704aa0486443fe96bd528d12510ac3b
parentf2f8fc440e24cf92213b33f1f913ec9beda8d46e (diff)
downloadsamba-db8115f687a5d51a7e487db5db9687c5aad1f4b3.tar.gz
samba-db8115f687a5d51a7e487db5db9687c5aad1f4b3.tar.bz2
samba-db8115f687a5d51a7e487db5db9687c5aad1f4b3.zip
build: fixed check for pthread_create()
-rw-r--r--buildtools/wafsamba/samba_autoconf.py42
-rw-r--r--lib/replace/wscript2
2 files changed, 30 insertions, 14 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 8589906dcb..01134cd26b 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -18,13 +18,20 @@ def DEFINE(conf, d, v, add_to_cflags=False):
if add_to_cflags:
conf.env.append_value('CCDEFINES', d + '=' + str(v))
-@runonce
+
def CHECK_HEADER(conf, h, add_headers=True):
'''check for a header'''
- if conf.check(header_name=h) and add_headers:
- conf.env.hlist.append(h)
+ d = 'HAVE_%s' % string.replace(h.upper(), '/', '_')
+ if CONFIG_SET(conf, d):
+ if add_headers:
+ conf.env.hlist.append(h)
+ conf.env.hlist = unique_list(conf.env.hlist)
return True
- return False
+ ret = conf.check(header_name=h)
+ if ret and add_headers:
+ conf.env.hlist.append(h)
+ conf.env.hlist = unique_list(conf.env.hlist)
+ return ret
@conf
@@ -122,23 +129,27 @@ def CHECK_DECLS(conf, vars, reverse=False, headers=None):
return ret
-@runonce
-def CHECK_FUNC(conf, f, checklink=False):
+def CHECK_FUNC(conf, f, checklink=False, header=''):
'''check for a function'''
+ hlist = conf.env.hlist[:]
+ for h in TO_LIST(header):
+ if CHECK_HEADER(conf, h, add_headers=False):
+ hlist.append(h)
define='HAVE_%s' % f.upper()
if CONFIG_SET(conf, define):
return True
if checklink:
- return CHECK_CODE(conf, '%s()' % f, execute=False, define=define)
- return conf.check(function_name=f, header_name=conf.env.hlist)
+ return CHECK_CODE(conf, 'void *x = (void *)%s' % f, execute=False, define=define)
+
+ return conf.check_cc(function_name=f, header_name=hlist)
@conf
-def CHECK_FUNCS(conf, list, checklink=False):
+def CHECK_FUNCS(conf, list, checklink=False, header=''):
'''check for a list of functions'''
ret = True
for f in TO_LIST(list):
- if not CHECK_FUNC(conf, f, checklink):
+ if not CHECK_FUNC(conf, f, checklink=checklink, header=header):
ret = False
return ret
@@ -287,10 +298,15 @@ Build.BuildContext.CONFIG_SET = CONFIG_SET
#
# optionally check for the functions first in libc
@conf
-def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False):
+def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, header=''):
remaining = TO_LIST(list)
liblist = TO_LIST(library)
+ hlist = conf.env.hlist[:]
+ for h in TO_LIST(header):
+ if CHECK_HEADER(conf, h, add_headers=False):
+ hlist.append(h)
+
# check if some already found
for f in remaining[:]:
if CONFIG_SET(conf, 'HAVE_%s' % f.upper()):
@@ -299,7 +315,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False):
# see if the functions are in libc
if checklibc:
for f in remaining[:]:
- if CHECK_FUNC(conf, f):
+ if CHECK_FUNC(conf, f, checklink=True, header=header):
remaining.remove(f)
if remaining == []:
@@ -326,7 +342,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False):
ret = True
for f in remaining:
- if not conf.check(function_name=f, lib=liblist, header_name=conf.env.hlist):
+ if not conf.check_cc(function_name=f, lib=liblist, header_name=hlist):
ret = False
if not ret:
diff --git a/lib/replace/wscript b/lib/replace/wscript
index de71017b2c..ef6b4237cc 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -203,7 +203,7 @@ def configure(conf):
conf.CHECK_FUNCS_IN('poptGetContext', 'popt')
conf.CHECK_FUNCS_IN('res_search', 'resolv', checklibc=True)
conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True)
- conf.CHECK_FUNCS_IN('pthread_create', 'pthread', checklibc=True)
+ conf.CHECK_FUNCS_IN('pthread_create', 'pthread', checklibc=True, header='pthread.h')
conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True)