s3:wscript: fix flex and bison detection
[metze/samba/wip.git] / source3 / wscript
index 8086359f706c80efb701652632d5894202c7b8e9..4eb0fe878cc1bd9e6cc501584ff4a7de9820fc24 100644 (file)
@@ -13,7 +13,7 @@ import build.charset
 from wafsamba import samba_utils
 from samba_utils import TO_LIST
 import samba3
-from waflib.Tools import bison, flex
+from waflib.Tools import bison
 
 default_prefix = Options.default_prefix = '/usr/local/samba'
 
@@ -46,7 +46,7 @@ def options(opt):
     opt.samba_add_onoff_option('cups', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('iprint', with_name="enable", without_name="disable")
     opt.samba_add_onoff_option('pam')
-    opt.samba_add_onoff_option('quotas')
+    opt.samba_add_onoff_option('quotas', default=None)
     opt.samba_add_onoff_option('sendfile-support', default=None)
     opt.samba_add_onoff_option('utmp')
     opt.samba_add_onoff_option('avahi', with_name="enable", without_name="disable")
@@ -1219,6 +1219,9 @@ main() {
 #include <unistd.h>
 #endif
 #include <sys/types.h>
+#if defined(HAVE_SYS_SYSMACROS_H)
+#include <sys/sysmacros.h>
+#endif
 main() { dev_t dev = makedev(1,2); return 0; }
 ''',
         'HAVE_MAKEDEV',
@@ -1252,6 +1255,8 @@ main() {
                     addmain=False,
                     execute=True)
 
+    conf.SET_TARGET_TYPE('sendfile', 'EMPTY')
+    conf.CHECK_LIB('sendfile')
     if not Options.options.with_sendfile_support == False:
         if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1):
             conf.CHECK_CODE('''
@@ -1396,13 +1401,15 @@ main() {
     conf.CHECK_FUNCS_IN('getspnam', 'sec')
 
     legacy_quota_libs = ''
-    if Options.options.with_quotas:
+    if not Options.options.with_quotas == False:
         # For quotas on Veritas VxFS filesystems
         conf.CHECK_HEADERS('sys/fs/vx_quota.h')
         # For sys/quota.h and linux/quota.h
         conf.CHECK_HEADERS('sys/quota.h')
         # For quotas on BSD systems
         conf.CHECK_HEADERS('ufs/ufs/quota.h')
+        # For quotas on AIX systems
+        conf.CHECK_HEADERS('jfs/quota.h')
         # For quotas on Linux XFS filesystems
         if conf.CHECK_HEADERS('xfs/xqm.h'):
             conf.DEFINE('HAVE_XFS_QUOTAS', '1')
@@ -1502,11 +1509,26 @@ main() {
                 legacy_quota_libs = ''
     conf.env['legacy_quota_libs'] = legacy_quota_libs
 
+    if Options.options.with_quotas == True and not conf.CONFIG_SET('WITH_QUOTAS'):
+        conf.fatal('quota support not found but it was equested !')
+
     conf.CHECK_CODE('(void)unshare(CLONE_FS);',
                     headers='sched.h',
                     define='HAVE_UNSHARE_CLONE_FS',
                     msg='for Linux unshare(CLONE_FS)')
 
+    # Check for mallinfo
+    conf.CHECK_CODE('''
+    struct mallinfo mi;
+    int tmp;
+
+    mi = mallinfo();
+    tmp = mi.arena + mi.ordblks + mi.smblks + mi.hblks +
+          mi.hblkhd + mi.usmblks + mi.fsmblks +  mi.uordblks +
+          mi.fordblks + mi.keepcost;
+    return tmp;
+    ''', 'HAVE_MALLINFO', msg="Checking for mallinfo()", headers='malloc.h')
+
     #
     # cluster support (CTDB)
     #
@@ -1570,6 +1592,9 @@ main() {
         conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 6" --cflags --libs',
                        msg='Checking for glusterfs-api >= 6',
                        uselib_store="GFAPI_VER_6")
+        conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.6" --cflags --libs',
+                       msg='Checking for glusterfs-api >= 7.6',
+                       uselib_store="GFAPI_VER_7_6")
     else:
         conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
         conf.undefine('HAVE_GLUSTERFS')
@@ -1613,38 +1638,55 @@ main() {
             conf.fatal('AFS headers not available, but --with-fake-kaserver was specified')
 
     conf.env['libtracker']=''
+    tracker_versions = ['2.0', '1.0', '0.16', '0.14']
+
+    for version in tracker_versions:
+        testlib = 'tracker-sparql-' + version
+        if conf.CHECK_CFG(package=testlib,
+                          args='--cflags --libs',
+                          mandatory=False):
+            conf.SET_TARGET_TYPE(testlib, 'SYSLIB')
+            conf.env['libtracker'] = testlib
+            conf.DEFINE('HAVE_TRACKER', '1')
+            break
+
+    Logs.info("Checking for bison")
+    bison.configure(conf)
+    if conf.env['BISON']:
+        conf.CHECK_COMMAND('%s --version  | head -n1' % conf.env.BISON[0],
+                           msg='Using bison version',
+                           define=None,
+                           on_target=False)
+
+    Logs.info("Checking for flex")
+    conf.find_program('flex', var='FLEX')
+    if conf.env['FLEX']:
+        conf.env.FLEXFLAGS = ['-t']
+        conf.CHECK_COMMAND('%s --version' % conf.env.FLEX[0],
+                           msg='Using flex version',
+                           define=None,
+                           on_target=False)
+
     conf.env.with_spotlight = False
     if Options.options.with_spotlight:
-
-        Logs.info("Requested Spotlight support, checking for bison")
-        bison.configure(conf)
         if not conf.env['BISON']:
             conf.fatal("Spotlight support requested but bison missing")
-        conf.CHECK_COMMAND('%s --version | head -n1' % conf.env['BISON'], msg='Using bison version', define=None, on_target=False)
-        Logs.info("Requested Spotlight support, checking for flex")
-        flex.configure(conf)
         if not conf.env['FLEX']:
             conf.fatal("Spotlight support requested but flex missing")
-        conf.CHECK_COMMAND('%s --version' % conf.env['FLEX'], msg='Using flex version', define=None, on_target=False)
-        versions = ['2.0', '1.0', '0.16', '0.14']
-        for version in versions:
-            testlib = 'tracker-sparql-' + version
-            if conf.CHECK_CFG(package=testlib,
-                              args='--cflags --libs',
-                              mandatory=False):
-                conf.SET_TARGET_TYPE(testlib, 'SYSLIB')
-                conf.env['libtracker'] = testlib
-                conf.env.with_spotlight = True
-                conf.DEFINE('WITH_SPOTLIGHT', '1')
-                break
-
-        if not conf.env.with_spotlight:
-            conf.fatal("Spotlight support requested but tracker-sparql library missing")
+
+        if not conf.CONFIG_SET('HAVE_TRACKER'):
+            conf.fatal('Missing Gnome Tracker development files')
+
         Logs.info("building with Spotlight support")
         default_static_modules.extend(TO_LIST('rpc_mdssvc_module'))
+        conf.DEFINE('WITH_SPOTLIGHT', '1')
+        conf.env.with_spotlight = True
 
     conf.CHECK_HEADERS('rpc/xdr.h', lib='tirpc')
 
+    if conf.CHECK_FUNCS_IN('nscd_flush_cache', 'nscd', headers='libnscd.h'):
+        conf.DEFINE('HAVE_NSCD_FLUSH_CACHE', '1')
+
     forced_static_modules.extend(TO_LIST('auth_builtin auth_sam auth_winbind'))
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam
                                       auth_unix