1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-08 23:37:47 +02:00

Readline fix to be robust against platforms where readline has its own

dependencies.  We play guess-the-depedency for a while, and try termcap,
curses, and ncurses.
This commit is contained in:
David Shaw 2004-12-18 22:23:49 +00:00
parent 39b0f6e4ea
commit 005b1d7960
9 changed files with 87 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2004-12-18 David Shaw <dshaw@jabberwocky.com>
* signal.c: Use only HAVE_LIBREADLINE to detect readline
availability.
* Makefile.am: Link with readline where necessary.
2004-12-17 Werner Koch <wk@g10code.com>
* passphrase.c (agent_get_passphrase): Define NREAD locally as

View File

@ -132,7 +132,7 @@ gpgv_SOURCES = gpgv.c \
# ks-db.h \
# $(common_source)
LDADD = $(needed_libs) $(other_libs) @ZLIBS@ @W32LIBS@
LDADD = $(needed_libs) $(other_libs) @ZLIBS@ @W32LIBS@ @LIBREADLINE@
gpg_LDADD = $(LDADD) @DLLIBS@ @NETLIBS@ @LIBUSB_LIBS@
$(PROGRAMS): $(needed_libs)

View File

@ -27,7 +27,7 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
#ifdef HAVE_READLINE_READLINE_H
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
@ -83,7 +83,7 @@ got_fatal_signal( int sig )
secmem_term();
#if defined(HAVE_READLINE_READLINE_H) && defined(HAVE_LIBREADLINE)
#ifdef HAVE_LIBREADLINE
rl_free_line_state ();
rl_cleanup_after_signal ();
#endif

View File

@ -1,3 +1,7 @@
2004-12-18 David Shaw <dshaw@jabberwocky.com>
* readline.m4: New.
2004-07-27 gettextize <bug-gnu-gettext@gnu.org>
* gettext.m4: Upgrade to gettext-0.14.1.

56
m4/readline.m4 Normal file
View File

@ -0,0 +1,56 @@
dnl Check for readline and dependencies
dnl Copyright (C) 2004 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
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
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,
AC_HELP_STRING([--with-readline=DIR],
[look for the readline library in DIR]),
[_do_readline=$withval],[_do_readline=yes])
if test "$_do_readline" != "no" ; then
if test -d "$withval" ; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
for _termcap in "" "-ltermcap" "-lcurses" "-lncurses" ; do
_readline_save_libs=$LIBS
_combo="-lreadline${_termcap:+ $_termcap}"
LIBS="$LIBS $_combo"
AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane])
AC_LINK_IFELSE(AC_LANG_PROGRAM([
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
],[add_history("foobar");]),_found_readline=yes,_found_readline=no)
AC_MSG_RESULT([$_found_readline])
LIBS=$_readline_save_libs
if test $_found_readline = yes ; then
AC_DEFINE(HAVE_LIBREADLINE,1,
[Define to 1 if you have a fully functional readline library.])
AC_SUBST(LIBREADLINE,$_combo)
break
fi
done
unset _termcap
unset _readline_save_libs
unset _combo
unset _found_readline
fi
])dnl

View File

@ -1,3 +1,7 @@
2004-12-18 David Shaw <dshaw@jabberwocky.com>
* Makefile.am: Link with readline where needed.
2004-10-28 Werner Koch <wk@g10code.com>
* Makefile.am (other_libs): New. Also include LIBICONV. Noted by

View File

@ -1,4 +1,5 @@
# Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999, 2000, 2001, 2003,
# 2004 Free Software Foundation, Inc.
#
# This file is part of GnuPG.
#
@ -28,7 +29,7 @@ noinst_PROGRAMS = mpicalc bftest clean-sat mk-tdata shmtest
gpgsplit_LDADD = $(needed_libs) $(other_libs) @ZLIBS@
mpicalc_LDADD = $(needed_libs) $(other_libs) @W32LIBS@
bftest_LDADD = $(needed_libs) $(other_libs) @W32LIBS@ @DLLIBS@ @NETLIBS@
shmtest_LDADD = $(needed_libs) $(other_libs)
bftest_LDADD = $(needed_libs) $(other_libs) @W32LIBS@ @DLLIBS@ @NETLIBS@ @LIBREADLINE@
shmtest_LDADD = $(needed_libs) $(other_libs) @LIBREADLINE@
gpgsplit mpicalc bftest shmtest: $(needed_libs)

View File

@ -1,3 +1,8 @@
2004-12-18 David Shaw <dshaw@jabberwocky.com>
* ttyio.c: Use only HAVE_LIBREADLINE to detect readline
availability.
2004-12-16 David Shaw <dshaw@jabberwocky.com>
* srv.h: Don't include arpa/nameser.h unless we have it. Include

View File

@ -46,7 +46,7 @@
#endif
#include <errno.h>
#include <ctype.h>
#ifdef HAVE_READLINE_READLINE_H
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
@ -162,7 +162,7 @@ init_ttyfp(void)
tty_get_ttyname (), strerror(errno) );
exit(2);
}
#if defined(HAVE_READLINE_READLINE_H) && defined(HAVE_LIBREADLINE)
#ifdef HAVE_LIBREADLINE
rl_catch_signals = 0;
rl_instream = rl_outstream = ttyfp;
#endif
@ -512,7 +512,7 @@ do_get( const char *prompt, int hidden )
char *
tty_get( const char *prompt )
{
#if defined(HAVE_READLINE_READLINE_H) && defined(HAVE_LIBREADLINE)
#ifdef HAVE_LIBREADLINE
if (!batchmode && !no_terminal) {
char *line;
char *buf;
@ -544,7 +544,7 @@ tty_get( const char *prompt )
return buf;
}
else
#endif /* HAVE_READLINE_READLINE_H && HAVE_LIBREADLINE */
#endif /* HAVE_LIBREADLINE */
return do_get( prompt, 0 );
}