gnupg (9 files)

cvs user dshaw cvs at cvs.gnupg.org
Sat Dec 18 23:19:11 CET 2004


    Date: Saturday, December 18, 2004 @ 23:23:49
  Author: dshaw
    Path: /cvs/gnupg/gnupg

   Added: m4/readline.m4
Modified: g10/ChangeLog g10/Makefile.am g10/signal.c m4/ChangeLog
          tools/ChangeLog tools/Makefile.am util/ChangeLog util/ttyio.c

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.


-------------------+
 g10/ChangeLog     |    7 ++++++
 g10/Makefile.am   |    2 -
 g10/signal.c      |    4 +--
 m4/ChangeLog      |    4 +++
 m4/readline.m4    |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/ChangeLog   |    4 +++
 tools/Makefile.am |    7 +++---
 util/ChangeLog    |    5 ++++
 util/ttyio.c      |    8 +++----
 9 files changed, 87 insertions(+), 10 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.661 gnupg/g10/ChangeLog:1.662
--- gnupg/g10/ChangeLog:1.661	Fri Dec 17 19:51:32 2004
+++ gnupg/g10/ChangeLog	Sat Dec 18 23:23:48 2004
@@ -1,3 +1,10 @@
+2004-12-18  David Shaw  <dshaw at 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 at g10code.com>
 
 	* passphrase.c (agent_get_passphrase): Define NREAD locally as
Index: gnupg/g10/Makefile.am
diff -u gnupg/g10/Makefile.am:1.87 gnupg/g10/Makefile.am:1.88
--- gnupg/g10/Makefile.am:1.87	Thu Oct 28 20:57:50 2004
+++ gnupg/g10/Makefile.am	Sat Dec 18 23:23:48 2004
@@ -132,7 +132,7 @@
 #	       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)
Index: gnupg/g10/signal.c
diff -u gnupg/g10/signal.c:1.19 gnupg/g10/signal.c:1.20
--- gnupg/g10/signal.c:1.19	Tue Sep 28 16:50:05 2004
+++ gnupg/g10/signal.c	Sat Dec 18 23:23:48 2004
@@ -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 @@
 
     secmem_term();
 
-#if defined(HAVE_READLINE_READLINE_H) && defined(HAVE_LIBREADLINE)
+#ifdef HAVE_LIBREADLINE
     rl_free_line_state ();
     rl_cleanup_after_signal ();
 #endif
Index: gnupg/m4/ChangeLog
diff -u gnupg/m4/ChangeLog:1.3 gnupg/m4/ChangeLog:1.4
--- gnupg/m4/ChangeLog:1.3	Tue Jul 27 17:11:53 2004
+++ gnupg/m4/ChangeLog	Sat Dec 18 23:23:49 2004
@@ -1,3 +1,7 @@
+2004-12-18  David Shaw  <dshaw at jabberwocky.com>
+
+	* readline.m4: New.
+
 2004-07-27  gettextize  <bug-gnu-gettext at gnu.org>
 
 	* gettext.m4: Upgrade to gettext-0.14.1.
Index: gnupg/m4/readline.m4
diff -u /dev/null gnupg/m4/readline.m4:1.1
--- /dev/null	Sat Dec 18 23:23:49 2004
+++ gnupg/m4/readline.m4	Sat Dec 18 23:23:49 2004
@@ -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
Index: gnupg/tools/ChangeLog
diff -u gnupg/tools/ChangeLog:1.31 gnupg/tools/ChangeLog:1.32
--- gnupg/tools/ChangeLog:1.31	Thu Oct 28 20:57:50 2004
+++ gnupg/tools/ChangeLog	Sat Dec 18 23:23:49 2004
@@ -1,3 +1,7 @@
+2004-12-18  David Shaw  <dshaw at jabberwocky.com>
+
+	* Makefile.am: Link with readline where needed.
+
 2004-10-28  Werner Koch  <wk at g10code.com>
 
 	* Makefile.am (other_libs): New.  Also include LIBICONV.  Noted by
Index: gnupg/tools/Makefile.am
diff -u gnupg/tools/Makefile.am:1.32 gnupg/tools/Makefile.am:1.33
--- gnupg/tools/Makefile.am:1.32	Thu Oct 28 20:57:50 2004
+++ gnupg/tools/Makefile.am	Sat Dec 18 23:23:49 2004
@@ -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 @@
 
 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)
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.171 gnupg/util/ChangeLog:1.172
--- gnupg/util/ChangeLog:1.171	Thu Dec 16 19:36:42 2004
+++ gnupg/util/ChangeLog	Sat Dec 18 23:23:49 2004
@@ -1,3 +1,8 @@
+2004-12-18  David Shaw  <dshaw at jabberwocky.com>
+
+	* ttyio.c: Use only HAVE_LIBREADLINE to detect readline
+	availability.
+
 2004-12-16  David Shaw  <dshaw at jabberwocky.com>
 
 	* srv.h: Don't include arpa/nameser.h unless we have it.  Include
Index: gnupg/util/ttyio.c
diff -u gnupg/util/ttyio.c:1.33 gnupg/util/ttyio.c:1.34
--- gnupg/util/ttyio.c:1.33	Wed Nov  3 21:03:46 2004
+++ gnupg/util/ttyio.c	Sat Dec 18 23:23:49 2004
@@ -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 @@
                   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 @@
 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 @@
       return buf;
     }
     else
-#endif /* HAVE_READLINE_READLINE_H && HAVE_LIBREADLINE */
+#endif /* HAVE_LIBREADLINE */
       return do_get( prompt, 0 );
 }
 




More information about the Gnupg-commits mailing list