This file is part of MXE. See index.html for further information. This patch has been taken from: https://github.com/file/file/commit/fc71117317bfe752a1adc2512530ec8e59c54a0c.patch From fc71117317bfe752a1adc2512530ec8e59c54a0c Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sat, 11 Oct 2014 15:03:16 +0000 Subject: [PATCH] locale autoconf fixes --- ChangeLog | 5 +++++ configure.ac | 4 ++-- src/file.c | 4 +++- src/file.h | 5 ++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b1bad9..b42e3d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-10-11 15:02 Christos Zoulas + + * fix autoconf glue for setlocale and locale_t; some OS's + have locale_t in xlocale.h + 2014-10-10 15:01 Christos Zoulas * release 5.20 diff --git a/configure.ac b/configure.ac index 545c6bd..e0b1c39 100644 --- a/configure.ac +++ b/configure.ac @@ -82,7 +82,7 @@ AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) AC_CHECK_HEADERS(zlib.h) @@ -138,7 +138,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale) +AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) diff --git a/src/file.c b/src/file.c index 8720772..b6c2c38 100644 --- a/src/file.c +++ b/src/file.c @@ -142,7 +142,9 @@ main(int argc, char *argv[]) const char *magicfile = NULL; /* where the magic is */ /* makes islower etc work for other langs */ +#ifdef HAVE_SETLOCALE (void)setlocale(LC_CTYPE, ""); +#endif #ifdef __EMX__ /* sh-like wildcard expansion! Shouldn't hurt at least ... */ diff --git a/src/file.h b/src/file.h index 85e3936..fdbc889 100644 --- a/src/file.h +++ b/src/file.h @@ -474,6 +474,9 @@ protected int file_os2_apptype(struct magic_set *, const char *, const void *, #if defined(HAVE_LOCALE_H) #include #endif +#if defined(HAVE_XLOCALE_H) +#include +#endif typedef struct { const char *pat;