From: Michael Ow Date: Wed, 29 Jun 2011 19:49:05 +0000 (+0000) Subject: ICU-8535 Use U_MINGW instead of U_CYGWIN where appropriate when building on MinGW X-Git-Tag: milestone-59-0-1~4705 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a0a5a7d87c86342b6e81421d23cbb2a928e6366;p=icu ICU-8535 Use U_MINGW instead of U_CYGWIN where appropriate when building on MinGW X-SVN-Rev: 30252 --- diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index c9e79cd2659..a321fd45f7c 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 */ -#if defined(U_WINDOWS) || defined(__MINGW32__) +#if defined(U_WINDOWS) || defined(U_MINGW) # define WIN32_LEAN_AND_MEAN # define VC_EXTRALEAN # define NOUSER @@ -113,8 +113,8 @@ Cleanly installed Solaris can use this #define. # endif #endif -#if defined(U_CYGWIN) && defined(__STRICT_ANSI__) -/* tzset isn't defined in strict ANSI on Cygwin. */ +#if (defined(U_CYGWIN) || defined(U_MINGW)) && defined(__STRICT_ANSI__) +/* tzset isn't defined in strict ANSI on Cygwin and MinGW. */ #undef __STRICT_ANSI__ #endif @@ -178,7 +178,7 @@ static const BitPatternConversion gInf = { (int64_t) INT64_C(0x7FF0000000000000) functions). ---------------------------------------------------------------------------*/ -#if defined(U_WINDOWS) || defined(XP_MAC) || defined(OS400) || defined(__MINGW32__) +#if defined(U_WINDOWS) || defined(XP_MAC) || defined(OS400) || defined(U_MINGW) # undef U_POSIX_LOCALE #else # define U_POSIX_LOCALE 1 @@ -1050,7 +1050,7 @@ uprv_tzname(int n) #endif #ifdef U_TZNAME -#if defined(U_WINDOWS) || defined(__MINGW32__) +#if defined(U_WINDOWS) || defined(U_MINGW) /* 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]); @@ -1570,7 +1570,7 @@ The leftmost codepage (.xxx) wins. return posixID; -#elif defined(U_WINDOWS) || defined(__MINGW32__) +#elif defined(U_WINDOWS) || defined(U_MINGW) UErrorCode status = U_ZERO_ERROR; LCID id = GetThreadLocale(); const char* locID = uprv_convertToPosix(id, &status); diff --git a/icu4c/source/common/unicode/pwin32.h b/icu4c/source/common/unicode/pwin32.h index 09670f6412a..148324d316d 100644 --- a/icu4c/source/common/unicode/pwin32.h +++ b/icu4c/source/common/unicode/pwin32.h @@ -40,7 +40,7 @@ /** Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H -# if defined(__BORLANDC__) || defined(__MINGW32__) +# if defined(__BORLANDC__) # define U_HAVE_INTTYPES_H 1 # else # define U_HAVE_INTTYPES_H 0 diff --git a/icu4c/source/configure b/icu4c/source/configure index 773ee441cb4..79692966443 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -7742,7 +7742,8 @@ case "${host}" in *-*-aix*) platform=U_AIX ;; *-*-hpux*) platform=U_HPUX ;; *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; - *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;; + *-*-cygwin*) platform=U_CYGWIN ;; + *-*-mingw*) platform=U_MINGW ;; *-*ibm-openedition*|*-*-os390*) platform=OS390 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then ICUDATA_CHAR="e" diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index 79f5d680eba..e95182831c6 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -1280,7 +1280,8 @@ case "${host}" in *-*-aix*) platform=U_AIX ;; *-*-hpux*) platform=U_HPUX ;; *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; - *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;; + *-*-cygwin*) platform=U_CYGWIN ;; + *-*-mingw*) platform=U_MINGW ;; *-*ibm-openedition*|*-*-os390*) platform=OS390 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then ICUDATA_CHAR="e" diff --git a/icu4c/source/extra/uconv/uconv.cpp b/icu4c/source/extra/uconv/uconv.cpp index 0add6cfca96..57cf80501d3 100644 --- a/icu4c/source/extra/uconv/uconv.cpp +++ b/icu4c/source/extra/uconv/uconv.cpp @@ -1,6 +1,6 @@ /***************************************************************************** * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ @@ -40,7 +40,7 @@ U_NAMESPACE_USE -#if (defined(U_WINDOWS) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__) +#if (defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW)) && !defined(__STRICT_ANSI__) #include #include #if defined(U_WINDOWS) diff --git a/icu4c/source/runConfigureICU b/icu4c/source/runConfigureICU index 24a44058c76..f265ce605d9 100755 --- a/icu4c/source/runConfigureICU +++ b/icu4c/source/runConfigureICU @@ -43,6 +43,7 @@ The following names can be supplied as the argument for platform: Linux/ICC Use the Intel ICC compiler on Linux Linux/VA Use the IBM Visual Age compiler on Power PC Linux MacOSX Use the GNU gcc/g++ compilers on MacOS X (Darwin) + MinGW Use the GNU gcc/g++ compilers on MinGW QNX Use the QNX QCC compiler on QNX/Neutrino Solaris Use the Sun cc/CC compilers on Solaris Solaris/GCC Use the GNU gcc/g++ compilers on Solaris @@ -276,6 +277,12 @@ case $platform in DEBUG_CFLAGS='-g -O0' DEBUG_CXXFLAGS='-g -O0' ;; + MinGW) + THE_OS="MinGW" + THE_COMP="the GNU C++" + RELEASE_CFLAGS='-O3' + RELEASE_CXXFLAGS='-O3' + ;; *BSD) THE_OS="BSD" THE_COMP="the GNU C++" diff --git a/icu4c/source/tools/genrb/derb.c b/icu4c/source/tools/genrb/derb.c index 3549cdbc496..095304fe389 100644 --- a/icu4c/source/tools/genrb/derb.c +++ b/icu4c/source/tools/genrb/derb.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -30,7 +30,7 @@ #include #include -#if defined(U_WINDOWS) || defined(U_CYGWIN) +#if defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW) #include #include #define USE_FILENO_BINARY_MODE 1 @@ -293,7 +293,7 @@ main(int argc, char* argv[]) { if (tostdout) { out = stdout; -#if defined(U_WINDOWS) || defined(U_CYGWIN) +#if defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW) if (setmode(fileno(out), O_BINARY) == -1) { fprintf(stderr, "%s: couldn't set standard output to binary mode\n", pname); return 4; diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index cf37177878f..6eae24792ba 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -30,8 +30,8 @@ #include "unicode/utypes.h" #if U_HAVE_POPEN -#if defined(U_CYGWIN) && defined(__STRICT_ANSI__) -/* popen/pclose aren't defined in strict ANSI on Cygwin */ +#if (defined(U_CYGWIN) || defined(U_MINGW)) && defined(__STRICT_ANSI__) +/* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */ #undef __STRICT_ANSI__ #endif #endif @@ -850,7 +850,7 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version } if (version != NULL) { -#if defined(U_CYGWIN) && !defined(__MINGW32__) +#if defined(U_CYGWIN) sprintf(libFileNames[LIB_FILE_CYGWIN], "cyg%s.%s", libName, pkgDataFlags[SO_EXT]); @@ -889,8 +889,8 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s\n", libFileNames[LIB_FILE_VERSION]); } -#ifdef U_CYGWIN - /* Cygwin only deals with the version major number. */ +#if defined(U_CYGWIN) || defined(U_MINGW) + /* Cygwin and MinGW only deals with the version major number. */ uprv_strcpy(libFileNames[LIB_FILE_VERSION_TMP], libFileNames[LIB_FILE_VERSION_MAJOR]); #endif } @@ -910,6 +910,11 @@ static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling) char name1[SMALL_BUFFER_MAX_SIZE]; /* symlink file name */ char name2[SMALL_BUFFER_MAX_SIZE]; /* file name to symlink */ +#if defined (U_MINGW) + /* On MINGW, symbolic links don't need to be created. */ + return result; +#endif + #ifndef USING_CYGWIN /* No symbolic link to make. */ if (uprv_strlen(libFileNames[LIB_FILE_VERSION]) == 0 || uprv_strlen(libFileNames[LIB_FILE_VERSION_MAJOR]) == 0 || @@ -988,7 +993,7 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir) fprintf(stderr, "Error installing library. Failed command: %s\n", cmd); return result; } -#elif defined (U_CYGWIN) +#elif defined(U_CYGWIN) sprintf(cmd, "cd %s && %s %s %s", targetDir, pkgDataFlags[INSTALL_CMD], @@ -1003,12 +1008,7 @@ 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) { @@ -1221,7 +1221,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c } freeCmd = TRUE; } -#if defined(U_CYGWIN) && !defined(__MINGW32__) +#if defined(U_CYGWIN) sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s", pkgDataFlags[GENLIB], targetDir, @@ -1697,7 +1697,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { T_FileStream_close(f); } } -#elif defined(U_CYGWIN) && !defined(__MINGW32__) +#elif defined(U_CYGWIN) /* Cygwin needs to change flag options. */ char *flag = NULL; int32_t length = 0; diff --git a/icu4c/source/tools/toolutil/toolutil.cpp b/icu4c/source/tools/toolutil/toolutil.cpp index 27d010b3b5d..33f3346f78a 100644 --- a/icu4c/source/tools/toolutil/toolutil.cpp +++ b/icu4c/source/tools/toolutil/toolutil.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -37,7 +37,7 @@ #endif /* In MinGW environment, io.h needs to be included for _mkdir() */ -#ifdef __MINGW32__ +#ifdef U_MINGW #include #endif @@ -166,21 +166,21 @@ U_CAPI void U_EXPORT2 uprv_mkdir(const char *pathname, UErrorCode *status) { int retVal = 0; -#if defined(U_WINDOWS) || defined(__MINGW32__) +#if defined(U_WINDOWS) || defined(U_MINGW) retVal = _mkdir(pathname); #else retVal = mkdir(pathname, S_IRWXU | (S_IROTH | S_IXOTH) | (S_IROTH | S_IXOTH)); #endif if (retVal && errno != EEXIST) { -#if defined(U_CYGWIN) - /*if using Cygwin and the mkdir says it failed...check if the directory already exists..*/ - /* if it does...don't give the error, if it does not...give the error - Brian Rower - 6/25/08 */ - struct stat st; - - if(stat(pathname,&st) != 0) - { - *status = U_FILE_ACCESS_ERROR; - } +#if defined(U_CYGWIN) || defined(U_MINGW) + /*if using Cygwin and the mkdir says it failed...check if the directory already exists..*/ + /* if it does...don't give the error, if it does not...give the error - Brian Rower - 6/25/08 */ + struct stat st; + + if(stat(pathname,&st) != 0) + { + *status = U_FILE_ACCESS_ERROR; + } #else *status = U_FILE_ACCESS_ERROR; #endif