gpg: Improve some output of gpgcompose.
[gnupg.git] / m4 / readline.m4
index 7fc996b..0c9619d 100644 (file)
@@ -1,5 +1,5 @@
 dnl Check for readline and dependencies
-dnl Copyright (C) 2004 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 dnl
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -10,6 +10,7 @@ dnl
 dnl Defines HAVE_LIBREADLINE to 1 if a working readline setup is
 dnl found, and sets @LIBREADLINE@ to the necessary libraries.
 
+
 AC_DEFUN([GNUPG_CHECK_READLINE],
 [
   AC_ARG_WITH(readline,
@@ -17,6 +18,7 @@ AC_DEFUN([GNUPG_CHECK_READLINE],
        [look for the readline library in DIR]),
      [_do_readline=$withval],[_do_readline=yes])
 
+  gnupg_cv_have_readline=no
   if test "$_do_readline" != "no" ; then
      if test -d "$withval" ; then
         CPPFLAGS="${CPPFLAGS} -I$withval/include"
@@ -30,16 +32,18 @@ AC_DEFUN([GNUPG_CHECK_READLINE],
 
         AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane])
 
-        AC_LINK_IFELSE(AC_LANG_PROGRAM([
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <readline/readline.h>
 #include <readline/history.h>
-],[
+]],[[
+rl_completion_func_t *completer;
 add_history("foobar");
 rl_catch_signals=0;
 rl_inhibit_completion=0;
 rl_attempted_completion_function=NULL;
-]),_found_readline=yes,_found_readline=no)
+rl_completion_matches(NULL,NULL);
+]])],[_found_readline=yes],[_found_readline=no])
 
         AC_MSG_RESULT([$_found_readline])
 
@@ -49,6 +53,7 @@ rl_attempted_completion_function=NULL;
            AC_DEFINE(HAVE_LIBREADLINE,1,
              [Define to 1 if you have a fully functional readline library.])
            AC_SUBST(LIBREADLINE,$_combo)
+           gnupg_cv_have_readline=yes
            break
         fi
      done