From 5d0926f03527ed236dd045f3ca77f44628fc73a6 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Tue, 1 Aug 2023 22:14:06 +0200 Subject: [PATCH] Detect by configure availability of readlinkat --- configure | 8 ++++++++ configure.in | 2 ++ h/gclincl.h.in | 3 +++ o/unixfsys.c | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git configure configure index 8d086abaa..e10fa1af1 100755 --- configure +++ configure @@ -7865,6 +7865,14 @@ else $as_nop fi +# Not each system has readlinkat +ac_fn_c_check_func "$LINENO" "readlinkat" "ac_cv_func_readlinkat" +if test "x$ac_cv_func_readlinkat" = xyes +then : + printf "%s\n" "#define HAVE_READLINKAT 1" >>confdefs.h + +fi + ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioctl_h" = xyes diff --git configure.in configure.in index 4628ea2a0..e4f0a7a92 100644 --- configure.in +++ configure.in @@ -1601,6 +1601,8 @@ AC_CHECK_FUNCS(getwd) AC_CHECK_FUNC(uname, , AC_DEFINE(NO_UNAME,1,[no uname call])) AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD)) +# Not each system has readlinkat +AC_CHECK_FUNCS(readlinkat) AC_CHECK_HEADERS(sys/ioctl.h) diff --git h/gclincl.h.in h/gclincl.h.in index 343e7ddda..bd16cd438 100644 --- h/gclincl.h.in +++ h/gclincl.h.in @@ -183,6 +183,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H +/* Define to 1 if you have the `readlinkat' function. */ +#undef HAVE_READLINKAT + /* have readline completion matches */ #undef HAVE_RL_COMPENTRY_FUNC_T diff --git o/unixfsys.c o/unixfsys.c index 6e1ea8b8f..ad56e7a7a 100755 --- o/unixfsys.c +++ o/unixfsys.c @@ -268,7 +268,7 @@ DEFUN_NEW("READLINKAT",object,fSreadlinkat,SI,2,2,NONE,OI,OO,OO,OO,(fixnum d,obj massert(z1st.st_self,z1); FN1[z1]=0; -#ifndef __MINGW32__ +#ifdef HAVE_READLINKAT massert((l=readlinkat(d ? dirfd((DIR *)d) : AT_FDCWD,FN1,FN2,sizeof(FN2)))>=0 && l