This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: How do I use readline?
Here's the bad way to get readline back into guile :-)
These are quick-and-dirty instructions on how to put readline support back
into the latest version of guile (guile-core). These instructions describe
what worked for me; this may not the simplest way to do it and it's really
gross.
Affected files in the guile distribution (not including automatically
generated ones):
libguile/Makefile.am
libguile/init.c
libguile/scmconfig.h.in
configure.in
Steps:
1) Make sure that you've built and installed the latest version of readline
(currently readline 4.0). Make sure you have current versions of automake
and autoconf.
2) Remove all Makefile.in's from the source tree. Add the following to
libguile/Makefile.am:
libguile_la_SOURCES = \
[what's already there] readline.c
BUILT_SOURCES = \
[what's already there] readline.x
modinclude_HEADERS = \
[what's already there] readline.h
Run "automake --gnu" from the top-level guile directory to regenerate all
the Makefile.in's.
3) Remove the configure script; edit the configure.in script as follows:
***************
*** 93,121 ****
AC_CHECK_LIB(socket, connect)
fi
- # check for readline
-
- AC_CHECK_LIB(termcap, tgoto)
- AC_CHECK_LIB(readline, readline)
- AC_CHECK_FUNCS(rl_clear_signals rl_cleanup_after_signal)
-
- AC_CACHE_CHECK([for rl_getc_function pointer in readline],
- ac_cv_var_rl_getc_function,
- [AC_TRY_LINK([
- #include <stdio.h>
- #include <readline/readline.h>],
- [rl_getc_function;],
- [ac_cv_var_rl_getc_function=yes],
- [ac_cv_var_rl_getc_function=no])])
- if test "$ac_cv_var_rl_getc_function" = "yes"; then
- AC_DEFINE(HAVE_RL_GETC_FUNCTION)
- fi
-
- if test $ac_cv_lib_readline_readline = yes -a $ac_cv_var_rl_getc_function = no; then
- echo 'Warning: libreadline is too old on your system. Need >= 2.1.'
- fi
-
-
# Checks for dynamic linking
if test "$enable_dynamic_linking" = "yes"; then
Run "autoconf" to regenerate the configure script. You may get some warnings;
ignore them.
4) Edit libguile/init.c:
***************
*** 98,104 ****
#include "ramap.h"
#include "random.h"
#include "read.h"
- #include "readline.h"
#include "scmsigs.h"
#include "script.h"
#include "simpos.h"
--- 98,103 ----
***************
*** 502,510 ****
scm_init_unif ();
scm_init_simpos ();
scm_init_load_path ();
- #if defined (HAVE_RL_GETC_FUNCTION)
- scm_init_readline ();
- #endif
scm_init_standard_ports ();
scm_init_dynamic_linking ();
scm_init_script ();
5) Append this to libguile/scmconfig.h.in:
/* Define if you have the rl_clear_signals function. */
#undef HAVE_RL_CLEAR_SIGNALS
/* Define if your readline library has the rl_getc_function variable. */
#undef HAVE_RL_GETC_FUNCTION
/* Define if you have the rl_clear_signals function. */
#undef HAVE_RL_CLEAR_SIGNALS
5) Configure your guile version so that it can access these libraries. For my
system, I had to do:
env CFLAGS=-I<my path to readline include directory> \
LDFLAGS=-L<my path to readline lib directory> ./configure \
<...usual options...>
6) Make the system as usual. There will probably be warnings about readline
and termcap not being shared libraries; ignore them.
I realize that this is a hack and is probably philosophically wrong; if anyone
has a more practical/elegant approach I'd be happy to try it.
Mike