From 7e547d87d2d3c170f9e035399f4afe56c999a923 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 6 Apr 2011 13:45:15 +0200 Subject: [PATCH] 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. --- ChangeLog | 38 ++++++++++++++++++------------- autogen.sh | 41 ++++++++++++++++++++------------- configure.ac | 62 +++++++++++++++++++++++++++++++++++++------------- src/ChangeLog | 10 ++++++-- src/gpgme.h.in | 45 ++++++++++++++++-------------------- 5 files changed, 121 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27e73745..3163b54a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-06 Werner Koch + + * 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 * configure.ac (NEED_LIBASSUAN_VERSION): Bump to 2.0.2 for system hooks. @@ -168,12 +174,12 @@ 2008-09-16 Marcus Brinkmann - * configure.ac (_XOPEN_SOURCE) [apple-darwin]: Define it. + * configure.ac (_XOPEN_SOURCE) [apple-darwin]: Define it. 2008-07-04 Werner Koch * config.guess, config.sub: Update to 2007-11-19. Also update - missing et al scripts. + missing et al scripts. 2008-04-01 Werner Koch @@ -252,7 +258,7 @@ * assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme. * assuan/assuan.h: Include instead of trying to duplicate the definitions. - + * assuan/: Update files to 2007-07-04 version of assuan. * autogen.sh: Use = not == in test. @@ -268,7 +274,7 @@ 2007-01-29 Marcus Brinkmann Released 1.1.3. - + * configure.ac (LIBGPGME_LT_REVISION): Bump for release. 2007-01-26 Werner Koch @@ -515,7 +521,7 @@ 2004-04-06 Werner Koch Released 0.4.6. - + * config.guess, config.sub, ltmain.sh: Updated to those from libtools 1.5.4. @@ -552,8 +558,8 @@ 2004-01-12 Werner Koch Released 0.4.4. - - * configure.ac: Bumbed LT_Revision; now at C12/A1/R1. + + * configure.ac: Bumbed LT_Revision; now at C12/A1/R1. (NEED_GPGSM_VERSION): Set to 1.9.3. (min_automake_version): Added. * README.CVS: New. @@ -650,7 +656,7 @@ (AC_CONFIG_FILES): Remove bonobo/Makefile. * Makefile.am (bonobo): Remove variable. (SUBDIRS): Remove ${bonobo}. - + * configure.ac: Remove all uses of GNUPG_CHECK_TYPEDEF, for byte, ushort, ulong, u16 and u32. * acinclude.m4 (GNUPG_CHECK_TYPEDEF): Remove macro. @@ -663,7 +669,7 @@ 2002-12-23 Marcus Brinkmann * configure.ac: Bump up to 0.4.1. - + Released 0.4.0. 2002-12-23 Marcus Brinkmann @@ -708,7 +714,7 @@ 2002-09-20 Werner Koch Released 0.3.11. - + * configure.ac: Bump up LIBGPGME_LT_REVISION. * configure.ac (AC_CHECK_HEADERS): Check for sys/select.h. @@ -788,7 +794,7 @@ 2002-06-25 Werner Koch Released 0.3.8. - + * configure.ac: Bumbed LT version to 9/3/0. (NEED_GPGSM_VERSION): Need 0.3.8 due to fixed export command. @@ -844,7 +850,7 @@ * configure.ac: Bumbed version to 0.3.4-cvs to continue development. Released 0.3.4. - + * configure.ac: Bumbed LT version numbers to (7,1,0), requires gpgsm 0.3.1. @@ -863,7 +869,7 @@ * jnlib/Makefile.am: Rever to older version that includes xmalloc but not dotlock and some other files. Reported by Stéphane Corthésy. - + 2002-02-10 Marcus Brinkmann * Released 0.3.2. @@ -957,7 +963,7 @@ 2001-09-17 Werner Koch Released 0.2.3. - + * configure.in (NEED_GPG_VERSION): Set to 1.0.6. Incremented LT current and age. @@ -969,14 +975,14 @@ 2001-04-05 Werner Koch - * configure.in (NEED_GPG_VERSION): Set to 1.0.4g + * configure.in (NEED_GPG_VERSION): Set to 1.0.4g 2001-04-02 Werner Koch Released 0.2.1. Changed the copyright notices all over the place. - + 2001-02-28 Werner Koch Released 0.2.0. diff --git a/autogen.sh b/autogen.sh index 23d672a3..2d079489 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Run this to generate all the initial makefiles, etc. +# Run this to generate all the initial makefiles, etc. # # Copyright (C) 2003 g10 Code GmbH # @@ -43,7 +43,7 @@ w32ce_toolprefixes= w32ce_extraoptions= amd64_toolprefixes= # End list of optional variables sourced from ~/.gnupg-autogen.rc -# What follows are variables which are sourced but default to +# What follows are variables which are sourced but default to # environment variables or lacking them hardcoded values. #w32root= #w32ce_root= @@ -55,7 +55,7 @@ if [ -f "$HOME/.gnupg-autogen.rc" ]; then fi # Convenience option to use certain configure options for some hosts. -myhost="" +myhost="" myhostsub="" case "$1" in --build-w32) @@ -65,6 +65,10 @@ case "$1" in myhost="w32" myhostsub="ce" ;; + --build-w64) + myhost="w32" + myhostsub="64" + ;; --build-amd64) myhost="amd64" ;; @@ -95,13 +99,18 @@ 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" ;; esac echo "Using $w32root as standard install directory" >&2 - + crossbindir= for host in $toolprefixes; do if ${host}-gcc --version >/dev/null 2>&1 ; then @@ -112,14 +121,14 @@ 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 + echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 fi echo "Stop." >&2 exit 1 fi - + if [ -f "$tsdir/config.log" ]; then if ! head $tsdir/config.log | grep "$host" >/dev/null; then echo "Pease run a 'make distclean' first" >&2 @@ -151,7 +160,7 @@ if [ "$myhost" = "amd64" ]; then [ -z "$amd64root" ] && amd64root="$HOME/amd64root" echo "Using $amd64root as standard install directory" >&2 - + # Locate the cross compiler crossbindir= for host in x86_64-linux-gnu amd64-linux-gnu; do @@ -166,7 +175,7 @@ if [ "$myhost" = "amd64" ]; then echo "Stop." >&2 exit 1 fi - + if [ -f "$tsdir/config.log" ]; then if ! head $tsdir/config.log | grep "$host" >/dev/null; then echo "Please run a 'make distclean' first" >&2 @@ -175,7 +184,7 @@ if [ "$myhost" = "amd64" ]; then fi $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \ - --host=${host} --build=${build} + --host=${host} --build=${build} rc=$? exit $rc fi @@ -184,19 +193,19 @@ fi # Grep the required versions from configure.ac -autoconf_vers=`sed -n '/^AC_PREREQ(/ { +autoconf_vers=`sed -n '/^AC_PREREQ(/ { s/^.*(\(.*\))/\1/p q }' ${configure_ac}` autoconf_vers_num=`echo "$autoconf_vers" | cvtver` -automake_vers=`sed -n '/^min_automake_version=/ { +automake_vers=`sed -n '/^min_automake_version=/ { s/^.*="\(.*\)"/\1/p q }' ${configure_ac}` automake_vers_num=`echo "$automake_vers" | cvtver` -#gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ { +#gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ { #s/^.*(\(.*\))/\1/p #q #}' ${configure_ac}` @@ -233,9 +242,9 @@ fi if test "$DIE" = "yes"; then cat </dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \ | awk '/^\* / {printf "%s",$3}'])) -AC_INIT([gpgme], +AC_INIT([gpgme], [my_version[]m4_if(my_issvn,[yes], [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])], [bug-gpgme@gnupg.org]) @@ -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' @@ -187,20 +190,31 @@ esac if test "$have_dosish_system" = yes; then AC_DEFINE(HAVE_DOSISH_SYSTEM,1, - [Defined if we run on some of the PCDOS like systems + [Defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2) with special properties like no file modes]) 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 +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 " +fi +AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H) # Checks for compiler features. if test "$GCC" = yes; then @@ -835,7 +865,7 @@ AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+") # Generate values for the DLL version info if test "$have_w32_system" = yes; then BUILD_TIMESTAMP=`date --iso-8601=minutes` - changequote(,)dnl + changequote(,)dnl BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` changequote([,])dnl BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}" @@ -857,7 +887,7 @@ AH_VERBATIM([SEPCONSTANTS], AH_BOTTOM([ /* Definition of GCC specific attributes. */ -#if __GNUC__ > 2 +#if __GNUC__ > 2 # define GPGME_GCC_A_PURE __attribute__ ((__pure__)) #else # define GPGME_GCC_A_PURE @@ -868,7 +898,7 @@ AH_BOTTOM([ ]) -# Substitution used for gpgme-config +# Substitution used for gpgme-config GPGME_CONFIG_LIBS="-lgpgme" GPGME_CONFIG_CFLAGS="" AC_SUBST(GPGME_CONFIG_API_VERSION) @@ -917,10 +947,10 @@ fi # -# Create config files +# Create config files AC_CONFIG_FILES(Makefile src/Makefile - tests/Makefile + tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile tests/opassuan/Makefile diff --git a/src/ChangeLog b/src/ChangeLog index 94200bc3..07b62bdb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-04-06 Werner Koch + + * gpgme.h.in: Use INSERT__TYPEDEFS_FOR_GPGME_H to include platform + specific typedefs. + 2011-02-03 Werner Koch * extra-stati.h: New. @@ -18,7 +23,7 @@ (is_socket): Remove function. (_gpgme_io_spawn) [HAVE_W32CE_SYSTEM]: Remove some dead code. (_gpgme_io_spawn): Translate handles before DuplicateHandle them. - + 2011-02-02 Marcus Brinkmann * w32-util.c (mkstemp): Don't use CreateFile instead of open (the @@ -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 diff --git a/src/gpgme.h.in b/src/gpgme.h.in index a70ff2ad..e75de194 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -4,20 +4,20 @@ 2010 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, see . - + File: @configure_input@ */ #ifndef GPGME_H @@ -34,12 +34,7 @@ /* Include stdio.h for the FILE type definition. */ #include -#ifdef _WIN32 - typedef long off_t; - typedef long ssize_t; -#else -# include -#endif +@INSERT__TYPEDEFS_FOR_GPGME_H@ #include @@ -233,7 +228,7 @@ gpgme_pubkey_algo_t; /* Hash algorithms from libgcrypt. */ typedef enum { - GPGME_MD_NONE = 0, + GPGME_MD_NONE = 0, GPGME_MD_MD5 = 1, GPGME_MD_SHA1 = 2, GPGME_MD_RMD160 = 3, @@ -341,7 +336,7 @@ typedef enum GPGME_PROTOCOL_GPGCONF = 2, /* Special code for gpgconf. */ GPGME_PROTOCOL_ASSUAN = 3, /* Low-level access to an Assuan server. */ GPGME_PROTOCOL_G13 = 4, - GPGME_PROTOCOL_UISERVER= 5, + GPGME_PROTOCOL_UISERVER= 5, GPGME_PROTOCOL_DEFAULT = 254, GPGME_PROTOCOL_UNKNOWN = 255 } @@ -367,7 +362,7 @@ typedef unsigned int gpgme_export_mode_t; /* Flags for the audit log functions. */ -#define GPGME_AUDITLOG_HTML 1 +#define GPGME_AUDITLOG_HTML 1 #define GPGME_AUDITLOG_WITH_HELP 128 @@ -523,7 +518,7 @@ struct _gpgme_engine_info /* The file name of the engine binary. */ char *file_name; - + /* The version string of the installed engine. */ char *version; @@ -576,7 +571,7 @@ struct _gpgme_subkey /* Internal to GPGME, do not use. */ unsigned int _unused : 21; - + /* Public key algorithm supported by this subkey. */ gpgme_pubkey_algo_t pubkey_algo; @@ -688,7 +683,7 @@ struct _gpgme_user_id unsigned int _unused : 30; /* The validity of the user ID. */ - gpgme_validity_t validity; + gpgme_validity_t validity; /* The user ID string. */ char *uid; @@ -1718,7 +1713,7 @@ struct _gpgme_trust_item /* The calculated validity. */ char *validity; - + /* Internal to GPGME, do not use. */ char _validity[2]; @@ -1772,13 +1767,13 @@ int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what, available GPG_ERR_NO_DATA is returned. */ gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags); -gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, +gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags); /* Low-level Assuan protocol access. */ -typedef gpgme_error_t (*gpgme_assuan_data_cb_t) +typedef gpgme_error_t (*gpgme_assuan_data_cb_t) (void *opaque, const void *data, size_t datalen); typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t) @@ -1790,7 +1785,7 @@ typedef gpgme_error_t (*gpgme_assuan_status_cb_t) /* Send the Assuan COMMAND and return results via the callbacks. Asynchronous variant. */ -gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, +gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -1801,7 +1796,7 @@ gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, /* Send the Assuan COMMAND and return results via the callbacks. Synchronous variant. */ -gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, +gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -1931,7 +1926,7 @@ typedef struct gpgme_conf_arg typedef struct gpgme_conf_opt { struct gpgme_conf_opt *next; - + /* The option name. */ char *name; @@ -1954,7 +1949,7 @@ typedef struct gpgme_conf_opt /* The default value. */ gpgme_conf_arg_t default_value; char *default_description; - + /* The default value if the option is not set. */ gpgme_conf_arg_t no_arg_value; char *no_arg_description; @@ -1987,7 +1982,7 @@ typedef struct gpgme_conf_comp char *description; /* The program name (an absolute path to the program). */ - char *program_name; + char *program_name; /* A linked list of options for this component. */ struct gpgme_conf_opt *options; @@ -2013,7 +2008,7 @@ gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, /* Release a set of configurations. */ void gpgme_conf_release (gpgme_conf_comp_t conf); - + /* Retrieve the current configurations. */ gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p);