2 dnl Copyright (c) 2003-2008 aMule Team (http://www.amule.org)
3 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
5 dnl This file is free software, distributed under the terms of the GNU
6 dnl General Public License. As a special exception to the GNU General
7 dnl Public License, this file may be distributed as part of a program
8 dnl that contains a configuration script generated by Autoconf, under
9 dnl the same distribution terms as the rest of that program.
11 dnl Original file available from the GNU Autoconf Macro Archive at:
12 dnl http://www.gnu.org/software/ac-archive/htmldoc/vl_lib_readline.html
15 AC_DEFUN([VL_LIB_READLINE], [
16 AC_CACHE_CHECK([for a readline compatible library],
19 for readline_lib in readline edit editline; do
20 for termcap_lib in "" termcap curses ncurses; do
21 if test -z "$termcap_lib"; then
22 TRY_LIB="-l$readline_lib"
24 TRY_LIB="-l$readline_lib -l$termcap_lib"
26 LIBS="$ORIG_LIBS $TRY_LIB"
27 AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
28 if test -n "$vl_cv_lib_readline"; then
32 if test -n "$vl_cv_lib_readline"; then
36 if test -z "$vl_cv_lib_readline"; then
37 vl_cv_lib_readline="no"
41 READLINE_LIBS="$vl_cv_lib_readline"
45 if test "$vl_cv_lib_readline" != "no"; then
46 AC_DEFINE(HAVE_LIBREADLINE, 1,
47 [Define if you have a readline compatible library])
48 AC_CHECK_HEADERS(readline.h readline/readline.h)
49 AC_CACHE_CHECK([whether readline supports history],
50 vl_cv_lib_readline_history, [
51 vl_cv_lib_readline_history="no"
52 AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
54 if test "$vl_cv_lib_readline_history" = "yes"; then
55 AC_DEFINE(HAVE_READLINE_HISTORY, 1,
56 [Define if your readline library has \`add_history'])
57 AC_CHECK_HEADERS(history.h readline/history.h)
60 AC_SUBST(READLINE_LIBS)