[GRASS5] [bug #2526] (grass) compiling with readline

this bug's URL: http://intevation.de/rt/webrt?serial_num=2526
-------------------------------------------------------------------------

Subject: compiling with readline

Hallo!

I had a little problem when compiling GRASS with readline on fedora 2: Linking
readline fails when ncurses is not linked as well. I adapted the configure
script accordingly such as the configure and make process are ending correctly.

The patch above shows the necessary changes.

Many greetings,

Silke

---------------------------------
--- configure.orig 2004-06-17 15:26:22.000000000 +0200
+++ configure 2004-07-01 17:02:03.119838488 +0200
@@ -8085,7 +8085,7 @@
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`

ac_save_LIBS="$LIBS"
-LIBS="-lreadline $LIBS"
+LIBS="-lreadline -lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 8091 "configure"
#include "confdefs.h"
@@ -8112,7 +8112,7 @@

if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
- READLINELIB="$READLINELIB -lreadline "
+ READLINELIB="$READLINELIB -lreadline -lncurses "
else
   echo "$ac_t""no" 1>&6

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=2526

Subject: compiling with readline

I had a little problem when compiling GRASS with readline on fedora
2: Linking readline fails when ncurses is not linked as well. I
adapted the configure script accordingly such as the configure and
make process are ending correctly.

This is a known issue. However, we don't know of a reliable solution.
Certainly, linking with -lncurses will fail on some platforms (i.e. if
they have libcurses rather than libncurses). Even if it works, it may
be overkill (readline only actually requires the termcap query
functions).

Essentially, the problem is that libreadline requires the following
termcap functions:

  tgetent
  tgetflag
  tgetnum
  tgetstr
  tgoto

There are several different libraries which might provide these
functions, including libtermcap, libtinfo and libcurses/libncurses.
Many platforms have at least two of these libraries. Linking with any
of them will typically "work", in the sense that the configure checks
succeed and r.mapcalc links.

However, the behaviour may vary depending upon which one is used. In
particular one library may obtain terminal descriptions from the
termcap database (a single text file, typically /etc/termcap), while
another may use the terminfo database (a directory tree populated with
binary files, typically /usr/lib/terminfo or /usr/share/terminfo).

One some systems, one of the two databases might be either incomplete
or inaccurate (this is quite common), and there is no way to determine
this using a configure test. I.e. we might be able to get r.mapcalc to
compile, and link, and even run (in the sense that it doesn't crash or
terminate with an error code), but it may not actually be usable (i.e.
pressing one of the arrow keys just appends an escape sequence to the
entered text).

Ultimately, the only real solution is for distribution vendors to
build libreadline with dependency information. They seem to manage it
for most of the other libraries, and some of them manage it for
libreadline (e.g. the RedHat 6.2 libreadline has a dependency against
libtermcap).

--
Glynn Clements <glynn.clements@virgin.net>