libreplace: Fix readline build with libedit.
authorJames Peach <jpeach@samba.org>
Fri, 19 Mar 2010 02:30:54 +0000 (19:30 -0700)
committerGünther Deschner <gd@samba.org>
Thu, 3 Jun 2010 14:33:43 +0000 (16:33 +0200)
libedit on MAc OSX 10.5 does not have the rl_completion_t typedef,
but uses a internal typedef names CPPFunction.

Signed-off-by: Günther Deschner <gd@samba.org>
lib/replace/system/readline.h
source4/lib/smbreadline/wscript_configure

index ba34dc6a6122dabddd78d9187b395522b100aafb..e6b8fb9129b73f19af6c66c976aa8dab8e01f38b 100644 (file)
 #endif
 
 #ifdef HAVE_NEW_LIBREADLINE
-#  define RL_COMPLETION_CAST (rl_completion_func_t *)
+#ifdef HAVE_CPPFUNCTION
+#  define RL_COMPLETION_CAST (CPPFunction *)
+#elif HAVE_RL_COMPLETION_T
+#  define RL_COMPLETION_CAST (rl_completion_t *)
+#else
+#  define RL_COMPLETION_CAST
+#endif
 #else
 /* This type is missing from libreadline<4.0  (approximately) */
 #  define RL_COMPLETION_CAST
index 76273ddc237355fd69aec2ca6da33ab6e0acb960..cec652689837901215f47ee7ca4d30b666e01dd7 100644 (file)
@@ -7,6 +7,44 @@ for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
         conf.env['READLINE_TERMLIB'] = termlib
         break
 
+conf.CHECK_CODE('''
+#ifdef HAVE_READLINE_READLINE_H
+#  include <readline/readline.h>
+#  ifdef HAVE_READLINE_HISTORY_H
+#    include <readline/history.h>
+#  endif
+#else
+#  ifdef HAVE_READLINE_H
+#    include <readline.h>
+#    ifdef HAVE_HISTORY_H
+#      include <history.h>
+#    endif
+#  endif
+#endif
+int main(void) {rl_completion_t f; return 0;}
+''',
+'HAVE_RL_COMPLETION_FUNC_T', execute=False, addmain=False,
+msg='Checking for rl_completion_t')
+
+conf.CHECK_CODE('''
+#ifdef HAVE_READLINE_READLINE_H
+#  include <readline/readline.h>
+#  ifdef HAVE_READLINE_HISTORY_H
+#    include <readline/history.h>
+#  endif
+#else
+#  ifdef HAVE_READLINE_H
+#    include <readline.h>
+#    ifdef HAVE_HISTORY_H
+#      include <history.h>
+#    endif
+#  endif
+#endif
+int main(void) {CPPFunction f; return 0;}
+''',
+'HAVE_CPPFUNCTION', execute=False, addmain=False,
+msg='Checking for CPPFunction')
+
 if conf.CHECK_FUNCS_IN('rl_completion_matches', 'readline'):
     conf.DEFINE('HAVE_NEW_LIBREADLINE', 1)