Insert platform dependent typedefs into gpgme.h

We already modify gpgme.h per playform and thus we can also get rid of
some #ifdefs.  The change does not change anything for current
platforms but should do the right think for W64.

Note that as per MS specs ssize_t is to be defined as LONG_PTR which
translates to a long on 32 bit platforms and to __int64 on 64 bit
Windows platforms.  We already used long in the past.  There seems to
be a problem with some versions of mingw32 which includes a ssize_t
type typedefed to int.  O(n 32 bit W32 platforms int and long are
identically.
This commit is contained in:
Werner Koch 2011-04-06 13:45:15 +02:00
parent b001a8df68
commit 7e547d87d2
5 changed files with 121 additions and 75 deletions

View File

@ -1,3 +1,9 @@
2011-04-06 Werner Koch <wk@g10code.com>
* autogen.sh (--build-w32): Support option --build-w64.
* configure.ac (HAVE_W64_SYSTEM): Define.
(INSERT__TYPEDEFS_FOR_GPGME_H): New.
2011-02-02 Marcus Brinkmann <mb@g10code.com>
* configure.ac (NEED_LIBASSUAN_VERSION): Bump to 2.0.2 for system hooks.

View File

@ -65,6 +65,10 @@ case "$1" in
myhost="w32"
myhostsub="ce"
;;
--build-w64)
myhost="w32"
myhostsub="64"
;;
--build-amd64)
myhost="amd64"
;;
@ -95,6 +99,11 @@ if [ "$myhost" = "w32" ]; then
[ -z "$w32root" ] && w32root="$HOME/w32ce_root"
toolprefixes="arm-mingw32ce"
;;
64)
w32root="$w64root"
[ -z "$w32root" ] && w32root="$HOME/w64root"
toolprefixes="amd64-mingw32msvc"
;;
*)
[ -z "$w32root" ] && w32root="$HOME/w32root"
toolprefixes="i586-mingw32msvc i386-mingw32msvc"
@ -112,7 +121,7 @@ if [ "$myhost" = "w32" ]; then
done
if [ -z "$crossbindir" ]; then
echo "Cross compiler kit not installed" >&2
if [ -z "$sub" ]; then
if [ -z "$myhostsub" ]; then
echo "Under Debian GNU/Linux, you may install it using" >&2
echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
fi

View File

@ -1,7 +1,7 @@
# configure.ac for GPGME
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
# 2009, 2010 g10 Code GmbH
# 2009, 2010, 2011 g10 Code GmbH
#
# This file is part of GPGME.
#
@ -132,16 +132,19 @@ G13_DEFAULT=no
component_system=None
have_dosish_system=no
have_w32_system=no
have_w64_system=no
build_w32_glib=no
build_w32_qt=no
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
;;
*-mingw32ce*)
have_w32ce_system=yes
;;
esac
case "${host}" in
*-mingw32ce*|*-mingw32*)
# special stuff for Windoze NT
have_dosish_system=yes
have_w32_system=yes
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
@ -194,13 +197,24 @@ fi
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
AC_DEFINE(HAVE_W32_SYSTEM,1,
[Defined if we run on any kind of W32 API based system])
ACSUBST
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
if test "$have_w64_system" = yes; then
AC_DEFINE(HAVE_W64_SYSTEM,1,
[Defined if we run on a 64 bit W32 API based system])
fi
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
if test "$have_w32ce_system" = yes; then
AC_DEFINE(HAVE_W32CE_SYSTEM,1, [Defined if we run on a W32 CE API based system])
AC_DEFINE(HAVE_W32CE_SYSTEM,1,
[Defined if we run on a W32 CE API based system])
fi
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
@ -233,6 +247,22 @@ case "$ac_cv_sys_file_offset_bits" in
esac
AC_SUBST(NEED__FILE_OFFSET_BITS)
# Figure out platform dependent typedefs for gpgme.h
if test "$have_w32_system" = yes; then
if test "$have_w64_system" = yes; then
INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
#include <basetsd.h>
typedef long off_t;
typedef __int64 ssize_t;"
else
INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
typedef long off_t;
typedef long ssize_t;"
fi
else
INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
fi
AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
# Checks for compiler features.
if test "$GCC" = yes; then

View File

@ -1,3 +1,8 @@
2011-04-06 Werner Koch <wk@g10code.com>
* gpgme.h.in: Use INSERT__TYPEDEFS_FOR_GPGME_H to include platform
specific typedefs.
2011-02-03 Werner Koch <wk@g10code.com>
* extra-stati.h: New.
@ -7074,7 +7079,8 @@
* data.c (gpgme_data_rewind): Allow to rewind data_type_none.
Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009 g10 Code GmbH
Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,
2011 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without

View File

@ -34,12 +34,7 @@
/* Include stdio.h for the FILE type definition. */
#include <stdio.h>
#ifdef _WIN32
typedef long off_t;
typedef long ssize_t;
#else
# include <sys/types.h>
#endif
@INSERT__TYPEDEFS_FOR_GPGME_H@
#include <time.h>