]> OCCT Git - occt.git/commitdiff
0028971: Configuration - fix compatibility with glibc 2.26+ due to xlocale.h removal
authorkgv <kgv@opencascade.com>
Mon, 7 Aug 2017 14:09:11 +0000 (17:09 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 8 Aug 2017 14:45:40 +0000 (17:45 +0300)
src/Standard/Standard_CLocaleSentry.cxx
src/Standard/Standard_CLocaleSentry.hxx
src/Standard/Standard_CString.cxx

index fc7a4b33cd657bd096e08559a19b8739d0aa3aea..ce3212f2af097cbb8f4a304450b9bc222f7929e0 100644 (file)
@@ -32,7 +32,7 @@ namespace
     CLocalePtr()
     #ifdef HAVE_XLOCALE_H
     : myLocale (newlocale (LC_ALL_MASK, "C", NULL))
-    #elif defined(_WIN32) && !defined(__MINGW32__)
+    #elif defined(_MSC_VER)
     : myLocale (_create_locale (LC_ALL, "C"))
     #else
     : myLocale (NULL)
@@ -43,7 +43,7 @@ namespace
     {
     #ifdef HAVE_XLOCALE_H
       freelocale (myLocale);
-    #elif defined(_WIN32) && !defined(__MINGW32__)
+    #elif defined(_MSC_VER)
       _free_locale (myLocale);
     #endif
     }
index 4d9f7b92773f529729bfaac8ac0d46cf009fda76..a94ade724db42c234c7c79636dbffb2d708b2e0f 100755 (executable)
@@ -35,7 +35,8 @@
   #endif
 #endif // ifndef HAVE_LOCALE_H
 
-#ifdef HAVE_XLOCALE_H
+#if defined(HAVE_XLOCALE_H) && !(defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 24))
+  // xlocale.h is actually a non-standard header file; glibc 2.26 has removed it altogether (all definition comes from locale.h)
   #include <xlocale.h>
 #endif
 
@@ -65,7 +66,7 @@ public:
 
 #ifdef HAVE_XLOCALE_H
   typedef  locale_t clocale_t;
-#elif defined(_WIN32) && !defined(__MINGW32__)
+#elif defined(_MSC_VER)
   typedef _locale_t clocale_t;
 #else
   typedef void*     clocale_t;
@@ -78,7 +79,7 @@ public:
 private:
 
   void* myPrevLocale;       //!< previous locale, platform-dependent pointer!
-#ifdef _WIN32
+#ifdef _MSC_VER
   int   myPrevTLocaleState; //!< previous thread-locale state, MSVCRT-specific
 #endif
 
index ec33b0a38f146bcac09ed137fbb13aefe3093d45..dc0a2223a12a372d41cab48371bcb5b4ca8f050b 100755 (executable)
@@ -63,7 +63,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
 #ifdef __APPLE__
   // There are a lot of *_l functions availalbe on Mac OS X - we use them
   #define SAVE_TL()
-#elif defined(_WIN32) && !defined(__MINGW32__)
+#elif defined(_MSC_VER)
   // MSVCRT has equivalents with slightly different syntax
   #define SAVE_TL()
   #define strtod_l(thePtr, theNextPtr, theLocale)                _strtod_l(thePtr, theNextPtr, theLocale)