[git] GPGME - branch, master, updated. gpgme-1.4.2-15-g6564e5e

by Werner Koch cvs at cvs.gnupg.org
Mon Jan 6 17:17:54 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  6564e5e78e8c6e5a120675a5699b5b75248cfbc7 (commit)
       via  02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b (commit)
      from  b0aaa3f9aef36634b5c391812362f016114f02ba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6564e5e78e8c6e5a120675a5699b5b75248cfbc7
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jan 6 17:16:52 2014 +0100

    Add global flags disable-gpgconf, gpgconf-name, and gpg-name.
    
    * src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf",
    "gpgconf-name", and "gpg-name".
    * src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New.
    (get_gpgconf_item): Minor debug info change.
    * src/posix-util.c (default_gpg_name, default_gpgconf_name): Add vars.
    (_gpgme_set_default_gpg_name): New.
    (_gpgme_set_default_gpgconf_name): New.
    (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
    (walk_path): Add debug output on failure.
    * src/w32-util.c (default_gpg_name, default_gpgconf_name): Add vars.
    (replace_slashes): New.
    (get_basename): New.
    (_gpgme_set_default_gpg_name): New.
    (_gpgme_set_default_gpgconf_name): New.
    (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
    
    * tests/t-engine-info.c (main): Add --verbose and --set-global-flag
    options.
    --
    
    Note that the Windows part has not been tested.

diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index 18b3c94..3f31492 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -1,5 +1,5 @@
-\input texinfo                   @c -*- mode: texinfo; coding: latin-1; -*-
- at documentencoding ISO-8859-1
+\input texinfo                   @c -*- mode: texinfo; coding: utf-8; -*-
+ at documentencoding UTF-8
 @setfilename gpgme.info
 @settitle The `GnuPG Made Easy' Reference Manual
 
@@ -14,7 +14,7 @@
 
 @copying
 Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2010, 2012, 2013 g10 Code GmbH.
+2008, 2010, 2012, 2013, 2014 g10 Code GmbH.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -72,7 +72,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED}, of
 @center for version @value{VERSION}
 @page
 @vskip 0pt plus 1filll
-Published by g10 Code GmbH@* Hüttenstr. 61@* 40699 Erkrath, Germany
+Published by g10 Code GmbH@* Hüttenstr. 61@* 40699 Erkrath, Germany
 
 @insertcopying
 @end titlepage
@@ -648,14 +648,39 @@ does not return a detailed error code).
 On some systems it is not easy to set environment variables and thus
 hard to use @acronym{GPGME}'s internal trace facility for debugging.
 This function has been introduced as an alternative way to enable
-debugging.  It is important to assure that only one thread accesses
- at acronym{GPGME} functions between a call to this function and after
-the return from the call to @code{gpgme_check_version}.
-
-To enable debugging, you need to call this function as early as
-possible --- even before @code{gpgme_check_version} --- with the
-string ``debug'' for @var{name} and @var{value} identical to the value
-used with the environment variable @code{GPGME_DEBUG}.
+debugging and for a couple of other rarely used tweaks.  It is
+important to assure that only one thread accesses @acronym{GPGME}
+functions between a call to this function and after the return from
+the call to @code{gpgme_check_version}.
+
+All currently supported features require that this function is called
+as early as possible --- even before @code{gpgme_check_version}.  The
+features are identified by the following values for @var{name}:
+
+ at table @code
+ at item "debug"
+To enable debugging use the string ``debug'' for @var{name} and
+ at var{value} identical to the value used with the environment variable
+ at code{GPGME_DEBUG}.
+
+ at item "disable-gpgconf"
+Using this feature with any @var{value} disables the detection of the
+gpgconf program and thus forces GPGME to fallback into the simple
+OpenPGP only mode.  It may be used to force the use of GnuPG-1 on
+systems which have both GPG versions installed.  Note that in general
+the use of @code{gpgme_set_engine_info} is a better way to select a
+specific engine version.
+
+ at item "gpgconf-name"
+ at itemx "gpg-name"
+Set the name of the gpgconf respective gpg binary.  The defaults are
+ at code{GNU/GnuPG/gpgconf} and @code{GNU/GnuPG/gpg}.  Under Unix the
+leading directory part is ignored.  Under Windows the leading
+directory part is used as the default installation directory; the
+ at code{.exe} suffix is added by GPGME.  Use forward slashed even under
+Windows.
+
+ at end table
 
 This function returns @code{0} on success.  In contrast to other
 functions the non-zero return value on failure does not convey any
diff --git a/src/dirinfo.c b/src/dirinfo.c
index 2e387fa..eb29c6b 100644
--- a/src/dirinfo.c
+++ b/src/dirinfo.c
@@ -48,6 +48,7 @@ enum
 /* Values retrieved via gpgconf and cached here.  */
 static struct {
   int  valid;         /* Cached information is valid.  */
+  int  disable_gpgconf;
   char *homedir;
   char *agent_socket;
   char *gpgconf_name;
@@ -58,6 +59,15 @@ static struct {
 } dirinfo;
 
 
+
+/* Helper function to be used only by gpgme_set_global_flag.  */
+void
+_gpgme_dirinfo_disable_gpgconf (void)
+{
+  dirinfo.disable_gpgconf = 1;
+}
+
+
 /* Parse the output of "gpgconf --list-dirs".  This function expects
    that DIRINFO_LOCK is held by the caller.  If COMPONENTS is set, the
    output of --list-components is expected. */
@@ -198,16 +208,16 @@ get_gpgconf_item (int what)
     {
       char *pgmname;
 
-      pgmname = _gpgme_get_gpgconf_path ();
+      pgmname = dirinfo.disable_gpgconf? NULL : _gpgme_get_gpgconf_path ();
       if (pgmname && access (pgmname, F_OK))
         {
           _gpgme_debug (DEBUG_INIT,
-                        "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname);
+                        "gpgme-dinfo: gpgconf='%s' [not installed]\n", pgmname);
           free (pgmname);
           pgmname = NULL; /* Not available.  */
         }
       else
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgconf='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: gpgconf='%s'\n",
                       pgmname? pgmname : "[null]");
       if (!pgmname)
         {
@@ -231,22 +241,22 @@ get_gpgconf_item (int what)
          allocated.  */
       dirinfo.valid = 1;
       if (dirinfo.gpg_name)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo:     gpg='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo:     gpg='%s'\n",
                       dirinfo.gpg_name);
       if (dirinfo.g13_name)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo:     g13='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo:     g13='%s'\n",
                       dirinfo.g13_name);
       if (dirinfo.gpgsm_name)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo:   gpgsm='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo:   gpgsm='%s'\n",
                       dirinfo.gpgsm_name);
       if (dirinfo.homedir)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: homedir='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: homedir='%s'\n",
                       dirinfo.homedir);
       if (dirinfo.agent_socket)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo:   agent='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo:   agent='%s'\n",
                       dirinfo.agent_socket);
       if (dirinfo.uisrv_socket)
-        _gpgme_debug (DEBUG_INIT, "gpgme_dinfo:   uisrv='%s'\n",
+        _gpgme_debug (DEBUG_INIT, "gpgme-dinfo:   uisrv='%s'\n",
                       dirinfo.uisrv_socket);
     }
   switch (what)
diff --git a/src/gpgme.c b/src/gpgme.c
index a8de64b..4a8afa9 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -37,6 +37,7 @@
 #include "wait.h"
 #include "debug.h"
 #include "priv-io.h"
+#include "sys-util.h"
 
 
 /* The default locale.  */
@@ -65,6 +66,15 @@ gpgme_set_global_flag (const char *name, const char *value)
     return -1;
   else if (!strcmp (name, "debug"))
     return _gpgme_debug_set_debug_envvar (value);
+  else if (!strcmp (name, "disable-gpgconf"))
+    {
+      _gpgme_dirinfo_disable_gpgconf ();
+      return 0;
+    }
+  else if (!strcmp (name, "gpgconf-name"))
+    return _gpgme_set_default_gpgconf_name (value);
+  else if (!strcmp (name, "gpg-name"))
+    return _gpgme_set_default_gpg_name (value);
   else
     return -1;
 }
diff --git a/src/posix-util.c b/src/posix-util.c
index d4e4e3f..5bfc486 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -29,6 +29,46 @@
 
 #include "util.h"
 #include "sys-util.h"
+#include "debug.h"
+
+/* These variables store the malloced name of alternative default
+   binaries.  The are set only once by gpgme_set_global_flag.  */
+static char *default_gpg_name;
+static char *default_gpgconf_name;
+
+/* Set the default name for the gpg binary.  This function may only be
+   called by gpgme_set_global_flag.  Returns 0 on success.  Leading
+   directories are removed from NAME.  */
+int
+_gpgme_set_default_gpg_name (const char *name)
+{
+  const char *s;
+
+  s = strrchr (name, '/');
+  if (s)
+    name = s + 1;
+
+  if (!default_gpg_name)
+    default_gpg_name = strdup (name);
+  return !default_gpg_name;
+}
+
+/* Set the default name for the gpgconf binary.  This function may
+   only be called by gpgme_set_global_flag.  Returns 0 on success.
+   Leading directories are removed from NAME.  */
+int
+_gpgme_set_default_gpgconf_name (const char *name)
+{
+  const char *s;
+
+  s = strrchr (name, '/');
+  if (s)
+    name = s + 1;
+
+  if (!default_gpgconf_name)
+    default_gpgconf_name = strdup (name);
+  return !default_gpgconf_name;
+}
 
 
 /* Find an executable program PGM along the envvar PATH.  */
@@ -60,6 +100,9 @@ walk_path (const char *pgm)
       path = s + 1;
     }
 
+  _gpgme_debug (DEBUG_ENGINE, "gpgme-walk_path: '%s' not found in '%s'",
+                pgm, path);
+
   free (fname);
   return NULL;
 }
@@ -72,7 +115,7 @@ walk_path (const char *pgm)
 char *
 _gpgme_get_gpg_path (void)
 {
-  return walk_path ("gpg");
+  return walk_path (default_gpg_name? default_gpg_name : "gpg");
 }
 
 
@@ -81,7 +124,7 @@ _gpgme_get_gpg_path (void)
 char *
 _gpgme_get_gpgconf_path (void)
 {
-  return walk_path ("gpgconf");
+  return walk_path (default_gpgconf_name? default_gpgconf_name : "gpgconf");
 }
 
 /* See w32-util.c */
diff --git a/src/sys-util.h b/src/sys-util.h
index 3686f89..7180fca 100644
--- a/src/sys-util.h
+++ b/src/sys-util.h
@@ -21,6 +21,9 @@
 #define SYS_UTIL_H
 
 /*-- {posix,w32}-util.c --*/
+int _gpgme_set_default_gpg_name (const char *name);
+int _gpgme_set_default_gpgconf_name (const char *name);
+
 char *_gpgme_get_gpg_path (void);
 char *_gpgme_get_gpgconf_path (void);
 
diff --git a/src/util.h b/src/util.h
index 57c8b13..c0934e1 100644
--- a/src/util.h
+++ b/src/util.h
@@ -51,6 +51,8 @@ int _gpgme_get_conf_int (const char *key, int *value);
 void _gpgme_allow_set_foreground_window (pid_t pid);
 
 /*-- dirinfo.c --*/
+void _gpgme_dirinfo_disable_gpgconf (void);
+
 const char *_gpgme_get_default_homedir (void);
 const char *_gpgme_get_default_agent_socket (void);
 const char *_gpgme_get_default_gpg_name (void);
diff --git a/src/w32-util.c b/src/w32-util.c
index 31a58bb..3884b40 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -81,6 +81,11 @@ DEFINE_STATIC_LOCK (get_path_lock);
    file name of the DLL or executable which contains the gpgme code.  */
 static HMODULE my_hmodule;
 
+/* These variables store the malloced name of alternative default
+   binaries.  The are set only once by gpgme_set_global_flag.  */
+static char *default_gpg_name;
+static char *default_gpgconf_name;
+
 
 #ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW
 
@@ -151,6 +156,32 @@ wchar_to_utf8 (const wchar_t *string)
 }
 
 
+/* Replace all forward slashes by backslashes.  */
+static void
+replace_slashes (char *string)
+{
+  for (; *string; string++)
+    if (*string == '/')
+      *string = '\\';
+}
+
+
+/* Get the base name of NAME.  Returns a pointer into NAME right after
+   the last slash or backslash or to NAME if no slash or backslash
+   exists.  */
+static const char *
+get_basename (const char *name)
+{
+  const char *mark, *s;
+
+  for (mark=NULL, s=name; *s; s++)
+    if (*s == '/' || *s == '\\')
+      mark = s;
+
+  return mark? mark+1 : name;
+}
+
+
 void
 _gpgme_allow_set_foreground_window (pid_t pid)
 {
@@ -373,7 +404,7 @@ find_program_in_inst_dir (const char *inst_dir, const char *name)
   char *dir;
 
   /* If an installation directory has been passed, this overrides a
-     location given bu the registry.  The idea here is that we prefer
+     location given by the registry.  The idea here is that we prefer
      a program installed alongside with gpgme.  We don't want the
      registry to override this to have a better isolation of an gpgme
      aware applications for other effects.  Note that the "Install
@@ -424,6 +455,41 @@ find_program_at_standard_place (const char *name)
 }
 
 
+/* Set the default name for the gpg binary.  This function may only be
+   called by gpgme_set_global_flag.  Returns 0 on success.  */
+int
+_gpgme_set_default_gpg_name (const char *name)
+{
+  if (!default_gpg_name)
+    {
+      default_gpg_name = malloc (strlen (name) + 5);
+      if (default_gpg_name)
+        {
+          strcpy (stpcpy (default_gpg_name, name), ".exe");
+          replace_slashes (default_gpg_name);
+        }
+    }
+  return !default_gpg_name;
+}
+
+/* Set the default name for the gpgconf binary.  This function may only be
+   called by gpgme_set_global_flag.  Returns 0 on success.  */
+int
+_gpgme_set_default_gpgconf_name (const char *name)
+{
+  if (!default_gpgconf_name)
+    {
+      default_gpgconf_name = malloc (strlen (name) + 5);
+      if (default_gpgconf_name)
+        {
+          strcpy (stpcpy (default_gpgconf_name, name), ".exe");
+          replace_slashes (default_gpgconf_name);
+        }
+    }
+  return !default_gpgconf_name;
+}
+
+
 /* Return the full file name of the GPG binary.  This function is used
    if gpgconf was not found and thus it can be assumed that gpg2 is
    not installed.  This function is only called by get_gpgconf_item
@@ -432,27 +498,47 @@ char *
 _gpgme_get_gpg_path (void)
 {
   char *gpg;
-  const char *inst_dir;
+  const char *inst_dir, *name;
 
   inst_dir = _gpgme_get_inst_dir ();
-  gpg = find_program_in_inst_dir (inst_dir, "gpg.exe");
+  gpg = find_program_in_inst_dir
+    (inst_dir,
+     default_gpg_name? get_basename (default_gpg_name) : "gpg.exe");
   if (!gpg)
-    gpg = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
+    {
+      name = (default_gpg_name? default_gpg_name
+              /* */           : "GNU\\GnuPG\\gpg.exe");
+      gpg = find_program_at_standard_place (name);
+      if (!gpg)
+        _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpg_path: '%s' not found",
+                      name);
+    }
+
   return gpg;
 }
 
+
 /* This function is only called by get_gpgconf_item and may not be
    called concurrently.  */
 char *
 _gpgme_get_gpgconf_path (void)
 {
   char *gpgconf;
-  const char *inst_dir;
+  const char *inst_dir, *name;
 
   inst_dir = _gpgme_get_inst_dir ();
-  gpgconf = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
+  gpgconf = find_program_in_inst_dir
+    (inst_dir,
+     default_gpgconf_name? get_basename (default_gpgconf_name) : "gpgconf.exe");
   if (!gpgconf)
-    gpgconf = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
+    {
+      name = (default_gpgconf_name? default_gpgconf_name
+              /* */               : "GNU\\GnuPG\\gpgconf.exe");
+      gpgconf = find_program_at_standard_place (name);
+      if (!gpgconf)
+        _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpgconf_path: '%s' not found",
+                      name);
+    }
   return gpgconf;
 }
 
diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c
index 43acd3d..11fe4a4 100644
--- a/tests/t-engine-info.c
+++ b/tests/t-engine-info.c
@@ -28,6 +28,12 @@
 
 #include <gpgme.h>
 
+#define PGM "t-engine-info"
+
+static int verbose;
+
+
+
 
 #define fail_if_err(err)					\
   do								\
@@ -42,13 +48,66 @@
   while (0)
 
 
-
 int
 main (int argc, char **argv )
 {
+  int last_argc = -1;
   gpgme_engine_info_t info;
   gpgme_error_t err;
 
+  if (argc)
+    { argc--; argv++; }
+
+  while (argc && last_argc != argc )
+    {
+      last_argc = argc;
+      if (!strcmp (*argv, "--"))
+        {
+          argc--; argv++;
+          break;
+        }
+      else if (!strcmp (*argv, "--help"))
+        {
+          fputs ("usage: " PGM " [options]\n"
+                 "Options:\n"
+                 "  --set-global-flag KEY VALUE\n",
+                 stdout);
+          exit (0);
+        }
+      else if (!strcmp (*argv, "--verbose"))
+        {
+          verbose++;
+          argc--; argv++;
+        }
+      else if (!strcmp (*argv, "--set-global-flag"))
+        {
+          argc--; argv++;
+          if (argc < 2)
+            {
+              fprintf (stderr, PGM ": not enough arguments for option\n");
+              exit (1);
+            }
+          if (gpgme_set_global_flag (argv[0], argv[1]))
+            {
+              fprintf (stderr, PGM ": gpgme_set_global_flag failed\n");
+              exit (1);
+            }
+          argc--; argv++;
+          argc--; argv++;
+        }
+      else if (!strncmp (*argv, "--", 2))
+        {
+          fprintf (stderr, PGM ": unknown option '%s'\n", *argv);
+          exit (1);
+        }
+    }
+
+  if (argc)
+    {
+      fprintf (stderr, PGM ": unexpected arguments\n");
+      exit (1);
+    }
+
   gpgme_check_version (NULL);
   err = gpgme_get_engine_info (&info);
   fail_if_err (err);

commit 02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Dec 27 16:08:20 2013 +0100

    Locate engine names only at runtime and prefer GnuPG-2.
    
    * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION)
    (NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related
    checks.  Do not check for any engine version.
    (HAVE_ASSUAN): Remove AM conditional.
    * src/Makefile.am: Remove separate component vars and always build all
    engines but uiserver.
    * src/dirinfo.c (WANT_GPGCONF_NAME): New.
    (struct dirinfo): Add field gpgconf_name.
    (_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME.
    (get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path
    now returning a malloced string.
    * src/engine.c (engine_ops): Always init all engines except for
    uiserver.
    * src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path):
    Remove unused functions.
    (walk_path): New.
    (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using
    walk_path.
    * src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove
    unused functions.
    (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced
    string.
    * src/engine-g13.c (g13_get_req_version): Use a hardwired string with
    the required version.  This info belongs into this file.
    * src/engine-gpg.c (gpg_get_req_version): Ditto.
    * src/engine-gpgconf.c (gpgconf_get_req_version): Ditto.
    * src/engine-gpgsm.c (gpgsm_get_req_version): Ditto.
    * tests/t-engine-info.c: Replace now useless test by an info output.
    * tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent.
    * tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/NEWS b/NEWS
index f68035d..8f9127e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+Noteworthy changes in version 1.5.0 (unreleased)
+------------------------------------------------
+
+ * On Unices the engine file names are not not anymore hardwired but
+   located via the envvar PATH.  All configuration options to set the
+   name of the engines for configure run are removed.
+
+ * If GPGME find the gpgconf binary it defaults to using gpg2 or
+   whatever gpgconf tells as name for the OpenPGP engine.  If gpgconf
+   is not found, GPGME looks for an engine named "gpg".
+
+
+
 Noteworthy changes in version 1.4.3 (2013-08-12)
 ------------------------------------------------
 
diff --git a/README b/README
index e886647..3b39215 100644
--- a/README
+++ b/README
@@ -41,7 +41,7 @@ See the file INSTALL for generic installation instructions.
 Check that you have unmodified sources.  See below on how to do this.
 Don't skip it - this is an important step!
 
-To build GPGME, you need to install libgpg-error (>= 1.8) and
+To build GPGME, you need to install libgpg-error (>= 1.11) and
 Libassuan (>= 2.0.2).
 
 For support of the OpenPGP protocol (default), you should use the
@@ -50,13 +50,6 @@ ftp://ftp.gnupg.org/gcrypt/gnupg/
 For support of the CMS (Cryptographic Message Syntax) protocol, you
 need a GnuPG version >= 2.0.
 
-If configure can't find the `gpg' binary in your path, you can specify
-the location with the --with-gpg=/path/to/gpg argument to configure.
-
-If configure can't find the `gpgsm' binary in your path, you can
-specify the location with the --with-gpgsm=/path/to/gpgsm argument to
-configure.
-
 On some platforms GPGME based applications might hang at certain
 operations when using GPGME_PROTOCOL_CMS.  A workaround for this
 problem is to build with the configure option --disable-fd-passing.
diff --git a/configure.ac b/configure.ac
index 92375e6..9575db2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,7 @@ LIBGPGME_LT_REVISION=0
 GPGME_CONFIG_API_VERSION=1
 ##############################################
 
-NEED_GPG_ERROR_VERSION=1.8
+NEED_GPG_ERROR_VERSION=1.11
 NEED_LIBASSUAN_API=2
 NEED_LIBASSUAN_VERSION=2.0.2
 
@@ -254,7 +254,32 @@ AC_SUBST(BUILD_TIMESTAMP)
 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
                    [The time this package was configured for a build])
 
+#
+# Options to disable some regression tests
+#
+run_gpgconf_test="yes"
+AC_ARG_ENABLE(gpgconf-test,
+  AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF regression test]),
+         run_gpgconf_test=$enableval)
+AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
+
+run_gpg_test="yes"
+AC_ARG_ENABLE(gpg-test,
+  AC_HELP_STRING([--disable-gpg-test], [disable GPG regression test]),
+         run_gpg_test=$enableval)
+AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
+
+run_gpgsm_test="yes"
+AC_ARG_ENABLE(gpgsm-test,
+  AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM regression test]),
+         run_gpgsm_test=$enableval)
+AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
 
+run_g13_test="yes"
+AC_ARG_ENABLE(g13-test,
+  AC_HELP_STRING([--disable-g13-test], [disable G13 regression test]),
+         run_g13_test=$enableval)
+AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
 
 
 # Checks for header files.
@@ -394,478 +419,6 @@ if test "$have_libassuan" = "yes"; then
   AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
                      [version of the libassuan library])
 fi
-AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
-if test "$have_libassuan" = "yes"; then
-  AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
-fi
-
-# Checks for system services
-NEED_GPG_VERSION_DEFAULT=1.4.0
-NEED_GPGSM_VERSION_DEFAULT=1.9.6
-NEED_GPGCONF_VERSION_DEFAULT=2.0.4
-NEED_G13_VERSION_DEFAULT=2.1.0
-NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
-NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
-NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
-NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
-AC_ARG_WITH(gpg-version,
-	    AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
-	    NEED_GPG_VERSION=$withval)
-if test "$NEED_GPG_VERSION" = "yes"; then
-  NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
-fi
-if test "$NEED_GPG_VERSION" = "no"; then
-  NEED_GPG_VERSION=0.0.0
-fi
-AC_ARG_WITH(gpgsm-version,
-	    AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
-	    NEED_GPGSM_VERSION=$withval)
-if test "$NEED_GPGSM_VERSION" = "yes"; then
-  NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
-fi
-if test "$NEED_GPGSM_VERSION" = "no"; then
-  NEED_GPGSM_VERSION=0.0.0
-fi
-AC_ARG_WITH(gpgconf-version,
-	    AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
-	    NEED_GPGCONF_VERSION=$withval)
-if test "$NEED_GPGCONF_VERSION" = "yes"; then
-  NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
-fi
-if test "$NEED_GPGCONF_VERSION" = "no"; then
-  NEED_GPGCONF_VERSION=0.0.0
-fi
-AC_ARG_WITH(g13-version,
-	    AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
-	    NEED_G13_VERSION=$withval)
-if test "$NEED_G13_VERSION" = "yes"; then
-  NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
-fi
-if test "$NEED_G13_VERSION" = "no"; then
-  NEED_G13_VERSION=0.0.0
-fi
-
-AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
-				         [Min. needed GPGCONF version.])
-AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
-				     [Min. needed GnuPG version.])
-AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
-				       [Min. needed GPGSM version.])
-AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
-				     [Min. needed G13 version.])
-
-#
-# Check for GPGCONF
-#
-gpgconf_usable_for_test=no
-NO_OVERRIDE=no
-AC_ARG_WITH(gpgconf,
-	    AC_HELP_STRING([--with-gpgconf=PATH],
-                           [use gpgconf binary at PATH]),
-	    GPGCONF=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
-  GPGCONF=
-  NO_OVERRIDE=yes
-  if test "$cross_compiling" != "yes"; then
-    AC_PATH_PROG(GPGCONF, gpgconf)
-  fi
-  if test -z "$GPGCONF"; then
-    GPGCONF="$GPGCONF_DEFAULT"
-  fi
-fi
-if test "$GPGCONF" = no; then
-  if test "$NO_OVERRIDE" = "yes"; then
-    if test "$cross_compiling" != "yes"; then
-      AC_MSG_WARN([
-***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
-***])
-    else
-      AC_MSG_ERROR([
-***
-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
-***])
-    fi
-  fi
-else
-  AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
-  AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
-fi
-AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
-
-dnl Check for GPGCONF version requirement.
-GPGCONF_VERSION=unknown
-ok=maybe
-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
-  ok=no
-else
-  if test "$cross_compiling" = "yes"; then
-    AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
-    ok=no
-  else
-    if test ! -x "$GPGCONF"; then
-      AC_MSG_WARN([GPGCONF not executable, version check disabled])
-      ok=no
-    fi
-  fi
-fi
-if test "$ok" = "maybe"; then
-  AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
-  req_major=`echo $NEED_GPGCONF_VERSION | \
-             sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-  req_minor=`echo $NEED_GPGCONF_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-  req_micro=`echo $NEED_GPGCONF_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-  GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
-  major=`echo $GPGCONF_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-  minor=`echo $GPGCONF_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-  micro=`echo $GPGCONF_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
-  if test "$major" -gt "$req_major"; then
-    ok=yes
-  else
-    if test "$major" -eq "$req_major"; then
-      if test "$minor" -gt "$req_minor"; then
-        ok=yes
-      else
-        if test "$minor" -eq "$req_minor"; then
-          if test "$micro" -ge "$req_micro"; then
-            ok=yes
-	  fi
-        fi
-      fi
-    fi
-  fi
-  if test "$ok" = "yes"; then
-    AC_MSG_RESULT(yes)
-    if test "$cross_compiling" != "yes"; then
-       gpgconf_usable_for_test=yes
-    fi
-  else
-    AC_MSG_RESULT(no)
-    AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
-  fi
-fi
-run_gpgconf_test="$ok"
-AC_ARG_ENABLE(gpgconf-test,
-  AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
-         run_gpgconf_test=$enableval)
-AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
-
-
-#
-# Check for GPG
-#
-NO_OVERRIDE=no
-AC_ARG_WITH(gpg,
-	    AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
-	    GPG=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
-  GPG=
-  NO_OVERRIDE=yes
-  if test "$cross_compiling" != "yes"; then
-    if test "$gpgconf_usable_for_test" = "yes"; then
-      GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
-    else
-      AC_PATH_PROG(GPG, gpg)
-    fi
-  fi
-  if test -z "$GPG"; then
-    GPG="$GPG_DEFAULT"
-  fi
-fi
-if test "$GPG" = no; then
-  if test "$NO_OVERRIDE" = "yes"; then
-    if test "$cross_compiling" != "yes"; then
-      AC_MSG_WARN([
-***
-*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
-***])
-    else
-      AC_MSG_ERROR([
-***
-*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
-***])
-    fi
-  fi
-else
-  AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
-  AC_SUBST(GPG)
-fi
-dnl Check for GnuPG version requirement.
-GPG_VERSION=unknown
-ok=maybe
-if test -z "$GPG" -o "x$GPG" = "xno"; then
-  ok=no
-else
-  if test "$cross_compiling" = "yes"; then
-    AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
-    ok=no
-  else
-    if test ! -x "$GPG"; then
-      AC_MSG_WARN([GnuPG not executable, version check disabled])
-      ok=no
-    fi
-  fi
-fi
-if test "$ok" = "maybe"; then
-  AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
-  req_major=`echo $NEED_GPG_VERSION | \
-             sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-  req_minor=`echo $NEED_GPG_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-  req_micro=`echo $NEED_GPG_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-  GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
-  major=`echo $GPG_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-  minor=`echo $GPG_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-  micro=`echo $GPG_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
-  if test "$major" -gt "$req_major"; then
-    ok=yes
-  else
-    if test "$major" -eq "$req_major"; then
-      if test "$minor" -gt "$req_minor"; then
-        ok=yes
-      else
-        if test "$minor" -eq "$req_minor"; then
-          if test "$micro" -ge "$req_micro"; then
-            ok=yes
-	  fi
-        fi
-      fi
-    fi
-  fi
-  if test "$ok" = "yes"; then
-    AC_MSG_RESULT(yes)
-  else
-    AC_MSG_RESULT(no)
-    AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
-  fi
-fi
-run_gpg_test="$ok"
-AC_ARG_ENABLE(gpg-test,
-  AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
-         run_gpg_test=$enableval)
-AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
-AC_SUBST(GPG_PATH)
-
-
-#
-# Check for GPGSM
-#
-NO_OVERRIDE=no
-AC_ARG_WITH(gpgsm,
-	    AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
-	    GPGSM=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
-  GPGSM=
-  NO_OVERRIDE=yes
-  if test "$cross_compiling" != "yes"; then
-    if test "$gpgconf_usable_for_test" = "yes"; then
-      GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
-    else
-      AC_PATH_PROG(GPGSM, gpgsm)
-    fi
-  fi
-  if test -z "$GPGSM"; then
-    GPGSM="$GPGSM_DEFAULT"
-  fi
-fi
-if test "$GPGSM" = no; then
-  if test "$NO_OVERRIDE" = "yes"; then
-    if test "$cross_compiling" != "yes"; then
-      AC_MSG_WARN([
-***
-*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
-***])
-    else
-      AC_MSG_ERROR([
-***
-*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
-***])
-    fi
-  fi
-else
-  AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
-  AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
-fi
-AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
-
-
-dnl Check for GPGSM version requirement.
-GPGSM_VERSION=unknown
-ok=maybe
-if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
-  ok=no
-else
-  if test "$cross_compiling" = "yes"; then
-    AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
-    ok=no
-  else
-    if test ! -x "$GPGSM"; then
-      AC_MSG_WARN([GPGSM not executable, version check disabled])
-      ok=no
-    fi
-  fi
-fi
-if test "$ok" = "maybe"; then
-  AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
-  req_major=`echo $NEED_GPGSM_VERSION | \
-             sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-  req_minor=`echo $NEED_GPGSM_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-  req_micro=`echo $NEED_GPGSM_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-  GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
-  major=`echo $GPGSM_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-  minor=`echo $GPGSM_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-  micro=`echo $GPGSM_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
-  if test "$major" -gt "$req_major"; then
-    ok=yes
-  else
-    if test "$major" -eq "$req_major"; then
-      if test "$minor" -gt "$req_minor"; then
-        ok=yes
-      else
-        if test "$minor" -eq "$req_minor"; then
-          if test "$micro" -ge "$req_micro"; then
-            ok=yes
-	  fi
-        fi
-      fi
-    fi
-  fi
-  if test "$ok" = "yes"; then
-    AC_MSG_RESULT(yes)
-  else
-    AC_MSG_RESULT(no)
-    AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
-  fi
-fi
-run_gpgsm_test="$ok"
-AC_ARG_ENABLE(gpgsm-test,
-  AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
-         run_gpgsm_test=$enableval)
-AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
-
-
-#
-# Check for G13
-#
-NO_OVERRIDE=no
-AC_ARG_WITH(g13,
-	    AC_HELP_STRING([--with-g13=PATH],
-                           [use g13 binary at PATH]),
-	    G13=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
-  G13=
-  NO_OVERRIDE=yes
-  if test "$cross_compiling" != "yes"; then
-    if test "$gpgconf_usable_for_test" = "yes"; then
-      G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
-      if test -z "$G13"; then
-        # Use a hack if gpgconf has no support for g13.
-        G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
-      fi
-    else
-      AC_PATH_PROG(G13, g13)
-    fi
-  fi
-  if test -z "$G13"; then
-    G13="$G13_DEFAULT"
-  fi
-fi
-if test "$G13" = no; then
-  if test "$NO_OVERRIDE" = "yes"; then
-    if test "$cross_compiling" != "yes"; then
-      AC_MSG_WARN([
-***
-*** Could not find g13, install g13 or use --with-g13=PATH to enable it
-***])
-    else
-      AC_MSG_ERROR([
-***
-*** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
-***])
-    fi
-  fi
-else
-  AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
-  AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
-fi
-AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
-
-dnl Check for G13 version requirement.
-G13_VERSION=unknown
-ok=maybe
-if test -z "$G13" -o "x$G13" = "xno"; then
-  ok=no
-else
-  if test "$cross_compiling" = "yes"; then
-    AC_MSG_WARN([G13 version can not be checked when cross compiling])
-    ok=no
-  else
-    if test ! -x "$G13"; then
-      AC_MSG_WARN([G13 not executable, version check disabled])
-      ok=no
-    fi
-  fi
-fi
-if test "$ok" = "maybe"; then
-  AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
-  req_major=`echo $NEED_G13_VERSION | \
-             sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-  req_minor=`echo $NEED_G13_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-  req_micro=`echo $NEED_G13_VERSION | \
-	     sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-  G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
-  major=`echo $G13_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-  minor=`echo $G13_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-  micro=`echo $G13_VERSION | \
-	 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
-  if test "$major" -gt "$req_major"; then
-    ok=yes
-  else
-    if test "$major" -eq "$req_major"; then
-      if test "$minor" -gt "$req_minor"; then
-        ok=yes
-      else
-        if test "$minor" -eq "$req_minor"; then
-          if test "$micro" -ge "$req_micro"; then
-            ok=yes
-	  fi
-        fi
-      fi
-    fi
-  fi
-  if test "$ok" = "yes"; then
-    AC_MSG_RESULT(yes)
-  else
-    AC_MSG_RESULT(no)
-    AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
-  fi
-fi
-run_g13_test="$ok"
-AC_ARG_ENABLE(g13-test,
-  AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
-         run_g13_test=$enableval)
-AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
 
 
 #
@@ -1030,7 +583,7 @@ if test "$have_libassuan" = "no"; then
    die=yes
    AC_MSG_NOTICE([[
 ***
-*** You need libassuan to build this program with GPGSM support.
+*** You need libassuan to build this program.
 *** This library is for example available at
 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
@@ -1067,17 +620,6 @@ echo "
         Revision:        mym4_revision  (mym4_revision_dec)
         Platform:        $host
 
-        Gpgconf at:      $GPGCONF
-        Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
-        GPG at:          $GPG
-        GPG version:     $GPG_VERSION, min. $NEED_GPG_VERSION
-        Gpgsm at:        $GPGSM
-        Gpgsm version:   $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
-        G13 at:          $G13
-        G13 version:     $G13_VERSION, min. $NEED_G13_VERSION
-
-        Assuan version:  $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
-
         UI Server:       $uiserver
         FD Passing:      $use_descriptor_passing
         GPGME Pthread:   $have_pthread
diff --git a/src/Makefile.am b/src/Makefile.am
index 1f95103..abc014c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -66,30 +66,6 @@ if HAVE_W32CE_SYSTEM
 system_components += w32-ce.h w32-ce.c
 endif
 
-if HAVE_GPGSM
-gpgsm_components = engine-gpgsm.c
-else
-gpgsm_components =
-endif
-
-if HAVE_ASSUAN
-assuan_components = assuan-support.c engine-assuan.c
-else
-assuan_components =
-endif
-
-if HAVE_GPGCONF
-gpgconf_components = engine-gpgconf.c
-else
-gpgconf_components =
-endif
-
-if HAVE_G13
-g13_components = engine-g13.c
-else
-g13_components =
-endif
-
 if HAVE_UISERVER
 uiserver_components = engine-uiserver.c
 else
@@ -113,11 +89,11 @@ main_sources =								\
 	sign.c passphrase.c progress.c					\
 	key.c keylist.c trust-item.c trustlist.c			\
 	import.c export.c genkey.c delete.c edit.c getauditlog.c        \
-	opassuan.c passwd.c                                             \
+	opassuan.c passwd.c assuan-support.c                            \
 	engine.h engine-backend.h engine.c engine-gpg.c status-table.c	\
-	$(gpgsm_components) $(assuan_components) $(gpgconf_components)  \
+	engine-gpgsm.c engine-assuan.c engine-gpgconf.c                 \
 	$(uiserver_components)						\
-	$(g13_components) vfs-mount.c vfs-create.c			\
+	engine-g13.c vfs-mount.c vfs-create.c			        \
 	gpgconf.c							\
 	sema.h priv-io.h $(system_components) sys-util.h dirinfo.c	\
 	debug.c debug.h gpgme.c version.c error.c
diff --git a/src/dirinfo.c b/src/dirinfo.c
index 27c0dd7..2e387fa 100644
--- a/src/dirinfo.c
+++ b/src/dirinfo.c
@@ -38,6 +38,7 @@ enum
   {
     WANT_HOMEDIR,
     WANT_AGENT_SOCKET,
+    WANT_GPGCONF_NAME,
     WANT_GPG_NAME,
     WANT_GPGSM_NAME,
     WANT_G13_NAME,
@@ -49,6 +50,7 @@ static struct {
   int  valid;         /* Cached information is valid.  */
   char *homedir;
   char *agent_socket;
+  char *gpgconf_name;
   char *gpg_name;
   char *gpgsm_name;
   char *g13_name;
@@ -194,13 +196,14 @@ get_gpgconf_item (int what)
   LOCK (dirinfo_lock);
   if (!dirinfo.valid)
     {
-      const char *pgmname;
+      char *pgmname;
 
       pgmname = _gpgme_get_gpgconf_path ();
       if (pgmname && access (pgmname, F_OK))
         {
           _gpgme_debug (DEBUG_INIT,
                         "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname);
+          free (pgmname);
           pgmname = NULL; /* Not available.  */
         }
       else
@@ -212,12 +215,13 @@ get_gpgconf_item (int what)
              GnuPG-1.  */
           pgmname = _gpgme_get_gpg_path ();
           if (pgmname)
-            dirinfo.gpg_name = strdup (pgmname);
+            dirinfo.gpg_name = pgmname;
         }
       else
         {
           read_gpgconf_dirs (pgmname, 0);
           read_gpgconf_dirs (pgmname, 1);
+          dirinfo.gpgconf_name = pgmname;
         }
       /* Even if the reading of the directories failed (e.g. due to an
          too old version gpgconf or no gpgconf at all), we need to
@@ -249,6 +253,7 @@ get_gpgconf_item (int what)
     {
     case WANT_HOMEDIR: result = dirinfo.homedir; break;
     case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
+    case WANT_GPGCONF_NAME: result = dirinfo.gpgconf_name; break;
     case WANT_GPG_NAME:   result = dirinfo.gpg_name; break;
     case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
     case WANT_G13_NAME:   result = dirinfo.g13_name; break;
@@ -294,14 +299,11 @@ _gpgme_get_default_g13_name (void)
   return get_gpgconf_item (WANT_G13_NAME);
 }
 
-/* Return the default gpgconf file name.  Returns NULL if not known.
-   Because gpgconf is the binary used to retrieved all these default
-   names, this function is merely a simple wrapper around the function
-   used to locate this binary.  */
+/* Return the default gpgconf file name.  Returns NULL if not known.  */
 const char *
 _gpgme_get_default_gpgconf_name (void)
 {
-  return _gpgme_get_gpgconf_path ();
+  return get_gpgconf_item (WANT_GPGCONF_NAME);
 }
 
 /* Return the default UI-server socket name.  Returns NULL if not
diff --git a/src/engine-backend.h b/src/engine-backend.h
index a4c0eb2..a768652 100644
--- a/src/engine-backend.h
+++ b/src/engine-backend.h
@@ -128,18 +128,10 @@ struct engine_ops
 
 
 extern struct engine_ops _gpgme_engine_ops_gpg;		/* OpenPGP.  */
-#ifdef ENABLE_GPGSM
 extern struct engine_ops _gpgme_engine_ops_gpgsm;	/* CMS.  */
-#endif
-#ifdef ENABLE_GPGCONF
 extern struct engine_ops _gpgme_engine_ops_gpgconf;	/* gpg-conf.  */
-#endif
-#ifdef ENABLE_ASSUAN
 extern struct engine_ops _gpgme_engine_ops_assuan;	/* Low-level Assuan. */
-#endif
-#ifdef ENABLE_G13
 extern struct engine_ops _gpgme_engine_ops_g13;         /* Crypto VFS. */
-#endif
 #ifdef ENABLE_UISERVER
 extern struct engine_ops _gpgme_engine_ops_uiserver;
 #endif
diff --git a/src/engine-g13.c b/src/engine-g13.c
index b97e0b4..f091015 100644
--- a/src/engine-g13.c
+++ b/src/engine-g13.c
@@ -107,7 +107,7 @@ g13_get_version (const char *file_name)
 static const char *
 g13_get_req_version (void)
 {
-  return NEED_G13_VERSION;
+  return "2.1.0";
 }
 
 
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 3bc9f66..2f59bb9 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1,7 +1,7 @@
 /* engine-gpg.c - Gpg Engine.
    Copyright (C) 2000 Werner Koch (dd9jn)
    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2009, 2010, 2012 g10 Code GmbH
+                 2009, 2010, 2012, 2013 g10 Code GmbH
 
    This file is part of GPGME.
 
@@ -303,7 +303,7 @@ gpg_get_version (const char *file_name)
 static const char *
 gpg_get_req_version (void)
 {
-  return NEED_GPG_VERSION;
+  return "1.4.0";
 }
 
 
diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index 1d457bb..47cde66 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -68,7 +68,7 @@ gpgconf_get_version (const char *file_name)
 static const char *
 gpgconf_get_req_version (void)
 {
-  return NEED_GPGCONF_VERSION;
+  return "2.0.4";
 }
 
 
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index cee20e3..24cd34d 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -127,7 +127,7 @@ gpgsm_get_version (const char *file_name)
 static const char *
 gpgsm_get_req_version (void)
 {
-  return NEED_GPGSM_VERSION;
+  return "2.0.4";
 }
 
 
diff --git a/src/engine.c b/src/engine.c
index 09f379c..80febea 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -46,26 +46,10 @@ struct engine
 static struct engine_ops *engine_ops[] =
   {
     &_gpgme_engine_ops_gpg,		/* OpenPGP.  */
-#ifdef ENABLE_GPGSM
     &_gpgme_engine_ops_gpgsm,		/* CMS.  */
-#else
-    NULL,
-#endif
-#ifdef ENABLE_GPGCONF
     &_gpgme_engine_ops_gpgconf,		/* gpg-conf.  */
-#else
-    NULL,
-#endif
-#ifdef ENABLE_ASSUAN
     &_gpgme_engine_ops_assuan,		/* Low-Level Assuan.  */
-#else
-    NULL,
-#endif
-#ifdef ENABLE_G13
     &_gpgme_engine_ops_g13,		/* Crypto VFS.  */
-#else
-    NULL,
-#endif
 #ifdef ENABLE_UISERVER
     &_gpgme_engine_ops_uiserver		/* UI-Server.  */
 #else
diff --git a/src/posix-util.c b/src/posix-util.c
index fd44507..d4e4e3f 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -30,47 +30,60 @@
 #include "util.h"
 #include "sys-util.h"
 
-const char *
-_gpgme_get_gpg_path (void)
-{
-#ifdef GPG_PATH
-  return GPG_PATH;
-#else
-  return NULL;
-#endif
-}
 
-const char *
-_gpgme_get_gpgsm_path (void)
+/* Find an executable program PGM along the envvar PATH.  */
+static char *
+walk_path (const char *pgm)
 {
-#ifdef GPGSM_PATH
-  return GPGSM_PATH;
-#else
+  const char *path, *s;
+  char *fname, *p;
+
+  path = getenv ("PATH");
+  if (!path)
+    path = "/bin:/usr/bin:.";
+
+  fname = malloc (strlen (path) + 1 + strlen (pgm) + 1);
+  if (!fname)
+    return NULL;
+
+  for (;;)
+    {
+      for (s=path, p=fname; *s && *s != ':'; s++, p++)
+        *p = *s;
+      if (*p != '/')
+        *p++ = '/';
+      strcpy (p, pgm);
+      if (!access (fname, X_OK))
+        return fname;
+      if (!*s)
+        break;
+      path = s + 1;
+    }
+
+  free (fname);
   return NULL;
-#endif
 }
 
-const char *
-_gpgme_get_gpgconf_path (void)
+
+/* Return the full file name of the GPG binary.  This function is used
+   if gpgconf was not found and thus it can be assumed that gpg2 is
+   not installed.  This function is only called by get_gpgconf_item
+   and may not be called concurrently.  */
+char *
+_gpgme_get_gpg_path (void)
 {
-#ifdef GPGCONF_PATH
-  return GPGCONF_PATH;
-#else
-  return NULL;
-#endif
+  return walk_path ("gpg");
 }
 
-const char *
-_gpgme_get_g13_path (void)
+
+/* This function is only called by get_gpgconf_item and may not be
+   called concurrently.  */
+char *
+_gpgme_get_gpgconf_path (void)
 {
-#ifdef G13_PATH
-  return G13_PATH;
-#else
-  return NULL;
-#endif
+  return walk_path ("gpgconf");
 }
 
-
 /* See w32-util.c */
 int
 _gpgme_get_conf_int (const char *key, int *value)
diff --git a/src/sys-util.h b/src/sys-util.h
index f6506d3..3686f89 100644
--- a/src/sys-util.h
+++ b/src/sys-util.h
@@ -21,9 +21,7 @@
 #define SYS_UTIL_H
 
 /*-- {posix,w32}-util.c --*/
-const char *_gpgme_get_gpg_path (void);
-const char *_gpgme_get_gpgsm_path (void);
-const char *_gpgme_get_gpgconf_path (void);
-const char *_gpgme_get_g13_path (void);
+char *_gpgme_get_gpg_path (void);
+char *_gpgme_get_gpgconf_path (void);
 
 #endif /* SYS_UTIL_H */
diff --git a/src/util.h b/src/util.h
index c432980..57c8b13 100644
--- a/src/util.h
+++ b/src/util.h
@@ -151,25 +151,13 @@ const char *_gpgme_get_w32spawn_path (void);
 char *_gpgme_w32ce_get_debug_envvar (void);
 #endif /*HAVE_W32CE_SYSTEM*/
 
-/*--  Error codes not yet available in current gpg-error.h.   --*/
-#ifndef GPG_ERR_UNFINISHED
-#define GPG_ERR_UNFINISHED 199
-#endif
-#ifndef GPG_ERR_NOT_OPERATIONAL
-#define GPG_ERR_NOT_OPERATIONAL 176
-#endif
-#ifndef GPG_ERR_MISSING_ISSUER_CERT
-#define GPG_ERR_MISSING_ISSUER_CERT 185
-#endif
 
 
-#ifdef ENABLE_ASSUAN
 #include <assuan.h>
 /* System hooks for assuan integration.  */
 extern struct assuan_system_hooks _gpgme_assuan_system_hooks;
 extern struct assuan_malloc_hooks _gpgme_assuan_malloc_hooks;
 int _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook,
 			  unsigned int cat, const char *msg);
-#endif
 
 #endif /* UTIL_H */
diff --git a/src/w32-util.c b/src/w32-util.c
index 4cee1cb..31a58bb 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -374,7 +374,7 @@ find_program_in_inst_dir (const char *inst_dir, const char *name)
 
   /* If an installation directory has been passed, this overrides a
      location given bu the registry.  The idea here is that we prefer
-     a a program installed alongside with gpgme.  We don't want the
+     a program installed alongside with gpgme.  We don't want the
      registry to override this to have a better isolation of an gpgme
      aware applications for other effects.  Note that the "Install
      Directory" registry item has been used for ages in Gpg4win and
@@ -424,72 +424,36 @@ find_program_at_standard_place (const char *name)
 }
 
 
-const char *
+/* Return the full file name of the GPG binary.  This function is used
+   if gpgconf was not found and thus it can be assumed that gpg2 is
+   not installed.  This function is only called by get_gpgconf_item
+   and may not be called concurrently. */
+char *
 _gpgme_get_gpg_path (void)
 {
-  static char *gpg_program;
+  char *gpg;
   const char *inst_dir;
 
   inst_dir = _gpgme_get_inst_dir ();
-  LOCK (get_path_lock);
-  if (!gpg_program)
-    gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe");
-  if (!gpg_program)
-    gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
-  UNLOCK (get_path_lock);
-  return gpg_program;
+  gpg = find_program_in_inst_dir (inst_dir, "gpg.exe");
+  if (!gpg)
+    gpg = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
+  return gpg;
 }
 
-
-const char *
-_gpgme_get_gpgsm_path (void)
-{
-  static char *gpgsm_program;
-  const char *inst_dir;
-
-  inst_dir = _gpgme_get_inst_dir ();
-  LOCK (get_path_lock);
-  if (!gpgsm_program)
-    gpgsm_program = find_program_in_inst_dir (inst_dir, "gpgsm.exe");
-  if (!gpgsm_program)
-    gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
-  UNLOCK (get_path_lock);
-  return gpgsm_program;
-}
-
-
-const char *
+/* This function is only called by get_gpgconf_item and may not be
+   called concurrently.  */
+char *
 _gpgme_get_gpgconf_path (void)
 {
-  static char *gpgconf_program;
-  const char *inst_dir;
-
-  inst_dir = _gpgme_get_inst_dir ();
-  LOCK (get_path_lock);
-  if (!gpgconf_program)
-    gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
-  if (!gpgconf_program)
-    gpgconf_program
-      = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
-  UNLOCK (get_path_lock);
-  return gpgconf_program;
-}
-
-
-const char *
-_gpgme_get_g13_path (void)
-{
-  static char *g13_program;
+  char *gpgconf;
   const char *inst_dir;
 
   inst_dir = _gpgme_get_inst_dir ();
-  LOCK (get_path_lock);
-  if (!g13_program)
-    g13_program = find_program_in_inst_dir (inst_dir, "g13.exe");
-  if (!g13_program)
-    g13_program = find_program_at_standard_place ("GNU\\GnuPG\\g13.exe");
-  UNLOCK (get_path_lock);
-  return g13_program;
+  gpgconf = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
+  if (!gpgconf)
+    gpgconf = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
+  return gpgconf;
 }
 
 
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index c9000c9..e72bd49 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -19,8 +19,8 @@
 
 ## Process this file with automake to produce Makefile.in
 
-GPG = @GPG@
-GPG_AGENT = @GPG_AGENT@
+GPG = gpg
+GPG_AGENT = gpg-agent
 
 TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
 
diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am
index 9086134..45b3b50 100644
--- a/tests/gpgsm/Makefile.am
+++ b/tests/gpgsm/Makefile.am
@@ -1,27 +1,27 @@
 # Copyright (C) 2000 Werner Koch (dd9jn)
 # Copyright (C) 2001 g10 Code GmbH
-# 
+#
 # This file is part of GPGME.
-# 
+#
 # GPGME is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as
 # published by the Free Software Foundation; either version 2.1 of the
 # License, or (at your option) any later version.
-# 
+#
 # GPGME 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 Lesser General
 # Public License for more details.
-# 
+#
 # You should have received a copy of the GNU Lesser 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
 
-GPGSM = @GPGSM@
+GPGSM = gpgsm
 
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= 
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
 
 noinst_HEADERS = t-support.h
 TESTS = t-import t-keylist t-encrypt t-verify t-decrypt t-sign t-export
@@ -41,7 +41,7 @@ noinst_PROGRAMS = $(TESTS) t-genkey cms-keylist cms-decrypt
 key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939
 
 CLEANFILES = pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \
-	random_seed S.gpg-agent  
+	random_seed S.gpg-agent
 
 clean-local:
 	-gpg-connect-agent KILLAGENT /bye
@@ -51,7 +51,7 @@ all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustl
 
 export GNUPGHOME := $(abs_builddir)
 
-export GPG_AGENT_INFO := 
+export GPG_AGENT_INFO :=
 
 ./pubring.kbx: $(srcdir)/cert_g10code_test1.der
 	$(GPGSM) --import $(srcdir)/cert_g10code_test1.der
diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c
index ec2e1e8..43acd3d 100644
--- a/tests/t-engine-info.c
+++ b/tests/t-engine-info.c
@@ -41,30 +41,6 @@
     }								\
   while (0)
 
-
-void
-check_engine_info (gpgme_engine_info_t info, gpgme_protocol_t protocol,
-		   const char *file_name, const char *req_version)
-{
-  if (info->protocol != protocol)
-    {
-      fprintf (stderr, "Unexpected protocol %i (expected %i instead)\n",
-	       info->protocol, protocol);
-      exit (1);
-    }
-  if (strcmp (info->file_name, file_name))
-    {
-      fprintf (stderr, "Unexpected file name to executable %s (expected %s instead)\n",
-	       info->file_name, file_name);
-      exit (1);
-    }
-  if (strcmp (info->req_version, req_version))
-    {
-      fprintf (stderr, "Unexpected required version %s (expected %s instead)\n",
-	       info->req_version, req_version);
-      exit (1);
-    }
-}
 
 
 int
@@ -77,18 +53,9 @@ main (int argc, char **argv )
   err = gpgme_get_engine_info (&info);
   fail_if_err (err);
 
-  check_engine_info (info, GPGME_PROTOCOL_OpenPGP, GPG_PATH, NEED_GPG_VERSION);
-
-  info = info->next;
-#ifdef GPGSM_PATH
-  check_engine_info (info, GPGME_PROTOCOL_CMS, GPGSM_PATH, NEED_GPGSM_VERSION);
-#else
-  if (info)
-    {
-      fprintf (stderr, "Unexpected engine info.\n");
-      exit (1);
-    }
-#endif
+  for (; info; info = info->next)
+    fprintf (stdout, "protocol=%d engine='%s' v='%s' (min='%s')\n",
+             info->protocol, info->file_name, info->version, info->req_version);
 
   return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 NEWS                    |   13 ++
 README                  |    9 +-
 configure.ac            |  512 +++--------------------------------------------
 doc/gpgme.texi          |   49 +++--
 src/Makefile.am         |   30 +--
 src/dirinfo.c           |   44 ++--
 src/engine-backend.h    |    8 -
 src/engine-g13.c        |    2 +-
 src/engine-gpg.c        |    4 +-
 src/engine-gpgconf.c    |    2 +-
 src/engine-gpgsm.c      |    2 +-
 src/engine.c            |   16 --
 src/gpgme.c             |   10 +
 src/posix-util.c        |  110 +++++++---
 src/sys-util.h          |    9 +-
 src/util.h              |   14 +-
 src/w32-util.c          |  154 +++++++++-----
 tests/gpg/Makefile.am   |    4 +-
 tests/gpgsm/Makefile.am |   16 +-
 tests/t-engine-info.c   |   98 +++++----
 20 files changed, 388 insertions(+), 718 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list