blob: e587b05d2755e4f974ae3bfb1c3f4428625402dc [file] [log] [blame]
From 02a0cf3635eab8b10a5a47a56aa905d925f669a8 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
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 b14ba46797..15cb4edcfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -537,7 +537,7 @@ need_libc=false
dnl Check for usual libc functions
AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
-AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
+AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap open_memstream openat pread posix_fadvise posix_madvise setlocale strerror_l stricmp strnicmp strptime uselocale])
AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
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.3