summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2019-09-23 16:53:12 +0200
committerStefan Metzmacher <metze@samba.org>2019-10-16 12:15:52 +0000
commit308c2c9cd48f6ff9dfae71ee4c2525f68e227aea (patch)
tree98988cb89fcbfd377593c31406d527c7cd454e9f
parentcade53a155838d85999efeb3da6525674977e2f8 (diff)
downloadsamba-308c2c9cd48f6ff9dfae71ee4c2525f68e227aea.tar.gz
waf:replace: Do not link against libpthread if not necessary
On Linux we should avoid linking everything against libpthread. Symbols used my most application are provided by glibc and code which deals with threads has to explicitly link against libpthread. This avoids setting LDFLAGS=-pthread globally. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140 Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Isaac Boukris <iboukris@gmail.com> Pair-Programmed-With: Isaac Boukris <iboukris@gmail.com> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 9499db075b72b147e2ff9bb78e9d5edbaac14e69)
-rw-r--r--lib/replace/wscript10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/replace/wscript b/lib/replace/wscript
index d8423b1d281..b5919835c0b 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -552,6 +552,11 @@ def configure(conf):
PTHREAD_LDFLAGS='error'
if PTHREAD_LDFLAGS == 'error':
+ # Check if pthread_attr_init() is provided by libc first!
+ if conf.CHECK_FUNCS('pthread_attr_init'):
+ PTHREAD_CFLAGS='-D_REENTRANT'
+ PTHREAD_LDFLAGS=''
+ if PTHREAD_LDFLAGS == 'error':
if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
PTHREAD_LDFLAGS='-lpthread'
@@ -563,10 +568,7 @@ def configure(conf):
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_FUNCS('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':