]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8814: fix build on older libedit
authorMichael Jerris <mike@jerris.com>
Tue, 9 Feb 2016 18:38:40 +0000 (12:38 -0600)
committerMichael Jerris <mike@jerris.com>
Tue, 9 Feb 2016 18:38:40 +0000 (12:38 -0600)
configure.ac
libs/esl/fs_cli.c

index 8544f3c4b88fa193aa8ead41afbf85e506281df1..c53eba84f6337691b4346caf657447894a4b0edb 100644 (file)
@@ -1414,6 +1414,7 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"],[
   PKG_CHECK_MODULES([LIBEDIT], [libedit >= 2.11],,[
     AC_MSG_RESULT([no])
     AC_CHECK_LIB([edit], [el_line], [LIBEDIT_LIBS=-ledit])
+    AC_CHECK_LIB([edit], [el_cursor], [ac_cv_has_el_cursor=yes])
     AC_CHECK_HEADER([histedit.h], [], [unset LIBEDIT_LIBS])
     AS_IF([test "x$LIBEDIT_LIBS" = "x"], [
       AC_MSG_ERROR([You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support])
@@ -1451,6 +1452,9 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"], [
   # If making changes here, don't forget to run autoheader and
   # update libs/esl/src/include/esl_config_auto.h.in manually.
   AC_DEFINE([HAVE_LIBEDIT], [1], [Define to 1 if you have libedit is available])
+if test x$ac_cv_has_el_cursor = xyes; then
+  AC_DEFINE([HAVE_EL_CURSOR], [1], [Define to 1 if you have libedit el_cursor support])
+fi
   save_LIBS="${LIBS}"
   save_CPPFLAGS="${CPPFLAGS}"
   LIBS="${LIBEDIT_LIBS}"
index bbdf9a1426e4d34e89a6c913f29a2dcc40e8730f..237dc483c05e6c25bb28c3ff1ff933a76a35f3ab 100644 (file)
@@ -214,7 +214,9 @@ static unsigned char console_eofkey(EditLine *el, int ch)
                return CC_EOF;
        } else {
                if (line->cursor != line->lastchar) {
+#ifdef HAVE_EL_CURSOR
                        el_cursor(el, 1);
+#endif
                        el_deletestr(el, 1);
                }
                return CC_REDISPLAY;