[vlc-commits] configure: test for newlocale() separate from uselocale()

Rémi Denis-Courmont git at videolan.org
Thu Feb 22 21:13:11 CET 2018


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Feb 22 21:51:05 2018 +0200| [4a90f3313fd2c72ac2a161b74529fa6ddb474625] | 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.

(cherry picked from commit 192c77e42d5b4151f1ea884882ead50056f3e28b)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

Conflicts:
	configure.ac

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4a90f3313fd2c72ac2a161b74529fa6ddb474625
---

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

diff --git a/configure.ac b/configure.ac
index 5bf2a0366e..225bcae987 100644
--- a/configure.ac
+++ b/configure.ac
@@ -590,7 +590,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 lstat 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 lstat memalign mkostemp mmap newlocale open_memstream 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 f1bcd06ce9..3003a154f6 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)



More information about the vlc-commits mailing list