From cb6684b63b3c4c5a90e194c5719bc82690180f30 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 31 Jan 2014 23:46:14 +0000 Subject: Introduce line editor library. This library will be used by clang-query. I can imagine LLDB becoming another client of this library, so I think LLVM is a sensible place for it to live. It wraps libedit, and adds tab completion support. The code is loosely based on the line editor bits in LLDB, with a few improvements: - Polymorphism for retrieving the list of tab completions, based on the concept pattern from the new pass manager. - Tab completion doesn't corrupt terminal output if the input covers multiple lines. Unfortunately this can only be done in a truly horrible way, as far as I can tell. But since the alternative is to implement our own line editor (which I don't think LLVM should be in the business of doing, at least for now) I think it may be acceptable. - Includes a fallback for the case where the user doesn't have libedit installed. Note that this uses C stdio, mainly because libedit also uses C stdio. Differential Revision: http://llvm-reviews.chandlerc.com/D2200 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200595 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/configure.ac | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'autoconf') diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 7e710080ea..0368f80585 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1190,6 +1190,17 @@ AC_ARG_ENABLE(terminfo,AS_HELP_STRING( esac], llvm_cv_enable_terminfo="yes") +dnl --enable-libedit: check whether the user wants to turn off libedit. +AC_ARG_ENABLE(libedit,AS_HELP_STRING( + [--enable-libedit], + [Use libedit if available (default is YES)]), + [case "$enableval" in + yes) llvm_cv_enable_libedit="yes" ;; + no) llvm_cv_enable_libedit="no" ;; + *) AC_MSG_ERROR([Invalid setting for --enable-libedit. Use "yes" or "no"]) ;; + esac], + llvm_cv_enable_libedit="yes") + dnl --enable-libffi : check whether the user wants to turn off libffi: AC_ARG_ENABLE(libffi,AS_HELP_STRING( --enable-libffi,[Check for the presence of libffi (default is NO)]), @@ -1506,6 +1517,13 @@ if test "$llvm_cv_enable_terminfo" = "yes" ; then [Define if the setupterm() function is supported this platform.])) fi +dnl The libedit library is optional; used by lib/LineEditor +if test "$llvm_cv_enable_libedit" = "yes" ; then + AC_SEARCH_LIBS(el_init,edit, + AC_DEFINE([HAVE_LIBEDIT],[1], + [Define if libedit is available on this platform.])) +fi + dnl libffi is optional; used to call external functions from the interpreter if test "$llvm_cv_enable_libffi" = "yes" ; then AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], -- cgit v1.2.3