From 630203f8700d8dcf9be661695418dbbddbe42df4 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 15 Feb 2013 22:01:44 +0100 Subject: util: fixed building on mingw32 --- util/configure.ac | 14 +++++++++++ util/include/axutil_log.h | 2 +- util/include/axutil_utils_defines.h | 8 +++---- .../include/platforms/windows/axutil_dir_windows.h | 3 +++ util/include/platforms/windows/axutil_windows.h | 2 +- util/src/Makefile.am | 4 ++-- util/src/platforms/unix/Makefile.am | 2 ++ util/src/platforms/windows/Makefile.am | 27 ++++++++++++++++++++++ util/src/platforms/windows/axutil_windows.c | 4 +++- 9 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 util/src/platforms/windows/Makefile.am diff --git a/util/configure.ac b/util/configure.ac index 1e7169e..65555da 100644 --- a/util/configure.ac +++ b/util/configure.ac @@ -135,6 +135,7 @@ dnl AC_FUNC_REALLOC AC_CHECK_FUNCS(getifaddrs) # System-dependent adjustments. +mingw=no cygwin=no darwin=no solaris=no @@ -155,11 +156,18 @@ alpha*) ;; esac +PLATFORM=unix + case "${host_os}" in cygwin) cygwin=yes no_undefined=yes ;; +mingw32) + mingw=yes + no_undefined=yes + PLATFORM=windows + ;; darwin*) darwin=yes dnl if test x"$GCC" = xyes @@ -178,10 +186,15 @@ solaris*) esac AM_CONDITIONAL(HOST_OS_CYGWIN, test x$cygwin = xyes) +AM_CONDITIONAL(HOST_OS_MINGW, test x$mingw = xyes) AM_CONDITIONAL(HOST_OS_DARWIN, test x$darwin = xyes) AM_CONDITIONAL(HOST_OS_SOLARIS, test x$solaris = xyes) AM_CONDITIONAL(NO_UNDEFINED, test x$no_undefined = xyes) +PLATFORM_SUB=platforms/${PLATFORM} +AC_SUBST([PLATFORM_SUB]) +AC_SUBST([PLATFORM]) +AC_DEFINE([HOST_OS_MINGW], 1, [define if we are on mingw]) AC_MSG_CHECKING(whether to build guththila xml parser library) AC_ARG_ENABLE(guththila, [ --enable-guththila build guththila xml parser library wrapper. default=no], @@ -283,6 +296,7 @@ AC_SUBST(TESTDIR) AC_CONFIG_FILES([Makefile \ src/Makefile \ src/platforms/unix/Makefile \ + src/platforms/windows/Makefile \ src/minizip/Makefile \ include/Makefile \ test/Makefile \ diff --git a/util/include/axutil_log.h b/util/include/axutil_log.h index 09e9242..453b04a 100644 --- a/util/include/axutil_log.h +++ b/util/include/axutil_log.h @@ -227,7 +227,7 @@ extern "C" # define AXIS2_LOG_TRACE(params, ...) # elif __STDC__ && __STDC_VERSION > 199901L # define AXIS2_LOG_TRACE(params, ...) -# elif WIN32 +# elif defined(WIN32) # define AXIS2_LOG_TRACE axutil_log_impl_log_trace # else # define AXIS2_LOG_TRACE axutil_log_impl_log_trace diff --git a/util/include/axutil_utils_defines.h b/util/include/axutil_utils_defines.h index 003cbae..2f5d374 100644 --- a/util/include/axutil_utils_defines.h +++ b/util/include/axutil_utils_defines.h @@ -21,7 +21,7 @@ #include -#if !defined(_WIN32) +#if !defined(_WIN32) || defined(__MINGW32__) #include #endif @@ -30,7 +30,7 @@ extern "C" { #endif -#if defined(_WIN32) && !defined(AXIS2_SKIP_INT_TYPEDEFS) +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(AXIS2_SKIP_INT_TYPEDEFS) /** * ANSI Type definitions for Windows */ @@ -107,7 +107,7 @@ extern "C" /** * Exporting */ -#if defined(_WIN32) && !defined(AXIS2_DECLARE_STATIC) +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(AXIS2_DECLARE_STATIC) #define AXIS2_EXPORT __declspec(dllexport) #else #define AXIS2_EXPORT @@ -116,7 +116,7 @@ extern "C" /** * Importing */ -#if defined(_WIN32) +#if defined(_WIN32) && !defined(__MINGW32__) #define AXIS2_IMPORT __declspec(dllimport) #else #define AXIS2_IMPORT diff --git a/util/include/platforms/windows/axutil_dir_windows.h b/util/include/platforms/windows/axutil_dir_windows.h index 89ba297..ce92a2f 100644 --- a/util/include/platforms/windows/axutil_dir_windows.h +++ b/util/include/platforms/windows/axutil_dir_windows.h @@ -26,6 +26,9 @@ #include #include +#ifndef _MAX_FNAME +#define _MAX_FNAME MAX_PATH +#endif /* struct dirent - same as Unix dirent.h */ struct dirent diff --git a/util/include/platforms/windows/axutil_windows.h b/util/include/platforms/windows/axutil_windows.h index 53d332c..843c3bf 100644 --- a/util/include/platforms/windows/axutil_windows.h +++ b/util/include/platforms/windows/axutil_windows.h @@ -217,7 +217,7 @@ extern "C" #define AXIS2_W_OK 02 /* test for write permission */ #define AXIS2_X_OK 00 /* test for execute or search permission */ #define AXIS2_F_OK 00 /* test whether the directories leading to the file can be - searched and the file exists * / + searched and the file exists */ /** * windows specific directory handling functions diff --git a/util/src/Makefile.am b/util/src/Makefile.am index 11714b6..fb40027 100644 --- a/util/src/Makefile.am +++ b/util/src/Makefile.am @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -SUBDIRS = platforms/unix @ZLIBBUILD@ +SUBDIRS = $(PLATFORM_SUB) @ZLIBBUILD@ lib_LTLIBRARIES = libaxutil.la libaxutil_la_SOURCES = hash.c \ allocator.c \ @@ -54,7 +54,7 @@ libaxutil_la_SOURCES = hash.c \ http_chunked_stream.c \ digest_calc.c -libaxutil_la_LIBADD = $(top_builddir)/src/platforms/unix/libaxis2_unix.la \ +libaxutil_la_LIBADD = $(top_builddir)/src/platforms/$(PLATFORM)/libaxis2_$(PLATFORM).la \ -lpthread \ @ZLIBLIBS@ diff --git a/util/src/platforms/unix/Makefile.am b/util/src/platforms/unix/Makefile.am index 2f1496c..a7ccc73 100644 --- a/util/src/platforms/unix/Makefile.am +++ b/util/src/platforms/unix/Makefile.am @@ -12,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +if !HOST_OS_MINGW noinst_LTLIBRARIES = libaxis2_unix.la libaxis2_unix_la_SOURCES = uuid_gen_unix.c\ @@ -20,3 +21,4 @@ libaxis2_unix_la_SOURCES = uuid_gen_unix.c\ INCLUDES = -I$(top_builddir)/include \ -I$(top_builddir)/include/platforms \ -I$(top_builddir)/include/platforms/unix +endif diff --git a/util/src/platforms/windows/Makefile.am b/util/src/platforms/windows/Makefile.am new file mode 100644 index 0000000..c0230d2 --- /dev/null +++ b/util/src/platforms/windows/Makefile.am @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +if HOST_OS_MINGW +noinst_LTLIBRARIES = libaxis2_windows.la + +libaxis2_windows_la_SOURCES = axutil_windows.c uuid_gen_windows.c\ + date_time_util_windows.c dir_windows.c\ + getopt_windows.c\ + thread_windows.c thread_mutex_windows.c +libaxis2_windows_la_LIBADD = -lws2_32 -lrpcrt4 + +INCLUDES = -I$(top_builddir)/include \ + -I$(top_builddir)/include/platforms \ + -I$(top_builddir)/include/platforms/windows +endif diff --git a/util/src/platforms/windows/axutil_windows.c b/util/src/platforms/windows/axutil_windows.c index 5e37abb..add6cc2 100644 --- a/util/src/platforms/windows/axutil_windows.c +++ b/util/src/platforms/windows/axutil_windows.c @@ -17,7 +17,9 @@ #include #include - +#ifdef __MINGW32__ +#include +#endif /* -- cgit v1.1-32-gdbae