Bill Allombert on Mon, 06 Feb 2012 20:55:45 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

termcap detection do not work


Dear PARI developers,

I am just discovering that my patch 7ee734dd7b for termcap support 
does not work, because config/get_readline is doing:

    RLLIBS="$RLLIBS -lncurses"
...
    RLLIBS="$RLLIBS -ltermcap"
  $CC $CFLAGS $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null

So we try to compile with -lncurses -ltermcap which does not work since by
hypothesis, -lncurses is not available.
So I am proposing the fix in attachment.

Cheers,
Bill.
diff --git a/config/get_readline b/config/get_readline
index da9f46d..ef73aa7 100644
--- a/config/get_readline
+++ b/config/get_readline
@@ -30,15 +30,16 @@ if test -n "$readline"; then
 else
   RLLIBS="-lreadline"
 fi
+BASELIBS="$RLLIBS";
 $CC $CFLAGS $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null
 if test ! -r $exe; then # need ncurses ?
   echo ..."Linking failed. Trying with libncurses"
   pth="$with_ncurses_lib $libpth"
   lib=ncurses; . ./locatelib
   if test -n "$ncurses"; then
-    RLLIBS="$RLLIBS -L$ncurses -lncurses"
+    RLLIBS="$BASELIBS -L$ncurses -lncurses"
   else
-    RLLIBS="$RLLIBS -lncurses"
+    RLLIBS="$BASELIBS -lncurses"
   fi
   $CC $CFLAGS $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null
 fi
@@ -47,9 +48,9 @@ if test ! -r $exe; then # need termcap ?
   pth="$with_ncurses_lib $libpth"
   lib=termcap; . ./locatelib
   if test -n "$termcap"; then
-    RLLIBS="$RLLIBS -L$termcap -ltermcap"
+    RLLIBS="$BASELIBS -L$termcap -ltermcap"
   else
-    RLLIBS="$RLLIBS -ltermcap"
+    RLLIBS="$BASELIBS -ltermcap"
   fi
   $CC $CFLAGS $extraflag $RLINCLUDE -o $exe rl_version.c $RLLIBS 2> /dev/null
 fi