]> granicus.if.org Git - icu/commitdiff
ICU-8535 Use U_MINGW instead of U_CYGWIN where appropriate when building on MinGW
authorMichael Ow <mow@svn.icu-project.org>
Wed, 29 Jun 2011 19:49:05 +0000 (19:49 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Wed, 29 Jun 2011 19:49:05 +0000 (19:49 +0000)
X-SVN-Rev: 30252

icu4c/source/common/putil.cpp
icu4c/source/common/unicode/pwin32.h
icu4c/source/configure
icu4c/source/configure.in
icu4c/source/extra/uconv/uconv.cpp
icu4c/source/runConfigureICU
icu4c/source/tools/genrb/derb.c
icu4c/source/tools/pkgdata/pkgdata.cpp
icu4c/source/tools/toolutil/toolutil.cpp

index c9e79cd2659f7d90fd0ffad8a9e94a29cb783a3e..a321fd45f7c82d574705ff24f0f4a3b188f88c73 100644 (file)
@@ -77,7 +77,7 @@ Cleanly installed Solaris can use this #define.
 #include <float.h>
 
 /* 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);
index 09670f6412a1045cd8673f219b3e4fa70f17a72f..148324d316d932049ebfe43f105fff0d5870f425 100644 (file)
@@ -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
index 773ee441cb4598b2044f1f027edec7d7bd1470a7..796929664431ac48577d9424423f3b8d9baa2ce4 100755 (executable)
@@ -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"
index 79f5d680eba774e32d9362f837f9f742c0895ada..e95182831c6e0e93fa0dea216d017acf83ce0c6e 100644 (file)
@@ -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"
index 0add6cfca96d41e44623f8631c9a4c5fb267a894..57cf80501d3c2f177ccf51b2c59d9db56aa3c6c6 100644 (file)
@@ -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 <io.h>
 #include <fcntl.h>
 #if defined(U_WINDOWS)
index 24a44058c76f32bbd645d6adc0ce90a4ccef1ad0..f265ce605d9a5bc7360e8010f6dc19e1b464dd82 100755 (executable)
@@ -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++"
index 3549cdbc496c5b3d000d1da9aaa6c29703a09348..095304fe389d177958aa5d59be6af5524194d443 100644 (file)
@@ -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 <stdio.h>
 #include <ctype.h>
 
-#if defined(U_WINDOWS) || defined(U_CYGWIN)
+#if defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW)
 #include <io.h>
 #include <fcntl.h>
 #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;
index cf37177878f1e25a2bcb75d91160ea1b469f1809..6eae24792ba881dfae10279271c4b65c936956d2 100644 (file)
@@ -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;
index 27d010b3b5d406c84aadedd3ca29f28f59ea7e18..33f3346f78abbdb1979c285da94a7f19fc159f5c 100644 (file)
@@ -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 <io.h>
 #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