xref: /OK3568_Linux_fs/buildroot/package/vlc/0005-Don-t-assume-strerror_l-is-available.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 0435cf37308652af1cf244b6429e919fa7ffaa95 Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Tue, 1 May 2018 22:31:23 +0200
4Subject: [PATCH] Don't assume strerror_l() is available
5
6Fix compile error
7
8  CCLD     vlc
9/home/br/br3/output/build/vlc-2.2.1/src/.libs/libvlccore.so: undefined reference to `strerror_l'
10
11Code for #else condition was taken from
12http://patches.osdyson.org/patch/series/view/vlc/2.2.0~rc2-1+dyson2/dyson.patch
13
14[Bernd: rebased for vlc-3.0.6 & 3.0.9.2]
15Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
16---
17 configure.ac      | 2 +-
18 src/posix/error.c | 4 ++++
19 2 files changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/configure.ac b/configure.ac
22index dfb4c1c329..bfe43512a2 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -590,7 +590,7 @@ dnl Check for system libs needed
26 need_libc=false
27
28 dnl Check for usual libc functions
29-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])
30+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])
31 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])
32 AC_REPLACE_FUNCS([gettimeofday])
33 AC_CHECK_FUNC(fdatasync,,
34diff --git a/src/posix/error.c b/src/posix/error.c
35index db51004601..b4aa6fb3ca 100644
36--- a/src/posix/error.c
37+++ b/src/posix/error.c
38@@ -31,6 +31,7 @@
39
40 static const char *vlc_strerror_l(int errnum, const char *lname)
41 {
42+#ifdef HAVE_STRERROR_L
43     int saved_errno = errno;
44     locale_t loc = newlocale(LC_MESSAGES_MASK, lname, (locale_t)0);
45
46@@ -51,6 +52,9 @@ static const char *vlc_strerror_l(int errnum, const char *lname)
47     const char *buf = strerror_l(errnum, loc);
48
49     freelocale(loc);
50+#else
51+    const char *buf = strerror(errnum);
52+#endif
53     return buf;
54 }
55
56--
572.14.4
58
59