waf: Create a better wscript for finding ncurses.
authorAndreas Schneider <asn@samba.org>
Thu, 2 Aug 2012 09:29:10 +0000 (11:29 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 29 Apr 2013 11:05:59 +0000 (13:05 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/wscript
source3/wscript_configure_system_ncurses [new file with mode: 0644]

index 4fbc19158d8bf61b1c709036eb5ac82e3fe7b767..28fa11f2276fc62a6b188b9a7f02306f3a826c8f 100644 (file)
@@ -1714,14 +1714,7 @@ main() {
         conf.DEFINE('HAVE_CEPH', '1')
 
     if Options.options.with_regedit:
-        #XXX these checks might need to be expanded
-        ncurses = conf.CHECK_FUNCS_IN('initscr', 'ncurses', headers='ncurses.h')
-        menu = conf.CHECK_FUNCS_IN('set_menu_items item_count', 'menu',
-                            headers='menu.h')
-        panel = conf.CHECK_FUNCS_IN('new_panel show_panel', 'panel',
-                            headers='panel.h')
-        if ncurses and menu:
-                conf.env.build_regedit = True
+        conf.PROCESS_SEPARATE_RULE('system_ncurses')
 
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
                                       auth_sam auth_unix auth_winbind auth_wbc
diff --git a/source3/wscript_configure_system_ncurses b/source3/wscript_configure_system_ncurses
new file mode 100644 (file)
index 0000000..f61e49c
--- /dev/null
@@ -0,0 +1,23 @@
+import Logs, Options, sys
+
+Logs.info("Looking for ncurses features")
+
+if isinstance(Options.options.with_regedit, list):
+    path_ncurses_config = [x+'/bin' for x in Options.options.with_regedit]
+else:
+    path_ncurses_config = None
+
+conf.find_program('ncurses5-config', path_list=path_ncurses_config, var='NCURSES_CONFIG')
+if not conf.env.NCURSES_CONFIG:
+    conf.find_program('ncurses6-config', path_list=path_ncurses_config, var='NCURSES_CONFIG')
+
+if conf.env.NCURSES_CONFIG:
+    conf.check_cfg(path=conf.env.NCURSES_CONFIG, args="--cflags --libs",
+               package="", uselib_store="NCURSES")
+    conf.env.build_regedit = True
+
+conf.CHECK_HEADERS('ncurses.h menu.h panel.h', lib='ncurses')
+
+conf.CHECK_FUNCS_IN('initscr', 'ncurses')
+conf.CHECK_FUNCS_IN('set_menu_items item_count', 'menu')
+conf.CHECK_FUNCS_IN('new_panel show_panel', 'panel')