[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Sep 25 16:57:06 UTC 2019


The branch, master has been updated
       via  ab232ca77f8 waf: Use waf function to add for -Wl,--as-needed
       via  9499db075b7 waf:replace: Do not link against libpthread if not necessary
       via  bd0cd8e1323 third_party: Link uid_wrapper against pthread
       via  68d8a02ef57 third_party: Link nss_wrapper against pthread
       via  36e8d715bc8 third_party: Only link cmocka against librt if really needed
       via  4b28239d13b pthreadpool: Only link pthreadpool against librt if we have to
       via  480152dd672 replace: Only link against librt if really needed
       via  952e1812fa9 s3:waf: Do not check for nanosleep() as we don't use it anywhere
      from  3bb7ccb4635 s4:scripting: make samba-gpupdate heed --disable-python

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ab232ca77f8f08879d99f88cfcd554500717075e
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 17:21:51 2019 +0200

    waf: Use waf function to add for -Wl,--as-needed
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Sep 25 16:56:40 UTC 2019 on sn-devel-184

commit 9499db075b72b147e2ff9bb78e9d5edbaac14e69
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 16:53:12 2019 +0200

    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 at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit bd0cd8e13234d684da77a65f6fdaea2572625369
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 17:40:13 2019 +0200

    third_party: Link uid_wrapper against pthread
    
    uid_wrapper uses pthread_atfork() which is only provided by libpthread.                                                                                   │····················
    So we need an explicit dependency.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 68d8a02ef57cce29e4ff3ef1b792adfc10d0b916
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 17:39:29 2019 +0200

    third_party: Link nss_wrapper against pthread
    
    nss_wrapper uses pthread_atfork() which is only provided by libpthread.
    So we need an explicit dependency.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 36e8d715bc8dc1e8466f5a5c9798df76310b7572
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 17:04:57 2019 +0200

    third_party: Only link cmocka against librt if really needed
    
    cmocka also uses clock_gettime().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 4b28239d13b17e42eb5aa4b405342f46347f3de4
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 16:10:35 2019 +0200

    pthreadpool: Only link pthreadpool against librt if we have to
    
    This calls clock_gettime() which is available in glibc on Linux. If the
    wscript in libreplace detected that librt is needed for clock_gettime()
    we have to link against it.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 480152dd6729d4c58faca6f3e4fa91ff4614c272
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 15:14:24 2019 +0200

    replace: Only link against librt if really needed
    
    fdatasync() and clock_gettime() are provided by glibc on Linux, so there
    is no need to link against librt. Checks have been added so if there are
    platforms which require it are still functional.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 952e1812fa9bdc1bac2a7ae5ebb5532f1ea31447
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Sep 23 15:18:55 2019 +0200

    s3:waf: Do not check for nanosleep() as we don't use it anywhere
    
    We use usleep() in the meantime.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Isaac Boukris <iboukris at gmail.com>
    Pair-Programmed-With: Isaac Boukris <iboukris at gmail.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/pthreadpool/wscript_build   |  7 ++++++-
 lib/replace/wscript             | 34 +++++++++++++++++++++++++++-------
 source3/wscript                 |  1 -
 third_party/cmocka/wscript      |  7 ++++++-
 third_party/nss_wrapper/wscript |  2 +-
 third_party/uid_wrapper/wscript |  2 +-
 wscript                         |  2 +-
 7 files changed, 42 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/pthreadpool/wscript_build b/lib/pthreadpool/wscript_build
index 57df25548b1..70aa7cbf041 100644
--- a/lib/pthreadpool/wscript_build
+++ b/lib/pthreadpool/wscript_build
@@ -1,12 +1,17 @@
 #!/usr/bin/env python
 
 if bld.env.WITH_PTHREADPOOL:
+    extra_libs=''
+
+    # Link to librt if needed for clock_gettime()
+    if bld.CONFIG_SET('HAVE_LIBRT'): extra_libs += ' rt'
+
     bld.SAMBA_SUBSYSTEM('PTHREADPOOL',
                          source='''pthreadpool.c
                                    pthreadpool_pipe.c
                                    pthreadpool_tevent.c
                                 ''',
-                         deps='pthread rt replace tevent-util')
+                         deps='pthread replace tevent-util' + extra_libs)
 else:
     bld.SAMBA_SUBSYSTEM('PTHREADPOOL',
                          source='''pthreadpool_sync.c
diff --git a/lib/replace/wscript b/lib/replace/wscript
index c22262191c2..93379a7aefe 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -459,11 +459,28 @@ def configure(conf):
     conf.CHECK_C_PROTOTYPE('dlopen', 'void *dlopen(const char* filename, unsigned int flags)',
                            define='DLOPEN_TAKES_UNSIGNED_FLAGS', headers='dlfcn.h dl.h')
 
-    if conf.CHECK_FUNCS_IN('fdatasync', 'rt', checklibc=True):
+    #
+    # Check for clock_gettime and fdatasync
+    #
+    # First check libc to avoid linking libreplace against librt.
+    #
+    if conf.CHECK_FUNCS('fdatasync'):
         # some systems are missing the declaration
         conf.CHECK_DECLS('fdatasync')
+    else:
+        if conf.CHECK_FUNCS_IN('fdatasync', 'rt'):
+            # some systems are missing the declaration
+            conf.CHECK_DECLS('fdatasync')
+
+    has_clock_gettime = False
+    if conf.CHECK_FUNCS('clock_gettime'):
+        has_clock_gettime = True
 
-    if conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True):
+    if not has_clock_gettime:
+        if conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True):
+            has_clock_gettime = True
+
+    if has_clock_gettime:
         for c in ['CLOCK_MONOTONIC', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME']:
             conf.CHECK_CODE('''
                 #if TIME_WITH_SYS_TIME
@@ -536,6 +553,11 @@ def configure(conf):
     PTHREAD_CFLAGS='error'
     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'
@@ -548,10 +570,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':
@@ -817,6 +836,7 @@ def build(bld):
 
     extra_libs = ''
     if bld.CONFIG_SET('HAVE_LIBBSD'): extra_libs += ' bsd'
+    if bld.CONFIG_SET('HAVE_LIBRT'): extra_libs += ' rt'
 
     bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC',
         REPLACE_HOSTCC_SOURCE,
@@ -856,7 +876,7 @@ def build(bld):
                       # at the moment:
                       # hide_symbols=bld.BUILTIN_LIBRARY('replace'),
                       private_library=True,
-                      deps='crypt dl nsl socket rt attr' + extra_libs)
+                      deps='crypt dl nsl socket attr' + extra_libs)
 
     replace_test_cflags = ''
     if bld.CONFIG_SET('HAVE_WNO_FORMAT_TRUNCATION'):
diff --git a/source3/wscript b/source3/wscript
index 83e7aca737f..d45222625c4 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -117,7 +117,6 @@ def configure(conf):
     conf.CHECK_FUNCS('fstatat')
     conf.CHECK_FUNCS('getpwent_r setenv clearenv strcasecmp fcvt fcvtl')
     conf.CHECK_FUNCS('syslog vsyslog timegm setlocale')
-    conf.CHECK_FUNCS_IN('nanosleep', 'rt')
     conf.CHECK_FUNCS('lutimes futimes utimensat futimens')
     conf.CHECK_FUNCS('mlock munlock mlockall munlockall')
     conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
diff --git a/third_party/cmocka/wscript b/third_party/cmocka/wscript
index 9ebdd7cfbe9..3c2ad50801a 100644
--- a/third_party/cmocka/wscript
+++ b/third_party/cmocka/wscript
@@ -12,8 +12,13 @@ def build(bld):
     if bld.CONFIG_SET('USING_SYSTEM_CMOCKA'):
         return
 
+    extra_libs=''
+
+    # Link to librt if needed for clock_gettime()
+    if bld.CONFIG_SET('HAVE_LIBRT'): extra_libs += ' rt'
+
     bld.SAMBA_LIBRARY('cmocka',
                       source='cmocka.c',
-                      deps='rt',
+                      deps=extra_libs,
                       allow_warnings=True,
                       private_library=True)
diff --git a/third_party/nss_wrapper/wscript b/third_party/nss_wrapper/wscript
index 127b5207c5e..7a2f53ad299 100644
--- a/third_party/nss_wrapper/wscript
+++ b/third_party/nss_wrapper/wscript
@@ -90,6 +90,6 @@ def build(bld):
         # breaks preloading!
         bld.SAMBA_LIBRARY('nss_wrapper',
                           source='nss_wrapper.c',
-                          deps='dl',
+                          deps='dl pthread',
                           install=False,
                           realname='libnss-wrapper.so')
diff --git a/third_party/uid_wrapper/wscript b/third_party/uid_wrapper/wscript
index df302ab7e3f..182ef88d3df 100644
--- a/third_party/uid_wrapper/wscript
+++ b/third_party/uid_wrapper/wscript
@@ -119,6 +119,6 @@ def build(bld):
         # breaks preloading!
         bld.SAMBA_LIBRARY('uid_wrapper',
                           source='uid_wrapper.c',
-                          deps='dl',
+                          deps='dl pthread',
                           install=False,
                           realname='libuid-wrapper.so')
diff --git a/wscript b/wscript
index 3e04df04080..a195ac33c98 100644
--- a/wscript
+++ b/wscript
@@ -321,7 +321,7 @@ def configure(conf):
     # allows us to find problems on our development hosts faster.
     # It also results in faster load time.
 
-    conf.env.asneeded_ldflags = conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
+    conf.add_as_needed()
 
     if not conf.CHECK_NEED_LC("-lc not needed"):
         conf.ADD_LDFLAGS('-lc', testflags=False)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list