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.
This commit is contained in:
Werner Koch 2012-01-12 18:10:30 +01:00
parent 02f282368e
commit 3a22b622c8
3 changed files with 24 additions and 6 deletions

View File

@ -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)
{

View File

@ -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"

View File

@ -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