* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.

* Makefile.am (EXTRA_DIST): Include autogen.sh

* autogen.sh: Added the usual code to build for W32 (--build-w32).

* configure.ac: Fixed the mingw32 host string, removed OS/2 stuff.
(HAVE_DRIVE_LETTERS): Removed.
(HAVE_W32_SYSTEM): Added.
(AC_GNU_SOURCE): New to replace the identical AH_VERBATIM.
(AH_BOTTOM): Added.

* w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not
cast away type checks.

* io.h [W32]: Do not include stdio.h.  If it is needed do it at
the right place.

* data.h [W32]: Removed kludge for EOPNOTSUP.
* data.c, data-compat.c [W32]: Explicitly test for it here.
This commit is contained in:
Werner Koch 2005-03-09 16:03:05 +00:00
parent 2d5f4c8188
commit e86f9181ad
16 changed files with 170 additions and 42 deletions

View File

@ -1,3 +1,17 @@
2005-03-09 Werner Koch <wk@g10code.com>
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
* Makefile.am (EXTRA_DIST): Include autogen.sh
* autogen.sh: Added the usual code to build for W32 (--build-w32).
* configure.ac: Fixed the mingw32 host string, removed OS/2 stuff.
(HAVE_DRIVE_LETTERS): Removed.
(HAVE_W32_SYSTEM): Added.
(AC_GNU_SOURCE): New to replace the identical AH_VERBATIM.
(AH_BOTTOM): Added.
2004-12-28 Werner Koch <wk@g10code.com>
Released 1.0.2.
@ -564,7 +578,7 @@
* autogen.sh: Added option --build-w32.
Copyright 2001, 2002, 2003, 2004 g10 Code GmbH
Copyright 2001, 2002, 2003, 2004, 2005 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

@ -23,7 +23,7 @@
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = dist-bzip2
EXTRA_DIST = gpgme.spec.in
EXTRA_DIST = gpgme.spec.in autogen.sh
if BUILD_ASSUAN
assuan = assuan

View File

@ -50,6 +50,9 @@ dnl Actual test code taken from glib-1.1.
AC_DEFUN([GNUPG_CHECK_VA_COPY],
[ AC_MSG_CHECKING(whether va_lists must be copied by value)
AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[
if test "$cross_compiling" = yes; then
gnupg_cv_must_copy_va_byval=no
else
gnupg_cv_must_copy_va_byval=no
AC_TRY_RUN([
#include <stdarg.h>
@ -70,9 +73,14 @@ AC_DEFUN([GNUPG_CHECK_VA_COPY],
return 0;
}
],gnupg_cv_must_copy_va_byval=yes)
fi
])
if test "$gnupg_cv_must_copy_va_byval" = yes; then
AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro])
fi
if test "$cross_compiling" = yes; then
AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval)
else
AC_MSG_RESULT($gnupg_cv_must_copy_va_byval)
fi
])

View File

@ -29,6 +29,62 @@ check_version () {
}
DIE=no
# Used to cross-compile for Windows.
if test "$1" = "--build-w32"; then
tmp=`dirname $0`
tsdir=`cd "$tmp"; pwd`
shift
if [ ! -f $tsdir/config.guess ]; then
echo "$tsdir/config.guess not found" >&2
exit 1
fi
build=`$tsdir/config.guess`
[ -z "$w32root" ] && w32root="$HOME/w32root"
echo "Using $w32root as standard install directory" >&2
# See whether we have the Debian cross compiler package or the
# old mingw32/cpd system
if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
host=i586-mingw32msvc
crossbindir=/usr/$host/bin
else
host=i386--mingw32
if ! mingw32 --version >/dev/null; then
echo "We need at least version 0.3 of MingW32/CPD" >&2
exit 1
fi
crossbindir=`mingw32 --install-dir`/bin
# Old autoconf version required us to setup the environment
# with the proper tool names.
CC=`mingw32 --get-path gcc`
CPP=`mingw32 --get-path cpp`
AR=`mingw32 --get-path ar`
RANLIB=`mingw32 --get-path ranlib`
export CC CPP AR RANLIB
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
exit 1
fi
fi
./configure --enable-maintainer-mode --prefix=${w32root} \
--host=i586-mingw32msvc --build=${build} \
--with-gpg-error-prefix=${w32root} \
--disable-shared --with-gpgsm=c:/gnupg/gpgsm.exe
exit $?
fi
# Grep the required versions from configure.ac
autoconf_vers=`sed -n '/^AC_PREREQ(/ {
s/^.*(\(.*\))/\1/p

View File

@ -123,7 +123,7 @@ main (int argc, char **argv )
opt.homedir = getenv("GNUPGHOME");
if( !opt.homedir || !*opt.homedir ) {
#ifdef HAVE_DRIVE_LETTERS
#ifdef HAVE_DOSISH_SYSTEM
opt.homedir = "c:/gnupg";
#else
opt.homedir = "~/.gnupg";

View File

@ -1,6 +1,6 @@
# configure.ac for GPGME
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
# Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
#
# This file is part of GPGME.
#
@ -43,8 +43,7 @@ GPGME_CONFIG_API_VERSION=1
NEED_GPG_VERSION=1.2.2
NEED_GPGSM_VERSION=1.9.6
##############################################
AC_PREREQ(2.52)
AC_REVISION($Revision$)
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
@ -57,11 +56,8 @@ AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AH_VERBATIM([_GNU_SOURCE],
[/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif])
# Enable GNU extensions on systems that have them.
AC_GNU_SOURCE
AH_VERBATIM([_REENTRANT],
[/* To allow the use of GPGME in multithreaded programs we have to use
@ -72,6 +68,16 @@ AH_VERBATIM([_REENTRANT],
# define _REENTRANT 1
#endif])
AH_BOTTOM([
/* Some environments miss the definition for EOPNOTSUPP. We provide
the error code here and test where neded whether it should be
defined. Can't do the test here due to the order of includes. */
#ifdef HAVE_W32_SYSTEM
#define VALUE_FOR_EOPNOTSUPP 95
#endif /*!HAVE_W32_SYSTEM*/
])
AC_PROG_CC
@ -109,17 +115,13 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
GPG_DEFAULT=no
GPGSM_DEFAULT=no
component_system=None
have_dosish_system=no
have_w32_system=no
case "${host}" in
*-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
*-mingw32*)
# special stuff for Windoze NT
# OS/2 with the EMX environment
# DOS with the DJGPP environment
AC_DEFINE(HAVE_DRIVE_LETTERS, ,
[Defined if we run on some of the PCDOS like systems (DOS,
Windoze, OS/2) with special properties like no file modes.])
AC_DEFINE(HAVE_DOSISH_SYSTEM, ,
[Defined if the filesystem uses driver letters.])
have_dosish_system=yes
have_w32_system=yes
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
# XXX Assuan is not supported in this configuration.
#GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
@ -141,7 +143,21 @@ case "${host}" in
# GPGSM_DEFAULT='/usr/bin/gpgsm'
;;
esac
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes")
if test "$have_dosish_system" = yes; then
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
[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])
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")

View File

@ -1,3 +1,17 @@
2005-03-09 Werner Koch <wk@g10code.com>
* w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not
cast away type checks.
* io.h [W32]: Do not include stdio.h. If it is needed do it at
the right place.
* data.h [W32]: Removed kludge for EOPNOTSUP.
* data.c, data-compat.c [W32]: Explicitly test for it here.
Replaced use of _WIN32 by HAVE_W32_SYSTEM except for public header
files.
2005-03-07 Timo Schulz <twoaday@g10code.de>
* gpgme.h: [_WIN32] Removed ssize_t typedef.

View File

@ -22,17 +22,18 @@
#include <config.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <unistd.h>
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#else
# include <sys/time.h>
#endif
#include <sys/types.h>
#ifndef _WIN32
#ifndef HAVE_W32_SYSTEM
#include <sys/wait.h>
#endif
#endif /*!HAVE_W32_SYSTEM*/
#include "ath.h"

View File

@ -21,12 +21,15 @@
#ifndef ATH_H
#define ATH_H
#ifdef _WIN32
#ifdef HAVE_W32_SYSTEM
/* fixme: Check how we did it in libgcrypt. */
struct msghdr { int dummy; };
typedef int socklen_t;
# include <windows.h>
# include <io.h>
#else
#else /*!HAVE_W32_SYSTEM*/
# ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
# else
@ -34,7 +37,8 @@ typedef int socklen_t;
# endif
# include <sys/types.h>
# include <sys/socket.h>
#endif
#endif /*!HAVE_W32_SYSTEM*/

View File

@ -30,6 +30,11 @@
#include "data.h"
#include "util.h"
#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP)
#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP
#endif
/* Create a new data buffer filled with LENGTH bytes starting from
OFFSET within the file FNAME or stream STREAM (exactly one must be

View File

@ -33,6 +33,11 @@
#include "ops.h"
#include "io.h"
#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP)
#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP
#endif
gpgme_error_t
_gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs)

View File

@ -19,11 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef _WIN32
#if HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef HAVE_W32_SYSTEM
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -1597,4 +1598,5 @@ struct engine_ops _gpgme_engine_ops_gpgsm =
gpgsm_io_event,
gpgsm_cancel
};
#endif
#endif /*!HAVE_W32_SYSTEM*/

View File

@ -344,7 +344,7 @@ gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
gpgme_error_t
gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
{
#ifndef _WIN32
#ifndef HAVE_W32_SYSTEM
int failed = 0;
char *new_lc_ctype;
char *new_lc_messages;
@ -398,7 +398,8 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
SET_ONE_LOCALE (messages, MESSAGES);
if (!ctx)
UNLOCK (def_lc_lock);
#endif
#endif /*!HAVE_W32_SYSTEM*/
return 0;
}

View File

@ -72,7 +72,8 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
#define GPGME_VERSION "1.0.1"
#define GPGME_VERSION "1.1.0-cvs"
/* Some opaque data types used by GPGME. */

View File

@ -22,9 +22,6 @@
#ifndef IO_H
#define IO_H
#ifdef _WIN32
#include <stdio.h>
#endif
/* A single file descriptor passed to spawn. For child fds, dup_to
specifies the fd it should become in the child. */

View File

@ -51,6 +51,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
DWORD n1, nbytes;
char *result = NULL;
#ifdef HAVE_W32_SYSTEM
#warning Check that this code matches the one used by gnupg
#endif
if (!root)
root_key = HKEY_CURRENT_USER;
else if (!strcmp (root, "HKEY_CLASSES_ROOT"))
@ -120,7 +124,7 @@ _gpgme_get_gpg_path (void)
LOCK (get_path_lock);
if (!gpg_program)
gpg_program = (char*)find_program_in_registry ("gpgProgram");
gpg_program = find_program_in_registry ("gpgProgram");
#ifdef GPG_PATH
if (!gpg_program)
gpg_program = GPG_PATH;
@ -136,7 +140,7 @@ _gpgme_get_gpgsm_path (void)
LOCK (get_path_lock);
if (!gpgsm_program)
gpgsm_program = (char*)find_program_in_registry ("gpgsmProgram");
gpgsm_program = find_program_in_registry ("gpgsmProgram");
#ifdef GPGSM_PATH
if (!gpgsm_program)
gpgsm_program = GPGSM_PATH;