diff -up gnupg-2.2.19/agent/agent.h.build gnupg-2.2.19/agent/agent.h --- gnupg-2.2.19/agent/agent.h.build 2019-07-09 11:08:44.000000000 +0200 +++ gnupg-2.2.19/agent/agent.h 2020-01-30 16:13:05.470939005 +0100 @@ -37,6 +37,14 @@ #include "../common/session-env.h" #include "../common/shareddefs.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* To convey some special hash algorithms we use algorithm numbers reserved for application use. */ #ifndef GCRY_MODULE_ID_USER @@ -55,6 +63,7 @@ /* A large struct name "opt" to keep global flags */ +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* Debug flags (DBG_foo_VALUE) */ diff -up gnupg-2.2.19/agent/gpg-agent.c.build gnupg-2.2.19/agent/gpg-agent.c --- gnupg-2.2.19/agent/gpg-agent.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/agent/gpg-agent.c 2020-01-30 15:43:43.566456867 +0100 @@ -49,6 +49,7 @@ #endif #include +#define INCLUDED_BY_MAIN_MODULE 1 #define GNUPG_COMMON_NEED_AFLOCAL #include "agent.h" #include /* Malloc hooks and socket wrappers. */ diff -up gnupg-2.2.19/agent/preset-passphrase.c.build gnupg-2.2.19/agent/preset-passphrase.c --- gnupg-2.2.19/agent/preset-passphrase.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/agent/preset-passphrase.c 2020-01-30 16:01:05.992812177 +0100 @@ -44,6 +44,7 @@ # include /* To initialize the sockets. fixme */ #endif +#define INCLUDED_BY_MAIN_MODULE 1 #include "agent.h" #include "../common/simple-pwquery.h" #include "../common/i18n.h" diff -up gnupg-2.2.19/agent/protect-tool.c.build gnupg-2.2.19/agent/protect-tool.c --- gnupg-2.2.19/agent/protect-tool.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/agent/protect-tool.c 2020-01-30 16:00:35.188363339 +0100 @@ -38,6 +38,7 @@ #include /* for setmode() */ #endif +#define INCLUDED_BY_MAIN_MODULE 1 #include "agent.h" #include "../common/i18n.h" #include "../common/get-passphrase.h" diff -up gnupg-2.2.19/agent/t-protect.c.build gnupg-2.2.19/agent/t-protect.c --- gnupg-2.2.19/agent/t-protect.c.build 2017-12-08 07:40:06.000000000 +0100 +++ gnupg-2.2.19/agent/t-protect.c 2020-01-30 16:01:22.903509604 +0100 @@ -23,6 +23,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "agent.h" diff -up gnupg-2.2.19/common/iobuf.c.build gnupg-2.2.19/common/iobuf.c --- gnupg-2.2.19/common/iobuf.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/common/iobuf.c 2020-01-29 19:10:03.488980061 +0100 @@ -118,6 +118,7 @@ struct close_cache_s typedef struct close_cache_s *close_cache_t; static close_cache_t close_cache; +int iobuf_debug_mode; #ifdef HAVE_W32_SYSTEM diff -up gnupg-2.2.19/common/iobuf.h.build gnupg-2.2.19/common/iobuf.h --- gnupg-2.2.19/common/iobuf.h.build 2017-02-24 13:46:24.000000000 +0100 +++ gnupg-2.2.19/common/iobuf.h 2020-01-30 10:14:21.404483909 +0100 @@ -249,14 +249,7 @@ struct iobuf_struct int subno; }; -#ifndef EXTERN_UNLESS_MAIN_MODULE -#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) -#define EXTERN_UNLESS_MAIN_MODULE extern -#else -#define EXTERN_UNLESS_MAIN_MODULE -#endif -#endif -EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; +extern int iobuf_debug_mode; /* Returns whether the specified filename corresponds to a pipe. In diff -up gnupg-2.2.19/dirmngr/dirmngr.c.build gnupg-2.2.19/dirmngr/dirmngr.c --- gnupg-2.2.19/dirmngr/dirmngr.c.build 2019-11-12 20:14:44.000000000 +0100 +++ gnupg-2.2.19/dirmngr/dirmngr.c 2020-01-30 16:30:39.650080724 +0100 @@ -55,6 +55,7 @@ #endif /*HTTP_USE_GNUTLS*/ +#define INCLUDED_BY_MAIN_MODULE 1 #define GNUPG_COMMON_NEED_AFLOCAL #include "dirmngr.h" diff -up gnupg-2.2.19/dirmngr/dirmngr.h.build gnupg-2.2.19/dirmngr/dirmngr.h --- gnupg-2.2.19/dirmngr/dirmngr.h.build 2019-11-18 18:44:30.000000000 +0100 +++ gnupg-2.2.19/dirmngr/dirmngr.h 2020-01-30 16:30:12.250570852 +0100 @@ -39,6 +39,14 @@ #include "dirmngr-status.h" #include "http.h" /* (parsed_uri_t) */ +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* This objects keeps information about a particular LDAP server and is used as item of a single linked list of servers. */ struct ldap_server_s @@ -76,6 +84,7 @@ struct fingerprint_list_s /* A large struct named "opt" to keep global flags. */ +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* debug flags (DBG_foo_VALUE) */ diff -up gnupg-2.2.19/g10/gpgcompose.c.build gnupg-2.2.19/g10/gpgcompose.c --- gnupg-2.2.19/g10/gpgcompose.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/g10/gpgcompose.c 2020-01-30 10:06:13.924966959 +0100 @@ -20,6 +20,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "gpg.h" #include "packet.h" #include "keydb.h" diff -up gnupg-2.2.19/g10/options.h.build gnupg-2.2.19/g10/options.h --- gnupg-2.2.19/g10/options.h.build 2020-01-29 12:54:10.308621663 +0100 +++ gnupg-2.2.19/g10/options.h 2020-01-29 19:10:44.659238547 +0100 @@ -32,7 +32,7 @@ #ifndef EXTERN_UNLESS_MAIN_MODULE /* Norcraft can't cope with common symbols */ -#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#if !defined (INCLUDED_BY_MAIN_MODULE) #define EXTERN_UNLESS_MAIN_MODULE extern #else #define EXTERN_UNLESS_MAIN_MODULE diff -up gnupg-2.2.19/g10/test.c.build gnupg-2.2.19/g10/test.c --- gnupg-2.2.19/g10/test.c.build 2017-02-10 17:24:08.000000000 +0100 +++ gnupg-2.2.19/g10/test.c 2020-01-30 10:06:33.522624663 +0100 @@ -22,6 +22,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "gpg.h" /* A unit test consists of one or more tests. Tests can be broken diff -up gnupg-2.2.19/g13/g13.c.build gnupg-2.2.19/g13/g13.c --- gnupg-2.2.19/g13/g13.c.build 2017-08-28 12:22:54.000000000 +0200 +++ gnupg-2.2.19/g13/g13.c 2020-01-30 16:18:25.927205688 +0100 @@ -27,6 +27,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "g13.h" #include diff -up gnupg-2.2.19/g13/g13-common.h.build gnupg-2.2.19/g13/g13-common.h --- gnupg-2.2.19/g13/g13-common.h.build 2017-08-28 12:22:54.000000000 +0200 +++ gnupg-2.2.19/g13/g13-common.h 2020-01-30 16:20:02.257482517 +0100 @@ -32,6 +32,13 @@ #include "../common/session-env.h" #include "../common/strlist.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif /* Debug values and macros. */ #define DBG_MOUNT_VALUE 1 /* Debug mount or device stuff. */ @@ -48,6 +55,7 @@ /* A large struct named "opt" to keep global flags. Note that this struct is used by g13 and g13-syshelp and thus some fields may only make sense for one of them. */ +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* Debug flags (DBG_foo_VALUE). */ diff -up gnupg-2.2.19/g13/g13-syshelp.c.build gnupg-2.2.19/g13/g13-syshelp.c --- gnupg-2.2.19/g13/g13-syshelp.c.build 2017-08-28 12:22:54.000000000 +0200 +++ gnupg-2.2.19/g13/g13-syshelp.c 2020-01-30 16:18:15.861385748 +0100 @@ -31,6 +31,7 @@ #endif #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "g13-syshelp.h" #include diff -up gnupg-2.2.19/scd/scdaemon.c.build gnupg-2.2.19/scd/scdaemon.c --- gnupg-2.2.19/scd/scdaemon.c.build 2020-01-29 12:54:10.340621101 +0100 +++ gnupg-2.2.19/scd/scdaemon.c 2020-01-30 16:13:38.942340121 +0100 @@ -37,6 +37,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #define GNUPG_COMMON_NEED_AFLOCAL #include "scdaemon.h" #include diff -up gnupg-2.2.19/scd/scdaemon.h.build gnupg-2.2.19/scd/scdaemon.h --- gnupg-2.2.19/scd/scdaemon.h.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/scd/scdaemon.h 2020-01-30 16:12:58.986055034 +0100 @@ -31,6 +31,14 @@ #include "../common/util.h" #include "../common/sysutils.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* To convey some special hash algorithms we use algorithm numbers reserved for application use. */ #ifndef GCRY_MODULE_ID_USER @@ -44,6 +52,7 @@ /* A large struct name "opt" to keep global flags. */ +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* Debug flags (DBG_foo_VALUE). */ diff -up gnupg-2.2.19/sm/gpgsm.c.build gnupg-2.2.19/sm/gpgsm.c --- gnupg-2.2.19/sm/gpgsm.c.build 2020-01-29 12:54:10.306621698 +0100 +++ gnupg-2.2.19/sm/gpgsm.c 2020-01-30 10:24:17.199619771 +0100 @@ -28,6 +28,8 @@ #include /*#include */ +#define INCLUDED_BY_MAIN_MODULE 1 + #include "gpgsm.h" #include #include /* malloc hooks */ diff -up gnupg-2.2.19/sm/gpgsm.h.build gnupg-2.2.19/sm/gpgsm.h --- gnupg-2.2.19/sm/gpgsm.h.build 2019-12-06 20:32:57.000000000 +0100 +++ gnupg-2.2.19/sm/gpgsm.h 2020-01-30 15:36:11.325545926 +0100 @@ -36,6 +36,13 @@ #include "../common/ksba-io-support.h" #include "../common/compliance.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif #define MAX_DIGEST_LEN 64 @@ -52,7 +59,7 @@ struct keyserver_spec /* A large struct named "opt" to keep global flags. */ -struct +EXTERN_UNLESS_MAIN_MODULE struct { unsigned int debug; /* debug flags (DBG_foo_VALUE) */ int verbose; /* verbosity level */ diff -up gnupg-2.2.19/tools/gpgconf.c.build gnupg-2.2.19/tools/gpgconf.c --- gnupg-2.2.19/tools/gpgconf.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/tools/gpgconf.c 2020-01-30 16:42:05.759830715 +0100 @@ -25,6 +25,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "gpgconf.h" #include "../common/i18n.h" #include "../common/sysutils.h" diff -up gnupg-2.2.19/tools/gpgconf.h.build gnupg-2.2.19/tools/gpgconf.h --- gnupg-2.2.19/tools/gpgconf.h.build 2019-02-26 13:15:58.000000000 +0100 +++ gnupg-2.2.19/tools/gpgconf.h 2020-01-30 16:41:48.570137395 +0100 @@ -22,7 +22,16 @@ #include "../common/util.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* We keep all global options in the structure OPT. */ +EXTERN_UNLESS_MAIN_MODULE struct { int verbose; /* Verbosity level. */ diff -up gnupg-2.2.19/tools/gpgtar.c.build gnupg-2.2.19/tools/gpgtar.c --- gnupg-2.2.19/tools/gpgtar.c.build 2019-03-07 10:56:18.000000000 +0100 +++ gnupg-2.2.19/tools/gpgtar.c 2020-01-30 16:53:24.787712030 +0100 @@ -34,6 +34,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "../common/util.h" #include "../common/i18n.h" #include "../common/sysutils.h" diff -up gnupg-2.2.19/tools/gpgtar.h.build gnupg-2.2.19/tools/gpgtar.h --- gnupg-2.2.19/tools/gpgtar.h.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/tools/gpgtar.h 2020-01-30 16:54:07.348951287 +0100 @@ -23,7 +23,16 @@ #include "../common/util.h" #include "../common/strlist.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* We keep all global options in the structure OPT. */ +EXTERN_UNLESS_MAIN_MODULE struct { int verbose; diff -up gnupg-2.2.19/tools/gpg-wks-client.c.build gnupg-2.2.19/tools/gpg-wks-client.c --- gnupg-2.2.19/tools/gpg-wks-client.c.build 2019-07-09 11:08:45.000000000 +0200 +++ gnupg-2.2.19/tools/gpg-wks-client.c 2020-01-30 16:39:54.755167950 +0100 @@ -25,6 +25,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "../common/util.h" #include "../common/status.h" #include "../common/i18n.h" diff -up gnupg-2.2.19/tools/gpg-wks.h.build gnupg-2.2.19/tools/gpg-wks.h --- gnupg-2.2.19/tools/gpg-wks.h.build 2019-03-25 15:14:32.000000000 +0100 +++ gnupg-2.2.19/tools/gpg-wks.h 2020-01-30 16:40:52.412139301 +0100 @@ -25,11 +25,20 @@ #include "../common/strlist.h" #include "mime-maker.h" +#ifndef EXTERN_UNLESS_MAIN_MODULE +#if !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif +#endif + /* The draft version we implement. */ #define WKS_DRAFT_VERSION 3 /* We keep all global options in the structure OPT. */ +EXTERN_UNLESS_MAIN_MODULE struct { int verbose; diff -up gnupg-2.2.19/tools/gpg-wks-server.c.build gnupg-2.2.19/tools/gpg-wks-server.c --- gnupg-2.2.19/tools/gpg-wks-server.c.build 2019-03-25 14:41:44.000000000 +0100 +++ gnupg-2.2.19/tools/gpg-wks-server.c 2020-01-30 16:40:05.052984229 +0100 @@ -32,6 +32,7 @@ #include #include +#define INCLUDED_BY_MAIN_MODULE 1 #include "../common/util.h" #include "../common/init.h" #include "../common/sysutils.h"