third_party/popt: Initial support for popt.
[samba.git] / lib / ldb / wscript
index fbed6fd594f53b4873f2b7427da84ea77a0107a5..be045448711597b6a602013bf7f8253705ceb80b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '1.1.15'
+VERSION = '1.1.17'
 
 blddir = 'bin'
 
@@ -10,13 +10,14 @@ import sys, os
 # find the buildtools directory
 srcdir = '.'
 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
-    srcdir = '../' + srcdir
+    srcdir = srcdir + '/..'
 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
 
 import wafsamba, samba_dist, Options
 
 samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
-                        lib/tdb:lib/tdb lib/tdb:lib/tdb lib/tevent:lib/tevent lib/popt:lib/popt
+                        lib/tdb:lib/tdb lib/tdb:lib/tdb lib/tevent:lib/tevent
+                       third_party/popt:third_party/popt
                         buildtools:buildtools''')
 
 
@@ -31,7 +32,15 @@ def set_options(opt):
 def configure(conf):
     conf.RECURSE('lib/tdb')
     conf.RECURSE('lib/tevent')
-    conf.RECURSE('lib/popt')
+
+    if conf.CHECK_FOR_THIRD_PARTY():
+        conf.RECURSE('third_party/popt')
+    else:
+        if not conf.CHECK_POPT():
+            raise Utils.WafError('popt development packages have not been found.\nIf third_party is installed, check that it is in the proper place.')
+        else:
+            conf.define('USING_SYSTEM_POPT', 1)
+
     conf.RECURSE('lib/replace')
     conf.find_program('python', var='PYTHON')
     conf.find_program('xsltproc', var='XSLTPROC')
@@ -64,7 +73,7 @@ def configure(conf):
 
         # we don't want any libraries or modules to rely on runtime
         # resolution of symbols
-        if sys.platform != "openbsd4" and sys.platform != "openbsd5":
+        if not sys.platform.startswith("openbsd"):
             conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
 
     conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
@@ -75,7 +84,10 @@ def configure(conf):
 
 def build(bld):
     bld.RECURSE('lib/tevent')
-    bld.RECURSE('lib/popt')
+
+    if os.path.exists('third_party'):
+        bld.RECURSE('third_party/popt')
+
     bld.RECURSE('lib/replace')
     bld.RECURSE('lib/tdb')
 
@@ -141,6 +153,7 @@ def build(bld):
                           pc_files='ldb.pc',
                           vnum=VERSION,
                           private_library=private_library,
+                          allow_warnings=True,
                           manpages='man/ldb.3',
                           abi_directory='ABI',
                           abi_match = abi_match)
@@ -205,6 +218,7 @@ def build(bld):
                          'tests/sample_module.c',
                          init_function='ldb_sample_init',
                          internal_module=False,
+                         allow_warnings=True,
                          module_init_name='ldb_init_module',
                          deps='ldb',
                          subsystem='ldb')
@@ -242,6 +256,7 @@ def build(bld):
                             'common/ldb.c',
                             deps='tevent tdb',
                             includes='include',
+                            allow_warnings=True,
                             cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
 
         LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
@@ -257,10 +272,10 @@ def build(bld):
         bld.SAMBA_BINARY('ldbdump', 'tools/ldbdump.c', deps='ldb-cmdline ldb',
                          install=False)
 
-    bld.SAMBA_LIBRARY('ldb-cmdline',
-                      source='tools/ldbutil.c tools/cmdline.c',
-                      deps='ldb dl popt',
-                      private_library=True)
+        bld.SAMBA_LIBRARY('ldb-cmdline',
+                          source='tools/ldbutil.c tools/cmdline.c',
+                          deps='ldb dl popt',
+                          private_library=True)
 
 
 def test(ctx):