[PATCH 4/5] port: first cut at native W32 building
thb at libreoffice.org
thb at libreoffice.org
Tue Jan 30 15:18:09 CET 2018
From: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Signed-off-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
---
m4/ax_cxx_compile_stdcxx.m4 | 2 +-
src/Makefile.am | 2 +-
src/dirinfo.c | 4 ++++
src/mbox-util.c | 2 ++
src/priv-io.h | 3 +++
src/util.h | 3 +++
src/versioninfo.rc.in | 1 -
src/vfs-mount.c | 4 ++++
src/w32-glib-io.c | 1 +
src/w32-util.c | 2 +-
10 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
index de3d0121..6834edd6 100644
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -156,7 +156,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
diff --git a/src/Makefile.am b/src/Makefile.am
index ce6f1d4e..c056f80e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -120,7 +120,7 @@ LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
SUFFIXES = .rc .lo
.rc.lo:
- $(LTRCCOMPILE) -i "$<" -o "$@"
+ $(LTRCCOMPILE) -i $< -o $@
gpgme_res = versioninfo.lo
no_undefined = -no-undefined
diff --git a/src/dirinfo.c b/src/dirinfo.c
index 73744124..285ed097 100644
--- a/src/dirinfo.c
+++ b/src/dirinfo.c
@@ -33,6 +33,10 @@
DEFINE_STATIC_LOCK (dirinfo_lock);
+#ifndef F_OK
+#define F_OK 0
+#endif
+
/* Constants used internally to select the data. */
enum
{
diff --git a/src/mbox-util.c b/src/mbox-util.c
index 0dafc2a2..a2adaf31 100644
--- a/src/mbox-util.c
+++ b/src/mbox-util.c
@@ -28,7 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include "mbox-util.h"
diff --git a/src/priv-io.h b/src/priv-io.h
index 23061756..6861eae0 100644
--- a/src/priv-io.h
+++ b/src/priv-io.h
@@ -36,6 +36,9 @@
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
+#if _MSC_VER
+typedef int pid_t;
+#endif
/* A single file descriptor passed to spawn. For child fds, dup_to
diff --git a/src/util.h b/src/util.h
index b4043ed1..45a17566 100644
--- a/src/util.h
+++ b/src/util.h
@@ -39,6 +39,9 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
#include "gpgme.h"
diff --git a/src/versioninfo.rc.in b/src/versioninfo.rc.in
index 2b1cc811..00cbc751 100644
--- a/src/versioninfo.rc.in
+++ b/src/versioninfo.rc.in
@@ -14,7 +14,6 @@
#line __LINE__ "versioninfo.rc.in"
-#include <afxres.h>
VS_VERSION_INFO VERSIONINFO
diff --git a/src/vfs-mount.c b/src/vfs-mount.c
index 68a8efe9..66d7e076 100644
--- a/src/vfs-mount.c
+++ b/src/vfs-mount.c
@@ -68,7 +68,11 @@ _gpgme_vfs_mount_status_handler (void *priv, const char *code, const char *args)
if (err)
return err;
+#if _MSC_VER
+ if (! _stricmp ("MOUNTPOINT", code))
+#else
if (! strcasecmp ("MOUNTPOINT", code))
+#endif
{
if (opd->result.mount_dir)
free (opd->result.mount_dir);
diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c
index 66dc9bf7..a80653f8 100644
--- a/src/w32-glib-io.c
+++ b/src/w32-glib-io.c
@@ -37,6 +37,7 @@
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
+#include <winsock2.h>
#include <glib.h>
#include <windows.h>
#include <io.h>
diff --git a/src/w32-util.c b/src/w32-util.c
index 5b02c7ea..5c474499 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -721,7 +721,7 @@ my_mkstemp (char *tmpl)
v /= 62;
XXXXXX[5] = letters[v % 62];
- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+ fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL);
if (fd >= 0)
{
gpg_err_set_errno (save_errno);
--
2.13.6
More information about the Gnupg-devel
mailing list