Support BSD libedit.

This commit is contained in:
Mats Erik Andersson
2013-08-31 00:54:39 +02:00
parent 0887048c53
commit 56660118ac
4 changed files with 40 additions and 4 deletions

View File

@@ -1,3 +1,20 @@
2013-08-31 Mats Erik Andersson <gnu@gisladisker.se>
Support BSD libedit. (Used on GNU/kFreeBSD.)
* am/readline.m4 (gl_FUNC_READLINE): Check for headers
before library linkage. Check for header file variants
<editline/readline.h> and <editline/history.h>.
While testing linking against libreadline and libedit,
conditionally use HAVE_*_READLINE_H to include the
correct header file.
* ftp/cmds.c, ftp/main.c
[!HAVE_READLINE_READLINE_H && HAVE_EDITLINE_READLINE_H]:
Include <editline/readline.h>
[!HAVE_READLINE_HISTORY_H && HAVE_EDITLINE_HISTORY_H]:
Include <editline/history.h>
2013-08-30 Mats Erik Andersson <gnu@gisladisker.se>
* bootstrap: Updated from gnulib.

View File

@@ -20,6 +20,11 @@ AC_DEFUN([gl_FUNC_READLINE],
[do not build against libreadline]), ,
[enable_readline=yes])
dnl Readline libraries come in a handful flavours.
dnl Detect the ones we do offer support for.
AC_CHECK_HEADERS([readline/readline.h readline/history.h \
editline/readline.h editline/history.h])
dnl Search for libreadline and define LIBREADLINE, LTLIBREADLINE and
dnl INCREADLINE accordingly.
AC_LIB_LINKFLAGS_BODY([readline])
@@ -45,7 +50,11 @@ AC_DEFUN([gl_FUNC_READLINE],
LIBS="$LIBS -l$extra_lib"
fi
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
#include <readline/readline.h>]],
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#elif defined HAVE_EDITLINE_READLINE_H
# include <editline/readline.h>
#endif]],
[[readline((char*)0);]])],
[if test -n "$extra_lib"; then
gl_cv_lib_readline="yes, requires -l$extra_lib"
@@ -67,7 +76,11 @@ AC_DEFUN([gl_FUNC_READLINE],
am_save_LIBS="$LIBS"
LIBS="$am_save_LIBS -ledit"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
#include <readline/readline.h>]],
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#elif defined HAVE_EDITLINE_READLINE_H
# include <editline/readline.h>
#endif]],
[[readline((char*)0);]])],
[gl_cv_lib_readline="yes"])
LIBS="$am_save_LIBS"
@@ -93,8 +106,6 @@ AC_DEFUN([gl_FUNC_READLINE],
fi
AC_SUBST([LIBREADLINE])
AC_SUBST([LTLIBREADLINE])
AC_CHECK_HEADERS([readline/readline.h readline/history.h])
])
# Prerequisites of lib/readline.c.

View File

@@ -80,9 +80,13 @@
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#elif defined HAVE_EDITLINE_READLINE_H
# include <editline/readline.h>
#endif
#ifdef HAVE_READLINE_HISTORY_H
# include <readline/history.h>
#elif defined HAVE_EDITLINE_HISTORY_H
# include <editline/history.h>
#endif
#include "ftp_var.h"

View File

@@ -82,9 +82,13 @@
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#elif defined HAVE_EDITLINE_READLINE_H
# include <editline/readline.h>
#endif
#ifdef HAVE_READLINE_HISTORY_H
# include <readline/history.h>
#elif defined HAVE_EDITLINE_HISTORY_H
# include <editline/history.h>
#endif