aboutsummaryrefslogtreecommitdiffstats
path: root/conf/m4/plptools/PLP_CHECK_READLINE.m4
diff options
context:
space:
mode:
Diffstat (limited to 'conf/m4/plptools/PLP_CHECK_READLINE.m4')
-rw-r--r--conf/m4/plptools/PLP_CHECK_READLINE.m461
1 files changed, 36 insertions, 25 deletions
diff --git a/conf/m4/plptools/PLP_CHECK_READLINE.m4 b/conf/m4/plptools/PLP_CHECK_READLINE.m4
index 3df8b5b..7f832ac 100644
--- a/conf/m4/plptools/PLP_CHECK_READLINE.m4
+++ b/conf/m4/plptools/PLP_CHECK_READLINE.m4
@@ -10,36 +10,51 @@ dnl
AC_DEFUN(PLP_CHECK_READLINE,
[
AC_MSG_CHECKING(for readline in -lreadline)
- ac_cv_addcurses=false
- ac_cv_have_libreadline=false
+ ac_cv_readline_libs=""
+ rl_desc="Define this, if you have libreadline"
saved_libs=$LIBS
LIBS="$LIBS -lreadline"
- link1ok=0
- link2ok=0
- AC_TRY_LINK(,[extern char *readline(void); readline();],link1ok=1)
- LIBS="$LIBS -lreadline -lcurses"
- AC_TRY_LINK(,[extern char *readline(void); readline();],link2ok=1)
+ l1ok=0
+ l2ok=0
+ l3ok=0
+ l4ok=0
+ AC_TRY_LINK(,[extern char *readline(void); readline();],l1ok=1)
+ LIBS="$saved_LIBS -lreadline -ltermcap"
+ AC_TRY_LINK(,[extern char *readline(void); readline();],l2ok=1)
+ LIBS="$saved_LIBS -lreadline -lcurses"
+ AC_TRY_LINK(,[extern char *readline(void); readline();],l3ok=1)
+ LIBS="$saved_LIBS -lreadline -lncurses"
+ AC_TRY_LINK(,[extern char *readline(void); readline();],l4ok=1)
LIBS="$saved_LIBS"
- case "$link1ok$link2ok" in
- 00)
+ case "$l1ok$l2ok$l3ok$l4ok" in
+ 0000)
AC_MSG_RESULT(no)
;;
- 01)
- ac_cv_have_libreadline=true;
- ac_cv_addcurses=true
- AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE)
+ 01*)
+ dnl We prefer libtermcap cause it's smaller
+ ac_cv_readline_libs="-lreadline -ltermcap"
+ AC_MSG_RESULT([yes, and needs libtermcap])
+ ;;
+ 001*)
+ dnl Prefer libcurses over libncurses
+ ac_cv_readline_libs="-lreadline -lcurses"
AC_MSG_RESULT([yes, and needs libcurses])
- PLP_READLINE_402
+ ;;
+ 0001)
+ ac_cv_readline_libs="-lreadline -lncurses"
+ AC_MSG_RESULT([yes, and needs libncurses])
;;
1*)
- ac_cv_have_libreadline=true;
- AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE)
+ ac_cv_readline_libs="-lreadline"
AC_MSG_RESULT(yes)
- PLP_READLINE_402
;;
esac
- AM_CONDITIONAL(HAVE_LIBREADLINE, test x$ac_cv_have_libreadline = xtrue)
- AM_CONDITIONAL(ADD_LIBCURSES, test x$ac_cv_addcurses = xtrue)
+ LIBREADLINE="${ac_cv_readline_libs}"
+ AC_SUBST(LIBREADLINE)
+ if test "${ac_cv_readline_libs}" != "" ; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE,1,$rl_desc)
+ PLP_READLINE_VERSION
+ fi
])
dnl
@@ -47,15 +62,11 @@ dnl Check for readline version.
dnl Those readline developers change their API too frequently
dnl and don't provide a version number in the headers :-(
dnl
-AC_DEFUN(PLP_READLINE_402,
+AC_DEFUN(PLP_READLINE_VERSION,
[
AC_MSG_CHECKING(for readline version)
saved_libs=$LIBS
- if $ac_cv_addcurses ; then
- LIBS="$LIBS -lreadline -lcurses"
- else
- LIBS="$LIBS -lreadline"
- fi
+ LIBS="$LIBS $LIBREADLINE"
rl42=false
AC_TRY_LINK(,[extern void rl_set_prompt(void); rl_set_prompt();],rl42=true)
LIBS="$saved_LIBS"