summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/bbackupquery/bbackupquery.cpp2
-rw-r--r--configure.ac6
-rw-r--r--infrastructure/m4/vl_lib_readline.m475
3 files changed, 56 insertions, 27 deletions
diff --git a/bin/bbackupquery/bbackupquery.cpp b/bin/bbackupquery/bbackupquery.cpp
index d76664fb..629f0eeb 100644
--- a/bin/bbackupquery/bbackupquery.cpp
+++ b/bin/bbackupquery/bbackupquery.cpp
@@ -15,6 +15,8 @@
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_READLINE_READLINE_H
#include <readline/readline.h>
+ #elif defined(HAVE_EDITLINE_READLINE_H)
+ #include <editline/readline.h>
#elif defined(HAVE_READLINE_H)
#include <readline.h>
#endif
diff --git a/configure.ac b/configure.ac
index 1aafb39d..6f334be7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,9 +35,7 @@ if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then
[AC_MSG_ERROR([[cannot find a short sleep function (nanosleep)]])])
fi
AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]])])
-VL_LIB_READLINE
-have_libreadline=no
-test "x$vl_cv_lib_readline" != "xno" && have_libreadline=yes
+VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no])
## Check for Berkely DB. Restrict to certain versions
AX_PATH_BDB(, [
@@ -212,7 +210,7 @@ case "$vl_cv_lib_readline" in
*readline*)
echo
AC_MSG_WARN([[do not distribute binaries compiled against GNU readline,
-as this would violate the GNU readline licence, which is GPL. You may use
+as this could violate the GNU readline licence, which is GPL. You may use
libedit or libeditline instead.]])
;;
esac
diff --git a/infrastructure/m4/vl_lib_readline.m4 b/infrastructure/m4/vl_lib_readline.m4
index 7c9217d6..a0571bfa 100644
--- a/infrastructure/m4/vl_lib_readline.m4
+++ b/infrastructure/m4/vl_lib_readline.m4
@@ -1,4 +1,4 @@
-dnl @synopsis VL_LIB_READLINE
+dnl @synopsis VL_LIB_READLINE([ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl
dnl Searches for a readline compatible library. If found, defines
dnl `HAVE_LIBREADLINE'. If the found library has the `add_history'
@@ -46,6 +46,8 @@ dnl
dnl Modifications to add --enable-gnu-readline to work around licensing
dnl problems between the traditional BSD licence and the GPL.
dnl Martin Ebourne, 2005/7/11
+dnl Rewrite to match headers with libraries and be more selective.
+dnl Martin Ebourne, 2006/1/4
dnl
dnl @category InstalledPackages
dnl @author Ville Laurikari <vl@iki.fi>
@@ -56,16 +58,34 @@ AC_DEFUN([VL_LIB_READLINE], [
AC_ARG_ENABLE(
[gnu-readline],
AC_HELP_STRING([--enable-gnu-readline],
- [Allow use of GNU readline (may violate GNU licence)])
+ [Use GNU readline if present (may violate GNU licence)])
)
- vl_gnu_readline_lib=""
+ vl_cv_lib_readline_compat_found=no
if test "x$enable_gnu_readline" = "xyes"; then
- vl_gnu_readline_lib=readline
+ VL_LIB_READLINE_CHECK([readline],
+ [readline],
+ [readline/readline.h readline.h],
+ [readline/history.h history.h])
fi
- AC_CACHE_CHECK([for a readline compatible library],
- vl_cv_lib_readline, [
+ if test "x$vl_cv_lib_readline_compat_found" = "xno"; then
+ VL_LIB_READLINE_CHECK([editline],
+ [edit editline],
+ [editline/readline.h],
+ [editline/readline.h])
+ fi
+ if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then
+ m4_ifvaln([$1],[$1],[:])dnl
+ m4_ifvaln([$2],[else $2])dnl
+ fi
+])
+
+dnl VL_LIB_READLINE_CHECK(name, libraries, headers, history headers)
+AC_DEFUN([VL_LIB_READLINE_CHECK], [
+ AC_CACHE_CHECK([for $1 library],
+ [vl_cv_lib_$1], [
ORIG_LIBS="$LIBS"
- for readline_lib in edit editline $vl_gnu_readline_lib; do
+ vl_cv_lib_$1=""
+ for readline_lib in $2; do
for termcap_lib in "" termcap curses ncurses; do
if test -z "$termcap_lib"; then
TRY_LIB="-l$readline_lib"
@@ -73,34 +93,43 @@ AC_DEFUN([VL_LIB_READLINE], [
TRY_LIB="-l$readline_lib -l$termcap_lib"
fi
LIBS="$ORIG_LIBS $TRY_LIB"
- AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
- if test -n "$vl_cv_lib_readline"; then
+ AC_TRY_LINK_FUNC([readline], [vl_cv_lib_$1="$TRY_LIB"])
+ if test -n "$vl_cv_lib_$1"; then
break
fi
done
- if test -n "$vl_cv_lib_readline"; then
+ if test -n "$vl_cv_lib_$1"; then
break
fi
done
- if test -z "$vl_cv_lib_readline"; then
- vl_cv_lib_readline="no"
+ if test -z "$vl_cv_lib_$1"; then
+ vl_cv_lib_$1=no
LIBS="$ORIG_LIBS"
fi
])
- if test "x$vl_cv_lib_readline" != "xno"; then
- AC_DEFINE(HAVE_LIBREADLINE, 1,
+ 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])
+ fi
+
+ if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then
+ AC_DEFINE([HAVE_LIBREADLINE], 1,
[Define if you have a readline compatible library])
- AC_CHECK_HEADERS(readline.h readline/readline.h)
- AC_CACHE_CHECK([whether readline supports history],
- vl_cv_lib_readline_history, [
- vl_cv_lib_readline_history="no"
- AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
+
+ AC_CACHE_CHECK([whether $1 supports history],
+ [vl_cv_lib_$1_history], [
+ vl_cv_lib_$1_history=no
+ AC_TRY_LINK_FUNC([add_history], [vl_cv_lib_$1_history=yes])
])
- if test "x$vl_cv_lib_readline_history" = "xyes"; then
- AC_DEFINE(HAVE_READLINE_HISTORY, 1,
- [Define if your readline library has \`add_history'])
- AC_CHECK_HEADERS(history.h readline/history.h)
+ if test "x$vl_cv_lib_$1_history" = "xyes"; then
+ vl_cv_lib_$1_history=no
+ AC_CHECK_HEADERS(
+ [$4],
+ [AC_DEFINE([HAVE_READLINE_HISTORY], [1],
+ [Define if your readline library has add_history])])
fi
+ else
+ LIBS="$ORIG_LIBS"
fi
])dnl