From: Chih-Wei Huang Date: Mon, 14 Jun 2021 04:24:10 +0000 (+0800) Subject: configure: check if eaccess() is available X-Git-Tag: v1.2.5.1~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=76d1aa0cd7635f903bb1d48bb9c18279d46ec624;p=alsa-lib.git configure: check if eaccess() is available To fix the build error on Android: src/ucm/parser.c:2521:7: error: implicit declaration of function 'eaccess' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (eaccess(filename, R_OK)) ^ src/ucm/parser.c:2521:7: note: did you mean 'access'? Signed-off-by: Chih-Wei Huang Signed-off-by: Jaroslav Kysela --- diff --git a/configure.ac b/configure.ac index 60271b8a..635bfeae 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,7 @@ AC_HEADER_TIME dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_CHECK_FUNCS([uselocale]) +AC_CHECK_FUNCS([eaccess]) SAVE_LIBRARY_VERSION AC_SUBST(LIBTOOL_VERSION_INFO) diff --git a/src/ucm/parser.c b/src/ucm/parser.c index fccf5791..ee997800 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -2518,7 +2518,11 @@ int uc_mgr_scan_master_configs(const char **_list[]) snprintf(fn, sizeof(fn), "%s.conf", d_name); ucm_filename(filename, sizeof(filename), 2, d_name, fn); +#ifdef HAVE_EACCESS if (eaccess(filename, R_OK)) +#else + if (access(filename, R_OK)) +#endif continue; err = uc_mgr_config_load(2, filename, &cfg); diff --git a/src/ucm/ucm_cond.c b/src/ucm/ucm_cond.c index 0ed0b690..985a366b 100644 --- a/src/ucm/ucm_cond.c +++ b/src/ucm/ucm_cond.c @@ -305,7 +305,11 @@ static int if_eval_path(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval) return -EINVAL; } +#ifdef HAVE_EACCESS if (eaccess(path, amode)) +#else + if (access(path, amode)) +#endif return 0; return 1;