[augeas-devel] augeas: master - configuration: check whether rl_completion_matches is available

David Lutterkort lutter at fedoraproject.org
Fri Jun 12 00:24:03 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=731b41e8a1cd67e915d06b7da9552d6a18e8d673
Commit:        731b41e8a1cd67e915d06b7da9552d6a18e8d673
Parent:        701fe64fd98235696a78bf30202b838dbe7cd213
Author:        Anders F Björklund <afb at users.sourceforge.net>
AuthorDate:    Thu Jun 11 14:45:57 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Jun 11 17:17:13 2009 -0700

configuration: check whether rl_completion_matches is available

That function is missing on OS/X; we substitute it with a dummy if readline
does not provide it.

Fixes part of ticket #66
---
 acinclude.m4  |    8 ++++++++
 src/augtool.c |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 6d99163..7168cf3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -91,6 +91,7 @@ AC_DEFUN([AUGEAS_COMPILE_WARNINGS],[
 
 dnl
 dnl Determine readline linker flags in a way that works on RHEL 5
+dnl Check for rl_completion_matches (missing on OS/X)
 dnl
 AC_DEFUN([AUGEAS_CHECK_READLINE], [
   AC_CHECK_HEADERS([readline/readline.h])
@@ -129,4 +130,11 @@ AC_DEFUN([AUGEAS_CHECK_READLINE], [
   fi
 
   AC_SUBST(READLINE_LIBS)
+
+  if test $use_readline = yes; then
+      saved_libs=$LIBS
+      LIBS=$READLINE_LIBS
+      AC_CHECK_FUNCS([rl_completion_matches])
+      LIBS=$saved_libs
+  fi
 ])
diff --git a/src/augtool.c b/src/augtool.c
index be07484..e4aa973 100644
--- a/src/augtool.c
+++ b/src/augtool.c
@@ -533,6 +533,14 @@ static char *readline_command_generator(const char *text, int state) {
     return NULL;
 }
 
+#ifndef HAVE_RL_COMPLETION_MATCHES
+typedef char *rl_compentry_func_t(const char *, int);
+static char **rl_completion_matches(ATTRIBUTE_UNUSED const char *text,
+                           ATTRIBUTE_UNUSED rl_compentry_func_t *func) {
+    return NULL;
+}
+#endif
+
 static char **readline_completion(const char *text, int start,
                                   ATTRIBUTE_UNUSED int end) {
     if (start == 0)




More information about the augeas-devel mailing list