summaryrefslogtreecommitdiff
path: root/source3/wscript
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-04-27 16:07:35 +0200
committerGünther Deschner <gd@samba.org>2011-04-27 16:51:02 +0200
commitcad8fafa0391e9f13c2958c45ca5ec57f93f1e7b (patch)
treeca721852ec78d4b568742347eb1ddc52c1fcb40e /source3/wscript
parentee0b0dd3a150dea35ef57d5867519a7df382137c (diff)
downloadsamba-cad8fafa0391e9f13c2958c45ca5ec57f93f1e7b.tar.gz
samba-cad8fafa0391e9f13c2958c45ca5ec57f93f1e7b.tar.bz2
samba-cad8fafa0391e9f13c2958c45ca5ec57f93f1e7b.zip
s3-waf: check for pthread support.
Guenther
Diffstat (limited to 'source3/wscript')
-rw-r--r--source3/wscript31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/wscript b/source3/wscript
index 45e60aae7c..3f9dfd9303 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1637,6 +1637,37 @@ main() {
if Options.options.with_profiling_data:
conf.DEFINE('WITH_PROFILE', 1);
+ PTHREAD_CFLAGS='error'
+ PTHREAD_LDFLAGS='error'
+
+ if PTHREAD_LDFLAGS == 'error':
+ if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
+ PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
+ PTHREAD_LDFLAGS='-lpthread'
+ if PTHREAD_LDFLAGS == 'error':
+ if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
+ PTHREAD_CFLAGS='-D_THREAD_SAFE'
+ PTHREAD_LDFLAGS='-lpthreads'
+ if PTHREAD_LDFLAGS == 'error':
+ if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
+ PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
+ PTHREAD_LDFLAGS='-pthread'
+ if PTHREAD_LDFLAGS == 'error':
+ if conf.CHECK_FUNC('pthread_attr_init'):
+ PTHREAD_CFLAGS='-D_REENTRANT'
+ PTHREAD_LDFLAGS='-lpthread'
+ # especially for HP-UX, where the CHECK_FUNC macro fails to test for
+ # pthread_attr_init. On pthread_mutex_lock it works there...
+ if PTHREAD_LDFLAGS == 'error':
+ if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
+ PTHREAD_CFLAGS='-D_REENTRANT'
+ PTHREAD_LDFLAGS='-lpthread'
+
+ if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
+ conf.ADD_CFLAGS(PTHREAD_CFLAGS)
+ conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
+ conf.CHECK_HEADERS('pthread.h')
+ conf.DEFINE('HAVE_PTHREAD', '1')
default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
auth_sam auth_unix auth_winbind auth_wbc auth_server