]> granicus.if.org Git - file/commitdiff
locale autoconf fixes
authorChristos Zoulas <christos@zoulas.com>
Sat, 11 Oct 2014 15:03:16 +0000 (15:03 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 11 Oct 2014 15:03:16 +0000 (15:03 +0000)
ChangeLog
configure.ac
src/file.c
src/file.h

index 2b1bad9dd355aec57fcee8ad34e9972ee395be7a..b42e3d789838afc73402fe2cd851a7228b5ddf79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-11  15:02  Christos Zoulas <christos@zoulas.com>
+
+       * fix autoconf glue for setlocale and locale_t; some OS's
+         have locale_t in xlocale.h
+
 2014-10-10  15:01  Christos Zoulas <christos@zoulas.com>
 
        * release 5.20
index 545c6bd74298e3ec3e3e9a7f26d7239927d83799..e0b1c39cacf11d446b6b3bc6aff834e483c5639a 100644 (file)
@@ -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)
index b18fcbbd12cde1223b3bfaf49d71386992ba88f8..aac9efaefa6325ef04dd8e28d41ec56101e8c5ee 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: file.c,v 1.154 2014/09/10 18:41:51 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.155 2014/10/11 15:03:16 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -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 ... */
index b8056f030000825a27bc80166f31c20a5327e49c..723a6495272aa8eeb24252f3406dcc7ef1ce5ef4 100644 (file)
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.154 2014/09/10 18:41:51 christos Exp $
+ * @(#)$File: file.h,v 1.155 2014/10/11 15:03:16 christos Exp $
  */
 
 #ifndef __file_h__
@@ -474,6 +474,9 @@ protected int file_os2_apptype(struct magic_set *, const char *, const void *,
 #if defined(HAVE_LOCALE_H)
 #include <locale.h>
 #endif
+#if defined(HAVE_XLOCALE_H)
+#include <xlocale.h>
+#endif
 
 typedef struct {
        const char *pat;