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