[m-rev.] for review: support editline as an alternative to GNU readline

Julien Fischer jfischer at opturion.com
Tue Jun 19 02:33:40 AEST 2018


Hi Mark

On Mon, 18 Jun 2018, Mark Brown wrote:

> On Mon, Jun 18, 2018 at 4:22 PM, Julien Fischer <jfischer at opturion.com> wrote:

>> Support the use of the editline library as an alternative to GNU readline
>> for
>> the debugger command-line prompt.  The former has a more permissive license
>> than the latter.  If licensing is not an issue then GNU readline is the
>> preferable choice (e.g. feature wise), as such it is the default option.
>
> s/,/;/

Done.

...

>> @@ -241,6 +241,36 @@ AC_SUBST(READLINE_LIBRARIES)
>>  ])
>>
>>
>> #-----------------------------------------------------------------------------#
>> +
>> +AC_DEFUN([MERCURY_CHECK_EDITLINE], [
>> +AC_REQUIRE([MERCURY_CHECK_READLINE])
>> +AC_ARG_WITH(editline,
>> +[  --without-editline      Do not use the editline library],
>> +mercury_cv_with_editline="$withval", mercury_cv_with_editline=yes)
>> +
>> +if test $mercury_cv_with_editline = no; then
>> +       mercury_cv_have_editline=no
>> +elif test $mercury_cv_have_readline = no; then
>> +
>> +       # Check for the editline header files.
>> +       MERCURY_CHECK_FOR_HEADERS(editline/readline.h)
>> +
>> +       # Check for the editline library.
>> +       AC_CHECK_LIB(edit, readline, mercury_cv_have_editline=yes,
>> +               mercury_cv_have_editline=no)
>> +else
>> +       mercury_cv_have_editline=no
>> +fi
>> +
>> +if test $mercury_cv_have_editline = yes; then
>> +       AC_DEFINE(MR_USE_EDITLINE)
>> +       TERMCAP_LIBARARIES=""
>> +       READLINE_LIBRARIES="-ledit"
>> +fi
>
> TERMCAP_LIBRARY

Fixed.

> Does it matter that the AC_SUBST for these variables has already happened?

No, AC_SUBST just tells autoconf to include the variable in the output.
The value of the variable can be modified anywhere up to the point where
AC_OUTPUT is called (at which point its current value is substituted
into the output).

...

>> diff --git a/trace/mercury_trace_completion.c
>> b/trace/mercury_trace_completion.c
>> index 428b2b1..541c26b 100644
>> --- a/trace/mercury_trace_completion.c
>> +++ b/trace/mercury_trace_completion.c
>> @@ -22,9 +22,11 @@
>>  #include <stdlib.h>
>>  #include <string.h>
>>
>> -#ifndef MR_NO_USE_READLINE
>> -  #ifdef MR_HAVE_READLINE_READLINE_H
>> +#if defined(MR_USE_READLINE) || defined(MR_USE_EDITLINE)
>> +  #if defined(MR_HAVE_READLINE_H)
>
> MR_HAVE_READLINE_READLINE_H
>
>>      #include <readline/readline.h>
>> +  #elif defined(MR_HAVE_EDITLINE_H)
>
> MR_HAVE_EDITLINE_READLINE_H

Both fixed.

Thanks for that.

Julien.


More information about the reviews mailing list