bug-inetutils
[Top][All Lists]
Advanced

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

Re: [bug-inetutils] NetBSD support.


From: Mats Erik Andersson
Subject: Re: [bug-inetutils] NetBSD support.
Date: Sat, 3 Dec 2011 22:34:35 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

fredag den  2 december 2011 klockan 12:44 skrev Simon Josefsson detta:
> Thanks for analysis, I agree that it seems that we should try -ledit
> too.  Could you take a look at am/readline.m4 and see if you can create
> a solution?

This is hard work, guessing which mechanisms to use. The difference below
applies to "gnulib/m4/readline.m4" and is sufficient to build our FTP
client with line editing support for GNU/Linux Debian and NetBSD 5.1.
The proper setting of LTLIBREADLINE should be added, though.

As a side remark, my development system GNU/Linux has "libedit2",
and the GNU/kFreeBSD system even has "libedit2" and "libedit-dev".
These are the very same library that is the default in NetBSD!

However, this success with the readline module moves focus to incorrect
dependency on HAVE_READLINE in our own source tree:

   /*
      telnet/telnet.c
      telnetd/utility.c
    */

    #ifdef HAVE_READLINE
    # include <curses.h>
    # include <term.h>
    #endif

    /* telnet/telnet.c */

    #ifdef HAVE_READLINE
      err = tgetent (termbuf, tname);
    #endif

    /* telnetd/utility.c */

    #ifdef HAVE_READLINE
      if (tgetent (buf, s) == 0)
    # endif

I claim HAVE_READLINE to be inappripriate here. Even more so since
NetBSD does not contain <term.h>. The call tgetent(3) is declared
is this manner in our (or mine!) targets:

  NetBSD:       <termcap.h>        (<term.h> is missing)

  OpenBSD:      <term.h>
                <termcap.h>

  FreeBSD:      the same

  GLibc:        the same

  OpenSolaris:  <term.h>           (<termcap.h> is missing)
                <ncurses/term.h>
                <ncurses/termcap.h>

To me the difference text below looks like a feasible base
to extend the module in Gnulib, thus resolving the build of
our FTP client fully, but we must in counter action refine
the depencecies we calculate for the tgetent(3) call, in order
that we meet all sympathetic systems we care for!

Best regards,
  Mats


diff --git a/m4/readline.m4 b/m4/readline.m4
index b7ce9e4..92cc510 100644
--- a/m4/readline.m4
+++ b/m4/readline.m4
@@ -53,6 +53,20 @@ AC_DEFUN([gl_FUNC_READLINE],
     LIBS="$am_save_LIBS"
   ])
 
+  dnl In case of failure, examine whether libedit can act
+  dnl as replacement. Small NetBSD systems use editline
+  dnl as wrapper for readline.
+  if test "$gl_cv_lib_readline" = no; then
+    am_save_LIBS="$LIBS"
+    LIBREADLINE=-ledit
+    LIBS="$am_save_LIBS $LIBREADLINE"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+#include <readline/readline.h>]],
+        [[readline((char*)0);]])],
+      [gl_cv_lib_readline="yes"])
+    LIBS="$am_save_LIBS"
+  fi
+
   if test "$gl_cv_lib_readline" != no; then
     AC_DEFINE([HAVE_READLINE], [1], [Define if you have the readline library.])
     extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'`



reply via email to

[Prev in Thread] Current Thread [Next in Thread]