diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-04-11 01:29:12 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-09-13 18:05:34 +0200 |
commit | 9d325e1d63869ff06878fa951fb963cbeea295eb (patch) | |
tree | f16c12e69f21ee0e44f8a7f32549e81183065880 | |
parent | 227de2b4df37bb1a2e16e331add6c973b99457d0 (diff) |
Android: disable include patterns if glob is unsupported
Because of missing glob() in NDK platforms before 28
-rw-r--r-- | conf/cf-lex.l | 10 | ||||
-rw-r--r-- | configure.ac | 9 |
2 files changed, 15 insertions, 4 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 9ea05e9d..07392228 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -27,13 +27,16 @@ %{ #undef REJECT /* Avoid name clashes */ +#include "sysdep/config.h" #include <errno.h> #include <stdlib.h> #include <stdarg.h> #include <stdint.h> #include <unistd.h> #include <libgen.h> +#ifdef HAVE_GLOB #include <glob.h> +#endif #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> @@ -461,7 +464,9 @@ cf_include(char *arg, int alen) struct include_file_stack *base_ifs = ifs; int new_depth, rv, i; char *patt; +#ifdef HAVE_GLOB glob_t g = {}; +#endif new_depth = ifs->depth + 1; if (new_depth > MAX_INCLUDE_DEPTH) @@ -491,6 +496,7 @@ cf_include(char *arg, int alen) return; } +#ifdef HAVE_GLOB /* Expand the pattern */ rv = glob(patt, GLOB_ERR | GLOB_NOESCAPE, NULL, &g); if (rv == GLOB_ABORTED) @@ -526,6 +532,10 @@ cf_include(char *arg, int alen) globfree(&g); enter_ifs(ifs); +#else + cf_error("Pattern match unsupported %s: %m", patt); + return; +#endif /* !HAVE_GLOB */ } static int diff --git a/configure.ac b/configure.ac index 3ec309bf..4b6c31cb 100644 --- a/configure.ac +++ b/configure.ac @@ -361,10 +361,11 @@ AC_C_BIGENDIAN( ) BIRD_CHECK_ANDROID_GLOB -if test "$bird_cv_lib_glob" = no ; then - AC_MSG_ERROR([glob.h not found.]) -elif test "$bird_cv_lib_glob" != yes ; then - LIBS="$LIBS $bird_cv_lib_glob" +if test "$bird_cv_lib_glob" != no ; then + AC_DEFINE([HAVE_GLOB], [1], [Define to 1 if you have glob()]) + if test "$bird_cv_lib_glob" != yes ; then + LIBS="$LIBS $bird_cv_lib_glob" + fi fi BIRD_CHECK_ANDROID_LOG |