components/samba/patches/ldap-libs.patch
author Jiri Sasek <Jiri.Sasek@Oracle.COM>
Tue, 22 Dec 2015 04:53:40 -0800
changeset 5222 8298df727253
parent 4371 components/samba/samba/patches/ldap-libs.patch@29fdb14099eb
child 6096 d24ce417bac1
permissions -rw-r--r--
22456590 Component path components/samba/samba now can be reduced to components/samba .

Source: Home brewed
Fixes: OpenLDAP C-SDK library has other name than libldap.so hardwired in wscript's

--- a/source3/wscript	2013-12-05 01:16:48.000000000 -0800
+++ b/source3/wscript	2014-05-21 06:47:12.420295640 -0700
@@ -61,6 +65,15 @@
 
     opt.SAMBA3_ADD_OPTION('glusterfs', with_name="enable", without_name="disable", default=True)
 
+    opt.add_option('--with-libldap',
+                   help=("Name of the libldap for -l<libname> format."),
+                   action="store", dest='libldap_name', default='ldap')
+
+    # mozldap has lber-calls part of the libldap so it should be also set on ldap60 to avoid link of lber from OpenLDAP
+    opt.add_option('--with-liblber',
+                   help=("Name of the liblber for -l<libname> format."),
+                   action="store", dest='liblber_name', default='lber')
+
 
 def configure(conf):
     from samba_utils import TO_LIST
@@ -618,7 +631,7 @@
     if Options.options.with_ldap:
         conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
         conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
-        conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
+        conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', Options.options.liblber_name )
         conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
 
         # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
@@ -626,8 +639,8 @@
         conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
                             define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
 
-        conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
-        conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
+        conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', Options.options.libldap_name )
+        conf.CHECK_FUNCS_IN('ldap_add_result_entry', Options.options.libldap_name )
 
         # Check if ldap_set_rebind_proc() takes three arguments
         if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
@@ -648,6 +661,25 @@
             if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
                     conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
                 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
+        # fix the conf.TARGET_TYPE and conf.LIB_... items
+        if 'ldap' != Options.options.libldap_name:
+            conf.SET_TARGET_TYPE('ldap', 'SYSLIB')
+            #conf.SET_TARGET_TYPE(Options.options.libldap_name, 'EMPTY')
+            conf.define('HAVE_LIBLDAP', 1)
+            conf.undefine('HAVE_LIB%s' % Options.options.libldap_name.upper().replace('-','_'))
+            conf.define('LIB_LDAP', Options.options.libldap_name)
+            conf.undefine('LIB_%s' % Options.options.libldap_name.upper().replace('-','_'))
+            #conf.define('LIB_ldap', [ Options.options.libldap_name ] )
+            #conf.undefine('LIB_%s' % Options.options.libldap_name.replace('-','_'))
+        if 'lber' != Options.options.liblber_name:
+            conf.SET_TARGET_TYPE('lber', 'SYSLIB')
+            #conf.SET_TARGET_TYPE(Options.options.liblber_name, 'EMPTY')
+            conf.define('HAVE_LIBLBER', 1)
+            conf.undefine('HAVE_LIB%s' % Options.options.liblber_name.upper().replace('-','_'))
+            conf.define('LIB_LBER', Options.options.liblber_name)
+            conf.undefine('LIB_%s' % Options.options.liblber_name.upper().replace('-','_'))
+            #conf.define('LIB_lber', [ Options.options.liblber_name ] )
+            #conf.undefine('LIB_%s' % Options.options.liblber_name.replace('-','_'))
     else:
         conf.SET_TARGET_TYPE('ldap', 'EMPTY')
         conf.SET_TARGET_TYPE('lber', 'EMPTY')