mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-29 15:41:13 +03:00
patch from Nick Wellnhofer and Roumen Petrov to fix some portability
* 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 svn path=/trunk/; revision=1478
This commit is contained in:
@ -1,3 +1,10 @@
|
||||
Thu Jun 12 11:23:23 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* 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
|
||||
|
||||
Tue Jun 3 18:26:26 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* configure.in libxslt/extra.c libxslt/Makefile.am libxslt/preproc.c
|
||||
|
@ -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. */
|
||||
|
51
configure.in
51
configure.in
@ -106,9 +106,18 @@ AC_PATH_PROG(TAR, tar, /bin/tar)
|
||||
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 @@ AC_TRY_RUN(
|
||||
#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
|
||||
|
@ -123,6 +123,19 @@ extern "C" {
|
||||
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "@LIBXSLT_DEFAULT_PLUGINS_PATH@"
|
||||
#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:
|
||||
*
|
||||
|
@ -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 @@ typedef locale_t xsltLocale;
|
||||
#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,12 +34,13 @@ typedef wchar_t xsltLocaleChar;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef XSLT_LOCALE_NONE
|
||||
#define XSLT_LOCALE_NONE
|
||||
#endif
|
||||
|
||||
typedef void *xsltLocale;
|
||||
typedef xmlChar xsltLocaleChar;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
xsltLocale xsltNewLocale(const xmlChar *langName);
|
||||
|
@ -47,6 +47,7 @@ var withIconv = true;
|
||||
var withZlib = false;
|
||||
var withCrypto = true;
|
||||
var withModules = false;
|
||||
var withLocale = true;
|
||||
/* Win32 build options. */
|
||||
var dirSep = "\\";
|
||||
var compiler = "msvc";
|
||||
@ -106,6 +107,7 @@ function usage()
|
||||
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 @@ function configureXslt()
|
||||
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 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
|
||||
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 += " Use iconv: " + boolToStr(withIconv) + "\n";
|
||||
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";
|
||||
|
Reference in New Issue
Block a user