aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2012-01-12 17:10:30 +0000
committerWerner Koch <[email protected]>2012-01-12 17:10:30 +0000
commit3a22b622c89ae87c4d557ab71c619803a4fed8ed (patch)
tree3a945df495466903bdbfa18483664b66b1927822
parentgpg: Remove unused fields from a trust data structure. (diff)
downloadgnupg-3a22b622c89ae87c4d557ab71c619803a4fed8ed.tar.gz
gnupg-3a22b622c89ae87c4d557ab71c619803a4fed8ed.zip
Allow building with the 32 bit mingw-w64 toolchain.
* scripts/autogen.sh <--build-w32>: Support i686-w64-mingw32 and use it by default if installed. * keyserver/gpgkeys_ldap.c (my_ldap_start_tls_s): Define macro depending on compiler version. (main): Use new macro. * util/miscutil.c [!HAVE_TIMEGM]: Add prototype for the timegm autoconf replacement function. -- It seems that the LDAP keyserver helper build with the old mingw32 toolchain never worked correctly for LDAPS. The prototype there for ldap_start_tls_s is plainly wrong for Windows. Anyway I included special support so not to break building with the old compiler.
-rw-r--r--keyserver/gpgkeys_ldap.c24
-rwxr-xr-xscripts/autogen.sh2
-rw-r--r--util/miscutil.c4
3 files changed, 24 insertions, 6 deletions
diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c
index 453632502..354195778 100644
--- a/keyserver/gpgkeys_ldap.c
+++ b/keyserver/gpgkeys_ldap.c
@@ -66,6 +66,20 @@
#include "util.h"
#endif
+#if HAVE_W32_SYSTEM
+# if !defined(__MINGW64_VERSION_MAJOR) || !defined(__MINGW32_MAJOR_VERSION)
+ /* This is mingw32 with bogus ldap definitions; i.e. Unix style
+ LDAP definitions. */
+# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_sA ((a),(b),(c))
+# else
+ /* Standard Microsoft or mingw64. */
+# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_sA ((a),NULL, NULL,(b),(c))
+# endif
+#else /*!W32*/
+# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_s ((a),(b),(c))
+#endif /*!W32*/
+
+
extern char *optarg;
extern int optind;
@@ -460,7 +474,7 @@ build_attrs(LDAPMod ***modlist,char *line)
case 'R':
revoked=1;
break;
-
+
case 'd':
case 'D':
disabled=1;
@@ -1043,7 +1057,7 @@ get_key(char *getkey)
else
{
/* short key id */
-
+
sprintf(search,"(pgpkeyid=%.8s)",getkey);
}
@@ -1773,12 +1787,12 @@ find_basekeyspacedn(void)
}
ldap_msgfree(si_res);
- }
+ }
return LDAP_SUCCESS;
}
-static void
+static void
show_help (FILE *fp)
{
fprintf (fp,"-h, --help\thelp\n");
@@ -2195,7 +2209,7 @@ main(int argc,char *argv[])
#endif
if(err==LDAP_SUCCESS)
- err=ldap_start_tls_s(ldap,NULL,NULL);
+ err = my_ldap_start_tls_s (ldap, NULL, NULL);
if(err!=LDAP_SUCCESS)
{
diff --git a/scripts/autogen.sh b/scripts/autogen.sh
index 408f760f0..9d3e7396a 100755
--- a/scripts/autogen.sh
+++ b/scripts/autogen.sh
@@ -56,7 +56,7 @@ if test "$1" = "--build-w32"; then
# Locate the cross compiler
crossbindir=
- for host in i586-mingw32msvc i386-mingw32msvc; do
+ for host in i686-w64-mingw32 i586-mingw32msvc i386-mingw32msvc; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"
diff --git a/util/miscutil.c b/util/miscutil.c
index f82c4d941..f0cbaca51 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -31,6 +31,10 @@
#include "util.h"
#include "i18n.h"
+#ifndef HAVE_TIMEGM
+time_t timegm (struct tm *tm);
+#endif
+
#ifdef HAVE_UNSIGNED_TIME_T
# define INVALID_TIME_CHECK(a) ((a) == (time_t)(-1))
#else