xref: /OK3568_Linux_fs/buildroot/package/popt/0002-Detect-glob_pattern_p.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 3938da1286534e4b280340411336eed5b6311d1b Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3*4882a593SmuzhiyunDate: Wed, 15 Jul 2020 23:21:32 +0200
4*4882a593SmuzhiyunSubject: [PATCH] Detect glob_pattern_p()
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe current popt build system tests the existence of <glob.h>, and
7*4882a593Smuzhiyunthen assumes that if __GLIBC__ is defined, then glob_pattern_p() must
8*4882a593Smuzhiyunbe available. Unfortunately, that's not true with uClibc: <glob.h> may
9*4882a593Smuzhiyunbe installed, but not necessarily the GNU glob extensions... and
10*4882a593SmuzhiyunuClibc defines __GLIBC__. This is causing build issues with certain
11*4882a593SmuzhiyunuClibc toolchains that do not have GNU glob extensions enabled.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunTo fix this, this patch adds an AC_CHECK_FUNCS() test for
14*4882a593Smuzhiyunglob_pattern_p, and uses that to find out whether glob_pattern_p() is
15*4882a593Smuzhiyunavailable or not.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18*4882a593Smuzhiyun[Retrieved (and slightly updated) from:
19*4882a593Smuzhiyunhttps://git.buildroot.net/buildroot/tree/package/popt/0003-glob-detection.patch]
20*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
21*4882a593Smuzhiyun[Retrieved from:
22*4882a593Smuzhiyunhttps://github.com/rpm-software-management/popt/commit/3938da1286534e4b280340411336eed5b6311d1b]
23*4882a593Smuzhiyun---
24*4882a593Smuzhiyun configure.ac     | 2 +-
25*4882a593Smuzhiyun src/poptconfig.c | 2 +-
26*4882a593Smuzhiyun 2 files changed, 2 insertions(+), 2 deletions(-)
27*4882a593Smuzhiyun
28*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
29*4882a593Smuzhiyunindex a5568c4..3b71d1a 100755
30*4882a593Smuzhiyun--- a/configure.ac
31*4882a593Smuzhiyun+++ b/configure.ac
32*4882a593Smuzhiyun@@ -50,7 +50,7 @@ AC_ARG_ENABLE(build-gcov,
33*4882a593Smuzhiyun ])
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun AC_SEARCH_LIBS(setreuid, [ucb])
36*4882a593Smuzhiyun-AC_CHECK_FUNCS(getuid geteuid iconv mtrace secure_getenv __secure_getenv setreuid setuid stpcpy strerror vasprintf srandom)
37*4882a593Smuzhiyun+AC_CHECK_FUNCS(getuid geteuid iconv mtrace secure_getenv __secure_getenv setreuid setuid stpcpy strerror vasprintf srandom glob_pattern_p)
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun AM_GNU_GETTEXT_VERSION([0.18.2])
40*4882a593Smuzhiyun AM_GNU_GETTEXT([external])
41*4882a593Smuzhiyundiff --git a/src/poptconfig.c b/src/poptconfig.c
42*4882a593Smuzhiyunindex 9d97ccd..b4d1b76 100644
43*4882a593Smuzhiyun--- a/src/poptconfig.c
44*4882a593Smuzhiyun+++ b/src/poptconfig.c
45*4882a593Smuzhiyun@@ -21,7 +21,7 @@
46*4882a593Smuzhiyun #if defined(HAVE_GLOB_H)
47*4882a593Smuzhiyun #include <glob.h>
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun-#if !defined(__GLIBC__)
50*4882a593Smuzhiyun+#if !defined(HAVE_GLOB_PATTERN_P)
51*4882a593Smuzhiyun /* Return nonzero if PATTERN contains any metacharacters.
52*4882a593Smuzhiyun    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
53*4882a593Smuzhiyun static int
54