xref: /OK3568_Linux_fs/buildroot/package/popt/0005-fix-build-without-mbstate_t.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From e4788a0f9d820574a165b2609ff16b717ce0baba Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Sat, 19 Sep 2020 18:51:15 +0200
4Subject: [PATCH] fix build without mbstate_t
5
6Commit 41911aac46d69df6a205af59d60f23a418b0e875 tried to fix build
7without wchar by checking for the availability of wchar.h however some
8toolchains have wchar.h but does not define mbstate_t and mbsrtowcs so
9replace HAVE_WCHAR_H by HAVE_MBSRTOWCS
10
11Fixes:
12 - http://autobuild.buildroot.org/results/27f184af35468941173628e5e847a284c0b80d73
13
14Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
15[Upstream status:
16https://github.com/rpm-software-management/popt/pull/51]
17---
18 configure.ac   | 4 ++--
19 src/popthelp.c | 4 ++--
20 2 files changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/configure.ac b/configure.ac
23index 1fce6df..442086b 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -18,7 +18,7 @@ LT_INIT
27
28 AC_SYS_LARGEFILE
29
30-AC_CHECK_HEADERS([fnmatch.h glob.h langinfo.h libintl.h mcheck.h stdalign.h wchar.h])
31+AC_CHECK_HEADERS([fnmatch.h glob.h langinfo.h libintl.h mcheck.h stdalign.h])
32
33 # For some systems we know that we have ld_version scripts.
34 # Use it then as default.
35@@ -50,7 +50,7 @@ AC_ARG_ENABLE([build-gcov],
36 ])
37
38 AC_SEARCH_LIBS([setreuid], [ucb])
39-AC_CHECK_FUNCS([getuid geteuid iconv mtrace secure_getenv __secure_getenv setreuid setuid stpcpy strerror vasprintf srandom glob_pattern_p])
40+AC_CHECK_FUNCS([getuid geteuid iconv mtrace secure_getenv __secure_getenv setreuid setuid stpcpy strerror vasprintf srandom glob_pattern_p mbsrtowcs])
41
42 AM_GNU_GETTEXT_VERSION([0.18.2])
43 AM_GNU_GETTEXT([external])
44diff --git a/src/popthelp.c b/src/popthelp.c
45index f604516..b4ab9b4 100644
46--- a/src/popthelp.c
47+++ b/src/popthelp.c
48@@ -15,7 +15,7 @@
49 #include <sys/ioctl.h>
50 #endif
51
52-#ifdef HAVE_WCHAR_H
53+#ifdef HAVE_MBSRTOWCS
54 #include <wchar.h>			/* for mbsrtowcs */
55 #endif
56 #include "poptint.h"
57@@ -117,7 +117,7 @@ static size_t maxColumnWidth(FILE *fp)
58 static inline size_t stringDisplayWidth(const char *s)
59 {
60     size_t n = strlen(s);
61-#ifdef HAVE_WCHAR_H
62+#ifdef HAVE_MBSRTOWCS
63     mbstate_t t;
64
65     memset ((void *)&t, 0, sizeof (t));	/* In initial state.  */
66--
672.28.0
68
69