2 dnl Copyright (c) 2003-2011 aMule Team (http://www.amule.org)
3 dnl Copyright (c) 1995-2008 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"
42 if test "$vl_cv_lib_readline" != "no"; then
43 have_readline_headers=no
44 AC_CHECK_HEADERS([readline/readline.h readline.h], [have_readline_headers=yes ; break])
45 if test "$have_readline_headers" = "yes"; then
46 READLINE_LIBS="$vl_cv_lib_readline"
47 AC_DEFINE(HAVE_LIBREADLINE, 1,
48 [Define if you have a readline compatible library])
53 AC_CACHE_CHECK([whether readline supports history],
54 vl_cv_lib_readline_history, [
55 vl_cv_lib_readline_history="no"
56 AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
58 if test "$vl_cv_lib_readline_history" = "yes"; then
59 have_readline_history_headers=no
60 AC_CHECK_HEADERS([readline/history.h history.h], [have_readline_history_headers=yes ; break])
61 if test "$have_readline_history_headers" = "yes"; then
62 AC_DEFINE(HAVE_READLINE_HISTORY, 1,
63 [Define if your readline library has \`add_history'])
65 vl_cv_lib_readline_history=no
71 AC_SUBST(READLINE_LIBS)