diff --git a/ChangeLog b/ChangeLog
index df1a6842..6f4559ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,554 +1,566 @@
 2001-08-03  Werner Koch  <wk@gnupg.org>
 
+	Released 1.1.4.
+
+	* acinclude.m4 (GNUPG_CHECK_TYPEDEF): Define GNU Source.
+	
+        Migrated to autoconf 2.52.
+	* acinclude.m4: Removed GNUPG_LINK_FILES and converted.
+	* acconfig.h: Removed
+	* configure.in: Replaced by...
+	* configure.ac: and modified for use with autoconf 2.52.  Replaced
+	GNUPG_LINK_FILES with AC_CONFIG_LINKS and moved some informational
+	messages to the end. Removed --enable-m-debug
+
 	* tests/: New.
 	* Makefile.am: Included tests directory
 	
 	* configure.in (DYNLINK_MOD_CFLAGS): Use -shared with dec-osf.
 	Reported by Chris Adams.  Merged some cases.
 
 2001-05-31  Werner Koch  <wk@gnupg.org>
 
-	Release 1.1.3.
+	Released 1.1.3.
 
 	* configure.in: Use _gcry_ prefix when creating the cipher constructor.
 
 	* acconfig.h (_GCRYPT_IN_LIBGCRYPT): Define it here.
 
 2001-05-28  Werner Koch  <wk@gnupg.org>
 
 	* acinclude.m4 (GPH_PROG_DOCBOOK): Removed.
 	(GPH_PROG_DB2ANY): New. Taken from GPH.
 	* configure.in: Use it here.
 
 2000-12-19  Werner Koch  <wk@gnupg.org>
 
 	Major change:
 	Removed all GnuPG stuff and renamed this piece of software
 	to gcrypt.  The directory gcrypt has been renamed to src.
 
 2000-11-14  Werner Koch  <wk@gnupg.org>
 
 	Version 1.1.2 released.
 
 2000-11-13  Werner Koch  <wk@gnupg.org>
 
 	* acinclude.m4 (GNUPG_FIX_HDR_VERSION): VPATH build fix.
 
 2000-10-10  Werner Koch  <wk@gnupg.org>
 
 	* Makefile.am (dist-hook): Create the version file.
 	* configure.in: Set the libtool version here, removed the need
 	for the version file.
 
 Mon Sep 18 16:35:45 CEST 2000  Werner Koch  <wk@openit.de>
 
         * acinclude.m4 (GNUPG_CHECK_MLOCK):  Removed that silly mkdir().
 
         * configure.in:  Changes to allow for Solaris random device.
         By Nils Ellmenreich.
         (--with-egd-socket): New.
 
         * configure.in (GNUPG_HOMEDIR): New.
 
         * configure.in: Check for fstat64 and fopen64
 
         * acinclude.m4 (GNUPG_CHECK_FAQPROG): New.
         * configure.in: Test for this.
 
         * configure.in (DYNLINK_MOD_CFLAGS): Fix by David Champion.
 
 Tue Aug 22 14:31:15 CEST 2000  Werner Koch  <wk@openit.de>
 
         Version 1.1.1
 
 Fri Aug 18 14:27:14 CEST 2000  Werner Koch  <wk@openit.de>
 
   * agent/: New.
   * Makefile.am, configure.in: Support for the new directory.
 
 Mon Jul 17 16:35:47 CEST 2000  Werner Koch  <wk@>
 
   * configure.in (mingw32): Changes to allow for mingw32msvc
 
 Fri Jul 14 19:38:23 CEST 2000  Werner Koch  <wk@>
 
   The big merge between this one and the stable branch 1.0.  Still need
   to merge TNANKS, AUTHORS and such.  It probaly does not compile yet.
 
   * acinclude.m4 (GNUPG_CHECK_MLOCK): Fixed syntax error in C code.
 
   * configure.in: Add check for termio.h, wait unctiosn and sigaction.
 
   * acinclude.m4, configure.in (GNUPG_CHECK_GNUMAKE): New.
 
   * acinclude.m4 (MKDIR_TAKES_ONE_ARG): Check some headers. By Ga�l Qu�ri.
 
   * configure.in (AM_INIT_AUTOMAKE): Use this now. By Ga�l.
 
   * acinclude.m4 (GNUPG_CHECK_EXPORTDYNAMIC): Replacement for
   GNUPG_CHECK_RDYNAMIC which should handle gcc with non GNU ld nicer.
   Contributed by Dave Dykstra.
   * configure.in (GNYPG_CHECK_RDYNAMIC): Replaced by the new check.
 
   * configure.in: Add a test for unisgned long long.
 
   * configure.in (DYNLINK_MOD_CFLAGS): Set different for NetBSD.
 
   * configure.in: Add check for clock_gettime
 
   * configure.in (ALL_LINGUAS): Add nl.
   * configure.in (ALL_LINGUAS): Add Esperanto.
   * configure.in (ALL_LINGUAS): Add sv and ja.
 
   * configure.in: Use /usr/local for CFLAGS and LDFLAGS when
   target is freebsd.  By R�mi.
 
   * configure.in: Do not set development version when the version has
   a dash in it.  Suggested by Dave Dykstra.
 
   * configure.in: Removed substitution for doc/gph/Makefile.
   Do all the gcc warning only in maintainer mode.
 
   * configure.in (dlopen): Use CHECK_FUNC for a test of dlopen in libc.
   Suggested by Alexandre Oliva.
   (-Wall): Moved the settting of gcc warning options near to the end
   so that tests don't get confused.  Suggested by Paul D. Smith.
 
   * acinclude.m4 (GNUPG_SYS_NM_PARSE): Added BSDI support.
   (GNUPG_CHECK_RDYNAMIC): Ditto.
 
   * acinclude.m4 (GNUPG_CHECK_MLOCK): Changed the way to test for
   librt.  Test suggested by Jeff Long.
 
   * acinclude.m4 (GNUPG_CHECK_MLOCK): Do librt check only when
   we can't link a test program.  This way GNU systems don't need
   to link against linrt.
   (GNUPG_CHECK_IPC): Fixed use of TRY_COMPILE macro.  From Tim Mooney.
 
   * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Add support for
   DJGPP.
   (GNUPG_CHECK_MLOCK): Check whether mlock sits in librt.
 
   * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Add NetBSD. By Thomas Klausner.
 
   * acconfig.h (HAVE_MLOCK): Added
 
 Mon Mar 13 19:22:46 CET 2000  Werner Koch  <wk@openit.de>
 
 	* configure.in: Now uses the Docbook M4s from GPH.
 
 Mon Jan 31 17:46:35 CET 2000  Werner Koch  <wk@>
 
 	* Makefile.am: Re-added tools. By R�mi.
 
 Mon Jan 31 16:37:34 CET 2000  Werner Koch  <wk@gnupg.de>
 
 	* configure.in: Create a symlink for types.h in gcrypt/.
 
 Thu Jan 27 18:00:44 CET 2000  Werner Koch  <wk@gnupg.de>
 
 	* configure.in (g10defs.h): Replaced by gnupg-defs.h
 
 Mon Jan 24 13:04:28 CET 2000  Werner Koch  <wk@gnupg.de>
 
 	* jnlib/ : New.
 
 	* configure.in: Do set development version when the version has
 	a dash in it.  Suggested by Dave Dykstra.
 
 Thu Dec  9 17:22:27 CET 1999  Werner Koch  <wk@gnupg.de>
 
 	* acinclude.m4 (GNUPG_FIX_HDR_VERSION): New.
 	* configure.in: Check and fix the version number of gcrypt/gcrypt.h
 	so that it is always the save as VERSION.
 
 Thu Oct 28 16:17:46 CEST 1999  Werner Koch  <wk@gnupg.de>
 
 	* Started with development series 1.1 on 1999-10-26
 
 Tue Oct 26 14:10:21 CEST 1999  Werner Koch  <wk@gnupg.de>
 
 	* README-alpha: New
 
 	* configure.in: Fixed quoting in test for development version.
 
 	* THANKS: Add entries for Michael, Brenno and J Horacio who did
 	very nice Howto documents - I apoligize for forgetting to mention them
 	earlier.
 
 Fri Sep 17 12:56:42 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* configure.in: Add "-lcap" when capabilities are requested.
 	Add the conditional CROSS_COMPILING.
 	* Makefile.am: Don't use checks when CROSS_COMPILING.
 
 
 Wed Sep 15 16:22:17 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* configure.in (ALL_LINGUAS): Add pt_PT.
 
 	* configure.in: Some tweaks for cross compiling under MingW32
 	* acconfig.h (USE_STATIC_RNDW32): New.
 
 Tue Sep  7 17:08:10 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* VERSION: Set to 1.0.0.
 
 Mon Sep  6 19:59:08 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* configure.in: Create makefile in doc/gph
 
 	* acinclude.m4 (GNUPG_FUNC_MKDIR_TAKES_ONE_ARG): New
 	* configure.in: use the above.
 
 Thu Sep  2 16:40:55 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* VERSION: Set to 0.9.11.
 
 Tue Aug 31 17:20:44 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Minor changes to the OS/2 and Mingw32 system labels.
 	Add a printable name for Hurd.
 
 Mon Aug 30 20:38:33 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Some support for DJGPP (Mark Elbrecht)
 
 Wed Aug  4 10:34:46 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* VERSION: Set to 0.9.10.
 
 Mon Jul 26 09:34:46 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): remove init of ac_cv_...
 
 	* Makefile.am (DISCLEANFILES): New
 
 Fri Jul 23 13:53:03 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* VERSION: Set to 0.9.9.
 
 	* configure.in: Print a notice when rndunix is used.
 
 Thu Jul 15 10:15:35 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Fixed last modification.
 
 Wed Jul  7 13:08:40 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* Makefile.am: Support for libtool.
 	* configure.in: Ditto.
 
 Tue Jun 29 21:44:25 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (use_local_zlib): The lost dollar is back.
 
 	* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Add EMX case.
 	* configure.in: Another variant of the MX vendor string
 
 	* configure.in (--with-capabilities): Some test code (Remi).
 
 Sat Jun 26 12:15:59 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Support for HPUX and IRIX.
 	* configure.in (HAVE_DL_SHL_LOAD): New for HPUX (Dave Dykstra).
 
 	* VERSION: Now 0.9.8
 
 Wed Jun 16 20:16:21 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Add test for docbook-to-man
 
 Tue Jun 15 12:21:08 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_SYS_NM_PARSE): Support for {net,free}bsd,
 
 Thu Jun 10 14:18:23 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (ZLIB,GDBM): Check both, header and lib.
 
 Sat Jun  5 15:30:33 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* pkclist.c (key_present_in_pk_list): New (Michael).
 
 Tue May 25 19:50:32 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (IS_DEVELOPMENT_VERSION): Fixed detection.
 
 Sun May 23 14:20:22 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): assume yes when
 	cross-compiling.
 
 Mon May 17 21:54:43 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (socket): Fix for Unisys by Katsuhiro Kondou.
 
 Sat May  8 19:28:08 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* NEWS: Add a marker line which I forgot to do for 0.9.6.
 
 Thu May  6 14:18:17 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* README: Minor updates
 
 	* VERSION: Now 0.9.6
 
 Thu Apr  8 09:35:53 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Fix for
 					       amiga-openbsd (Peter Reich)
 	(GNUPG_PROG_NM): Ditto
 
 Wed Apr  7 20:51:39 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* Makefile.am (g10defs.h): Removed.
 	* configure.in (AC_OUTPUT_COMMANDS): Create g10defs.h
 
 Sat Mar 20 12:55:33 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* VERSION: Now 0.9.5
 
 Sun Mar 14 19:34:36 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (AM_SYS_SYMBOL_UNDERSCORE): Removed because it is
 	now in the latest libtool.
 
 Thu Mar 11 16:39:46 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Removed the need for libtool
 
 Mon Mar  8 20:47:17 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (DLSYM_NEEDS_UNDERSCORE): Replaced.
 	* acinclude.in (AM_SYS_SYMBOL_UNDERSCORE): New.
 
 	* VERSION: Now 0.9.4
 
 Sun Feb 28 19:11:00 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (dld): Test disabled.
 
 Fri Feb 26 17:55:41 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* encode.c (encode_simple): temporary fix.
 
 Wed Feb 24 11:07:27 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: New option --enable-static-rnd.
 
 Mon Feb 22 20:04:00 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* BUGS: Now we assign bug numbers.
 	* OBUGS: New to keep rack o fixed bugs (CVS only)
 
 Fri Feb 19 18:01:54 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* VERSION: Released 0.9.3
 
 Fri Feb 19 15:49:15 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4: Removed gettext macros.
 
 Tue Feb 16 14:10:02 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in (socket): Check for -lsocket and -lnsl.
 	(osf4): Disable all warnings for DEC's cc.
 	(-Wall): Add more warning options for gcc
 
 Sat Feb 13 12:04:43 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Changed detection of compiler flags.
 	* intl/ : Removed directory
 
 Wed Feb 10 17:15:39 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Fix for freebsd 2.2
 
 	* configure.in: a lot of changes to allow selection of modules.
 	Add support for OS/2.
 
 	* acinclude.m4: add some more caching
 
 	* README: Spelling and grammar corrections (John A. Martin)
 	* INSTALL: Ditto.
 
 Wed Jan 20 21:40:21 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: --enable-m-guard is now default
 
 Wed Jan 13 12:49:36 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* INSTALL: Applied new information how to build rpms by Fabio Coatti
 	* Makefile.in (gnupg.spec): Changed the names.
 
 Tue Jan 12 11:17:18 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* config.links (m68k-atari-mint): New
 
 Tue Jan 12 09:17:19 CET 1999  Ga�l Qu�ri <gqueri@mail.dotcom.fr>
 
 	* all: Fixed typos all over the place
 
 Sat Jan  9 16:02:23 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Add a way to statically link rndunix
 
 Sun Jan  3 15:28:44 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m4 (GNUPG_CHECK_RDYNAMIC): New.
 	* configure.in (DYNLOAD_CFLAGS): Use result from CHECK_RDYNAMIC
 
 Wed Dec 23 13:18:14 CET 1998  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* README: Replaced the command overview with a short intro.
 
 Sat Dec 12 18:40:32 CET 1998  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* configure.in: Add check for dlopen in libc (Greg Troxel)
 	and a new define
 	* acconfig.h (DLSYM_NEEDS_UNDERSCORE): New.
 
 Thu Dec 10 20:15:36 CET 1998  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* acinclude.m (GNUPG_CHECK_PIC): New
 	* configure.in, acinclude.m4: Renamed all WK_ to GNUPG_
 
 Tue Dec  8 15:09:29 CET 1998  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* VERSION: Set to 0.4.5
 
 Wed Nov 25 12:38:29 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (USE_RNDLINUX): New.
 
 Fri Nov 20 19:34:57 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* VERSION: Released 0.4.4
 
 	* configure.in (try_asm_modules): For option --disable-asm
 
 Tue Nov 10 19:32:40 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (MPI_SFLAGS): New.
 
 Tue Nov 10 13:44:53 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* ABOUT-NLS: New
 	* configure.in (AC_REVISION): New.
 
 Sun Nov  8 18:20:35 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* VERSION: Set to 0.4.3
 
 Sun Oct 25 19:49:37 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* Makefile.am (g10defs.h): New macro GNUPG_DATADIR.
 
 Wed Oct 21 17:24:24 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in: Removed gettext kludge
 	* acinclude.m4: Add patched AM_WITH_NKS macro
 
 Tue Oct 20 19:03:36 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in: Kludge to make AM_GNU_GETTEXT work,
 	changed some macors to more modern versions. Also
 	changeg the all makefiles to remove duplicate ../intl.
 	* acinclude.m4: Removed the gettext stuff, as this
 	already comes with automake now.
 
 Wed Oct 14 12:11:34 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (NAME_OF_DEV_RANDOM): New.
 	(DYNLINK_MOD_CFLAGS): New.
 
 Thu Oct  8 10:55:15 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* Makefile.am (g10defs.h): creates include file
 	* acconfig.h: now includes g10defs.h
 	* configure.in: Removed G10_LOCALEDIR and GNUPG_LIB
 
 Thu Sep 17 18:49:40 1998  Werner Koch  (wk@(none))
 
 	* Makefile.am (dist-hook): Now creates RPM file.
 	* scripts/gnupg.spec: New template file for RPMs
 
 Thu Jul 30 19:17:07 1998  Werner Koch  (wk@(none))
 
 	* acinclude.h (WK_CHECK_IPC): New
 	* configure.in : Add checks for SysV IPC
 
 Thu Jun 25 11:18:49 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (--disable-dynload): New.
 
 Wed Jun 10 07:48:59 1998  Werner Koch,mobil,,,	(wk@tobold)
 
 	* configure.in (GNUPG_LIBDIR): New.
 
 Mon May 25 19:10:59 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* rand-unix.c (fast_random_poll): fixed syntax bug.
 
 Mon May 11 10:21:31 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (PRINTABLE_OS_NAME): Linux is now GNU/Linux
 
 Tue Apr 14 19:08:05 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* [all files]: Applied Matthew Skala's typo and grammar fixes.
 
 Wed Mar  4 10:32:40 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (getrusage,gettimeofday): New tests.
 
 Fri Feb 27 13:14:17 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (--disable-m-guard): New.
 
 Thu Feb 26 17:09:27 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in, acinclude.m4, intl/, po/: New macros taken
 	from GNOME, switched to automake 1.2f
 
 Thu Feb 26 09:05:46 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (doc/Makefile): New
 
 Thu Feb 26 07:40:47 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in: Changed gettext stuff
 
 Wed Feb 25 11:44:10 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* checks/*test : restructured the directory.
 
 Tue Feb 24 15:59:12 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in: Changed the name of the package to GNUPG and
 	chnaged several other names too.
 
 Wed Feb 18 17:36:45 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* Makefile.am (checks): New.
 
 Sat Feb 14 15:37:55 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (mpi_config_done): Removed asm links caching.
 
 Sat Feb 14 14:02:20 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in (PRINTABLE_OS_NAME): New.
 	* acconfig.h: Likewise.
 
 Fri Feb 13 19:43:41 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* configure.in : Fixed zlib stuff
 	* Makefile.am: Likewise
 
diff --git a/NEWS b/NEWS
index dc41db23..2d98e9ad 100644
--- a/NEWS
+++ b/NEWS
@@ -1,19 +1,28 @@
+Noteworthy changes in version 1.1.4 (2001-08-03)
+------------------------------------------------
 
   * Arcfour does now work.                   
 
+  * Some minor fixes.
+
+  * Added a first test program
+
+  * Migrated to autoconf 2.52.
+
+
 Noteworthy changes in version 1.1.3 (2001-05-31)
 ------------------------------------------------
 
   * First release of Libgcrypt which is a result of splitting GnuPG
     into into libgcrypt and GnuPG.
 
 
 Copyright 2001 Free Software Foundation, Inc.
 
 This file is free software; as a special exception the author gives
 unlimited permission to copy and/or distribute it, with or without
 modifications, as long as this notice is preserved.
 
 This file is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/README b/README
index 5e0d674f..6590e9ee 100644
--- a/README
+++ b/README
@@ -1,19 +1,24 @@
 		    libgcrypt - The GNU crypto library
 		   ------------------------------------
   			    Version 1.1
 
         	WARNING:  This is work in PROGRESS!
 
 Libgcrypt is a general purpose crypto library based on the code used
 in GnuPG.  We can't start with a new version number becuase libgcrypt
 was part of gnupg 1.1 and some applications already used it and tested
 for the version number. We believe that the API can stay as it is,
 except that new functions may be added in the future.
 
 This is a development version, the first stable version will be 1.2.0.
 
+If you are using the CVS version, make sure that you have the latest
+automake (I am using Debian Sid). Ignore the make warnings about
+overriding old rules. I had to include lsmain.sh two times due to
+autoconf/libtool mismatches.
+
 
 
 
 
 
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index 0b7a8365..00000000
--- a/acconfig.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* acconfig.h - used by autoheader to make config.h.in
- *	Copyright (C) 1998 Free Software Foundation, Inc.
- *
- * This file is part of GNUPG.
- *
- * GNUPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNUPG is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#ifndef GCRYPT_CONFIG_H
-#define GCRYPT_CONFIG_H
-
-/* need this, because some autoconf tests rely on this (e.g. stpcpy)
- * and it should be used for new programs
- */
-#define _GNU_SOURCE  1
-
-@TOP@
-
-#undef M_DEBUG
-#undef M_GUARD
-#undef VERSION
-#undef PACKAGE
-#undef PRINTABLE_OS_NAME
-#undef IS_DEVELOPMENT_VERSION
-
-/* Define if your locale.h file contains LC_MESSAGES.  */
-#undef HAVE_LC_MESSAGES
-
-/* Define to 1 if NLS is requested.  */
-#undef ENABLE_NLS
-
-/* Define as 1 if you have catgets and don't want to use GNU gettext.  */
-#undef HAVE_CATGETS
-
-/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
-#undef HAVE_GETTEXT
-
-/* libintl.h is available; this is obsolete because if we don't have
- * this header we use a symlink to the one in intl/ */
-#undef HAVE_LIBINTL_H
-
-
-#undef HAVE_STPCPY
-
-#undef HAVE_MLOCK
-
-
-#undef BIG_ENDIAN_HOST
-#undef LITTLE_ENDIAN_HOST
-
-#undef HAVE_BYTE_TYPEDEF
-#undef HAVE_USHORT_TYPEDEF
-#undef HAVE_ULONG_TYPEDEF
-#undef HAVE_U16_TYPEDEF
-#undef HAVE_U32_TYPEDEF
-
-#undef HAVE_BROKEN_MLOCK
-
-/* defined if we have a /dev/random and /dev/urandom */
-#undef HAVE_DEV_RANDOM
-/* and the real names of the random devices */
-#undef NAME_OF_DEV_RANDOM
-#undef NAME_OF_DEV_URANDOM
-/* Linux has an ioctl */
-#undef HAVE_DEV_RANDOM_IOCTL
-/* see cipher/rndegd.c */
-#undef EGD_SOCKET_NAME
-
-
-#undef USE_DYNAMIC_LINKING
-#undef HAVE_DL_DLOPEN
-#undef HAVE_DL_SHL_LOAD
-#undef HAVE_DLD_DLD_LINK
-
-#undef USE_SHM_COPROCESSING
-
-#undef IPC_HAVE_SHM_LOCK
-#undef IPC_RMID_DEFERRED_RELEASE
-
-/* set this to limit filenames to the 8.3 format */
-#undef USE_ONLY_8DOT3
-/* defined if we must run on a stupid file system */
-#undef HAVE_DRIVE_LETTERS
-/* defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2)
- * with special properties like no file modes */
-#undef HAVE_DOSISH_SYSTEM
-/* because the Unix gettext has to much overhead on MingW32 systems
- * and these systems lack Posix functions, we use a simplified version
- * of gettext */
-#undef USE_SIMPLE_GETTEXT
-/* At some point in the system we need to know that we use the Windows
- * random module. */
-#undef USE_STATIC_RNDW32
-
-#undef USE_CAPABILITIES
-
-/* Some systems have mkdir that takes a single argument. */
-#undef MKDIR_TAKES_ONE_ARG
-
-
-@BOTTOM@
-
-#include "gcrypt-defs.h"
-
-#define _GCRYPT_IN_LIBGCRYPT 1
-
-
-#endif /*GCRYPT_CONFIG_H*/
diff --git a/acinclude.m4 b/acinclude.m4
index daf6a355..e1d74f52 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,780 +1,782 @@
-dnl macros to configure g10
+dnl macros to configure Libgcrypt
+dnl Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl
+dnl This file is part of Libgcrypt.
+dnl
+dnl Libgcrypt is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl Libgcrypt is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
 
 dnl GNUPG_MSG_PRINT(STRING)
 dnl print a message
 dnl
 define(GNUPG_MSG_PRINT,
-  [ echo $ac_n "$1"" $ac_c" 1>&AC_FD_MSG
+  [ echo $ac_n "$1"" $ac_c" 1>&AS_MESSAGE_FD([])
   ])
 
 
 dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME)
 dnl Check whether a typedef exists and create a #define $2 if it exists
 dnl
 AC_DEFUN(GNUPG_CHECK_TYPEDEF,
   [ AC_MSG_CHECKING(for $1 typedef)
     AC_CACHE_VAL(gnupg_cv_typedef_$1,
-    [AC_TRY_COMPILE([#include <stdlib.h>
+    [AC_TRY_COMPILE([#define _GNU_SOURCE 1
+    #include <stdlib.h>
     #include <sys/types.h>], [
     #undef $1
     int a = sizeof($1);
     ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )])
     AC_MSG_RESULT($gnupg_cv_typedef_$1)
     if test "$gnupg_cv_typedef_$1" = yes; then
-        AC_DEFINE($2)
+        AC_DEFINE($2,1,[Defined if a `]$1[' is typedef'd])
     fi
   ])
 
 
 dnl GNUPG_FIX_HDR_VERSION(FILE, NAME)
 dnl Make the version number in gcrypt/gcrypt.h the same as the one here.
 dnl (this is easier than to have a .in file just for one substitution)
 dnl
 AC_DEFUN(GNUPG_FIX_HDR_VERSION,
   [ sed "s/^#define $2 \".*/#define $2 \"$VERSION\"/" $srcdir/$1 > $srcdir/$1.tmp
     if cmp -s $srcdir/$1 $srcdir/$1.tmp 2>/dev/null; then
         rm -f $srcdir/$1.tmp
     else
         rm -f $srcdir/$1
         if mv $srcdir/$1.tmp $srcdir/$1 ; then
             :
         else
             AC_MSG_ERROR([[
 *** Failed to fix the version string macro $2 in $1.
 *** The old file has been saved as $1.tmp
                          ]])
         fi
         AC_MSG_WARN([fixed the $2 macro in $1])
     fi
   ])
 
 
 dnl GNUPG_CHECK_GNUMAKE
 dnl
 AC_DEFUN(GNUPG_CHECK_GNUMAKE,
   [
     if ${MAKE-make} --version 2>/dev/null | grep '^GNU ' >/dev/null 2>&1; then
         :
     else
         AC_MSG_WARN([[
 ***
 *** It seems that you are not using GNU make.  Some make tools have serious
 *** flaws and you may not be able to build this software at all. Before you
 *** complain, please try GNU make:  GNU make is easy to build and available
 *** at all GNU archives.  It is always available from ftp.gnu.org:/gnu/make.
 ***]])
     fi
   ])
 
 dnl GNUPG_CHECK_FAQPROG
 dnl
 AC_DEFUN(GNUPG_CHECK_FAQPROG,
   [ AC_MSG_CHECKING(for faqprog.pl)
     if faqprog.pl -V 2>/dev/null | grep '^faqprog.pl ' >/dev/null 2>&1; then
         working_faqprog=yes
         FAQPROG="faqprog.pl"
     else 
 	working_faqprog=no
         FAQPROG=": "
     fi
     AC_MSG_RESULT($working_faqprog)
     AC_SUBST(FAQPROG)
     AM_CONDITIONAL(WORKING_FAQPROG, test "$working_faqprog" = "yes" )
 
     if test $working_faqprog = no; then
 	AC_MSG_WARN([[
 ***
 *** It seems that the faqprog.pl program is not installed.
 *** Unless you do not change the source of the FAQs it is not required.
 *** The working version of this utility should be available at:
 ***   ftp://ftp.gnupg.org/pub/gcrypt/contrib/faqprog.pl
 ***]])
     fi
   ])       
 
 
 
-dnl GNUPG_LINK_FILES( SRC, DEST )
-dnl same as AC_LINK_FILES, but collect the files to link in
-dnl some special variables and do the link
-dnl when GNUPG_DO_LINK_FILES is called
-dnl This is a workaround for AC_LINK_FILES, because it does not work
-dnl correct when using a caching scheme
-dnl
-define(GNUPG_LINK_FILES,
-  [ if test "x$wk_link_files_src" = "x"; then
-        wk_link_files_src="$1"
-        wk_link_files_dst="$2"
-    else
-        wk_link_files_src="$wk_link_files_src $1"
-        wk_link_files_dst="$wk_link_files_dst $2"
-    fi
-  ])
-define(GNUPG_DO_LINK_FILES,
-  [ AC_LINK_FILES( $wk_link_files_src, $wk_link_files_dst )
-  ])
-
-
-
-
 dnl GNUPG_CHECK_ENDIAN
 dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST
 dnl
 define(GNUPG_CHECK_ENDIAN,
   [ if test "$cross_compiling" = yes; then
         AC_MSG_WARN(cross compiling; assuming little endianess)
     fi
     AC_MSG_CHECKING(endianess)
     AC_CACHE_VAL(gnupg_cv_c_endian,
       [ gnupg_cv_c_endian=unknown
         # See if sys/param.h defines the BYTE_ORDER macro.
         AC_TRY_COMPILE([#include <sys/types.h>
         #include <sys/param.h>], [
         #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
          bogus endian macros
         #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
         AC_TRY_COMPILE([#include <sys/types.h>
         #include <sys/param.h>], [
         #if BYTE_ORDER != BIG_ENDIAN
          not big endian
         #endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)])
         if test "$gnupg_cv_c_endian" = unknown; then
             AC_TRY_RUN([main () {
               /* Are we little or big endian?  From Harbison&Steele.  */
               union
               {
                 long l;
                 char c[sizeof (long)];
               } u;
               u.l = 1;
               exit (u.c[sizeof (long) - 1] == 1);
               }],
               gnupg_cv_c_endian=little,
               gnupg_cv_c_endian=big,
               gnupg_cv_c_endian=little
             )
         fi
       ])
     AC_MSG_RESULT([$gnupg_cv_c_endian])
     if test "$gnupg_cv_c_endian" = little; then
-      AC_DEFINE(LITTLE_ENDIAN_HOST)
+      AC_DEFINE(LITTLE_ENDIAN_HOST,1,
+                [Defined if the host has little endian byte ordering])
     else
-      AC_DEFINE(BIG_ENDIAN_HOST)
+      AC_DEFINE(BIG_ENDIAN_HOST,1,
+                [Defined if the host has big endian byte ordering])
     fi
   ])
 
 dnl GNUPG_CHECK_CACHE
 dnl
 define(GNUPG_CHECK_CACHE,
   [ AC_MSG_CHECKING(cached information)
     gnupg_hostcheck="$target"
     AC_CACHE_VAL(gnupg_cv_hostcheck, [ gnupg_cv_hostcheck="$gnupg_hostcheck" ])
     if test "$gnupg_cv_hostcheck" != "$gnupg_hostcheck"; then
         AC_MSG_RESULT(changed)
         AC_MSG_WARN(config.cache exists!)
         AC_MSG_ERROR(you must do 'make distclean' first to compile for
                  different target or different parameters.)
     else
         AC_MSG_RESULT(ok)
     fi
   ])
 
 
 ######################################################################
 # Check for -fPIC etc (taken from libtool)
 # This sets CFLAGS_PIC to the required flags
 #           NO_PIC to yes if it is not possible to
 #                  generate PIC
 ######################################################################
 dnl GNUPG_CHECK_PIC
 dnl
 define(GNUPG_CHECK_PIC,
   [ AC_MSG_CHECKING(for option to create PIC)
     CFLAGS_PIC=
     NO_PIC=no
     if test "$cross_compiling" = yes; then
         AC_MSG_RESULT(assume none)
     else
         if test "$GCC" = yes; then
             CFLAGS_PIC="-fPIC"
         else
             case "$host_os" in
               aix3* | aix4*)
                 # All rs/6000 code is PIC
                 # but is there any non-rs/6000 AIX platform?
                 ;;
 
               hpux9* | hpux10*)
                 CFLAGS_PIC="+Z"
                 ;;
 
               irix5* | irix6*)
                 # PIC (with -KPIC) is the default.
                 ;;
 
               osf3* | osf4*)
                 # FIXME - pic_flag is probably required for
                 # hppa*-osf* and i860-osf*
                 ;;
 
               sco3.2v5*)
                 CFLAGS_PIC='-Kpic'
                 ;;
 
               solaris2* | solaris7* )
                 CFLAGS_PIC='-KPIC'
                 ;;
 
               sunos4*)
                 CFLAGS_PIC='-PIC'
                 ;;
 
               *)
                 NO_PIC=yes
                 ;;
             esac
         fi
 
         case "$host_cpu" in
         rs6000 | powerpc | powerpcle)
           # Yippee! All RS/6000 and PowerPC code is position-independent.
           CFLAGS_PIC=""
           ;;
         esac
 
         if test "$NO_PIC" = yes; then
             AC_MSG_RESULT(not possible)
         else
             if test -z "$CFLAGS_PIC"; then
                AC_MSG_RESULT(none)
             else
                 AC_MSG_RESULT($CFLAGS_PIC)
             fi
         fi
     fi
   ])
 
 
 ######################################################################
 # Check for export-dynamic flag
 # This sets CFLAGS_EXPORTDYNAMIC to the required flags
 ######################################################################
 dnl GNUPG_CHECK_EXPORTDYNAMIC
 dnl
 define(GNUPG_CHECK_EXPORTDYNAMIC,
   [ AC_MSG_CHECKING(how to specify -export-dynamic)
     if test "$cross_compiling" = yes; then
       AC_MSG_RESULT(assume none)
       CFLAGS_EXPORTDYNAMIC=""
     else
       AC_CACHE_VAL(gnupg_cv_export_dynamic,[
       if AC_TRY_COMMAND([${CC-cc} $CFLAGS -Wl,--version 2>&1 |
                                           grep "GNU ld" >/dev/null]); then
           # using gnu's linker
           gnupg_cv_export_dynamic="-Wl,-export-dynamic"
       else
           case "$host_os" in
             hpux* )
               gnupg_cv_export_dynamic="-Wl,-E"
               ;;
             * )
               gnupg_cv_export_dynamic=""
               ;;
           esac
       fi
       ])
       AC_MSG_RESULT($gnupg_cv_export_dynamic)
       CFLAGS_EXPORTDYNAMIC="$gnupg_cv_export_dynamic"
     fi
   ])
 
 #####################################################################
 # Check for SysV IPC  (from GIMP)
 #   And see whether we have a SHM_LOCK (FreeBSD does not have it).
 #####################################################################
 dnl GNUPG_CHECK_IPC
 dnl
 define(GNUPG_CHECK_IPC,
    [ AC_CHECK_HEADERS(sys/ipc.h sys/shm.h)
      if test "$ac_cv_header_sys_shm_h" = "yes"; then
        AC_MSG_CHECKING(whether IPC_RMID allowes subsequent attaches)
        AC_CACHE_VAL(gnupg_cv_ipc_rmid_deferred_release,
           AC_TRY_RUN([
              #include <sys/types.h>
              #include <sys/ipc.h>
              #include <sys/shm.h>
              int main()
              {
                int id;
                char *shmaddr;
              id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
              if (id == -1)
                exit (2);
                shmaddr = shmat (id, 0, 0);
                shmctl (id, IPC_RMID, 0);
                if ((char*) shmat (id, 0, 0) == (char*) -1)
                {
                  shmdt (shmaddr);
                  exit (1);
                }
                shmdt (shmaddr);
                shmdt (shmaddr);
                exit (0);
              }
          ],
          gnupg_cv_ipc_rmid_deferred_release="yes",
          gnupg_cv_ipc_rmid_deferred_release="no",
          gnupg_cv_ipc_rmid_deferred_release="assume-no")
        )
        if test "$gnupg_cv_ipc_rmid_deferred_release" = "yes"; then
-           AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
+           AC_DEFINE(IPC_RMID_DEFERRED_RELEASE,1,
+                     [Defined if we can do a deferred shm release])
            AC_MSG_RESULT(yes)
        else
           if test "$gnupg_cv_ipc_rmid_deferred_release" = "no"; then
               AC_MSG_RESULT(no)
           else
               AC_MSG_RESULT([assuming no])
           fi
        fi
 
        AC_MSG_CHECKING(whether SHM_LOCK is available)
        AC_CACHE_VAL(gnupg_cv_ipc_have_shm_lock,
           AC_TRY_COMPILE([#include <sys/types.h>
              #include <sys/ipc.h>
              #include <sys/shm.h>],[
              int shm_id;
              shmctl(shm_id, SHM_LOCK, 0);
              ],
              gnupg_cv_ipc_have_shm_lock="yes",
              gnupg_cv_ipc_have_shm_lock="no"
           )
        )
        if test "$gnupg_cv_ipc_have_shm_lock" = "yes"; then
-         AC_DEFINE(IPC_HAVE_SHM_LOCK)
+         AC_DEFINE(IPC_HAVE_SHM_LOCK,1,
+                   [Defined if a SysV shared memory supports the LOCK flag])
          AC_MSG_RESULT(yes)
        else
          AC_MSG_RESULT(no)
        fi
      fi
    ])
 
 
 ######################################################################
 # Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock
 # is not called from uid 0 (not tested whether uid 0 works)
 # For DECs Tru64 we have also to check whether mlock is in librt
 # mlock is there a macro using memlk()
 ######################################################################
 dnl GNUPG_CHECK_MLOCK
 dnl
 define(GNUPG_CHECK_MLOCK,
   [ AC_CHECK_FUNCS(mlock)
     if test "$ac_cv_func_mlock" = "no"; then
         AC_CHECK_HEADERS(sys/mman.h)
         if test "$ac_cv_header_sys_mman_h" = "yes"; then
             # Add librt to LIBS:
             AC_CHECK_LIB(rt, memlk)
             AC_CACHE_CHECK([whether mlock is in sys/mman.h],
                             gnupg_cv_mlock_is_in_sys_mman,
                 [AC_TRY_LINK([
                     #include <assert.h>
                     #ifdef HAVE_SYS_MMAN_H
                     #include <sys/mman.h>
                     #endif
                 ], [
                     int i;
                     
                     /* glibc defines this for functions which it implements
                      * to always fail with ENOSYS.  Some functions are actually
                      * named something starting with __ and the normal name
                      * is an alias.  */
                     #if defined (__stub_mlock) || defined (__stub___mlock)
                     choke me
                     #else
                     mlock(&i, 4);
                     #endif
                     ; return 0;
                 ],
                 gnupg_cv_mlock_is_in_sys_mman=yes,
                 gnupg_cv_mlock_is_in_sys_mman=no)])
             if test "$gnupg_cv_mlock_is_in_sys_mman" = "yes"; then
-                AC_DEFINE(HAVE_MLOCK)
+                AC_DEFINE(HAVE_MLOCK,1,
+                          [Defined if the system supports an mlock() call])
             fi
         fi
     fi
     if test "$ac_cv_func_mlock" = "yes"; then
         AC_MSG_CHECKING(whether mlock is broken)
           AC_CACHE_VAL(gnupg_cv_have_broken_mlock,
              AC_TRY_RUN([
                 #include <stdlib.h>
                 #include <unistd.h>
                 #include <errno.h>
                 #include <sys/mman.h>
                 #include <sys/types.h>
                 #include <fcntl.h>
 
                 int main()
                 {
                     char *pool;
                     int err;
                     long int pgsize = getpagesize();
 
                     pool = malloc( 4096 + pgsize );
                     if( !pool )
                         return 2;
                     pool += (pgsize - ((long int)pool % pgsize));
 
                     err = mlock( pool, 4096 );
                     if( !err || errno == EPERM )
                         return 0; /* okay */
 
                     return 1;  /* hmmm */
                 }
 
             ],
             gnupg_cv_have_broken_mlock="no",
             gnupg_cv_have_broken_mlock="yes",
             gnupg_cv_have_broken_mlock="assume-no"
            )
          )
          if test "$gnupg_cv_have_broken_mlock" = "yes"; then
-             AC_DEFINE(HAVE_BROKEN_MLOCK)
+             AC_DEFINE(HAVE_BROKEN_MLOCK,1,
+                       [Defined if the mlock() call does not work])
              AC_MSG_RESULT(yes)
          else
             if test "$gnupg_cv_have_broken_mlock" = "no"; then
                 AC_MSG_RESULT(no)
             else
                 AC_MSG_RESULT(assuming no)
             fi
          fi
     fi
   ])
 
 
 
 ################################################################
 # GNUPG_PROG_NM - find the path to a BSD-compatible name lister
 ################################################################
 AC_DEFUN(GNUPG_PROG_NM,
 [AC_MSG_CHECKING([for BSD-compatible nm])
 AC_CACHE_VAL(ac_cv_path_NM,
 [if test -n "$NM"; then
   # Let the user override the test.
   ac_cv_path_NM="$NM"
 else
   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/nm; then
       # Check to see if the nm accepts a BSD-compat flag.
       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
       #   nm: unknown option "B" ignored
       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
         ac_cv_path_NM="$ac_dir/nm -B"
       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
         ac_cv_path_NM="$ac_dir/nm -p"
       else
         ac_cv_path_NM="$ac_dir/nm"
       fi
       break
     fi
   done
   IFS="$ac_save_ifs"
   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
 AC_SUBST(NM)
 ])
 
 # GNUPG_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
 # by C symbol name from nm.
 AC_DEFUN(GNUPG_SYS_NM_PARSE,
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([GNUPG_PROG_NM])dnl
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 AC_MSG_CHECKING([command to parse $NM output])
 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
 [# These are sane defaults that work on at least a few old systems.
 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
 
 changequote(,)dnl
 # Character class describing NM global symbol codes.
 ac_symcode='[BCDEGRSTU]'
 
 # Regexp to match symbols that can be accessed directly from C.
 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
 
 # Transform the above into a raw symbol and a C symbol.
 ac_symxfrm='\1 \1'
 
 # Define system-specific variables.
 case "$host_os" in
 aix*)
   ac_symcode='[BCDTU]'
   ;;
 freebsd* | netbsd* | openbsd* | bsdi* | sunos* | cygwin32* | mingw32*)
   ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
   ac_symxfrm='_\1 \1'
   ;;
 irix*)
   # Cannot use undefined symbols on IRIX because inlined functions mess us up.
   ac_symcode='[BCDEGRST]'
   ;;
 solaris*)
   ac_symcode='[BDTU]'
   ;;
 esac
 
 # If we're using GNU nm, then use its standard symbol codes.
 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
   ac_symcode='[ABCDGISTUW]'
 fi
 
 case "$host_os" in
 cygwin32* | mingw32*)
   # We do not want undefined symbols on cygwin32.  The user must
   # arrange to define them via -l arguments.
   ac_symcode='[ABCDGISTW]'
   ;;
 esac
 changequote([,])dnl
 
 # Write the raw and C identifiers.
 ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"
 
 # Check to see that the pipe works correctly.
 ac_pipe_works=no
 cat > conftest.$ac_ext <<EOF
 #ifdef __cplusplus
 extern "C" {
 #endif
 char nm_test_var;
 void nm_test_func(){}
 #ifdef __cplusplus
 }
 #endif
 int main(){nm_test_var='a';nm_test_func;return 0;}
 EOF
 if AC_TRY_EVAL(ac_compile); then
   # Now try to grab the symbols.
   ac_nlist=conftest.nm
   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
 
     # Try sorting and uniquifying the output.
     if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
       mv -f "$ac_nlist"T "$ac_nlist"
       ac_wcout=`wc "$ac_nlist" 2>/dev/null`
 changequote(,)dnl
       ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[    ]*\([0-9][0-9]*\).*$/\1/'`
 changequote([,])dnl
       (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
     else
       rm -f "$ac_nlist"T
       ac_count=-1
     fi
 
     # Make sure that we snagged all the symbols we need.
     if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
       if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
         cat <<EOF > conftest.c
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 EOF
         # Now generate the symbol file.
         sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
 
         cat <<EOF >> conftest.c
 #if defined (__STDC__) && __STDC__
 # define __ptr_t void *
 #else
 # define __ptr_t char *
 #endif
 
 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
 int dld_preloaded_symbol_count = $ac_count;
 
 /* The mapping between symbol names and symbols. */
 struct {
   char *name;
   __ptr_t address;
 }
 changequote(,)dnl
 dld_preloaded_symbols[] =
 changequote([,])dnl
 {
 EOF
         sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
         cat <<\EOF >> conftest.c
   {0, (__ptr_t) 0}
 };
 
 #ifdef __cplusplus
 }
 #endif
 EOF
         # Now try linking the two files.
         mv conftest.$ac_objext conftestm.$ac_objext
         ac_save_LIBS="$LIBS"
         ac_save_CFLAGS="$CFLAGS"
         LIBS="conftestm.$ac_objext"
         CFLAGS="$CFLAGS$no_builtin_flag"
         if AC_TRY_EVAL(ac_link) && test -s conftest; then
           ac_pipe_works=yes
         else
-          echo "configure: failed program was:" >&AC_FD_CC
-          cat conftest.c >&AC_FD_CC
+          echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD()
+          cat conftest.c >&AS_MESSAGE_LOG_FD()
         fi
         LIBS="$ac_save_LIBS"
         CFLAGS="$ac_save_CFLAGS"
       else
-        echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
+        echo "cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD()
       fi
     else
-      echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
+      echo "cannot find nm_test_var in $ac_nlist" >&AS_MESSAGE_LOG_FD()
     fi
   else
-    echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
+    echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD()
   fi
 else
-  echo "$progname: failed program was:" >&AC_FD_CC
-  cat conftest.c >&AC_FD_CC
+  echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD()
+  cat conftest.c >&AS_MESSAGE_LOG_FD()
 fi
 rm -rf conftest*
 
 # Do not use the global_symbol_pipe unless it works.
 test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=
 ])
 
 ac_result=yes
 if test -z "$ac_cv_sys_global_symbol_pipe"; then
    ac_result=no
 fi
 AC_MSG_RESULT($ac_result)
 ])
 
 # GNUPG_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
 AC_DEFUN(GNUPG_SYS_LIBTOOL_CYGWIN32,
 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
 AC_CHECK_TOOL(AS, as, false)
 ])
 
 # GNUPG_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
 #                              with an underscore?
 AC_DEFUN(GNUPG_SYS_SYMBOL_UNDERSCORE,
 [tmp_do_check="no"
 case "${target}" in
     i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp)
         ac_cv_sys_symbol_underscore=yes
         ;;
     *)
       if test "$cross_compiling" = yes; then
          ac_cv_sys_symbol_underscore=yes
       else
          tmp_do_check="yes"
       fi
        ;;
 esac
 
 if test "$tmp_do_check" = "yes"; then
 AC_REQUIRE([GNUPG_PROG_NM])dnl
 AC_REQUIRE([GNUPG_SYS_NM_PARSE])dnl
 AC_MSG_CHECKING([for _ prefix in compiled symbols])
 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
 [ac_cv_sys_symbol_underscore=no
 cat > conftest.$ac_ext <<EOF
 void nm_test_func(){}
 int main(){nm_test_func;return 0;}
 EOF
 if AC_TRY_EVAL(ac_compile); then
   # Now try to grab the symbols.
   ac_nlist=conftest.nm
   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
     # See whether the symbols have a leading underscore.
     if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
       ac_cv_sys_symbol_underscore=yes
     else
       if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
         :
       else
-        echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
+        echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD()
       fi
     fi
   else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
+    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD()
   fi
 else
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.c >&AC_FD_CC
+  echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD()
+  cat conftest.c >&AS_MESSAGE_LOG_FD()
 fi
 rm -rf conftest*
 ])
 else
 AC_MSG_CHECKING([for _ prefix in compiled symbols])
 fi
 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
 if test x$ac_cv_sys_symbol_underscore = xyes; then
   AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,
   [define if compiled symbols have a leading underscore])
 fi
 ])
 
 dnl Stolen from gcc
 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
 dnl of the usual 2.
 AC_DEFUN(GNUPG_FUNC_MKDIR_TAKES_ONE_ARG,
 [AC_CHECK_HEADERS(sys/stat.h unistd.h direct.h)
 AC_CACHE_CHECK([if mkdir takes one argument], gnupg_cv_mkdir_takes_one_arg,
 [AC_TRY_COMPILE([
 #include <sys/types.h>
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 #ifdef HAVE_DIRECT_H
 # include <direct.h>
 #endif], [mkdir ("foo", 0);],
         gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)])
 if test $gnupg_cv_mkdir_takes_one_arg = yes ; then
-  AC_DEFINE(MKDIR_TAKES_ONE_ARG)
+  AC_DEFINE(MKDIR_TAKES_ONE_ARG,1,
+            [Defined if mkdir() does not take permission flags])
 fi
 ])
 
 
 dnl GPH_PROG_DB2ANY()
 dnl Check whether we have the needed Docbook tools
 dnl and issue a warning if this is not the case.
 dnl
 dnl This test defines these variables for substitution:
 dnl    DB2ANY  - script used to render Docbook
 dnl
 dnl (wk 2000-05-16)
 dnl
 AC_DEFUN(GPH_PROG_DB2ANY,
   [  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
      working_db2any=no
      if $ac_aux_dir/db2any --systemcheck; then
 	working_db2any=yes
 	DB2ANY=`cd $ac_aux_dir && pwd`/db2any
      else
 	DB2ANY=": "
 	AC_MSG_WARN([[
 ***
 *** It seems that the Docbook environment is not installed as required.
 *** We will try to build everything,  but if you either touch some files
 *** or use a bogus make tool, you may run into problems.
 *** Docbook is normally only needed to build the documentation.
 *** To further investigate the problem you can run the command
 ***    $ac_aux_dir/db2any --systemcheck --verbose
 ***]])
     fi
     AC_SUBST(DB2ANY)
     AM_CONDITIONAL(WORKING_DB2ANY, test "$working_db2any" != yes )
   ])
 
 
diff --git a/cipher/Makefile.am b/cipher/Makefile.am
index 217aa35e..2598359a 100644
--- a/cipher/Makefile.am
+++ b/cipher/Makefile.am
@@ -1,116 +1,127 @@
 # Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 #
 # This file is part of Libgcrypt.
 #
 # Libgcrypt is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 # 
 # Libgcrypt is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
 # Process this file with automake to produce Makefile.in
 
 
 INCLUDES = -I$(top_srcdir)/src 
 
 noinst_LTLIBRARIES = libcipher.la
 
 OMIT_DEPENDENCIES = types.h gcrypt.h
 
 
 # The configure script greps the module names from the EXTRA_PROGRAMS line
 EXTRA_PROGRAMS = rndlinux rndunix rndegd rndw32 sha1 rmd160 md5 tiger
 
 EXTRA_rndlinux_SOURCES = rndlinux.c
 EXTRA_rndunix_SOURCES = rndunix.c
 EXTRA_rndegd_SOURCES = rndegd.c
 EXTRA_rndw32_SOURCES = rndw32.c
 EXTRA_md5_SOURCES = md5.c
 EXTRA_rmd160_SOURCES = rmd160.c
 EXTRA_sha1_SOURCES = sha1.c
 EXTRA_tiger_SOURCES = tiger.c
 
 
 if ENABLE_GNUPG_EXTENSIONS
 pkglib_PROGRAMS  = @DYNAMIC_CIPHER_MODS@
 else
 pkglib_PROGRAMS  =
 endif
 
 
 DYNLINK_MOD_CFLAGS = -DIS_MODULE @DYNLINK_MOD_CFLAGS@
 
 libcipher_la_LDFLAGS =
 libcipher_la_SOURCES = cipher.c  \
 		 pubkey.c	\
 		 md.c		\
 		 dynload.c	\
 		 dynload.h	\
 		 bithelp.h	\
 		 des.c		\
 		 des.h		\
 		 rijndael.c     \
 		 twofish.c	\
 		 blowfish.c	\
 		 blowfish.h	\
 		 cast5.c	\
 		 cast5.h	\
 		 arcfour.c arcfour.h \
 		 elgamal.c	\
 		 elgamal.h	\
 		 primegen.c	\
 		 random.h	\
 		 random.c	\
 		 rand-internal.h \
 		 rmd.h		\
 		 dsa.h		\
 		 dsa.c		\
 		 rsa.c rsa.h    \
 		 smallprime.c	\
 		 construct.c
 
 # configure creates the constructor file
 BUILT_SOURCES = construct.c
 
 libcipher_la_DEPENDENCIES = @STATIC_CIPHER_OBJS@
 libcipher_la_LIBADD =	  @STATIC_CIPHER_OBJS@
 
 
 # If I remember it correct, automake 1.4 has a feature to set
 # fooFLAGS depending on the program.  So we should check it out.
 
+#if BUILD_MODULE_TIGER
 tiger: $(srcdir)/tiger.c
 	`echo $(COMPILE) $(DYNLINK_MOD_CFLAGS) -o tiger $(srcdir)/tiger.c | \
 	    sed -e 's/-O[2-9s]*/-O/g' `
+#endif
 
 tiger.o: $(srcdir)/tiger.c
 	`echo $(COMPILE) -c $(srcdir)/tiger.c | sed -e 's/-O[2-9s]*/-O1/g' `
 
 #twofish: $(srcdir)/twofish.c
 #	 `echo $(COMPILE) $(DYNLINK_MOD_CFLAGS) -o twofish $(srcdir)/twofish.c | \
 #	     sed -e 's/-O[0-9s]*/  /g' `
 
+#if BUILD_MODULE_TWOFISH
 twofish: $(srcdir)/twofish.c
 	$(COMPILE) $(DYNLINK_MOD_CFLAGS) -o twofish $(srcdir)/twofish.c
+#endif
 
 #twofish.o: $(srcdir)/twofish.c
 #	 `echo $(COMPILE) -c $(srcdir)/twofish.c | sed -e 's/-O[0-9s]*/  /g' `
 
-
+#if BUILD_MODULE_RNDUNIX
 rndunix: $(srcdir)/rndunix.c
 	$(COMPILE) $(DYNLINK_MOD_CFLAGS) -o rndunix $(srcdir)/rndunix.c
+#endif
 
+#if BUILD_MODULE_RNDLINUX
 rndlinux: $(srcdir)/rndlinux.c
 	$(COMPILE) $(DYNLINK_MOD_CFLAGS) -o rndlinux $(srcdir)/rndlinux.c
+#endif
 
+#if BUILD_MODULE_RNDEGD
 rndegd: $(srcdir)/rndegd.c
 	$(COMPILE) $(DYNLINK_MOD_CFLAGS) -o rndegd $(srcdir)/rndegd.c
+#endif
+
+
 
diff --git a/configure.in b/configure.ac
similarity index 78%
rename from configure.in
rename to configure.ac
index c4526d18..6ec0a9ae 100644
--- a/configure.in
+++ b/configure.ac
@@ -1,723 +1,785 @@
+dnl Configure.ac script for Libgcrypt
+dnl Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 dnl
-dnl Configure template for GNUPG
+dnl This file is part of Libgcrypt.
+dnl
+dnl Libgcrypt is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl Libgcrypt is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 dnl
 dnl (Process this file with autoconf to produce a configure script.)
 AC_REVISION($Revision$)dnl
 
-dnl Must reset CDPATH so that bash's cd does not print to stdout
-CDPATH=
-
-AC_PREREQ(2.13)
-AC_INIT(src/gcrypt.h)
-AC_CONFIG_AUX_DIR(scripts)
-AM_CONFIG_HEADER(config.h)
-AC_CANONICAL_SYSTEM
+AC_PREREQ(2.52)
 #############################################
 # Version numbers (Rember to change them just before a release)
 # 1. No interfaces changed, only implementations (good): Increment REVISION.
 # 2. Interfaces added, none removed (good): Increment CURRENT, increment
 #    AGE, set REVISION to 0.
 # 3. Interfaces removed (BAD, breaks upward compatibility): Increment
 #    CURRENT, set AGE and REVISION to 0.
-AM_INIT_AUTOMAKE(libgcrypt,1.1.3)
+AC_INIT(libgcrypt,1.1.4)
 LIBGCRYPT_LT_CURRENT=2
 LIBGCRYPT_LT_AGE=1
-LIBGCRYPT_LT_REVISION=0
+LIBGCRYPT_LT_REVISION=1
 ##############################################
+AC_CONFIG_SRCDIR([src/gcrypt.h])
+AC_CONFIG_AUX_DIR(scripts)
+AM_CONFIG_HEADER(config.h)
+AC_CANONICAL_TARGET([])
+
 
 AC_SUBST(LIBGCRYPT_LT_CURRENT)
 AC_SUBST(LIBGCRYPT_LT_AGE)
 AC_SUBST(LIBGCRYPT_LT_REVISION)
 
+PACKAGE="$PACKAGE_NAME"
+VERSION="$PACKAGE_VERSION"
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
 
 
 # ALL_LINGUAS="da de eo es_ES fr id it ja nl pl pt_BR pt_PT ru sv"
 static_modules="sha1 md5 rmd160"
 static_random_module=""
 
 AC_PROG_AWK
 
 MODULES_IN_CIPHER=`$AWK '/^EXTRA_PROGRAMS/ { for(i=3;i<=NF;i++) print $i}' \
                                               $srcdir/cipher/Makefile.am`
 
 dnl
 dnl  Check for random module options
 dnl
 dnl  Fixme: get the list of available modules from MODULES_IN_CIPHER
 dnl         and check against this list
 
 AC_MSG_CHECKING([which static random module to use])
 AC_ARG_ENABLE(static-rnd,
     [  --enable-static-rnd=[egd|unix|linux|none]  ],
 [use_static_rnd=$enableval], [use_static_rnd=default] )
 
 if test "$use_static_rnd" = no; then
     use_static_rnd=default
 fi
 
 case "$use_static_rnd" in
     egd | linux | unix | none | default )
       AC_MSG_RESULT($use_static_rnd)
       ;;
     * )
       AC_MSG_RESULT(invalid argument)
       AC_MSG_ERROR(there is no random module rnd$use_static_rnd)
       ;;
 esac
 
 AC_ARG_WITH(egd-socket,
     [  --with-egd-socket=NAME  Use NAME for the EGD socket)],
             egd_socket_name="$withval", egd_socket_name="" )
-AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, "$egd_socket_name")
+AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, "$egd_socket_name",
+                   [Define if you don't want the default EGD socket name.
+                    For details see cipher/rndegd.c])
 
 
 
 dnl
 dnl See whether the user wants to disable checking for /dev/random
 
 AC_MSG_CHECKING([whether use of /dev/random is requested])
 AC_ARG_ENABLE(dev-random,
 [  --disable-dev-random    disable the use of dev random],
     try_dev_random=$enableval, try_dev_random=yes)
 AC_MSG_RESULT($try_dev_random)
 
 
 dnl
 dnl  Check other options
 dnl
 
 AC_MSG_CHECKING([whether use of extensions is requested])
 AC_ARG_ENABLE(dynload,
 [  --disable-dynload       disable use of extensions],
     try_dynload=$enableval, try_dynload=yes)
 AC_MSG_RESULT($try_dynload)
 
 AC_MSG_CHECKING([whether assembler modules are requested])
 AC_ARG_ENABLE(asm,
 [  --disable-asm           do not use assembler modules],
      try_asm_modules=$enableval, try_asm_modules=yes)
 AC_MSG_RESULT($try_asm_modules)
 
-AC_MSG_CHECKING([whether memory debugging is requested])
-AC_ARG_ENABLE(m-debug,
-[  --enable-m-debug        enable debugging of memory allocation],
-use_m_debug=$enableval, use_m_debug=no)
-AC_MSG_RESULT($use_m_debug)
-if test "$use_m_debug" = yes; then
-    AC_DEFINE(M_DEBUG)
-    use_m_guard=yes
-else
-    AC_MSG_CHECKING([whether memory guard is requested])
-    AC_ARG_ENABLE(m-guard,
+AC_MSG_CHECKING([whether memory guard is requested])
+AC_ARG_ENABLE(m-guard,
     [  --enable-m-guard        enable memory guard facility],
     use_m_guard=$enableval, use_m_guard=no)
     AC_MSG_RESULT($use_m_guard)
-fi
 if test "$use_m_guard" = yes ; then
-    AC_DEFINE(M_GUARD)
+    AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature])
 fi
 
 dnl
 dnl Check whether we want to use Linux capabilities
 dnl
 AC_MSG_CHECKING([whether use of capabilities is requested])
 AC_ARG_WITH(capabilities,
     [  --with-capabilities     use linux capabilities [default=no]],
 [use_capabilities="$withval"],[use_capabilities=no])
 AC_MSG_RESULT($use_capabilities)
 
+AH_TOP([
+/* need this, because some autoconf tests rely on this (e.g. stpcpy)
+ * and it should be used for new programs  */
+#define _GNU_SOURCE  1
+])
+
+AH_BOTTOM([
+#include "gcrypt-defs.h"
+#define _GCRYPT_IN_LIBGCRYPT 1
+])
 
 
 AM_MAINTAINER_MODE
 
 dnl Checks for programs.
 
 dnl
 dnl Setup some stuff depending on host/target.
 dnl
 case "${target}" in
     *-*-mingw32*)
         # special stuff for Windoze NT
         # Do we need to set cross_compiling here or is it sufficient
         # to rely on AC_PROG_CC which is called later?
         cross_compiling=yes
         CC="${target}-gcc"
         CPP="${target}-gcc -E"
         RANLIB="${target}-ranlib"
         disallowed_modules="rndunix rndlinux rndegd"
         ;;
     *)
         disallowed_modules="rndw32"
        ;;
 esac
 
 AC_ARG_PROGRAM
 AC_PROG_MAKE_SET
 AM_SANITY_CHECK
 missing_dir=`cd $ac_aux_dir && pwd`
 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
 AC_PROG_CC
 AC_PROG_CPP
 AC_ISC_POSIX
 AC_PROG_INSTALL
 AC_PROG_AWK
 GPH_PROG_DB2ANY
 
 AM_DISABLE_STATIC
 AM_PROG_LIBTOOL
 
 
 MPI_OPT_FLAGS=""
 
 
 try_gettext=no
 case "${target}" in
     *-*-mingw32*)
         # special stuff for Windoze NT
         ac_cv_have_dev_random=no
-        AC_DEFINE(USE_ONLY_8DOT3)
-        AC_DEFINE(HAVE_DRIVE_LETTERS)
-        AC_DEFINE(HAVE_DOSISH_SYSTEM)
+        AC_DEFINE(USE_ONLY_8DOT3,1,
+                  [set this to limit filenames to the 8.3 format])
+        AC_DEFINE(HAVE_DRIVE_LETTERS,1,
+                  [defined if we must run on a stupid file system])
+        AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
+                  [defined if we run on some of the PCDOS like systems 
+                   (DOS, Windoze. OS/2) with special properties like
+                    no file modes])
         try_gettext="no"
         ;;
     i?86-emx-os2 | i?86-*-os2*emx )
         # OS/2 with the EMX environment
         ac_cv_have_dev_random=no
         AC_DEFINE(HAVE_DRIVE_LETTERS)
         AC_DEFINE(HAVE_DOSISH_SYSTEM)
         try_gettext="no"
         ;;
 
     i?86-*-msdosdjgpp*)
         # DOS with the DJGPP environment
         ac_cv_have_dev_random=no
         AC_DEFINE(HAVE_DRIVE_LETTERS)
         AC_DEFINE(HAVE_DOSISH_SYSTEM)
         try_gettext="no"
         ;;
 
     *-*-freebsd*)
        # FreeBSD
        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
        LDFLAGS="$LDFLAGS -L/usr/local/lib"
        ;;
 
     *-*-hpux*)
         if test -z "$GCC" ; then
             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
         fi
         ;;
     *-dec-osf4*)
         if test -z "$GCC" ; then
             # Suppress all warnings
             # to get rid of the unsigned/signed char mismatch warnings.
             CFLAGS="$CFLAGS -w"
         fi
         ;;
     m68k-atari-mint)
         ;;
     *)
        ;;
 esac
 
 AC_SUBST(MPI_OPT_FLAGS)
 GNUPG_SYS_SYMBOL_UNDERSCORE
 GNUPG_CHECK_PIC
 GNUPG_CHECK_EXPORTDYNAMIC
 if test "$NO_PIC" = yes; then
     try_dynload=no
 fi
 
 
 case "${target}" in
     *-*-mingw32*)
         PRINTABLE_OS_NAME="MingW32"
         ;;
     i?86-emx-os2 | i?86-*-os2*emx )
         PRINTABLE_OS_NAME="OS/2"
         ;;
     i?86-*-msdosdjgpp*)
         PRINTABLE_OS_NAME="MSDOS/DJGPP"
         try_dynload=no
         ;;
     *-linux*)
         PRINTABLE_OS_NAME="GNU/Linux"
         ;;
 dnl let that after linux to avoid gnu-linux problems
     *-gnu*)
         PRINTABLE_OS_NAME="GNU/Hurd"
         ;;
     *)
         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
         ;;
 esac
-AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
+AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
+                   [A human readable text with the name of the OS])
 
 dnl  Fixme: Are these the best flags for OpenBSD????
 case "${target}" in
     *-openbsd* | *-netbsd*)
         NAME_OF_DEV_RANDOM="/dev/srandom"
         NAME_OF_DEV_URANDOM="/dev/urandom"
         DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x"
         ;;
 
     *-solaris* | *-irix* | *-dec-osf* )
         NAME_OF_DEV_RANDOM="/dev/random"
         NAME_OF_DEV_URANDOM="/dev/random"
         DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC"
         ;;
 
     *)
         NAME_OF_DEV_RANDOM="/dev/random"
         NAME_OF_DEV_URANDOM="/dev/urandom"
         # -shared is a gcc-ism.  Find pic flags from GNUPG_CHECK_PIC.
         if test -n "$GCC" ; then
            DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC"                            
         else
            DYNLINK_MOD_CFLAGS="$CFLAGS_PIC"
         fi
         ;;
 esac
-AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM")
-AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM")
+AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM",
+                   [defined to the name of the strong random device])
+AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM",
+                   [defined to the name of the weaker random device])
 AC_SUBST(MPI_OPT_FLAGS)
 
 
 dnl Checks for libraries.
 
 USE_NLS=no
 USE_INCLUDED_LIBINTL=no
 AC_SUBST(USE_NLS)
 AC_SUBST(USE_INCLUDED_LIBINTL)
 
 
 dnl Solaris needs -lsocket and -lnsl. Unisys system includes
 dnl gethostbyname in libsocket but needs libnsl for socket.
 AC_CHECK_LIB(nsl, gethostbyname)
 AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
 if test x$ac_need_libsocket = x1; then
     LIBS="$LIBS -lsocket"
 fi
 if test x$ac_try_nsl = x1; then
     AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
     if test x$ac_need_libnsl = x1
     then
         LIBS="$LIBS -lnsl"
     fi
 fi
 
 
 if test "$try_dynload" = yes ; then
   AC_CHECK_LIB(dl,dlopen)
   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
-    AC_DEFINE(USE_DYNAMIC_LINKING)
-    AC_DEFINE(HAVE_DL_DLOPEN)
+    AC_DEFINE(USE_DYNAMIC_LINKING,1,
+              [define to enable the use of extensions])
+    AC_DEFINE(HAVE_DL_DLOPEN,1,
+              [Defined when the dlopen function family is available])
     DYNLINK_LDFLAGS="$CFLAGS_EXPORTDYNAMIC"
     use_gnupg_extensions=yes
   else
     AC_CHECK_FUNCS(dlopen)
     if test "$ac_cv_func_dlopen" = "yes"; then
       AC_DEFINE(USE_DYNAMIC_LINKING)
       AC_DEFINE(HAVE_DL_DLOPEN)
       DYNLINK_LDFLAGS="$CFLAGS_EXPORTDYNAMIC"
       use_gnupg_extensions=yes
     else
       AC_CHECK_LIB(dld,shl_load)
       if test "$ac_cv_lib_dld_shl_load" = "yes"; then
         AC_DEFINE(USE_DYNAMIC_LINKING)
-        AC_DEFINE(HAVE_DL_SHL_LOAD)
+        AC_DEFINE(HAVE_DL_SHL_LOAD,1,
+                  [Defined if the shl_load function family is available])
         DYNLINK_LDFLAGS="$CFLAGS_EXPORTDYNAMIC"
         use_gnupg_extensions=yes
 dnl -----------------
 dnl  DLD is not ready for use. So I better disable this test
 dnl
 dnl    AC_CHECK_LIB(dld,dld_link)
 dnl    if test "$ac_cv_lib_dld_dld_link" = "yes"; then
 dnl      AC_DEFINE(USE_DYNAMIC_LINKING)
 dnl      AC_DEFINE(HAVE_DLD_DLD_LINK)
 dnl      DYNLINK_LDFLAGS="$CFLAGS_EXPORTDYNAMIC"
 dnl      use_gnupg_extensions=yes
 dnl ---------------
       fi
     fi
   fi
 else
   AC_MSG_CHECKING(for dynamic loading)
   DYNLINK_LDFLAGS=
   DYNLINK_MOD_CFLAGS=
   use_gnupg_extensions=no
   AC_MSG_RESULT(has been disabled)
 fi
 
 AM_CONDITIONAL(ENABLE_GNUPG_EXTENSIONS, test "$use_gnupg_extensions" = yes )
 AC_SUBST(DYNLINK_LDFLAGS)
 AC_SUBST(DYNLINK_MOD_CFLAGS)
 
 
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS(unistd.h langinfo.h termio.h)
 
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_C_INLINE
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL
 AC_DECL_SYS_SIGLIST
 
 GNUPG_CHECK_ENDIAN
 
 
 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
 
 AC_CHECK_SIZEOF(unsigned short, 2)
 AC_CHECK_SIZEOF(unsigned int, 4)
 AC_CHECK_SIZEOF(unsigned long, 4)
 AC_CHECK_SIZEOF(unsigned long long, 0)
 
 if test "$ac_cv_sizeof_unsigned_short" = "0" \
    || test "$ac_cv_sizeof_unsigned_int" = "0" \
    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
 fi
 
 
 
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
 AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit clock_gettime)
 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask fopen64 fstat64)
 
 GNUPG_CHECK_MLOCK
 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
 
 dnl
 dnl Check whether we can use Linux capabilities as requested
 dnl
 if test "$use_capabilities" = "yes" ; then
 use_capabilities=no
 AC_CHECK_HEADERS(sys/capability.h)
 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
   AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
   if test "$ac_cv_lib_cap_cap_init" = "yes"; then
-     AC_DEFINE(USE_CAPABILITIES)
+     AC_DEFINE(USE_CAPABILITIES,1,
+               [define if capabilities should be used])
      LIBS="$LIBS -lcap"
      use_capabilities=yes
   fi
 fi
 if test "$use_capabilities" = "no" ; then
     AC_MSG_WARN([[
 ***
 *** The use of capabilities on this system is not possible.
 *** You need a recent Linux kernel and some patches:
 ***   fcaps-2.2.9-990610.patch      (kernel patch for 2.2.9)
 ***   fcap-module-990613.tar.gz     (kernel module)
 ***   libcap-1.92.tar.gz            (user mode library and utilities)
 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
 ***]])
 fi
 fi
 
 
 GNUPG_CHECK_IPC
 if test "$ac_cv_header_sys_shm_h" = "yes"; then
-  AC_DEFINE(USE_SHM_COPROCESSING)
+  AC_DEFINE(USE_SHM_COPROCESSING,1,
+            [define if the shared memory interface should be made available])
 fi
 
 dnl
 dnl check whether we have a random device
 dnl
 if test "$try_dev_random" = yes ; then
     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
     [if test -r "$NAME_OF_DEV_RANDOM" && test -r "$NAME_OF_DEV_URANDOM" ; then
       ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
     if test "$ac_cv_have_dev_random" = yes; then
-        AC_DEFINE(HAVE_DEV_RANDOM)
+        AC_DEFINE(HAVE_DEV_RANDOM,1,
+                 [defined if the system supports a random device] )
     fi
 else
     AC_MSG_CHECKING(for random device)
     ac_cv_have_dev_random=no
     AC_MSG_RESULT(has been disabled)
 fi
 
 dnl
 dnl and whether this device supports ioctl
 dnl (Note, that we should do a real test here)
 dnl
 if test "$ac_cv_have_dev_random" = yes ; then
     AC_CHECK_HEADERS(linux/random.h)
     AC_CACHE_CHECK(for random device ioctl, ac_cv_have_dev_random_ioctl,
       [ if test "$ac_cv_header_linux_random_h" = yes ; then
           ac_cv_have_dev_random_ioctl=yes;
         else
           ac_cv_have_dev_random_ioctl=no;
         fi
       ])
     if test "$ac_cv_have_dev_random_ioctl" = yes; then
-        AC_DEFINE(HAVE_DEV_RANDOM_IOCTL)
+        AC_DEFINE(HAVE_DEV_RANDOM_IOCTL,1,
+                  [defined if the random device supports some IOCTLs])
     fi
 fi
 
 
 dnl
 dnl Figure out the default linkage mode for cipher modules
 dnl
 print_egd_notice=no
 if test "$use_static_rnd" = default; then
   if test "$ac_cv_have_dev_random" = yes; then
       static_random_module="rndlinux"
   else
       case "${target}" in
           *-*-mingw32*)
               static_random_module="rndw32"
-              AC_DEFINE(USE_STATIC_RNDW32)
+              AC_DEFINE(USE_STATIC_RNDW32,1,
+                       [At a certain point in the code we need to know that
+                        we use the Windows random module.])
               ;;
           i?86-emx-os2|i?86-*-os2*emx)
               static_random_module="rndos2"
               ;;
           m68k-atari-mint)
               static_random_module="rndatari"
               ;;
           i?86-*-msdosdjgpp*)
               :
               ;;
           *)
               static_random_module="rndunix"
               print_egd_notice=yes
              ;;
       esac
   fi
 else
   if test "$use_static_rnd" = none; then
     :
   else
     static_random_module="rnd$use_static_rnd"
     if test "$use_static_rnd" = "unix"; then
         print_egd_notice=yes
     fi
   fi
 fi
 
 
 if test "$print_egd_notice" = "yes"; then
     AC_MSG_WARN([[
 ***
 *** The performance of the UNIX random gatherer module is not very good
 *** and it does not keep the entropy pool over multiple invocations of
 *** GnuPG.  The suggested way to overcome this problem is to use the
 ***
 ***               Entropy Gathering Daemon (EGD)
 ***
 *** which provides a entropy source for the whole system.  It is written
 *** in Perl and available at the GnuPG FTP servers.  For more information
 *** consult the GnuPG webpages:
 ***
 ***           http://www.gnupg.org/download.html#egd
 ***
 *** You may want to run ./configure with --enable-static-rnd=none to be
 *** able to load the EGD client code dynamically; this way you can choose
 *** between RNDUNIX and RNDEGD without recompilation.
 ***]])
 fi
 
 dnl
 dnl Parse the modules list and build the list
 dnl of static and dymically linked modules
 dnl
 dnl (We always need a static rmd160)
 static_modules="$static_modules rmd160 $static_random_module"
 STATIC_CIPHER_NAMES=""
 STATIC_CIPHER_OBJS=""
 DYNAMIC_CIPHER_MODS=""
 GNUPG_MSG_PRINT([dynamically linked cipher modules:])
 for name in $MODULES_IN_CIPHER; do
     x="yes"
     for i in $disallowed_modules; do
         if test "$name" = "$i" ; then x="no" ; fi
     done;
     if test $x = yes; then
         x="no"
         for i in $static_modules; do
             if test "$name" = "$i" ; then
                 x="yes"
             fi
         done;
         if test $x = yes; then
             STATIC_CIPHER_NAMES="$STATIC_CIPHER_NAMES $name"
             STATIC_CIPHER_OBJS="$STATIC_CIPHER_OBJS $name.lo"
         else
             DYNAMIC_CIPHER_MODS="$DYNAMIC_CIPHER_MODS $name"
             GNUPG_MSG_PRINT([$name])
         fi
+
+dnl        dnl Very ugly way to do this, but I don't knwo how to
+dnl        dnl cope with AC_SUBST otherwise
+dnl        case "$name" in
+dnl          tiger)
+dnl            AM_CONDITIONAL(BUILD_MODULE_TIGER,   [test $x = no])
+dnl            ;;                                   
+dnl          twofish)                               
+dnl            AM_CONDITIONAL(BUILD_MODULE_TWOFISH, [test $x = no])
+dnl            ;;                                   
+dnl          rndunix)                               
+dnl            AM_CONDITIONAL(BUILD_MODULE_RNDUNIX, [test $x = no])
+dnl            ;;                                   
+dnl          rndlinux)                              
+dnl            AM_CONDITIONAL(BUILD_MODULE_RNDLINUX,[test $x = no])
+dnl            ;;                                   
+dnl          rndegd)                                
+dnl            AM_CONDITIONAL(BUILD_MODULE_RNDEGD,  [test $x = no])
+dnl            ;;
+dnl          *)
+dnl            ;;
+dnl        esac
     fi
 done
 AC_MSG_RESULT()
 AC_SUBST(STATIC_CIPHER_OBJS)
 AC_SUBST(STATIC_CIPHER_NAMES)
 AC_SUBST(DYNAMIC_CIPHER_MODS)
 
+
 dnl
 dnl And build the constructor file
 dnl
 
 test -d cipher || mkdir cipher
 cat <<G10EOF >cipher/construct.c
 /* automatically generated by configure - do not edit */
 
 G10EOF
 GNUPG_MSG_PRINT([statically linked cipher modules:])
 for name in $STATIC_CIPHER_NAMES; do
     echo "void _gcry_${name}_constructor(void);" >>cipher/construct.c
     GNUPG_MSG_PRINT([$name])
 done
 AC_MSG_RESULT()
 cat <<G10EOF >>cipher/construct.c
 
 void
 _gcry_cipher_modules_constructor(void)
 {
     static int done = 0;
     if( done )
         return;
     done = 1;
 
 G10EOF
 for name in $STATIC_CIPHER_NAMES; do
     echo "   _gcry_${name}_constructor();" >>cipher/construct.c
 done
 echo '}' >>cipher/construct.c
 
 
 
 
 dnl
 dnl Figure how to link the cipher modules
 dnl
 AC_SUBST(STATIC_CIPHER_OBJS)
 AC_SUBST(DYNAMIC_CIPHER_MODS)
 
-
-dnl setup assembler stuff
+#
+# setup assembler stuff
+#
 AC_MSG_CHECKING(for mpi assembler functions)
 if test -f $srcdir/mpi/config.links ; then
     . $srcdir/mpi/config.links
-    GNUPG_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
+    AC_CONFIG_LINKS("$mpi_ln_list")
     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
     ac_cv_mpi_sflags="$mpi_sflags"
     ac_cv_mpi_config_done="yes"
     AC_MSG_RESULT(done)
 else
     AC_MSG_RESULT(failed)
     AC_MSG_ERROR([mpi/config.links missing!])
 fi
 MPI_EXTRA_ASM_OBJS=""
+show_extraasm=""
 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
-GNUPG_MSG_PRINT([mpi extra asm functions:])
 for i in $ac_cv_mpi_extra_asm_modules; do
-    GNUPG_MSG_PRINT([$i])
-    MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.lo"
+    show_extraasm="$show_extraasm $i"
+    MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
 done
-AC_MSG_RESULT()
 fi
 AC_SUBST(MPI_EXTRA_ASM_OBJS)
 MPI_SFLAGS="$ac_cv_mpi_sflags"
 AC_SUBST(MPI_SFLAGS)
 
 
 # Allow users to append something to the version string without
 # flagging it as development version.  The user version part is
 # considered everything after a dash.
 changequote(,)dnl
 tmp_pat='[a-zA-Z]'
 changequote([,])dnl
 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
-    AC_DEFINE(IS_DEVELOPMENT_VERSION)
+    AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
+              [Defined if this is not a regular release])
 fi
 
 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
 
-GNUPG_DO_LINK_FILES
-
 GNUPG_CHECK_GNUMAKE
 
 if test "$GCC" = yes; then
     if test "$MAINTAINER_MODE" = "yes"; then
         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
     else
         CFLAGS="$CFLAGS -Wall"
     fi
 fi
 
 dnl
 dnl Make the version number in src/gcrypt.h the same as the one here.
 dnl (this is easier than to have a *.in file just for one substitution)
 dnl
-GNUPG_FIX_HDR_VERSION(src/gcrypt.h, GCRYPT_VERSION)
+GNUPG_FIX_HDR_VERSION([src/gcrypt.h], GCRYPT_VERSION)
 
 LIBGCRYPT_LIBS="-L${libdir} -lgcrypt"
 LIBGCRYPT_CFLAGS=""
 AC_SUBST(LIBGCRYPT_LIBS)
 AC_SUBST(LIBGCRYPT_CFLAGS)
 
-AC_OUTPUT_COMMANDS([
+AC_CONFIG_COMMANDS([gcrypt-defs],[[
 chmod +x scripts/db2any
 chmod +x src/libgcrypt-config
 cat >gcrypt-defs.tmp <<G10EOF
 /* Generated automatically by configure */
 #ifdef HAVE_DRIVE_LETTERS
   #define GNUPG_LOCALEDIR "c:/lib/gnupg/locale"
   #define GNUPG_LIBDIR  "c:/lib/gnupg"
   #define GNUPG_DATADIR "c:/lib/gnupg"
   #define GNUPG_HOMEDIR "c:/gnupg-test"
 #else
   #define GNUPG_LOCALEDIR "${prefix}/${DATADIRNAME}/locale"
   #define GNUPG_LIBDIR  "${libdir}/gnupg"
   #define GNUPG_DATADIR "${datadir}/gnupg"
   #ifdef __VMS
     #define GNUPG_HOMEDIR "/SYS\$LOGIN/gnupg" 
   #else
     #define GNUPG_HOMEDIR "~/.gnupg-test" 
   #endif
 #endif
 G10EOF
 if cmp -s gcrypt-defs.h gcrypt-defs.tmp 2>/dev/null; then
     echo "gcrypt-defs.h is unchanged"
     rm -f gcrypt-defs.tmp
 else
     rm -f gcrypt-defs.h
     mv gcrypt-defs.tmp gcrypt-defs.h
     echo "gcrypt-defs.h created"
 fi
-],[
+]],[[
 prefix=$prefix
 exec_prefix=$exec_prefix
 libdir=$libdir
 datadir=$datadir
 DATADIRNAME=$DATADIRNAME
-])
+]])
 
 
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile
 jnlib/Makefile
 mpi/Makefile
 cipher/Makefile
 doc/Makefile
 doc/version.sgml
 src/Makefile
 src/libgcrypt-config
 tests/Makefile
 ])
+AC_OUTPUT
 
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index a97ccf40..63cd4cf2 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,360 +1,365 @@
+2001-08-03  Werner Koch  <wk@gnupg.org>
+
+	* config.links: Changed the way the list of files to be
+	symlinked is returned.
+
 2001-05-31  Werner Koch  <wk@gnupg.org>
 
 	* mpih-cmp.c: Removed and moved mpihelp_cmp to ..
 	* mpi-inline.h: .. here.
 
 	Major function renaming. All global functions are now prefixed
 	with _gcry_ or gcry_.  Renamed also all mpihelp_ to just mpih_ so
 	that functions names are not getting to long an unreadable and for
 	better matching with the filenames.
 	
 2001-05-28  Werner Koch  <wk@gnupg.org>
 
 	* mpicoder.c (mpi_fromstr): Made static and assume that all input
 	is in hexformat.
 
 	Updated all CPU specific code with the one from GnuPG-1.0.5.  This
 	is just a change of text formatting and the use of .label
 	instead of labels for hppa and pa7100.
 
 	* longlong.h: Fixes for ARM by Phil Blundell.
 
 2001-03-29  Werner Koch  <wk@gnupg.org>
 
 	* mpi-mul.c (mpi_mul): Make sure that secret temporary results are
 	not stored in w.  Suggested by Florian Weimer.
 
 	* config.links: Use i386 code for i386.  According to tests by
 	Kevin Ryde the i586 code runs slow on i386 CPUs.  Ditto for i786.
 
 2001-01-11  Werner Koch  <wk@gnupg.org>
 
 	* Makefile.am: Removed mpi.h.
 
 2000-12-19  Werner Koch  <wk@gnupg.org>
 
 	* mpi-internal.h: Put limb_t definition in an ifdef.
 
  	Major change:
 	Removed all GnuPG stuff and renamed this piece of software
 	to gcrypt. 
 
 2000-11-14  Werner Koch  <wk@gnupg.org>
 
 	* mpi-internal.h, mpi.h: Changed the way they are called and
 	introduced DID_MPI_LIMP_TYPEDEF hack.  Very ugly, should all be
 	revamped.
 	
 	* Makefile.am (OMIT_DEPENDENCIES): Hack to work around dependency
 	problems.
 
 2000-10-11  Werner Koch  <wk@gnupg.org>
 
 	* generic/mpi-asm-defs.h: New.
 	* mips3/mpi-asm-defs.h: New.
 	* config.links: Create a link to one of the above files.
 
 Fri Jul 28 18:19:11 CEST 2000  Werner Koch  <wk@openit.de>
 
   * mpicoder.c (gcry_mpi_scan): Normalize the returned MPI.
 
 Tue Jul 25 17:44:15 CEST 2000  Werner Koch  <wk@openit.de>
 
   * config.links: Support for powerpc--netbsd by Gabriel Rosenkoetter.
 
 Mon Jul 17 16:35:47 CEST 2000  Werner Koch  <wk@>
 
   * power/: Add all files from GMP for this CPU. Converted comments to
   CPP comments because some ASes complain about ' in comments.
 
   * config.links:  Support for BSDI 4.x; by Wayne Chapeskie. Add support
   for FreeBSD 5 and made the case stmt looking nicer; by Jun Kuriyama.
   Add support for NetBSD.
   (sparc8): Made the search path the same as sparc9
   (sparc64-unknown-linux-gnu): use udiv module; by Adam Mitchell.
 
   * Makefile.am: c/SFLAGS/ASFLAGS/. This has only been used by the
   powerpc and actually never passed the -Wa,foo to the cc.
 
   * mpih-div.c (mpihelp_divrem): The MPN_COPY_DECR copied one element
   too many.  This is a gmp2.0.2p9.txt patch.
 
   * longlong.h (umul_ppmm): Fixes for ARM-4. By Sean MacLennan.
 
   * mpi-internal.h (karatsuba_ctx): New.
   * mpih-mul.c (mpihelp_release_karatsuba_ctx): New.
   (mpihelp_mul_karatsuba_case): New.
   (mpihelp_mul): Splitted to make use of the new functions.
   * mpi-pow.c (mpi_powm): Make use of the new splitted function to avoid
   multiple allocation of temporary memory during the karatsuba operations.
   * mpi_mpow.c: Removed the unused Barrett code.
 
 2000-03-21 16:17:30  Werner Koch  (wk@habibti.openit.de)
 
 	* config.links: Add support for FreeBSD 5.
 
 Mon Jan 24 22:24:38 CET 2000  Werner Koch  <wk@gnupg.de>
 
 	* mpicoder.c (gcry_mpi_aprint): Now really returns the length.
 
 Mon Jan 24 13:04:28 CET 2000  Werner Koch  <wk@gnupg.de>
 
 	* mpiutil.c: Removed all memory debugging code.
 
 	* mpicoder.c (gcry_mpi_aprint): New.
 
 	* Replaced all m_ memory functions by g10_ ones.
 
 Fri Dec 31 14:06:56 CET 1999  Werner Koch  <wk@gnupg.de>
 
 	* mpi-bit.c (gcry_mpi_get_nbits): New.
 
 	* mpiutil.c (mpi_set_secure): made static.
 	(gcry_mpi_get_flag): New.
 	(gcry_mpi_set_flag): New.
 	(gcry_mpi_clear_flag): New.
 	(mpi_set_opaque): renamed to gcry_mpi_set_opaque.
 	(mpi_get_opaque): renamed to gcry_mpi_get_opaque.
 
 Fri Dec 31 12:48:31 CET 1999  Werner Koch  <wk@gnupg.de>
 
 	* mpicoder.c (mpi_read_from_buffer): Made static.
 	(gcry_mpi_print): A buffer of NULL is now allowed to get the required
 	length back.
 	(mpi_get_keyid): Removed.
 	(mpi_print): Made static - should be removed.
 
 Wed Dec  8 21:58:32 CET 1999  Werner Koch  <wk@gnupg.de>
 
 	* Makefile.am (INCLUDES): Add ../gcrypt.
 
 	* g10m.c : Removed.
 
 	* mpicoder.c (mpi_write): Removed.
 	(mpi_read): Removed.
 	(gcry_mpi_scan): New. Taken from ../gcrypt/mpiapi.c.
 	(gcry_mpi_print): Ditto.
 
 	* mpi-pow.c (mpi_powm): Renamed to ...
 	(gcry_mpi_powm): ... this.
 
 	* mpiutil.c (gcry_mpi_new): New as a wrapper around the old function.
 	Taken from ../gcrypt/mpiapi.c.
 	(gcry_mpi_snew): Ditto.
 	(gcry_mpi_release): Ditto.
 	(gcry_mpi_copy): Ditto.
 	(gcry_mpi_set): Ditto.
 	(gcry_mpi_set_ui): Ditto.
 	(gcry_mpi_cmp): Ditto.
 	(gcry_mpi_cmp_ui): Ditto.
 	(gcry_mpi_randomize): Ditto.
 
 	* mpicoder.c (mpi_print): Removed the nbit_info kludge.
 	* mpi-bits.c (mpi_get_nbits): Replaced the is_protected stuff by
 	checking whether it is an opaque mpi and then returns it's length
 	in bits.
 	* mpiutil.c (mpi_set_opaque): Changed the interface to take a number
 	of bits for the length.  Adjusted all users.
 	(mpi_get_opaque): Ditto.
 
 Fri Nov 19 17:15:20 CET 1999  Werner Koch  <wk@gnupg.de>
 
 	* mpicoder.c (g10_log_mpidump): Add a temporary workaround
 
 	* mpih-mul.c (mpihelp_mul_n): s/m_is_ecure/g10_is_secure/
 
 	* mpiutil.c (mpi_alloc): Remved the debug mode because it has turned
 	out, that this feature was not very useful in the past.  Use the
 	new alloc functions.
 	(mpi_alloc_secure): Ditto.
 	(mpi_alloc_limb_space): Ditto.
 	(mpi_free_limb_space): Ditto.
 	(mpi_resize): Ditto.
 	(mpi_free): Ditto.
 	(mpi_set_secure): Removed the debug stuff.
 	(mpi_set_opaque): Ditto.
 	(mpi_copy): Ditto.
 	(mpi_alloc_set_ui): Ditto.
 	(mpi_m_check): Use g10_ wrapper.
 
 Mon Aug 30 20:38:33 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* config.links: Add case label for DJGPP
 
 Wed Jul 14 19:42:08 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* Makefile.am: Use .s files as temporaries, disabled other .S rules.
 
 Wed Jul  7 13:08:40 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* mpicoder.c (g10_log_mpidump): New.
 
 	* Makefile.am: Support for libtool.
 
 Fri Jul  2 11:45:54 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
 	* mpi-bit.c (mpi_lshift_limbs,mpi_rshift_limbs): New.
 	* mpi-mpow.c (barrett_mulm): New but diabled.
 
 Tue Jun  1 16:01:46 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* config.links (i[56]86*-*-freebsdelf*): New.
 
 Sun May 23 14:20:22 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* config.links (sysdep.h): Not any more conditionally created.
 
 Tue May  4 15:47:53 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mpiutil.c (mpi_alloc_like): New.
 
 Mon Apr 26 17:48:15 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mpih-add.c, mpih-sub.c: Removed
 	* mpi-inline.c: New.
 	* mpi-inline.h: Make it usable by mpi-inline.c.
 
 Sun Apr 18 10:11:28 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mpih-mul.c (mpihelp_mul_n): Fixed use of memory region.
 	(mpihelp_mul): Ditto.
 
 Wed Apr  7 20:51:39 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* Makefile.am: Explicit rules to invoke cpp on *.S
 
 Mon Mar  8 20:47:17 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* config.links: Take advantage of the with_symbol_underscore macro.
 	Add support for freebsd 4.
 
 Wed Feb 24 11:07:27 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mips3/mpih-sub1.S: Removed left over junk in last line. (Should I
 	blame me or my editor?).
 
 Sat Feb 13 12:04:43 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* Makefile.am: Removed the +=. Add MPI_OPT_FLAGS.
 
 Sat Jan  9 16:02:23 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mpi-cmp.c (mpi_cmp_ui): Normalized the arg.
 
 Thu Jan  7 18:00:58 CET 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* mpi-bit.c (mpi_normalize): New.
 	(mpi_get_nbits): Normalize the MPI.
 	* mpi-bit.c (mpi_cmp): Normalize the MPI before the compare.
 
 
 Tue Dec  8 13:15:16 CET 1998  Werner Koch  <wk@isil.d.shuttle.de>
 
 	* config.links: Moved the case for powerpc*linux
 	* powerpcp32/*.S: Removed some underscores.
 
 Thu Nov 26 07:27:52 1998  Werner Koch  <werner.koch@guug.de>
 
 	* config.links: Support for ppc with ELF
 	* powerpc32/syntax.h: New.
 	* powerpc32/*.S: Applied ELF patches (glibc patches)
 
 Tue Nov 10 19:31:37 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* power*/ : Started with stuff for PPC
 	* config.links: Some stuff for PPC.
 	* generic/udiv-w-sdiv.c: New but disabled.
 
 Tue Oct 27 12:37:46 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links (freebsd): Fixes for FreeBSD 3.0
 
 Wed Oct 14 09:59:30 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links (freebsd): ELF patches from Jun Kuriyama.
 
 Thu Oct  8 13:28:17 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpi-mpow.c (mpi_mulpowm): Fixed mem leak (m_free/mpi_free).
 
 Thu Sep 17 18:08:50 1998  Werner Koch  (wk@(none))
 
 	* hppa1.1/udiv-qrnnd.S: Fix from Steffen Zahn for HPUX 10.20
 
 Thu Aug  6 16:39:28 1998  Werner Koch,mobil,,,	(wk@tobold)
 
 	* mpi-bit.c (mpi_set_bytes): Removed.
 
 Wed Aug  5 15:11:12 1998  Werner Koch  (wk@(none))
 
 	* mpicoder.c (mpi_read_from_buffer): New.
 
 	* mpiutil.c (mpi_set_opaque): New.
 	(mpi_get_opaque): New.
 	(mpi_copy): Changed to support opauqe flag
 	(mpi_free): Ditto.
 
 Sat Jul  4 10:11:11 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpiutil.c (mpi_clear): Reset flags.
 	(mpi_set): Ditto.
 	(mpi_alloc_secure): Set flag to 1 and not ored the 1 in, tsss..
 
 Fri Jun 26 11:19:06 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpiutil.c (mpi_alloc): set nbits to 0.
 	(mpi_alloc_secure): Ditto.
 	(mpi_clear): Ditto.
 
 Thu Jun 25 11:50:01 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mips3/*.S: New
 
 Mon May 18 13:47:06 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links: split mpih-shift into mpih-[lr]shift and
 	changed all implementations.
 	* mpi/alpha: add some new assembler stuff.
 
 Wed May 13 11:04:29 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links: Add support for MIPS
 
 Thu Apr  9 11:31:36 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpicoder.c (mpi_get_secure_buffer): New.
 
 Wed Apr  8 09:44:33 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links: Applied small fix from Ulf M�ller.
 
 Mon Apr  6 12:38:52 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpicoder.c (mpi_get_buffer): Removed returned leading zeroes
 	and changed all callers.
 
 Tue Mar 10 13:40:34 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpi-bit.c (mpi_clear_highbit): New.
 
 Mon Mar  2 19:29:00 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* Makefile.am (DISTCLEANFILES): New
 
 Thu Feb 26 06:48:54 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links (X86_BROKEN_ALIGN): Added for some systems.
 
 Mon Feb 23 12:21:40 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* mpi/m68k/mpih-shift.S (Lspecial): Changed duplicate symbol.
 
 Mon Feb 16 13:00:27 1998  Werner Koch  (wk@isil.d.shuttle.de)
 
 	* config.links : Add detection of m68k cpus
 
 
diff --git a/mpi/config.links b/mpi/config.links
index 48c7977c..8c47cb90 100644
--- a/mpi/config.links
+++ b/mpi/config.links
@@ -1,289 +1,304 @@
+# config.links - helper for ../configure
+# Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+#
+# This file is part of Libgcrypt.
+#
+# Libgcrypt is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# Libgcrypt is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
 # sourced by ../configure to get the list of files to link
-# this should set $mpi_ln_src and mpi_ln_dst.
+# this should set $mpi_ln_list.
 # Note: this is called from the above directory.
 
 
 mpi_extra_modules=
 mpi_sflags=
 
 test -d ./mpi || mkdir ./mpi
 
 echo '/* created by config.links - do not edit */' >./mpi/asm-syntax.h
 
 if test "$try_asm_modules" = "yes" ; then
 case "${target}" in
     i[3467]86*-*-freebsd*-elf  | \
     i[3467]86*-*-freebsd[3-9]* | \
     i[3467]86*-*-freebsdelf*   | \
     i[3467]86*-*-netbsd* )
        echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
        cat  $srcdir/mpi/i386/syntax.h	   >>./mpi/asm-syntax.h
        path="i386"
        ;;
     i586*-*-freebsd*-elf  | \
     i586*-*-freebsd[3-9]* | \
     i586*-*-freebsdelf*   | \
     i586*-*-netbsd*	     | \
     pentium-*-netbsd*	     | \
     pentiumpro-*-netbsd*)
        echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
        cat  $srcdir/mpi/i386/syntax.h	   >>./mpi/asm-syntax.h
        path="i586 i386"
        ;;
     i[34]86*-*-bsdi4*)
        echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
        cat  $srcdir/mpi/i386/syntax.h	 >>./mpi/asm-syntax.h
        path="i386"
        ;;
     i[3467]86*-*-linuxaout*  | \
     i[3467]86*-*-linuxoldld* | \
     i[3467]86*-*-*bsd*)
 	echo '#define BSD_SYNTAX' >>./mpi/asm-syntax.h
 	echo '#define X86_BROKEN_ALIGN' >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h
 	path="i386"
 	;;
     i586*-*-linuxaout*  | \
     i586*-*-linuxoldld* | \
     i586*-*-*bsd*)
 	echo '#define BSD_SYNTAX' >>./mpi/asm-syntax.h
 	echo '#define X86_BROKEN_ALIGN' >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h
 	path="i586 i386"
 	;;
     i[3467]86*-msdosdjgpp*)
 	echo '#define BSD_SYNTAX'        >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	 >>./mpi/asm-syntax.h
 	path="i386"
 	;;
     i586*-msdosdjgpp*)
 	echo '#define BSD_SYNTAX'        >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	 >>./mpi/asm-syntax.h
 	path="i586 i386"
 	;;
     i[3467]86*-*-*)
 	echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h
 	path="i386"
 	;;
     i586*-*-*  | \
     pentium-*-*   | \
     pentiumpro-*-*)
 	echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h
 	path="i586 i386"
 	;;
     alpha*-*-*)
 	echo '/* configured for alpha */' >>./mpi/asm-syntax.h
 	path="alpha"
 	mpi_extra_modules="udiv-qrnnd"
 	;;
     hppa7000*-*-*)
 	echo '/* configured for HPPA (pa7000) */' >>./mpi/asm-syntax.h
 	path="hppa1.1 hppa"
 	mpi_extra_modules="udiv-qrnnd"
 	;;
     hppa1.0*-*-*)
 	echo '/* configured for HPPA 1.0 */' >>./mpi/asm-syntax.h
 	path="hppa"
 	mpi_extra_modules="udiv-qrnnd"
 	;;
     hppa*-*-*)	# assume pa7100
 	echo '/* configured for HPPA (pa7100) */' >>./mpi/asm-syntax.h
 	path="pa7100 hppa1.1 hppa"
 	mpi_extra_modules="udiv-qrnnd"
 	;;
     sparc64-*-linux-gnu)
 	# An extra rule because we have an report for this one only.
 	# Should be compared against the next GMP version
 	echo '/* configured for sparc64-*-linux-gnu */' >>./mpi/asm-syntax.h
 	path="sparc32v8 sparc32"
 	mpi_extra_modules="udiv"
 	;;
     sparc9*-*-*     | \
     sparc64*-*-*    | \
     ultrasparc*-*-* )
 	echo '/* configured for sparc9 or higher */' >>./mpi/asm-syntax.h
 	path="sparc32v8 sparc32"
 	;;
     sparc8*-*-*     | \
     microsparc*-*-*)
 	echo '/* configured for sparc8 */' >>./mpi/asm-syntax.h
 	path="sparc32v8 sparc32"
 	;;
     supersparc*-*-*)
 	echo '/* configured for supersparc */' >>./mpi/asm-syntax.h
 	path="supersparc sparc32v8 sparc32"
 	mpi_extra_modules="udiv"
 	;;
     sparc*-*-*)
 	echo '/* configured for sparc */' >>./mpi/asm-syntax.h
 	path="sparc32"
 	mpi_extra_modules="udiv"
 	;;
     mips[34]*-*-* | \
     mips*-*-irix6*)
        echo '/* configured for MIPS3 */' >>./mpi/asm-syntax.h
        path="mips3"
        ;;
     mips*-*-*)
        echo '/* configured for MIPS2 */' >>./mpi/asm-syntax.h
        path="mips2"
        ;;
 
     # Motorola 68k configurations.  Let m68k mean 68020-68040.
     # mc68000 or mc68060 configurations need to be specified explicitly
     m680[234]0*-*-linuxaout* | \
     m68k*-*-linuxaout*)
 	echo '#define MIT_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k/mc68020 m68k"
 	;;
     m68060*-*-linuxaout*)
 	echo '#define MIT_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k"
 	;;
     m680[234]0*-*-linux* | \
     m68k*-*-linux*)
 	echo '#define ELF_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	;;
     m68060*-*-linux*)
 	echo '#define ELF_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k"
 	;;
     m68k-atari-mint)
 	echo '#define MIT_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k/mc68020 m68k"
 	;;
     m68000*-*-* | \
     m68060*-*-*)
 	echo '#define MIT_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k/mc68000"
 	;;
     m680[234]0*-*-* | \
     m68k*-*-*)
 	echo '#define MIT_SYNTAX'           >>./mpi/asm-syntax.h
 	cat  $srcdir/mpi/m68k/syntax.h	    >>./mpi/asm-syntax.h
 	path="m68k/mc68020 m68k"
 	;;
 
     powerpc*-*-linux*)
 	echo '/* configured for powerpc/ELF */' >>./mpi/asm-syntax.h
 	echo '#define ELF_SYNTAX'               >>./mpi/asm-syntax.h
 	cat   $srcdir/mpi/powerpc32/syntax.h	>>./mpi/asm-syntax.h
 	path="powerpc32"
 	;;
 
     powerpc*-*-netbsd*)
        echo '/* configured NetBSD on powerpc */' >>./mpi/asm-syntax.h
        echo '#define ELF_SYNTAX'                 >>./mpi/asm-syntax.h
        cat   $srcdir/mpi/powerpc32/syntax.h	 >>./mpi/asm-syntax.h
        mpi_sflags="-Wa,-mppc"
        path="powerpc32"
        ;;
 
     rs6000-*-aix[456789]*    | \
     rs6000-*-aix3.2.[456789])
 	mpi_sflags="-Wa,-mpwr"
 	path="power"
 	mpi_extra_modules="udiv-w-sdiv"
 	;;
     rs6000-*-* | \
     power-*-*  | \
     power2-*-*)
 	mpi_sflags="-Wa,-mppc"
 	path="power"
 	mpi_extra_modules="udiv-w-sdiv"
 	;;
     powerpc-ibm-aix4.2.* )
 	# I am not sure about this one but a machine identified by
 	# powerpc-ibm-aix4.2.1.0 cannot use the powerpc32 code.
 	mpi_sflags="-Wa,-mpwr"
 	path="power"
 	mpi_extra_modules="udiv-w-sdiv"
 	;;
     ppc601-*-*)
 	mpi_sflags="-Wa,-mppc"
 	path="power powerpc32"
 	;;
     ppc60[234]*-*-* | \
     powerpc*-*-*)
 	mpi_sflags="-Wa,-mppc"
 	path="powerpc32"
 	;;
     ppc620-*-*	    | \
     powerpc64*-*-*)
 	mpi_sflags="-Wa,-mppc"
 	path="powerpc64"
 	;;
 
     *)
 	echo '/* No assembler modules configured */' >>./mpi/asm-syntax.h
 	path=""
 	;;
 esac
 else
     echo '/* Assembler modules disabled on request */' >>./mpi/asm-syntax.h
     path=""
 fi
 
 
 # Make sysdep.h
 echo '/* created by config.links - do not edit */' >./mpi/sysdep.h
 if test x$ac_cv_sys_symbol_underscore = xyes; then
     cat <<EOF >>./mpi/sysdep.h
 #if __STDC__
 #define C_SYMBOL_NAME(name) _##name
 #else
 #define C_SYMBOL_NAME(name) _/**/name
 #endif
 EOF
 else
     cat <<EOF >>./mpi/sysdep.h
 #define C_SYMBOL_NAME(name) name
 EOF
 fi
 
 
 # fixme: grep these modules from Makefile.in
 mpi_ln_modules="${mpi_extra_modules} mpih-add1 mpih-mul1 mpih-mul2 mpih-mul3 \
 		 mpih-lshift mpih-rshift mpih-sub1"
 
 mpi_ln_objects=
-mpi_ln_src=
-mpi_ln_dst=
+mpi_ln_list=
 
 # try to get file to link from the assembler subdirectory and
 # if this fails get it from the generic subdirectory.
 path="$path generic"
 for fn in $mpi_ln_modules ; do
     mpi_ln_objects="$mpi_ln_objects $fn.o"
     for dir in $path ; do
 	rm -f $srcdir/mpi/$fn.[Sc]
 	if test -f $srcdir/mpi/$dir/$fn.S ; then
-	    mpi_ln_src="$mpi_ln_src mpi/$dir/$fn.S"
-	    mpi_ln_dst="$mpi_ln_dst mpi/$fn.S"
+            mpi_ln_list="$mpi_ln_list mpi/$fn.S:mpi/$dir/$fn.S"
 	    break;
 	elif test -f $srcdir/mpi/$dir/$fn.c ; then
-	    mpi_ln_src="$mpi_ln_src mpi/$dir/$fn.c"
-	    mpi_ln_dst="$mpi_ln_dst mpi/$fn.c"
+            mpi_ln_list="$mpi_ln_list mpi/$fn.c:mpi/$dir/$fn.c"
 	    break;
 	fi
     done
 done
 
 # Same thing for the file which defines the limb size
 path="$path generic"
 for dir in $path ; do
-     	rm -f $srcdir/mpi/mpi-asm-defs.h
-	if test -f $srcdir/mpi/$dir/mpi-asm-defs.h ; then
-	    mpi_ln_src="$mpi_ln_src mpi/$dir/mpi-asm-defs.h"
-	    mpi_ln_dst="$mpi_ln_dst mpi/mpi-asm-defs.h"
-	    break;
-	fi
+    rm -f $srcdir/mpi/mpi-asm-defs.h
+    if test -f $srcdir/mpi/$dir/mpi-asm-defs.h ; then
+        mpi_ln_list="$mpi_ln_list mpi/mpi-asm-defs.h:mpi/$dir/mpi-asm-defs.h"
+        break;
+    fi
 done
diff --git a/scripts/autogen.sh b/scripts/autogen.sh
index ae80fa10..2bb55b98 100755
--- a/scripts/autogen.sh
+++ b/scripts/autogen.sh
@@ -1,105 +1,105 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
 
 PGM=GnuPG
 DIE=no
 
-autoconf_vers=2.13
+autoconf_vers=2.52
 automake_vers=1.4
 aclocal_vers=1.4
 libtool_vers=1.3
 
 if (autoconf --version) < /dev/null > /dev/null 2>&1 ; then
     if (autoconf --version | awk 'NR==1 { if( $3 >= '$autoconf_vers') \
 			       exit 1; exit 0; }');
     then
        echo "**Error**: "\`autoconf\'" is too old."
        echo '           (version ' $autoconf_vers ' or newer is required)'
        DIE="yes"
     fi
 else
     echo
     echo "**Error**: You must have "\`autoconf\'" installed to compile $PGM."
     echo '           (version ' $autoconf_vers ' or newer is required)'
     DIE="yes"
 fi
 
 if (automake --version) < /dev/null > /dev/null 2>&1 ; then
   if (automake --version | awk 'NR==1 { if( $4 >= '$automake_vers') \
 			     exit 1; exit 0; }');
      then
      echo "**Error**: "\`automake\'" is too old."
      echo '           (version ' $automake_vers ' or newer is required)'
      DIE="yes"
   fi
   if (aclocal --version) < /dev/null > /dev/null 2>&1; then
     if (aclocal --version | awk 'NR==1 { if( $4 >= '$aclocal_vers' ) \
 						exit 1; exit 0; }' );
     then
       echo "**Error**: "\`aclocal\'" is too old."
       echo '           (version ' $aclocal_vers ' or newer is required)'
       DIE="yes"
     fi
   else
     echo
     echo "**Error**: Missing "\`aclocal\'".  The version of "\`automake\'
     echo "           installed doesn't appear recent enough."
     DIE="yes"
   fi
 else
     echo
     echo "**Error**: You must have "\`automake\'" installed to compile $PGM."
     echo '           (version ' $automake_vers ' or newer is required)'
     DIE="yes"
 fi
 
 
 #if (gettext --version </dev/null 2>/dev/null | awk 'NR==1 { split($4,A,"\."); \
 #    X=10000*A[1]+100*A[2]+A[3]; echo X; if( X >= 1035 ) exit 1; exit 0}')
 #    then
 #    echo "**Error**: You must have "\`gettext\'" installed to compile $PGM."
 #    echo '           (version 0.10.35 or newer is required; get'
 #    echo '            ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz'
 #    echo '            or install the latest Debian package)'
 #    DIE="yes"
 #fi
 
 
 if (libtool --version) < /dev/null > /dev/null 2>&1 ; then
     if (libtool --version | awk 'NR==1 { if( $4 >= '$libtool_vers') \
 			       exit 1; exit 0; }');
     then
        echo "**Error**: "\`libtool\'" is too old."
        echo '           (version ' $libtool_vers ' or newer is required)'
        DIE="yes"
     fi
 else
     echo
     echo "**Error**: You must have "\`libtool\'" installed to compile $PGM."
     echo '           (version ' $libtool_vers ' or newer is required)'
     DIE="yes"
 fi
 
 
 if test "$DIE" = "yes"; then
     exit 1
 fi
 
 #echo "Running gettextize...  Ignore non-fatal messages."
 #echo "no" | gettextize --force
 echo "Running libtoolize...  Ignore non-fatal messages."
 echo "no" | libtoolize
 
 
 echo "Running aclocal..."
 aclocal
 echo "Running autoheader..."
 autoheader
 echo "Running automake --gnu ..."
 automake --gnu;
 echo "Running autoconf..."
 autoconf
 
 echo "You can now run \"./configure\" and then \"make\"."
 
 
diff --git a/scripts/distfiles b/scripts/distfiles
index 2d79a5b7..fc36b039 100644
--- a/scripts/distfiles
+++ b/scripts/distfiles
@@ -1,11 +1,10 @@
 config.guess
 config.sub
 install-sh
 mkinstalldirs
 missing
 autogen.sh
 ChangeLog
-ltconfig
-ltmain.sh
 db2any
+ltmain.sh
 
diff --git a/src/gcrypt.h b/src/gcrypt.h
index b13e3875..43b7a5a1 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -1,534 +1,534 @@
 /* gcrypt.h -  GNU digital encryption library interface
  *	Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  *
  * This file is part of Libgcrypt.
  *
  * Libgcrypt is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * Libgcrypt is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
 #ifndef _GCRYPT_H
 #define _GCRYPT_H
 
 #include <stdarg.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
  * The version of this header should match the one of the library
  * It should not be used by a program because gcry_check_version()
  * should reurn the same version.  The purpose of this macro is to
  * let autoconf (using the AM_PATH_GCRYPT macro) check that this
  * header matches the installed library.
  * Note: Do not edit the next line as configure may fix the string here.
  */
-#define GCRYPT_VERSION "1.1.3"
+#define GCRYPT_VERSION "1.1.4"
 
 
 #ifndef HAVE_BYTE_TYPEDEF
 # undef byte	   /* maybe there is a macro with this name */
   typedef unsigned char byte;
 # define HAVE_BYTE_TYPEDEF
 #endif
 
 #ifdef _GCRYPT_IN_LIBGCRYPT
 # ifndef GCRYPT_NO_MPI_MACROS
 #   define GCRYPT_NO_MPI_MACROS 1
 # endif
 #endif
 
 struct gcry_mpi;
 typedef struct gcry_mpi *GCRY_MPI;
 
 /*******************************************
  *					   *
  *  error handling etc. 		   *
  *					   *
  *******************************************/
 
 /* FIXME: We should use the same values as they were used in GnuPG 1.0.
  *	  gpg --status-fd may print some of these values */
 enum {
     GCRYERR_SUCCESS = 0,    /* "no error" */
     GCRYERR_GENERAL = 1,    /* catch all the other errors code */
 
     GCRYERR_INV_PK_ALGO = 4, /* invalid public key algorithm */
     GCRYERR_INV_MD_ALGO = 5, /* invalid message digest algorithm */
     GCRYERR_BAD_PUBLIC_KEY = 6, /* Bad public key */
     GCRYERR_BAD_SECRET_KEY = 7, /* Bad secret key */
     GCRYERR_BAD_SIGNATURE = 8,	/* Bad signature */
 
     GCRYERR_INV_CIPHER_ALGO = 12, /* invalid cipher algorithm */
     GCRYERR_BAD_MPI = 30,
     GCRYERR_WRONG_PK_ALGO = 41, /* wrong public key algorithm */
     GCRYERR_WEAK_KEY = 43,  /* weak encryption key */
     GCRYERR_INV_KEYLEN = 44,  /* invalid length of a key*/
     GCRYERR_INV_ARG = 45,    /* invalid argument */
     GCRYERR_SELFTEST = 50,	/* selftest failed */
 
     /* error codes not used in GnuPG 1.0 */
     GCRYERR_INV_OP = 61,     /* invalid operation code or ctl command */
     GCRYERR_NO_MEM = 62,     /* out of core */
     GCRYERR_INTERNAL = 63,   /* internal error */
     GCRYERR_EOF = 64,	     /* (-1) is remapped to this value */
     GCRYERR_INV_OBJ = 65,    /* an object is not valid */
     GCRYERR_TOO_SHORT = 66,  /* provided buffer too short */
     GCRYERR_TOO_LARGE = 67,  /* object is too large */
     GCRYERR_NO_OBJ = 68,     /* Missing item in an object */
     GCRYERR_NOT_IMPL = 69,   /* Not implemented */
     GCRYERR_CONFLICT = 70,
     GCRYERR_INV_CIPHER_MODE = 71, 
 };
 
 const char *gcry_check_version( const char *req_version );
 
 int gcry_errno(void);
 const char *gcry_strerror( int ec );
 
 enum gcry_ctl_cmds {
     GCRYCTL_SET_KEY  = 1,
     GCRYCTL_SET_IV   = 2,
     GCRYCTL_CFB_SYNC = 3,
     GCRYCTL_RESET    = 4,   /* e.g. for MDs */
     GCRYCTL_FINALIZE = 5,
     GCRYCTL_GET_KEYLEN = 6,
     GCRYCTL_GET_BLKLEN = 7,
     GCRYCTL_TEST_ALGO = 8,
     GCRYCTL_IS_SECURE = 9,
     GCRYCTL_GET_ASNOID = 10,
     GCRYCTL_ENABLE_ALGO = 11,
     GCRYCTL_DISABLE_ALGO = 12,
     GCRYCTL_DUMP_RANDOM_STATS = 13,
     GCRYCTL_DUMP_SECMEM_STATS = 14,
     GCRYCTL_GET_ALGO_NPKEY    = 15,
     GCRYCTL_GET_ALGO_NSKEY    = 16,
     GCRYCTL_GET_ALGO_NSIGN    = 17,
     GCRYCTL_GET_ALGO_NENCR    = 18,
     GCRYCTL_SET_VERBOSITY     = 19,
     GCRYCTL_SET_DEBUG_FLAGS   = 20,
     GCRYCTL_CLEAR_DEBUG_FLAGS = 21,
     GCRYCTL_USE_SECURE_RNDPOOL= 22,
     GCRYCTL_DUMP_MEMORY_STATS = 23,
     GCRYCTL_INIT_SECMEM       = 24,
     GCRYCTL_TERM_SECMEM       = 25,
     GCRYCTL_DISABLE_SECMEM_WARN = 27,
     GCRYCTL_SUSPEND_SECMEM_WARN = 28,
     GCRYCTL_RESUME_SECMEM_WARN	= 29,
     GCRYCTL_DROP_PRIVS		= 30,
     GCRYCTL_ENABLE_M_GUARD	= 31,
     GCRYCTL_START_DUMP		= 32,
     GCRYCTL_STOP_DUMP		= 33,
     GCRYCTL_GET_ALGO_USAGE      = 34
 };
 
 int gcry_control( enum gcry_ctl_cmds, ... );
 
 enum gcry_random_level {
     GCRY_WEAK_RANDOM = 0,
     GCRY_STRONG_RANDOM = 1,
     GCRY_VERY_STRONG_RANDOM = 2
 };
 
 
 struct gcry_sexp;
 typedef struct gcry_sexp *GCRY_SEXP;
 
 enum gcry_sexp_format {
     GCRYSEXP_FMT_DEFAULT   = 0,
     GCRYSEXP_FMT_CANON	   = 1,
     GCRYSEXP_FMT_BASE64    = 2,
     GCRYSEXP_FMT_ADVANCED  = 3,
 };
 
 
 void	  gcry_sexp_release( GCRY_SEXP sexp );
 void	  gcry_sexp_dump( const GCRY_SEXP a );
 GCRY_SEXP gcry_sexp_cons( const GCRY_SEXP a, const GCRY_SEXP b );
 GCRY_SEXP gcry_sexp_alist( const GCRY_SEXP *array );
 GCRY_SEXP gcry_sexp_vlist( const GCRY_SEXP a, ... );
 GCRY_SEXP gcry_sexp_append( const GCRY_SEXP a, const GCRY_SEXP n );
 GCRY_SEXP gcry_sexp_prepend( const GCRY_SEXP a, const GCRY_SEXP n );
 int	  gcry_sexp_sscan( GCRY_SEXP *retsexp, size_t *erroff,
 			   const char *buffer, size_t length );
 int	  gcry_sexp_build( GCRY_SEXP *retsexp, size_t *erroff,
 			   const char *format, ... );
 size_t	  gcry_sexp_sprint( GCRY_SEXP sexp, int mode, char *buffer,
 						size_t maxlength );
 GCRY_SEXP   gcry_sexp_find_token( GCRY_SEXP list,
 				  const char *tok, size_t toklen );
 int	    gcry_sexp_length( const GCRY_SEXP list );
 GCRY_SEXP   gcry_sexp_nth( const GCRY_SEXP list, int number );
 GCRY_SEXP   gcry_sexp_car( const GCRY_SEXP list );
 GCRY_SEXP   gcry_sexp_cdr( const GCRY_SEXP list );
 GCRY_SEXP   gcry_sexp_cadr( const GCRY_SEXP list );
 const char *gcry_sexp_nth_data( const GCRY_SEXP list, int number,
 						      size_t *datalen );
 GCRY_MPI    gcry_sexp_nth_mpi( GCRY_SEXP list, int number, int mpifmt );
 
 
 /*******************************************
  *					   *
  *  multi precision integer functions	   *
  *					   *
  *******************************************/
 
 enum gcry_mpi_format {
     GCRYMPI_FMT_NONE= 0,
     GCRYMPI_FMT_STD = 1,    /* twos complement stored without length */
     GCRYMPI_FMT_PGP = 2,    /* As used by OpenPGP */
     GCRYMPI_FMT_SSH = 3,    /* As used by SSH (same as 1 but with length)*/
     GCRYMPI_FMT_HEX = 4,    /* hex format */
     GCRYMPI_FMT_USG = 5,    /* like STD but this is an unsigned one */
 };
 
 
 enum gcry_mpi_flag {
     GCRYMPI_FLAG_SECURE = 1,
     GCRYMPI_FLAG_OPAQUE = 2,
 };
 
 
 
 GCRY_MPI gcry_mpi_new( unsigned int nbits );
 GCRY_MPI gcry_mpi_snew( unsigned int nbits );
 void	 gcry_mpi_release( GCRY_MPI a );
 GCRY_MPI gcry_mpi_copy( const GCRY_MPI a );
 GCRY_MPI gcry_mpi_set( GCRY_MPI w, const GCRY_MPI u );
 GCRY_MPI gcry_mpi_set_ui( GCRY_MPI w, unsigned long u );
 int	 gcry_mpi_cmp( const GCRY_MPI u, const GCRY_MPI v );
 int	 gcry_mpi_cmp_ui( const GCRY_MPI u, unsigned long v );
 void	 gcry_mpi_randomize( GCRY_MPI w,
 			     unsigned int nbits, enum gcry_random_level level);
 int	 gcry_mpi_scan( GCRY_MPI *ret_mpi, enum gcry_mpi_format format,
 				       const char *buffer, size_t *nbytes );
 int	 gcry_mpi_print( enum gcry_mpi_format format,
 			 char *buffer, size_t *nbytes, const GCRY_MPI a );
 int	 gcry_mpi_aprint( enum gcry_mpi_format format,
 			  void **buffer, size_t *nbytes, const GCRY_MPI a );
 
 
 void     gcry_mpi_add(GCRY_MPI w, GCRY_MPI u, GCRY_MPI v);
 void     gcry_mpi_add_ui(GCRY_MPI w, GCRY_MPI u, unsigned long v );
 void     gcry_mpi_addm(GCRY_MPI w, GCRY_MPI u, GCRY_MPI v, GCRY_MPI m);
 void     gcry_mpi_sub( GCRY_MPI w, GCRY_MPI u, GCRY_MPI v);
 void     gcry_mpi_sub_ui(GCRY_MPI w, GCRY_MPI u, unsigned long v );
 void     gcry_mpi_subm( GCRY_MPI w, GCRY_MPI u, GCRY_MPI v, GCRY_MPI m);
 void     gcry_mpi_mul_ui(GCRY_MPI w, GCRY_MPI u, unsigned long v );
 void     gcry_mpi_mul_2exp( GCRY_MPI w, GCRY_MPI u, unsigned long cnt);
 void     gcry_mpi_mul( GCRY_MPI w, GCRY_MPI u, GCRY_MPI v);
 void     gcry_mpi_mulm( GCRY_MPI w, GCRY_MPI u, GCRY_MPI v, GCRY_MPI m);
 
 void     gcry_mpi_powm( GCRY_MPI w,
                         const GCRY_MPI b, const GCRY_MPI e, const GCRY_MPI m );
 int      gcry_mpi_gcd( GCRY_MPI g, GCRY_MPI a, GCRY_MPI b );
 
 unsigned int gcry_mpi_get_nbits( GCRY_MPI a );
 int      gcry_mpi_test_bit( GCRY_MPI a, unsigned int n );
 void     gcry_mpi_set_bit( GCRY_MPI a, unsigned int n );
 void     gcry_mpi_clear_bit( GCRY_MPI a, unsigned int n );
 void     gcry_mpi_set_highbit( GCRY_MPI a, unsigned int n );
 void     gcry_mpi_clear_highbit( GCRY_MPI a, unsigned int n );
 void     gcry_mpi_rshift( GCRY_MPI x, GCRY_MPI a, unsigned int n );
 
 GCRY_MPI gcry_mpi_set_opaque( GCRY_MPI a, void *p, unsigned int nbits );
 void *   gcry_mpi_get_opaque( GCRY_MPI a, unsigned int *nbits );
 void     gcry_mpi_set_flag( GCRY_MPI a, enum gcry_mpi_flag flag );
 void     gcry_mpi_clear_flag( GCRY_MPI a, enum gcry_mpi_flag flag );
 int      gcry_mpi_get_flag( GCRY_MPI a, enum gcry_mpi_flag flag );
 
 
 #ifndef GCRYPT_NO_MPI_MACROS
 #define mpi_new(n)	    gcry_mpi_new( (n) )
 #define mpi_secure_new( n ) gcry_mpi_snew( (n) )
 #define mpi_release( a )    do { gcry_mpi_release( (a) ); \
 				 (a) = NULL; } while(0)
 #define mpi_copy( a )	    gcry_mpi_copy( (a) )
 #define mpi_set( w, u)	    gcry_mpi_set( (w), (u) )
 #define mpi_set_ui( w, u)   gcry_mpi_set_ui( (w), (u) )
 #define mpi_cmp( u, v )     gcry_mpi_cmp( (u), (v) )
 #define mpi_cmp_ui( u, v )  gcry_mpi_cmp_ui( (u), (v) )
 
 #define mpi_add_ui(w,u,v)   gcry_mpi_add_ui((w),(u),(v))
 #define mpi_add(w,u,v)      gcry_mpi_add ((w),(u),(v))
 #define mpi_addm(w,u,v,m)   gcry_mpi_addm ((w),(u),(v),(m))
 #define mpi_sub_ui(w,u,v)   gcry_mpi_sub_ui ((w),(u),(v))
 #define mpi_sub(w,u,v)      gcry_mpi_sub ((w),(u),(v))
 #define mpi_subm(w,u,v,m)   gcry_mpi_subm ((w),(u),(v),(m))
 #define mpi_mul_ui(w,u,v)   gcry_mpi_mul_ui ((w),(u),(v))
 #define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
 #define mpi_mul(w,u,v)      gcry_mpi_mul ((w),(u),(v))
 #define mpi_mulm(w,u,v,m)   gcry_mpi_mulm ((w),(u),(v),(m))
 #define mpi_powm(w,b,e,m)   gcry_mpi_powm( (w), (b), (e), (m) )
 #define mpi_gcd(g,a,b)      gcry_mpi_gcd( (g), (a), (b) )
 
 #define mpi_get_nbits(a)       gcry_mpi_get_nbits ((a))
 #define mpi_test_bit(a,b)      gcry_mpi_test_bit ((a),(b))
 #define mpi_set_bit(a,b)       gcry_mpi_set_bit ((a),(b))
 #define mpi_set_highbit(a,b)   gcry_mpi_set_highbit ((a),(b))
 #define mpi_clear_bit(a,b)     gcry_mpi_clear_bit ((a),(b))
 #define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
 #define mpi_rshift(a,b,c)      gcry_mpi_rshift ((a),(b),(c))
 
 #define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
 #define mpi_get_opaque(a,b)   gcry_mpi_get_opaque( (a), (b) )
 #endif /* GCRYPT_NO_MPI_MACROS */
 
 /********************************************
  *******  symmetric cipher functions  *******
  ********************************************/
 
 struct gcry_cipher_handle;
 typedef struct gcry_cipher_handle *GCRY_CIPHER_HD;
 
 enum gcry_cipher_algos {
     GCRY_CIPHER_NONE	    = 0,
     GCRY_CIPHER_IDEA	    = 1,
     GCRY_CIPHER_3DES	    = 2,
     GCRY_CIPHER_CAST5	    = 3,
     GCRY_CIPHER_BLOWFISH    = 4,
     GCRY_CIPHER_SAFER_SK128 = 5,
     GCRY_CIPHER_DES_SK	    = 6,
     GCRY_CIPHER_RIJNDAEL    = 7,
     GCRY_CIPHER_RIJNDAEL192 = 8,
     GCRY_CIPHER_RIJNDAEL256 = 9,
     GCRY_CIPHER_TWOFISH     = 10,
     /* other cipher numbers are above 300 for OpenPGP reasons. */
     GCRY_CIPHER_ARCFOUR     = 301
 };
 
 #define GCRY_CIPHER_AES    GCRY_CIPHER_RIJNDAEL
 #define GCRY_CIPHER_AES128 GCRY_CIPHER_RIJNDAEL128
 #define GCRY_CIPHER_AES192 GCRY_CIPHER_RIJNDAEL192
 #define GCRY_CIPHER_AES256 GCRY_CIPHER_RIJNDAEL256
 
 enum gcry_cipher_modes {
     GCRY_CIPHER_MODE_NONE   = 0,
     GCRY_CIPHER_MODE_ECB    = 1,
     GCRY_CIPHER_MODE_CFB    = 2,
     GCRY_CIPHER_MODE_CBC    = 3,
     GCRY_CIPHER_MODE_STREAM = 4 /* native stream mode of some the algorithms */
 };
 
 enum gcry_cipher_flags {
     GCRY_CIPHER_SECURE	    = 1,  /* allocate in secure memory */
     GCRY_CIPHER_ENABLE_SYNC = 2,  /* enable CFB sync mode */
 };
 
 
 GCRY_CIPHER_HD gcry_cipher_open( int algo, int mode, unsigned flags);
 void gcry_cipher_close( GCRY_CIPHER_HD h );
 int  gcry_cipher_ctl( GCRY_CIPHER_HD h, int cmd, void *buffer, size_t buflen);
 int gcry_cipher_info( GCRY_CIPHER_HD h, int what, void *buffer, size_t *nbytes);
 int gcry_cipher_algo_info( int algo, int what, void *buffer, size_t *nbytes);
 const char *gcry_cipher_algo_name( int algo );
 int gcry_cipher_map_name( const char* name );
 
 int gcry_cipher_encrypt( GCRY_CIPHER_HD h, byte *out, size_t outsize,
 				      const byte *in, size_t inlen );
 int gcry_cipher_decrypt( GCRY_CIPHER_HD h, byte *out, size_t outsize,
 				      const byte *in, size_t inlen );
 
 
 /* some handy macros */
 /* We have to cast a way a const char* here - this catch-all ctl function
  * was probably not the best choice */
 #define gcry_cipher_setkey(h,k,l)  gcry_cipher_ctl( (h), GCRYCTL_SET_KEY, \
 							 (char*)(k), (l) )
 #define gcry_cipher_setiv(h,k,l)  gcry_cipher_ctl( (h), GCRYCTL_SET_IV, \
 							 (char*)(k), (l) )
 #define gcry_cipher_sync(h)  gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, \
 								   NULL, 0 )
 
 #define gcry_cipher_get_algo_keylen(a) \
 	    gcry_cipher_algo_info( (a), GCRYCTL_GET_KEYLEN, NULL, NULL )
 #define gcry_cipher_get_algo_blklen(a) \
 	    gcry_cipher_algo_info( (a), GCRYCTL_GET_BLKLEN, NULL, NULL )
 #define gcry_cipher_test_algo(a) \
 	    gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
 
 
 /*********************************************
  *******  asymmetric cipher functions  *******
  *********************************************/
 
 enum gcry_pk_algos {
     GCRY_PK_RSA = 1,
     GCRY_PK_RSA_E = 2,	    /* use only for OpenPGP */
     GCRY_PK_RSA_S = 3,	    /* use only for OpenPGP */
     GCRY_PK_ELG_E = 16,     /* use only for OpenPGP */
     GCRY_PK_DSA   = 17,
     GCRY_PK_ELG   = 20,
 };
 
 /* Flags describing usage capabilites/request of a PK algorithm */
 #define GCRY_PK_USAGE_SIGN 1
 #define GCRY_PK_USAGE_ENCR 2
 
 int gcry_pk_encrypt( GCRY_SEXP *result, GCRY_SEXP data, GCRY_SEXP pkey );
 int gcry_pk_decrypt( GCRY_SEXP *result, GCRY_SEXP data, GCRY_SEXP skey );
 int gcry_pk_sign(    GCRY_SEXP *result, GCRY_SEXP data, GCRY_SEXP skey );
 int gcry_pk_verify(  GCRY_SEXP sigval, GCRY_SEXP data, GCRY_SEXP pkey );
 int gcry_pk_testkey( GCRY_SEXP key );
 int gcry_pk_genkey(  GCRY_SEXP *r_key, GCRY_SEXP s_parms );
 
 int gcry_pk_ctl( int cmd, void *buffer, size_t buflen);
 int gcry_pk_algo_info( int algo, int what, void *buffer, size_t *nbytes);
 const char *gcry_pk_algo_name( int algo );
 int gcry_pk_map_name( const char* name );
 unsigned int gcry_pk_get_nbits( GCRY_SEXP key );
 
 
 #define gcry_pk_test_algo(a) \
 	    gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
 
 /*********************************************
  *******  cryptograhic hash functions  *******
  *********************************************/
 
 enum gcry_md_algos {
     GCRY_MD_NONE    = 0,
     GCRY_MD_MD5     = 1,
     GCRY_MD_SHA1    = 2,
     GCRY_MD_RMD160  = 3,
     GCRY_MD_TIGER   = 6
 };
 
 enum gcry_md_flags {
     GCRY_MD_FLAG_SECURE = 1,
     GCRY_MD_FLAG_HMAC	= 2
 };
 
 
 struct gcry_md_context;
 struct gcry_md_handle {
     struct gcry_md_context *ctx;
     int  bufpos;
     int  bufsize;
     byte buf[1];
 };
 typedef struct gcry_md_handle *GCRY_MD_HD;
 
 
 GCRY_MD_HD gcry_md_open( int algo, unsigned flags );
 void gcry_md_close( GCRY_MD_HD hd );
 int gcry_md_enable( GCRY_MD_HD hd, int algo );
 GCRY_MD_HD gcry_md_copy( GCRY_MD_HD hd );
 void gcry_md_reset( GCRY_MD_HD hd );
 int gcry_md_ctl( GCRY_MD_HD hd, int cmd, byte *buffer, size_t buflen);
 void gcry_md_write( GCRY_MD_HD hd, const byte *buffer, size_t length);
 byte *gcry_md_read( GCRY_MD_HD hd, int algo );
 void gcry_md_hash_buffer( int algo, char *digest,
 			  const char *buffer, size_t length);
 int gcry_md_get_algo( GCRY_MD_HD hd );
 unsigned int gcry_md_get_algo_dlen( int algo );
 /*??int gcry_md_get( GCRY_MD_HD hd, int algo, byte *buffer, int buflen );*/
 int gcry_md_info( GCRY_MD_HD h, int what, void *buffer, size_t *nbytes);
 int gcry_md_algo_info( int algo, int what, void *buffer, size_t *nbytes);
 const char *gcry_md_algo_name( int algo );
 int gcry_md_map_name( const char* name );
 int gcry_md_setkey( GCRY_MD_HD hd, const char *key, size_t keylen );
 
 #define gcry_md_putc(h,c)  \
 	    do {					\
 		if( (h)->bufpos == (h)->bufsize )	\
 		    gcry_md_write( (h), NULL, 0 );	\
 		(h)->buf[(h)->bufpos++] = (c) & 0xff;	\
 	    } while(0)
 
 #define gcry_md_final(a) \
 	    gcry_md_ctl( (a), GCRYCTL_FINALIZE, NULL, 0 )
 
 #define gcry_md_is_secure(a) \
 	    gcry_md_info( (a), GCRYCTL_IS_SECURE, NULL, NULL )
 
 #define gcry_md_test_algo(a) \
 	    gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
 
 #define gcry_md_start_debug(a,b) \
 	    gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
 #define gcry_md_stop_debug(a,b) \
 	    gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
 
 
 /*********************************************
  *******  random generating functions  *******
  *********************************************/
 void gcry_randomize( byte *buffer, size_t length,
 		     enum gcry_random_level level );
 void *gcry_random_bytes( size_t nbytes, enum gcry_random_level level );
 void *gcry_random_bytes_secure( size_t nbytes, enum gcry_random_level level );
 
 /*****************************************
  *******  miscellaneous stuff	**********
  *****************************************/
 
 enum gcry_log_levels {
     GCRY_LOG_CONT   = 0,    /* continue the last log line */
     GCRY_LOG_INFO   = 10,
     GCRY_LOG_WARN   = 20,
     GCRY_LOG_ERROR  = 30,
     GCRY_LOG_FATAL  = 40,
     GCRY_LOG_BUG    = 50,
     GCRY_LOG_DEBUG  = 100,
 };
 
 
 /* Provide custom functions for special tasks of libgcrypt.
  */
 void gcry_set_allocation_handler( void *(*new_alloc_func)(size_t n),
 				  void *(*new_alloc_secure_func)(size_t n),
 				  int (*new_is_secure_func)(const void*),
 				  void *(*new_realloc_func)(void *p, size_t n),
 				  void (*new_free_func)(void*) );
 void gcry_set_outofcore_handler( int (*h)( void*, size_t, unsigned int ),
 								void *opaque );
 void gcry_set_fatalerror_handler( void (*fnc)(void*,int, const char*),
 								void *opaque );
 void gcry_set_gettext_handler( const char *(*f)(const char*) );
 void gcry_set_log_handler( void (*f)(void*,int, const char*, va_list ),
 							     void *opaque );
 
 
 /* Access to the memory function of libgcrypt.
  * Especially the gcry_free() should be used for memory
  * allocated by gcry_ functions.
  */
 void *gcry_malloc( size_t n );
 void *gcry_calloc( size_t n, size_t m );
 void *gcry_malloc_secure( size_t n );
 void *gcry_calloc_secure( size_t n, size_t m );
 void *gcry_realloc( void *a, size_t n );
 void *gcry_xmalloc( size_t n );
 void *gcry_xcalloc( size_t n, size_t m );
 void *gcry_xmalloc_secure( size_t n );
 void *gcry_xcalloc_secure( size_t n, size_t m );
 void *gcry_xrealloc( void *a, size_t n );
 char *gcry_xstrdup( const char * a);
 void  gcry_free( void *a );
 int   gcry_is_secure( const void *a );
 
 
 #ifndef GCRYPT_NO_MPI_MACROS
 # ifndef DID_MPI_TYPEDEF
     typedef struct gcry_mpi *MPI;
 #   define DID_MPI_TYPEDEF
 # endif
 #endif /* GCRYPT_NO_MPI_MACROS */
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _GCRYPT_H */