libxslt r1478 - in trunk: . libxslt win32
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxslt r1478 - in trunk: . libxslt win32
- Date: Thu, 12 Jun 2008 09:43:28 +0000 (UTC)
Author: veillard
Date: Thu Jun 12 09:43:28 2008
New Revision: 1478
URL: http://svn.gnome.org/viewvc/libxslt?rev=1478&view=rev
Log:
* libxslt/xsltconfig.h.in libxslt/xsltlocale.h configure.in
config.h.in win32/configure.js: patch from Nick Wellnhofer and
Roumen Petrov to fix some portability problems on the previous
xsl:sort locale patch
Daniel
Modified:
trunk/ChangeLog
trunk/config.h.in
trunk/configure.in
trunk/libxslt/xsltconfig.h.in
trunk/libxslt/xsltlocale.h
trunk/win32/configure.js
Modified: trunk/config.h.in
==============================================================================
--- trunk/config.h.in (original)
+++ trunk/config.h.in Thu Jun 12 09:43:28 2008
@@ -123,7 +123,7 @@
/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF
-/* Have working xlocale.h */
+/* Define to 1 if you have the <xlocale.h> header file. */
#undef HAVE_XLOCALE_H
/* Define to 1 if you have the `_stat' function. */
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Jun 12 09:43:28 2008
@@ -106,9 +106,18 @@
AC_STDC_HEADERS
AM_PROG_LIBTOOL
-AC_MSG_CHECKING([for working xlocale.h])
-AC_TRY_RUN(
-[
+
+dnl
+dnl Detect supported locale
+dnl
+
+XSLT_LOCALE_XLOCALE=0
+XSLT_LOCALE_MSVCRT=0
+
+AC_CHECK_HEADERS([xlocale.h])
+if test $ac_cv_header_xlocale_h = yes; then
+AC_MSG_CHECKING([for working xlocale])
+AC_RUN_IFELSE(AC_LANG_PROGRAM([[
#include <locale.h>
#include <xlocale.h>
#include <string.h>
@@ -121,32 +130,40 @@
#define strxfrm_l __strxfrm_l
#define LC_COLLATE_MASK (1 << LC_COLLATE)
#endif
-
-int main()
-{
+]],[[
locale_t locale;
- const char *src[2] = { "\xc3\x84rger", "Zeppelin" };
- char *dst[2];
+ const char *src[[2]] = { "\xc3\x84rger", "Zeppelin" };
+ char *dst[[2]];
size_t len, r;
int i;
-
+
locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
if (locale == NULL) exit(1);
for (i=0; i<2; ++i) {
- len = strxfrm_l(NULL, src[i], 0, locale) + 1;
- dst[i] = malloc(len);
- if(dst[i] == NULL) exit(1);
- r = strxfrm_l(dst[i], src[i], len, locale);
+ len = strxfrm_l(NULL, src[[i]], 0, locale) + 1;
+ dst[[i]] = malloc(len);
+ if(dst[[i]] == NULL) exit(1);
+ r = strxfrm_l(dst[[i]], src[[i]], len, locale);
if(r >= len) exit(1);
}
- if (strcmp(dst[0], dst[1]) >= 0) exit(1);
-
+ if (strcmp(dst[[0]], dst[[1]]) >= 0) exit(1);
+
exit(0);
-}
-],
- [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_XLOCALE_H, 1, [Have working xlocale.h])],
- [AC_MSG_RESULT(no)]
+ return(0);
+]]),
+ [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_WARN([cross compiling: assuming no])]
)
+else
+ dnl defined in msvcrt
+ AC_CHECK_FUNC(_create_locale,
+ [XSLT_LOCALE_MSVCRT=1]
+ )
+fi
+
+AC_SUBST(XSLT_LOCALE_XLOCALE)
+AC_SUBST(XSLT_LOCALE_MSVCRT)
dnl
dnl Math detection
Modified: trunk/libxslt/xsltconfig.h.in
==============================================================================
--- trunk/libxslt/xsltconfig.h.in (original)
+++ trunk/libxslt/xsltconfig.h.in Thu Jun 12 09:43:28 2008
@@ -124,6 +124,19 @@
#endif
/**
+ * Locale support
+ */
+#if @XSLT_LOCALE_XLOCALE@
+#ifndef XSLT_LOCALE_XLOCALE
+#define XSLT_LOCALE_XLOCALE
+#endif
+#elif @XSLT_LOCALE_MSVCRT@
+#ifndef XSLT_LOCALE_MSVCRT
+#define XSLT_LOCALE_MSVCRT
+#endif
+#endif
+
+/**
* ATTRIBUTE_UNUSED:
*
* This macro is used to flag unused function parameters to GCC
Modified: trunk/libxslt/xsltlocale.h
==============================================================================
--- trunk/libxslt/xsltlocale.h (original)
+++ trunk/libxslt/xsltlocale.h Thu Jun 12 09:43:28 2008
@@ -13,9 +13,7 @@
#include <libxml/xmlstring.h>
-#ifdef HAVE_XLOCALE_H
-
-#define XSLT_LOCALE_XLOCALE
+#ifdef XSLT_LOCALE_XLOCALE
#include <locale.h>
#include <xlocale.h>
@@ -27,10 +25,7 @@
#endif
typedef xmlChar xsltLocaleChar;
-#else
-#if defined(_MSC_VER) || defined (__MINGW32__) && defined(__MSVCRT__)
-
-#define XSLT_LOCALE_MSVCRT
+#elif defined(XSLT_LOCALE_MSVCRT)
#include <locale.h>
@@ -39,13 +34,14 @@
#else
+#ifndef XSLT_LOCALE_NONE
#define XSLT_LOCALE_NONE
+#endif
typedef void *xsltLocale;
typedef xmlChar xsltLocaleChar;
#endif
-#endif
xsltLocale xsltNewLocale(const xmlChar *langName);
void xsltFreeLocale(xsltLocale locale);
Modified: trunk/win32/configure.js
==============================================================================
--- trunk/win32/configure.js (original)
+++ trunk/win32/configure.js Thu Jun 12 09:43:28 2008
@@ -47,6 +47,7 @@
var withZlib = false;
var withCrypto = true;
var withModules = false;
+var withLocale = true;
/* Win32 build options. */
var dirSep = "\\";
var compiler = "msvc";
@@ -106,6 +107,7 @@
txt += " zlib: Use zlib library (" + (withZlib? "yes" : "no") + ")\n";
txt += " crypto: Enable Crypto support (" + (withCrypto? "yes" : "no") + ")\n";
txt += " modules: Enable Module support (" + (withModules? "yes" : "no") + ")\n";
+ txt += " locale: Enable Locale support, requires msvcr80.dll (" + (withLocale? "yes" : "no") + ")\n";
txt += "\nWin32 build options, default value given in parentheses:\n\n";
txt += " compiler: Compiler to be used [msvc|mingw] (" + compiler + ")\n";
txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\n";
@@ -240,6 +242,10 @@
of.WriteLine(s.replace(/\ WITH_DEBUGGER\@/, withDebugger? "1" : "0"));
} else if (s.search(/\ WITH_MODULES\@/) != -1) {
of.WriteLine(s.replace(/\ WITH_MODULES\@/, withModules? "1" : "0"));
+ } else if (s.search(/\ XSLT_LOCALE_XLOCALE\@/) != -1) {
+ of.WriteLine(s.replace(/\ XSLT_LOCALE_XLOCALE\@/, "0"));
+ } else if (s.search(/\ XSLT_LOCALE_MSVCRT\@/) != -1) {
+ of.WriteLine(s.replace(/\ XSLT_LOCALE_MSVCRT\@/, withLocale? "1" : "0"));
} else if (s.search(/\ LIBXSLT_DEFAULT_PLUGINS_PATH\@/) != -1) {
of.WriteLine(s.replace(/\ LIBXSLT_DEFAULT_PLUGINS_PATH\@/, "NULL"));
} else
@@ -343,6 +349,8 @@
withCrypto = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "modules")
withModules = strToBool(arg.substring(opt.length + 1, arg.length));
+ else if (opt == "locale")
+ withLocale = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "compiler")
compiler = arg.substring(opt.length + 1, arg.length);
else if (opt == "cruntime")
@@ -477,6 +485,7 @@
txtOut += " With zlib: " + boolToStr(withZlib) + "\n";
txtOut += " Crypto: " + boolToStr(withCrypto) + "\n";
txtOut += " Modules: " + boolToStr(withModules) + "\n";
+txtOut += " Locale: " + boolToStr(withLocale) + "\n";
txtOut += "\n";
txtOut += "Win32 build configuration\n";
txtOut += "-------------------------\n";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]