build: optionally enable builtin popt
authorAndrew Tridgell <tridge@samba.org>
Wed, 17 Mar 2010 06:22:54 +0000 (00:22 -0600)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:26:51 +0000 (20:26 +1000)
lib/popt/wscript [new file with mode: 0644]
lib/popt/wscript_build [deleted file]
source4/wscript
source4/wscript_build

diff --git a/lib/popt/wscript b/lib/popt/wscript
new file mode 100644 (file)
index 0000000..ccdb290
--- /dev/null
@@ -0,0 +1,23 @@
+import Options
+
+def set_options(opt):
+    opt.add_option('--with-included-popt',
+                   help=("use bundled popt library, not from system"),
+                   action="store_true", dest='INCLUDED_POPT', default=False)
+
+def configure(conf):
+    conf.CHECK_HEADERS('float.h')
+    if not Options.options.INCLUDED_POPT:
+        if (conf.CHECK_HEADERS('popt.h') and
+            conf.CHECK_FUNCS_IN('poptGetContext', 'popt')):
+            conf.DEFINE('HAVE_SYSTEM_POPT', 1)
+
+def build(bld):
+    if not bld.CONFIG_SET('HAVE_SYSTEM_POPT'):
+        bld.SAMBA_SUBSYSTEM('LIBPOPT',
+                            source='findme.c popt.c poptconfig.c popthelp.c poptparse.c',
+                            cflags='-DDBL_EPSILON=__DBL_EPSILON__'
+                            )
+        bld.TARGET_ALIAS('LIBPOPT', 'popt')
+    else:
+        bld.TARGET_ALIAS('popt', 'LIBPOPT')
diff --git a/lib/popt/wscript_build b/lib/popt/wscript_build
deleted file mode 100644 (file)
index de0e625..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# AUTOGENERATED by mktowscript.pl from ../../lib/popt/config.mk
-# Please remove this notice if hand editing
-
-
-bld.SAMBA_SUBSYSTEM('LIBPOPT',
-       source='findme.c popt.c poptconfig.c popthelp.c poptparse.c',
-       )
-
index ae6a64f4841f3096ee8abb82264f8c481cf4927d..fe5df0d959a47d1bfef2cb5581eb5015a110fb20 100644 (file)
@@ -17,6 +17,7 @@ def set_options(opt):
     opt.recurse('../lib/nss_wrapper')
     opt.recurse('../lib/socket_wrapper')
     opt.recurse('../lib/uid_wrapper')
+    opt.recurse('../lib/popt')
 
 def configure(conf):
     conf.define('PACKAGE_NAME', 'samba')
@@ -60,6 +61,7 @@ def configure(conf):
     conf.sub_config('../lib/nss_wrapper')
     conf.sub_config('../lib/socket_wrapper')
     conf.sub_config('../lib/uid_wrapper')
+    conf.sub_config('../lib/popt')
     conf.sub_config('lib/smbreadline')
 
     conf.SAMBA_CONFIG_H('include/config.h')
index b351f488d5dc61fdc9ecb760873095ee7b5f8308..9bcebe9ec88aff7851bc884fbca4d92d27ceccd7 100644 (file)
@@ -15,7 +15,6 @@ bld.SAMBA_MKVERSION('version.h')
 # this sets up some aliases
 bld.TARGET_ALIAS('attr', 'XATTR')
 bld.TARGET_ALIAS('execinfo', 'EXECINFO')
-bld.TARGET_ALIAS('popt', 'LIBPOPT')
 bld.TARGET_ALIAS('tevent', 'LIBTEVENT_EXT')
 bld.TARGET_ALIAS('z', 'ZLIB')
 bld.TARGET_ALIAS('pam', 'PAM')
@@ -74,6 +73,7 @@ bld.BUILD_SUBDIR('lib/cmdline')
 bld.BUILD_SUBDIR('../lib/socket_wrapper')
 bld.BUILD_SUBDIR('../lib/nss_wrapper')
 bld.BUILD_SUBDIR('../lib/uid_wrapper')
+bld.BUILD_SUBDIR('../lib/popt')
 bld.BUILD_SUBDIR('lib/stream')
 bld.BUILD_SUBDIR('../lib/util')
 bld.BUILD_SUBDIR('../lib/tdr')