vlc | branch: master | Rémi Denis-Courmont <r...@remlab.net> | Thu Feb 22 
21:51:05 2018 +0200| [192c77e42d5b4151f1ea884882ead50056f3e28b] | committer: 
Rémi Denis-Courmont

configure: test for newlocale() separate from uselocale()

As NetBSD only implements a barely sensical subset of the locale_t API.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=192c77e42d5b4151f1ea884882ead50056f3e28b
---

 configure.ac         |  2 +-
 include/vlc_fixups.h | 24 +++++++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 705e71ca41..6573e9b99a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -584,7 +584,7 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r 
isatty memalign mkostemp mmap open_memstream openat pipe2 pread posix_fadvise 
posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale])
+AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r 
isatty memalign mkostemp mmap open_memstream newlocale openat pipe2 pread 
posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime 
uselocale])
 AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir ffsll flockfile 
fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv 
strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof 
strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])
 AC_REPLACE_FUNCS([gettimeofday])
 AC_CHECK_FUNC(fdatasync,,
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 4c3af3bd3b..7f819bbb27 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -320,16 +320,13 @@ void *aligned_alloc(size_t, size_t);
 
 /* locale.h */
 #ifndef HAVE_USELOCALE
-#define LC_ALL_MASK      0
-#define LC_NUMERIC_MASK  0
-#define LC_MESSAGES_MASK 0
-#define LC_GLOBAL_LOCALE ((locale_t)(uintptr_t)1)
+# ifndef HAVE_NEWLOCALE
+#  define LC_ALL_MASK      0
+#  define LC_NUMERIC_MASK  0
+#  define LC_MESSAGES_MASK 0
+#  define LC_GLOBAL_LOCALE ((locale_t)(uintptr_t)1)
 typedef void *locale_t;
-static inline locale_t uselocale(locale_t loc)
-{
-    (void)loc;
-    return NULL;
-}
+
 static inline void freelocale(locale_t loc)
 {
     (void)loc;
@@ -339,6 +336,15 @@ static inline locale_t newlocale(int mask, const char * 
locale, locale_t base)
     (void)mask; (void)locale; (void)base;
     return NULL;
 }
+# else
+#  include <locale.h>
+# endif
+
+static inline locale_t uselocale(locale_t loc)
+{
+    (void)loc;
+    return NULL;
+}
 #endif
 
 #if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert)

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to