regedit: First crack at linking to ncurses.
authorC. Davis <cd.rattan@gmail.com>
Tue, 10 Jul 2012 13:16:35 +0000 (06:16 -0700)
committerMichael Adam <obnox@samba.org>
Mon, 29 Apr 2013 11:05:44 +0000 (13:05 +0200)
First attempt of editing build scripts to link to ncurses
libraries. It seems to work, though checks may need to be
expanded upon.

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/utils/regedit.c
source3/wscript
source3/wscript_build

index 9c117e346e208e2b6594f45cc993d297bec10094..5ae21201fb4f9be52bde687bcfa968099e8bcb8f 100644 (file)
@@ -22,6 +22,8 @@
 #include "lib/util/data_blob.h"
 #include "lib/registry/registry.h"
 #include "regedit.h"
+#include <ncurses.h>
+#include <menu.h>
 
 int main(int argc, char **argv)
 {
@@ -43,6 +45,9 @@ int main(int argc, char **argv)
        uint32_t n;
        WERROR rv;
 
+       initscr();
+       endwin();
+
        frame = talloc_stackframe();
 
        setup_logging("regedit", DEBUG_DEFAULT_STDERR);
index 18e45f2ed65fc01fda46d1a39a5ccac4056ac173..54daaa7f22158712dd8333c239097ef032bfae63 100644 (file)
@@ -47,6 +47,8 @@ def set_options(opt):
 
     opt.SAMBA3_ADD_OPTION('cluster-support', default=None)
 
+    opt.SAMBA3_ADD_OPTION('regedit', default=True)
+
     opt.add_option('--with-ctdb-dir',
                    help=("Directory under which ctdb is installed"),
                    action="store", dest='ctdb_dir', default=None)
@@ -1711,6 +1713,14 @@ main() {
     if conf.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf.CHECK_LIB('cephfs'):
         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')
+        if ncurses and menu:
+                conf.env.build_regedit = True
+
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
                                       auth_sam auth_unix auth_winbind auth_wbc
                                       auth_domain auth_builtin vfs_default
index 269b29aec749ae8037ee67bc777b75d449d0df79..61acb377e0f7ceda2a981e0a949127535f63493a 100755 (executable)
@@ -1643,7 +1643,9 @@ bld.SAMBA3_PYTHON('pylibsmb',
 
 bld.SAMBA3_BINARY('regedit',
                   source='utils/regedit.c utils/regedit_samba3.c utils/regedit_wrap.c',
-                  deps='registry param popt_samba3 smbregistry')
+                  deps='ncurses menu registry param popt_samba3 smbregistry',
+                  enabled=bld.env.build_regedit,
+                  vars=locals())
 
 swat_dir = os.path.join(bld.curdir, '../swat')
 swat_files = recursive_dirlist(swat_dir, swat_dir, '*')