blob: cd839b73799b4c27899ff58cc137260e3f60e909 [file] [log] [blame]
From 0435cf37308652af1cf244b6429e919fa7ffaa95 Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Tue, 1 May 2018 22:31:23 +0200
Subject: [PATCH] Don't assume strerror_l() is available
Fix compile error
CCLD vlc
/home/br/br3/output/build/vlc-2.2.1/src/.libs/libvlccore.so: undefined reference to `strerror_l'
Code for #else condition was taken from
http://patches.osdyson.org/patch/series/view/vlc/2.2.0~rc2-1+dyson2/dyson.patch
[Bernd: rebased for vlc-3.0.6 & 3.0.9.2]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
configure.ac | 2 +-
src/posix/error.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index dfb4c1c329..bfe43512a2 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 getmntent_r 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_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getmntent_r getpwuid_r isatty lstat memalign mkostemp mmap newlocale open_memstream openat pipe2 pread posix_fadvise posix_madvise posix_memalign setlocale strerror_l stricmp strnicmp strptime uselocale])
AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lfind 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/src/posix/error.c b/src/posix/error.c
index db51004601..b4aa6fb3ca 100644
--- a/src/posix/error.c
+++ b/src/posix/error.c
@@ -31,6 +31,7 @@
static const char *vlc_strerror_l(int errnum, const char *lname)
{
+#ifdef HAVE_STRERROR_L
int saved_errno = errno;
locale_t loc = newlocale(LC_MESSAGES_MASK, lname, (locale_t)0);
@@ -51,6 +52,9 @@ static const char *vlc_strerror_l(int errnum, const char *lname)
const char *buf = strerror_l(errnum, loc);
freelocale(loc);
+#else
+ const char *buf = strerror(errnum);
+#endif
return buf;
}
--
2.14.4