Updated French and Turkish translation by gagar
[amule.git] / m4 / readline.m4
blob0abd02d0c77b75beefbbd746a8e0a39a3e1f5b1e
1 dnl
2 dnl Copyright (c) 2003-2011 aMule Team (http://www.amule.org)
3 dnl Copyright (c) 1995-2008 Free Software Foundation, Inc.
4 dnl
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.
10 dnl
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
13 dnl
15 AC_DEFUN([VL_LIB_READLINE], [
16   AC_CACHE_CHECK([for a readline compatible library],
17                  vl_cv_lib_readline, [
18     ORIG_LIBS="$LIBS"
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"
23         else
24           TRY_LIB="-l$readline_lib -l$termcap_lib"
25         fi
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
29           break
30         fi
31       done
32       if test -n "$vl_cv_lib_readline"; then
33         break
34       fi
35     done
36     if test -z "$vl_cv_lib_readline"; then
37       vl_cv_lib_readline="no"
38       LIBS="$ORIG_LIBS"
39     fi
40   ])
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])
49     else
50       READLINE_LIBS=
51       vl_cv_lib_readline=no
52     fi
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")
57     ])
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'])
64       else
65         vl_cv_lib_readline_history=no
66       fi
67     fi
68   else
69     READLINE_LIBS=""
70   fi
71   AC_SUBST(READLINE_LIBS)
72 ])dnl