|
Packit |
fc043f |
dnl Check for readline and dependencies
|
|
Packit |
fc043f |
dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
|
Packit |
fc043f |
dnl
|
|
Packit |
fc043f |
dnl This file is free software, distributed under the terms of the GNU
|
|
Packit |
fc043f |
dnl General Public License. As a special exception to the GNU General
|
|
Packit |
fc043f |
dnl Public License, this file may be distributed as part of a program
|
|
Packit |
fc043f |
dnl that contains a configuration script generated by Autoconf, under
|
|
Packit |
fc043f |
dnl the same distribution terms as the rest of that program.
|
|
Packit |
fc043f |
dnl
|
|
Packit |
fc043f |
dnl Defines HAVE_LIBREADLINE to 1 if a working readline setup is
|
|
Packit |
fc043f |
dnl found, and sets @LIBREADLINE@ to the necessary libraries.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
AC_DEFUN([GNUPG_CHECK_READLINE],
|
|
Packit |
fc043f |
[
|
|
Packit |
fc043f |
AC_ARG_WITH(readline,
|
|
Packit |
fc043f |
AC_HELP_STRING([--with-readline=DIR],
|
|
Packit |
fc043f |
[look for the readline library in DIR]),
|
|
Packit |
fc043f |
[_do_readline=$withval],[_do_readline=yes])
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
gnupg_cv_have_readline=no
|
|
Packit |
fc043f |
if test "$_do_readline" != "no" ; then
|
|
Packit |
fc043f |
if test -d "$withval" ; then
|
|
Packit |
fc043f |
CPPFLAGS="${CPPFLAGS} -I$withval/include"
|
|
Packit |
fc043f |
LDFLAGS="${LDFLAGS} -L$withval/lib"
|
|
Packit |
fc043f |
fi
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
for _termcap in "" "-ltermcap" "-lcurses" "-lncurses" ; do
|
|
Packit |
fc043f |
_readline_save_libs=$LIBS
|
|
Packit |
fc043f |
_combo="-lreadline${_termcap:+ $_termcap}"
|
|
Packit |
fc043f |
LIBS="$LIBS $_combo"
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane])
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
Packit |
fc043f |
#include <stdio.h>
|
|
Packit |
fc043f |
#include <readline/readline.h>
|
|
Packit |
fc043f |
#include <readline/history.h>
|
|
Packit |
fc043f |
]],[[
|
|
Packit |
fc043f |
rl_completion_func_t *completer;
|
|
Packit |
fc043f |
add_history("foobar");
|
|
Packit |
fc043f |
rl_catch_signals=0;
|
|
Packit |
fc043f |
rl_inhibit_completion=0;
|
|
Packit |
fc043f |
rl_attempted_completion_function=NULL;
|
|
Packit |
fc043f |
rl_completion_matches(NULL,NULL);
|
|
Packit |
fc043f |
]])],[_found_readline=yes],[_found_readline=no])
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
AC_MSG_RESULT([$_found_readline])
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
LIBS=$_readline_save_libs
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
if test $_found_readline = yes ; then
|
|
Packit |
fc043f |
AC_DEFINE(HAVE_LIBREADLINE,1,
|
|
Packit |
fc043f |
[Define to 1 if you have a fully functional readline library.])
|
|
Packit |
fc043f |
AC_SUBST(LIBREADLINE,$_combo)
|
|
Packit |
fc043f |
gnupg_cv_have_readline=yes
|
|
Packit |
fc043f |
break
|
|
Packit |
fc043f |
fi
|
|
Packit |
fc043f |
done
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
unset _termcap
|
|
Packit |
fc043f |
unset _readline_save_libs
|
|
Packit |
fc043f |
unset _combo
|
|
Packit |
fc043f |
unset _found_readline
|
|
Packit |
fc043f |
fi
|
|
Packit |
fc043f |
])dnl
|