[Pkg-gnupg-commit] [libassuan] 332/437: Changes to allow building the CE version with MSC.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:34:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 8fbda4494c424a6343ece3a0850372a2e457d641
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Nov 1 14:57:12 2010 +0000

    Changes to allow building the CE version with MSC.
---
 ChangeLog                       |   8 ++
 configure.ac                    |   3 +-
 contrib/conf-w32ce-msc/build.mk | 158 ++++++++++++++++++++++++++++++++++
 contrib/conf-w32ce-msc/config.h | 184 ++++++++++++++++++++++++++++++++++++++++
 src/ChangeLog                   |  28 ++++++
 src/assuan-buffer.c             |   6 +-
 src/assuan-defs.h               |  18 ++--
 src/assuan-io.c                 |  15 +++-
 src/assuan-listen.c             |   4 +-
 src/assuan-logging.c            |   5 +-
 src/assuan-pipe-connect.c       |  15 +++-
 src/assuan-pipe-server.c        |  19 +++--
 src/assuan-socket-connect.c     |  11 ++-
 src/assuan-socket-server.c      |  11 ++-
 src/assuan-socket.c             |  20 +++--
 src/assuan-uds.c                |  17 ++--
 src/assuan.h.in                 |   4 +-
 src/debug.c                     |  10 ++-
 src/debug.h                     |   4 +-
 src/mkheader.c                  |  18 ++++
 src/posix-fd-t.inc.h            |   2 +-
 src/system-w32ce.c              |   3 +
 src/system.c                    |   6 +-
 src/sysutils.c                  |   6 +-
 src/w32-fd-t.inc.h              |   2 +-
 src/w32-types.inc.h             |   6 ++
 src/w32ce-fd-t.inc.h            |   2 +-
 27 files changed, 532 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c42443..f912424 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-01  Werner Koch  <wk at g10code.com>
+
+	* configure.ac: Check for sys/types.h, sys/stat.h, sys/time and
+	unistd.h
+
+	* contrib/conf-w32ce-msc/build.mk: New.
+	* contrib/conf-w32ce-msc/config.h: New.
+
 2010-08-19  Werner Koch  <wk at g10code.com>
 
 	* configure.ac (AH_TOP, AH_BOTTOM): New.  Define
diff --git a/configure.ac b/configure.ac
index c1bdfc2..e3517e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,7 +249,8 @@ AC_SUBST(LIBASSUAN_CONFIG_EXTRA_LIBS)
 
 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([string.h locale.h sys/uio.h stdint.h inttypes.h])
+AC_CHECK_HEADERS([string.h locale.h sys/uio.h stdint.h inttypes.h \
+                  sys/types.h sys/stat.h unistd.h sys/time.h])
 AC_TYPE_UINTPTR_T
 AC_TYPE_UINT16_T
 
diff --git a/contrib/conf-w32ce-msc/build.mk b/contrib/conf-w32ce-msc/build.mk
new file mode 100755
index 0000000..b88ca43
--- /dev/null
+++ b/contrib/conf-w32ce-msc/build.mk
@@ -0,0 +1,158 @@
+# build.mk - Makefile to build libgpg-error using Visual-C
+# Copyright 2010 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
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This is a helper make script to build libgpg-error for WindowsCE
+# using the Microsoft Visual C compiler.  
+
+# The target build directry where we run the Visual C compiler/
+# This needs to be an absolute directory name.
+targetdir = /home/smb/xppro-gnu/src/libassuan
+
+
+help:
+	@echo "Run "
+	@echo "  make -f ../contrib/conf-w32ce-msc/build.mk copy-source"
+	@echo "on the POSIX system and then"
+	@echo "  nmake -f build.mk all"
+	@echo "on the Windows system"
+
+ce_defines = -DWINCE -D_WIN32_WCE=0x502 -DUNDER_CE \
+             -DWIN32_PLATFORM_PSPC -D_UNICODE -DUNICODE \
+             -D_CONSOLE -DARM -D_ARM_
+#-D_DEBUG -DDEBUG 
+
+# Some options of Visual-C:
+# -W3   Set warning level 3
+# -Zi   Generate debug info
+# -Od   Disable optimization
+# -Gm   Enable minimal rebuild (for C++)
+# -EHsc Exception handling model sc 
+# -MTd  Create a debug multithreaded executable
+# -fp:  Floating point behaviour
+# -GR-  Disable runtime type information
+# -Os   Favor small code
+# -LD   Create a DLL
+# -Fe   Set executable output name (may be only a directory)
+CFLAGS = -nologo -W3 -fp:fast -Os $(ce_defines) \
+         -DHAVE_CONFIG_H -DDLL_EXPORT -D_CRT_SECURE_NO_WARNINGS \
+	 -I. -Igpg-extra -I../libgpg-error
+
+LDFLAGS =
+
+# Standard source files
+sources = \
+	assuan.c                 \
+	context.c  		 \
+	system.c  		 \
+	debug.c  		 \
+	conversion.c  		 \
+	sysutils.c  		 \
+	client.c  		 \
+	server.c  		 \
+	assuan-error.c  	 \
+	assuan-buffer.c  	 \
+	assuan-handler.c  	 \
+	assuan-inquire.c  	 \
+	assuan-listen.c  	 \
+	assuan-pipe-server.c  	 \
+	assuan-socket-server.c   \
+	assuan-pipe-connect.c  	 \
+	assuan-socket-connect.c  \
+	assuan-uds.c  		 \
+	assuan-logging.c  	 \
+	assuan-socket.c  	 \
+	system-w32ce.c  	 \
+	assuan-io.c  		 \
+	putc_unlocked.c  	 \
+	memrchr.c  		 \
+	stpcpy.c  		 \
+	setenv.c                 \
+	vasprintf.c              \
+        assuan-defs.h            \
+        debug.h                  \
+	libassuan.def
+
+# The object files we need to create from sources.
+objs = \
+	assuan.obj               \
+	context.obj  		 \
+	system.obj  		 \
+	debug.obj  		 \
+	conversion.obj  	 \
+	sysutils.obj  		 \
+	client.obj  		 \
+	server.obj  		 \
+	assuan-error.obj  	 \
+	assuan-buffer.obj  	 \
+	assuan-handler.obj  	 \
+	assuan-inquire.obj  	 \
+	assuan-listen.obj  	 \
+	assuan-pipe-server.obj   \
+	assuan-socket-server.obj \
+	assuan-pipe-connect.obj  \
+	assuan-socket-connect.obj \
+	assuan-uds.obj  	 \
+	assuan-logging.obj  	 \
+	assuan-socket.obj  	 \
+	system-w32ce.obj  	 \
+	assuan-io.obj  		 \
+	putc_unlocked.obj  	 \
+	memrchr.obj  		 \
+	stpcpy.obj  		 \
+	setenv.obj               \
+	vasprintf.obj
+
+
+# Sources files in this directory inclduing this Makefile
+conf_sources = \
+	build.mk \
+	config.h
+
+# Source files built by running the standard build system.
+built_sources = \
+	assuan.h
+
+copy-static-source:
+	@if [ ! -f ./assuan-defs.h ]; then \
+           echo "Please cd to the src/ directory first"; \
+	   exit 1; \
+        fi
+	cp -t $(targetdir) $(sources);
+	cd ../contrib/conf-w32ce-msc ; cp -t $(targetdir) $(conf_sources)
+
+
+copy-built-source:
+	@if [ ! -f ./assuan.h ]; then \
+           echo "Please build using ./autogen.sh --build-w32ce first"; \
+	   exit 1; \
+        fi
+	cp -t $(targetdir) $(built_sources)
+
+copy-source: copy-static-source copy-built-source
+
+
+.c.obj:
+	$(CC) $(CFLAGS) -c $<
+
+all:  $(sources) $(conf_sources) $(built_sources) $(objs)
+	link    /DLL /IMPLIB:libassuan-0-msc.lib \
+                /OUT:libassuan-0-msc.dll \
+		/DEF:libassuan.def /NOLOGO /MANIFEST:NO \
+		/NODEFAULTLIB:"oldnames.lib" /DYNAMICBASE:NO \
+	        $(objs) \
+		coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \
+		commctrl.lib /subsystem:windowsce,5.02
+
+# Note that install needs to be run on the POSIX platform and the all
+# is only to make sure we build everything; it won't compile anything
+# because Visual-C is probably not installed on that platform.
+install: all
+	@echo fixme Install the files
diff --git a/contrib/conf-w32ce-msc/config.h b/contrib/conf-w32ce-msc/config.h
new file mode 100644
index 0000000..e9b1f3e
--- /dev/null
+++ b/contrib/conf-w32ce-msc/config.h
@@ -0,0 +1,184 @@
+/* config.h for building with Visual-C for WindowsCE. 
+ * Copyright 2010 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
+ * modifications, as long as this notice is preserved.
+ * 
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* This file was originally created by running 
+ *   ./autogen.sh --build-w32ce
+ * on svn revision 389 (libassuan 2.0.2-svn389) and then adjusted to work
+ * with Visual-C.
+ */
+
+#ifndef _ASSUAN_CONFIG_H_INCLUDED
+#define _ASSUAN_CONFIG_H_INCLUDED
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.0.2-svn389-msc1"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libassuan " PACKAGE_VERSION
+
+/* Name of this package */
+#define PACKAGE "libassuan"
+
+/* Bug report address */
+#define PACKAGE_BUGREPORT "bug-libassuan at gnupg.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libassuan"
+
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libassuan"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Version of this package */
+#define VERSION PACKAGE_VERSION
+
+
+/* Enable gpg-error's strerror macro under W32CE.  */
+#define GPG_ERR_ENABLE_ERRNO_MACROS 1
+
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL_SYS_SIGLIST 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2)
+   with special properties like no file modes */
+#define HAVE_DOSISH_SYSTEM 1
+
+/* Define to 1 if you have the `flockfile' function. */
+/* #undef HAVE_FLOCKFILE */
+
+/* Define to 1 if you have the `fopencookie' function. */
+/* #undef HAVE_FOPENCOOKIE */
+
+/* Define to 1 if you have the `funlockfile' function. */
+/* #undef HAVE_FUNLOCKFILE */
+
+/* Define to 1 if you have the `funopen' function. */
+/* #undef HAVE_FUNOPEN */
+
+/* Define to 1 if you have the `inet_pton' function. */
+/* #undef HAVE_INET_PTON */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+/* #undef HAVE_LOCALE_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memrchr' function. */
+/* #undef HAVE_MEMRCHR */
+
+/* Define to 1 if you have the `nanosleep' function in libc. */
+/* #undef HAVE_NANOSLEEP */
+
+/* Define to 1 if you have the `putc_unlocked' function. */
+/* #undef HAVE_PUTC_UNLOCKED */
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef HAVE_SETENV */
+
+/* Defined if SO_PEERCRED is supported (Linux specific) */
+/* #undef HAVE_SO_PEERCRED */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+/* #undef HAVE_SYS_SOCKET_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+/* #undef HAVE_SYS_STAT_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+/* #undef HAVE_SYS_TYPES_H */
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+/* #undef HAVE_SYS_UIO_H */
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if you have the `vasprintf' function. */
+/* #undef HAVE_VASPRINTF */
+
+/* Defined if we run on WindowsCE */
+#define HAVE_W32CE_SYSTEM 1
+
+/* Defined if we run on a W32 API based system */
+#define HAVE_W32_SYSTEM 1
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+#define HAVE_WINSOCK2_H 1
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#define HAVE_WS2TCPIP_H 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Defined if descriptor passing is supported */
+/* #undef USE_DESCRIPTOR_PASSING */
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+
+
+/* snprintf is not part of oldnames.lib thus we redefine it here. */
+#define snprintf _snprintf
+
+
+#endif /*_ASSUAN_CONFIG_H_INCLUDED*/
+
diff --git a/src/ChangeLog b/src/ChangeLog
index c84cc33..5a875a4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,31 @@
+2010-11-01  Werner Koch  <wk at g10code.com>
+
+	* assuan-socket.c (S_IRUSR) [W32]: Define if not defined.
+
+	* sysutils.c: Remove include of devload.h.
+
+	* assuan-defs.h [HAVE_WINSOCK2_H]: Include winsock2.h prior to
+	windows.h.
+	* assuan-pipe-server.c: Ditto.
+	* sysutils.c: Ditto.
+	* assuan-socket-server.c: Ditto.
+	* assuan-pipe-connect.c: Ditto.
+	* assuan-socket-connect.c: Ditto.
+	* assuan-uds.c: Ditto.
+	* assuan-logging.c: Ditto.
+	* system-w32ce.c: Ditto.
+	* assuan-io.c: Ditto.
+
+	* w32-types.inc.h [_MSC_VER]: Define ssize_t and pid_t.
+
+	* w32ce-fd-t.inc.h, w32-fd-t.inc.h, posix-fd-t.inc.h, debug.h:
+	s/inline/GPG_ERR_INLINE/.
+	* assuan.h.in: Let mkheader write the sys/types.h and unistd.h
+	include lines.
+	* mkheader.c: Change accordingly.
+
+	Guard include of sys/types.h, sys/stat.h, sys/time.h and unistd.h.
+
 2010-09-17  Werner Koch  <wk at g10code.com>
 
 	* assuan-socket-connect.c (INADDR_NONE): New replacement.  Fixes
diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c
index 45dc08c..3c2e7be 100644
--- a/src/assuan-buffer.c
+++ b/src/assuan-buffer.c
@@ -22,10 +22,12 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <assert.h>
 #ifdef HAVE_W32_SYSTEM
-#include <process.h>
+# include <process.h>
 #endif
 #include "assuan-defs.h"
 
diff --git a/src/assuan-defs.h b/src/assuan-defs.h
index 9c1e64e..4a25568 100644
--- a/src/assuan-defs.h
+++ b/src/assuan-defs.h
@@ -21,14 +21,22 @@
 #ifndef ASSUAN_DEFS_H
 #define ASSUAN_DEFS_H
 
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifndef HAVE_W32_SYSTEM
-#include <sys/socket.h>
-#include <sys/un.h>
+# include <sys/socket.h>
+# include <sys/un.h>
 #else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+#  /* Avoid inclusion of winsock.h via windows.h. */
+#  include <winsock2.h>
+# endif
+# include <windows.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
 #endif
-#include <unistd.h>
 
 #include "assuan.h"
 
diff --git a/src/assuan-io.c b/src/assuan-io.c
index c5bbc99..8bb8ed9 100644
--- a/src/assuan-io.c
+++ b/src/assuan-io.c
@@ -22,14 +22,23 @@
 #endif
 
 #include <time.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <errno.h>
 #ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
 # include <windows.h>
 #else
 # include <sys/wait.h>
diff --git a/src/assuan-listen.c b/src/assuan-listen.c
index 55ddd0a..2c589ab 100644
--- a/src/assuan-listen.c
+++ b/src/assuan-listen.c
@@ -24,7 +24,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <errno.h>
 
 #include "assuan-defs.h"
diff --git a/src/assuan-logging.c b/src/assuan-logging.c
index dc2427e..d74e5d2 100644
--- a/src/assuan-logging.c
+++ b/src/assuan-logging.c
@@ -26,7 +26,10 @@
 #include <string.h>
 #include <stdarg.h>
 #ifdef HAVE_W32_SYSTEM
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
+# include <windows.h>
 #endif /*HAVE_W32_SYSTEM*/
 #include <errno.h>
 #include <ctype.h>
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index bdcedc1..ed23cb2 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -29,14 +29,21 @@
 #ifndef HAVE_DOSISH_SYSTEM 
 # include <signal.h>
 #endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifndef HAVE_W32_SYSTEM
-#include <sys/wait.h>
+# include <sys/wait.h>
 #else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
+# include <windows.h>
 #endif
 
 #include "assuan-defs.h"
diff --git a/src/assuan-pipe-server.c b/src/assuan-pipe-server.c
index f8c98d0..3304498 100644
--- a/src/assuan-pipe-server.c
+++ b/src/assuan-pipe-server.c
@@ -23,12 +23,21 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #ifdef HAVE_W32_SYSTEM
-#include <windows.h>
-#include <fcntl.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
+# include <windows.h>
+# include <fcntl.h>
 #endif
 
 #include "assuan-defs.h"
diff --git a/src/assuan-socket-connect.c b/src/assuan-socket-connect.c
index b54d5e4..4ccaf1a 100644
--- a/src/assuan-socket-connect.c
+++ b/src/assuan-socket-connect.c
@@ -26,9 +26,16 @@
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
 #endif
-#include <unistd.h>
-#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
 # include <windows.h>
 #else
 # include <sys/socket.h>
diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c
index 031ee88..27994a2 100644
--- a/src/assuan-socket-server.c
+++ b/src/assuan-socket-server.c
@@ -24,9 +24,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
 # include <windows.h>
 # if HAVE_SYS_SOCKET_H
 #  include <sys/socket.h>
diff --git a/src/assuan-socket.c b/src/assuan-socket.c
index ca0609a..937ff56 100644
--- a/src/assuan-socket.c
+++ b/src/assuan-socket.c
@@ -24,16 +24,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef HAVE_W32_SYSTEM
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <wincrypt.h>
-#include <io.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <wincrypt.h>
+# include <io.h>
 #else
-#include <sys/types.h>
-#include <sys/socket.h>
+# include <sys/types.h>
+# include <sys/socket.h>
 #endif
 #include <errno.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #include <fcntl.h>
 #include <assert.h>
 
@@ -53,6 +55,10 @@
 #endif
 
 #ifdef HAVE_W32_SYSTEM
+#ifndef S_IRUSR
+# define S_IRUSR 0
+# define S_IWUSR 0
+#endif
 #ifndef S_IRGRP
 # define S_IRGRP 0
 # define S_IWGRP 0
diff --git a/src/assuan-uds.c b/src/assuan-uds.c
index 96cf683..93fa957 100644
--- a/src/assuan-uds.c
+++ b/src/assuan-uds.c
@@ -25,17 +25,24 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <errno.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #ifndef HAVE_W32_SYSTEM
-#include <sys/socket.h>
-#include <sys/un.h>
+# include <sys/socket.h>
+# include <sys/un.h>
 #else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
+# include <windows.h>
 #endif
 #if HAVE_SYS_UIO_H
 #include <sys/uio.h>
 #endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include <assert.h>
diff --git a/src/assuan.h.in b/src/assuan.h.in
index 456e184..ea91973 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -24,8 +24,8 @@
 #define ASSUAN_H
 
 #include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
+ at include:sys/types.h@
+ at include:unistd.h@
 #include <stdarg.h>
 
 #ifndef _ASSUAN_NO_SOCKET_WRAPPER
diff --git a/src/debug.c b/src/debug.c
index 6ebc179..5ed4d4d 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -26,13 +26,15 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <ctype.h>
 #include <errno.h>
 #ifndef HAVE_DOSISH_SYSTEM
-#  include <sys/types.h>
-#  include <sys/stat.h>
-#  include <fcntl.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
 #endif
 #include <assert.h>
 
diff --git a/src/debug.h b/src/debug.h
index 8d2771e..bd586c3 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -39,10 +39,10 @@
 

 /* Remove path components from filenames (i.e. __FILE__) for cleaner
    logs. */
-static inline const char *_assuan_debug_srcname (const char *file)
+static GPG_ERR_INLINE const char *_assuan_debug_srcname (const char *file)
   ASSUAN_GCC_A_PURE;
 
-static inline const char *
+static GPG_ERR_INLINE const char *
 _assuan_debug_srcname (const char *file)
 {
   const char *s = strrchr (file, '/');
diff --git a/src/mkheader.c b/src/mkheader.c
index 1b2e165..d44f6b4 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -82,6 +82,24 @@ write_special (const char *fname, int lnr, const char *tag)
       else
         include_file (fname, lnr, "posix-includes.inc.h");
     }
+  else if (!strcmp (tag, "include:sys/types.h"))
+    {
+      if (!strcmp (host_os, "mingw32ce"))
+        fputs ("#ifdef __MINGW32CE__\n"
+               "# include <sys/types.h>\n"
+               "#endif\n", stdout);
+      else
+        fputs ("#include <sys/types.h>\n", stdout);
+    }
+  else if (!strcmp (tag, "include:unistd.h"))
+    {
+      if (!strcmp (host_os, "mingw32ce"))
+        fputs ("#ifdef __MINGW32CE__\n"
+               "# include <unistd.h>\n"
+               "#endif\n", stdout);
+      else
+        fputs ("#include <unistd.h>\n", stdout);
+    }
   else if (!strcmp (tag, "include:types"))
     {
       if (strstr (host_os, "mingw32"))
diff --git a/src/posix-fd-t.inc.h b/src/posix-fd-t.inc.h
index 35bf5ae..80aa5f0 100644
--- a/src/posix-fd-t.inc.h
+++ b/src/posix-fd-t.inc.h
@@ -23,7 +23,7 @@
 typedef int assuan_fd_t;
 #define ASSUAN_INVALID_FD  (-1)
 #define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
 assuan_fd_from_posix_fd (int fd)
 {
   return fd;
diff --git a/src/system-w32ce.c b/src/system-w32ce.c
index c201c47..3061f45 100644
--- a/src/system-w32ce.c
+++ b/src/system-w32ce.c
@@ -26,6 +26,9 @@
 #include <errno.h>
 #include <time.h>
 #include <fcntl.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
 #include <windows.h>
 #include <winioctl.h>
 #include <devload.h>
diff --git a/src/system.c b/src/system.c
index 779b567..1c7d617 100644
--- a/src/system.c
+++ b/src/system.c
@@ -24,8 +24,10 @@
 
 #include <stdlib.h>
 #include <errno.h>
-/* Solaris 8 needs sys/types.h before time.h.  */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+  /* Solaris 8 needs sys/types.h before time.h.  */
+# include <sys/types.h>
+#endif
 #include <time.h>
 #include <fcntl.h>
 
diff --git a/src/sysutils.c b/src/sysutils.c
index 1760f44..578e47d 100644
--- a/src/sysutils.c
+++ b/src/sysutils.c
@@ -25,10 +25,12 @@
 #include <string.h>
 #include <stdarg.h>
 #ifdef HAVE_W32_SYSTEM
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif 
+# include <windows.h>
 # ifdef HAVE_W32CE_SYSTEM
 # include <winioctl.h>
-# include <devload.h>
 # endif /*HAVE_W32CE_SYSTEM*/
 #endif /*HAVE_W32_SYSTEM*/
 
diff --git a/src/w32-fd-t.inc.h b/src/w32-fd-t.inc.h
index 11cd511..37f20f4 100644
--- a/src/w32-fd-t.inc.h
+++ b/src/w32-fd-t.inc.h
@@ -27,7 +27,7 @@
 typedef void *assuan_fd_t;
 #define ASSUAN_INVALID_FD ((void*)(-1))
 #define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
 assuan_fd_from_posix_fd (int fd)
 {
   if (fd < 0)
diff --git a/src/w32-types.inc.h b/src/w32-types.inc.h
index 56bc7b2..35aaec9 100644
--- a/src/w32-types.inc.h
+++ b/src/w32-types.inc.h
@@ -20,4 +20,10 @@
 ## This file is included by the mkheader tool.  Lines starting with
 ## a double hash mark are not copied to the destination file.
 typedef void *assuan_msghdr_t;
+
+#ifdef _MSC_VER
+  typedef long ssize_t;
+  typedef int  pid_t;
+#endif
+
 ##EOF##
diff --git a/src/w32ce-fd-t.inc.h b/src/w32ce-fd-t.inc.h
index df55f23..2de72e6 100644
--- a/src/w32ce-fd-t.inc.h
+++ b/src/w32ce-fd-t.inc.h
@@ -23,7 +23,7 @@
 typedef void *assuan_fd_t;
 #define ASSUAN_INVALID_FD ((void*)(-1))
 #define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
 assuan_fd_from_posix_fd (int fd)
 {
   return (assuan_fd_t)(fd);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list