summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2008-06-12 09:43:28 +0000
committerDaniel Veillard <veillard@src.gnome.org>2008-06-12 09:43:28 +0000
commit80353190270f6b742aea1969cb1d1de899764fb1 (patch)
tree588593217d4f047d2c5ae209bac9545058a41ed3 /configure.in
parent7d1f6c338ee0305c4b15323618cb4ff293f59227 (diff)
downloadlibxslt-80353190270f6b742aea1969cb1d1de899764fb1.tar.gz
libxslt-80353190270f6b742aea1969cb1d1de899764fb1.tar.bz2
libxslt-80353190270f6b742aea1969cb1d1de899764fb1.zip
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
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in55
1 files changed, 36 insertions, 19 deletions
diff --git a/configure.in b/configure.in
index 7ad6b898..36d9fd51 100644
--- a/configure.in
+++ b/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