+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
/* 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. */
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>
#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
#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
#include <libxml/xmlstring.h>
-#ifdef HAVE_XLOCALE_H
-
-#define XSLT_LOCALE_XLOCALE
+#ifdef XSLT_LOCALE_XLOCALE
#include <locale.h>
#include <xlocale.h>
#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>
#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);
var withZlib = false;
var withCrypto = true;
var withModules = false;
+var withLocale = true;
/* Win32 build options. */
var dirSep = "\\";
var compiler = "msvc";
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";
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
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")
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";