0002-Detect-glob_pattern_p.patch 2.1 KB

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