From c1f1d09b7098849b9b2969fc98314a1b9f0a4415 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Tue, 28 Jun 2011 21:07:36 +0000 Subject: [PATCH] ICU-8535 Merge changes for MINGW build fix in branch to trunk and fix some other errors when building with MINGW. X-SVN-Rev: 30247 --- icu4c/source/common/Makefile.in | 2 +- icu4c/source/common/putil.cpp | 12 ++++++------ icu4c/source/common/unicode/umachine.h | 2 +- icu4c/source/tools/pkgdata/pkgdata.cpp | 11 ++++++++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/icu4c/source/common/Makefile.in b/icu4c/source/common/Makefile.in index f99a5db1d85..998a18922f8 100644 --- a/icu4c/source/common/Makefile.in +++ b/icu4c/source/common/Makefile.in @@ -62,7 +62,7 @@ CPPFLAGS += -I$(top_builddir)/common endif CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/i18n $(LIBCPPFLAGS) $(CPPFLAGSICUUC) # we want DEFS here, because we want icucfg.h -DEFS += -DU_COMMON_IMPLEMENTATION @DEFS@ +DEFS += -DU_COMMON_IMPLEMENTATION -DU_HAVE_ICUCFG LDFLAGS += $(LDFLAGSICUUC) # for plugin configuration diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index 978ab85fac2..5feca1b1272 100644 --- a/icu4c/source/common/putil.cpp +++ b/icu4c/source/common/putil.cpp @@ -77,7 +77,7 @@ Cleanly installed Solaris can use this #define. #include /* include system headers */ -#ifdef U_WINDOWS +#if defined(U_WINDOWS) || defined(__MINGW32__) # define WIN32_LEAN_AND_MEAN # define VC_EXTRALEAN # define NOUSER @@ -143,7 +143,7 @@ Cleanly installed Solaris can use this #define. * Simple things (presence of functions, etc) should just go in configure.in and be added to * icucfg.h via autoheader. */ -#if defined(HAVE_CONFIG_H) +#if defined(U_HAVE_ICUCFG) #include "icucfg.h" #endif @@ -176,7 +176,7 @@ static const BitPatternConversion gInf = { (int64_t) INT64_C(0x7FF0000000000000) functions). ---------------------------------------------------------------------------*/ -#if defined(U_WINDOWS) || defined(XP_MAC) || defined(OS400) +#if defined(U_WINDOWS) || defined(XP_MAC) || defined(OS400) || defined(__MINGW32__) # undef U_POSIX_LOCALE #else # define U_POSIX_LOCALE 1 @@ -613,7 +613,7 @@ uprv_maximumPtr(void * base) U_CAPI void U_EXPORT2 uprv_tzset() { -#ifdef U_TZSET +#if defined(U_TZSET) && !defined(__MINGW32__) U_TZSET(); #else /* no initialization*/ @@ -1048,7 +1048,7 @@ uprv_tzname(int n) #endif #ifdef U_TZNAME -#ifdef U_WINDOWS +#if defined(U_WINDOWS) || defined(__MINGW32__) /* The return value is free'd in timezone.cpp on Windows because * the other code path returns a pointer to a heap location. */ return uprv_strdup(U_TZNAME[n]); @@ -1568,7 +1568,7 @@ The leftmost codepage (.xxx) wins. return posixID; -#elif defined(U_WINDOWS) +#elif defined(U_WINDOWS) || defined(__MINGW32__) UErrorCode status = U_ZERO_ERROR; LCID id = GetThreadLocale(); const char* locID = uprv_convertToPosix(id, &status); diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index a587883fb3c..afd32b0e58c 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -43,7 +43,7 @@ #if defined(U_PALMOS) # include "unicode/ppalmos.h" -#elif /*!defined(__MINGW32__) && */(defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) +#elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) /* * platform.h is now also generated by MSVC Solution/Project files * from platform.win and should always be included unless you are diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index 9819dd93fe6..cf37177878f 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -850,7 +850,7 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version } if (version != NULL) { -#ifdef U_CYGWIN +#if defined(U_CYGWIN) && !defined(__MINGW32__) sprintf(libFileNames[LIB_FILE_CYGWIN], "cyg%s.%s", libName, pkgDataFlags[SO_EXT]); @@ -1003,7 +1003,12 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir) } #endif +#if defined (__MINGW32__) + /* On MINGW, symbolic links don't need to be created. */ + return result; +#else return pkg_createSymLinks(installDir, TRUE); +#endif } static int32_t pkg_installCommonMode(const char *installDir, const char *fileName) { @@ -1216,7 +1221,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c } freeCmd = TRUE; } -#ifdef U_CYGWIN +#if defined(U_CYGWIN) && !defined(__MINGW32__) sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s", pkgDataFlags[GENLIB], targetDir, @@ -1692,7 +1697,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { T_FileStream_close(f); } } -#elif defined(U_CYGWIN) +#elif defined(U_CYGWIN) && !defined(__MINGW32__) /* Cygwin needs to change flag options. */ char *flag = NULL; int32_t length = 0;