hc
2023-11-22 f743a7adbd6e230d66a6206fa115b59fec2d88eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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