+Detect glob_pattern_p()
+
+The current popt build system tests the existence of <glob.h>, and
+then assumes that if __GLIBC__ is defined, then glob_pattern_p() must
+be available. Unfortunately, that's not true with uClibc: <glob.h> may
+be installed, but not necessarily the GNU glob extensions... and
+uClibc defines __GLIBC__. This is causing build issues with certain
+uClibc toolchains that do not have GNU glob extensions enabled.
+
+To fix this, this patch adds an AC_CHECK_FUNCS() test for
+glob_pattern_p, and uses that to find out whether glob_pattern_p() is
+available or not.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -81,7 +81,7 @@
+ AC_CHECK_FUNC(setreuid, [], [
+ AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
+ ])
+-AC_CHECK_FUNCS(getuid geteuid iconv mtrace __secure_getenv setregid stpcpy strerror vasprintf srandom)
++AC_CHECK_FUNCS(getuid geteuid iconv mtrace __secure_getenv setregid stpcpy strerror vasprintf srandom glob_pattern_p)
+
+ AM_GNU_GETTEXT([external])
+ AM_ICONV_LINK
+Index: b/poptconfig.c
+===================================================================
+--- a/poptconfig.c
++++ b/poptconfig.c
+@@ -42,7 +42,7 @@
+ /*@=declundef =exportheader =incondefs =protoparammatch =redecl =type @*/
+ #endif /* __LCLINT__ */
+
+-#if !defined(__GLIBC__)
++#if !defined(HAVE_GLOB_PATTERN_P)
+ /* Return nonzero if PATTERN contains any metacharacters.
+ Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
+ static int