summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2010-02-26 14:11:33 +0000
committerChris Wilson <chris+github@qwirx.com>2010-02-26 14:11:33 +0000
commit8559ee2918d16db9fceef84eb9e15cc1ab61eb75 (patch)
treebb7227ccfb843a331752d4711939d067caca8c06
parenta4c9b9697bad7e709319e8b8200da6ff3eedfdb3 (diff)
Detect whether rl_completion_matches or completion_matches is declared
by readline headers at configure time, and use the appropriate one in bbackupquery. Thanks to Melissa Jenkins for reporting the compilation failure on OSX and providing additional details.
-rw-r--r--bin/bbackupquery/bbackupquery.cpp7
-rw-r--r--infrastructure/m4/vl_lib_readline.m423
2 files changed, 28 insertions, 2 deletions
diff --git a/bin/bbackupquery/bbackupquery.cpp b/bin/bbackupquery/bbackupquery.cpp
index 6d697087..f004310c 100644
--- a/bin/bbackupquery/bbackupquery.cpp
+++ b/bin/bbackupquery/bbackupquery.cpp
@@ -132,7 +132,12 @@ char ** bbackupquery_completion(const char *text, int start, int end)
*/
if (start == 0)
{
- matches = rl_completion_matches(text, command_generator);
+ #ifdef HAVE_RL_COMPLETION_MATCHES
+ matches = rl_completion_matches(text,
+ command_generator);
+ #elif defined HAVE_COMPLETION_MATCHES
+ matches = completion_matches(text, command_generator);
+ #endif
}
return matches;
diff --git a/infrastructure/m4/vl_lib_readline.m4 b/infrastructure/m4/vl_lib_readline.m4
index a0571bfa..21440111 100644
--- a/infrastructure/m4/vl_lib_readline.m4
+++ b/infrastructure/m4/vl_lib_readline.m4
@@ -79,6 +79,16 @@ AC_DEFUN([VL_LIB_READLINE], [
fi
])
+dnl BOX_CHECK_VAR(name, where, headers)
+AC_DEFUN([BOX_CHECK_VAR], [
+ AC_CACHE_CHECK([for $1 $2], [vl_cv_var_$1],
+ [AC_TRY_LINK([$3], [(void) $1], [vl_cv_var_$1=yes], [vl_cv_var_$1=no])
+ ])
+ if test "${vl_cv_var_$1}" = "yes"; then
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1, [Define if you have $1 $2])
+ fi
+ ])
+
dnl VL_LIB_READLINE_CHECK(name, libraries, headers, history headers)
AC_DEFUN([VL_LIB_READLINE_CHECK], [
AC_CACHE_CHECK([for $1 library],
@@ -108,12 +118,23 @@ AC_DEFUN([VL_LIB_READLINE_CHECK], [
fi
])
+ vl_cv_lib_includes=""
+
vl_cv_lib_readline_compat_found=no
if test "x$vl_cv_lib_$1" != "xno"; then
- AC_CHECK_HEADERS([$3], [vl_cv_lib_readline_compat_found=yes])
+ AC_CHECK_HEADERS([$3], [
+ vl_cv_lib_readline_compat_found=yes
+ vl_cv_lib_includes="$vl_cv_lib_headers #include <$ac_header>"
+ ])
fi
if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then
+ BOX_CHECK_VAR([rl_completion_matches], [in readline headers],
+ [$vl_cv_lib_includes])
+
+ BOX_CHECK_VAR([completion_matches], [in readline headers],
+ [$vl_cv_lib_includes])
+
AC_DEFINE([HAVE_LIBREADLINE], 1,
[Define if you have a readline compatible library])