diff options
author | David Shaw <[email protected]> | 2004-12-18 22:23:49 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-12-18 22:23:49 +0000 |
commit | 005b1d7960c0371207af42a4a060a6dd9cc72fac (patch) | |
tree | c39f1653def62376c7b684ed514142c25fee87cd | |
parent | * configure.ac: Add a --with-ldap=DIR so people can add to the search (diff) | |
download | gnupg-005b1d7960c0371207af42a4a060a6dd9cc72fac.tar.gz gnupg-005b1d7960c0371207af42a4a060a6dd9cc72fac.zip |
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.
-rw-r--r-- | g10/ChangeLog | 7 | ||||
-rw-r--r-- | g10/Makefile.am | 2 | ||||
-rw-r--r-- | g10/signal.c | 4 | ||||
-rw-r--r-- | m4/ChangeLog | 4 | ||||
-rw-r--r-- | m4/readline.m4 | 56 | ||||
-rw-r--r-- | tools/ChangeLog | 4 | ||||
-rw-r--r-- | tools/Makefile.am | 7 | ||||
-rw-r--r-- | util/ChangeLog | 5 | ||||
-rw-r--r-- | util/ttyio.c | 8 |
9 files changed, 87 insertions, 10 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index a6b092b29..1e0b08aa2 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-12-18 David Shaw <[email protected]> + + * signal.c: Use only HAVE_LIBREADLINE to detect readline + availability. + + * Makefile.am: Link with readline where necessary. + 2004-12-17 Werner Koch <[email protected]> * passphrase.c (agent_get_passphrase): Define NREAD locally as diff --git a/g10/Makefile.am b/g10/Makefile.am index a3f2ff6e9..3e7e0e165 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -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) diff --git a/g10/signal.c b/g10/signal.c index 0f904ed97..7f91070f3 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -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 diff --git a/m4/ChangeLog b/m4/ChangeLog index ef3e43c89..9095322a5 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2004-12-18 David Shaw <[email protected]> + + * readline.m4: New. + 2004-07-27 gettextize <[email protected]> * gettext.m4: Upgrade to gettext-0.14.1. diff --git a/m4/readline.m4 b/m4/readline.m4 new file mode 100644 index 000000000..ba55b6619 --- /dev/null +++ b/m4/readline.m4 @@ -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 diff --git a/tools/ChangeLog b/tools/ChangeLog index 186ac9a40..3d56d7b2b 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,7 @@ +2004-12-18 David Shaw <[email protected]> + + * Makefile.am: Link with readline where needed. + 2004-10-28 Werner Koch <[email protected]> * Makefile.am (other_libs): New. Also include LIBICONV. Noted by diff --git a/tools/Makefile.am b/tools/Makefile.am index 4cb7e74a4..42929810b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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) diff --git a/util/ChangeLog b/util/ChangeLog index c4a2315ca..6784de7a3 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2004-12-18 David Shaw <[email protected]> + + * ttyio.c: Use only HAVE_LIBREADLINE to detect readline + availability. + 2004-12-16 David Shaw <[email protected]> * srv.h: Don't include arpa/nameser.h unless we have it. Include diff --git a/util/ttyio.c b/util/ttyio.c index f5b761f14..b7dd47173 100644 --- a/util/ttyio.c +++ b/util/ttyio.c @@ -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 ); } |