2 # See if we need to provide readlinkat replacement.
4 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 # Written by Eric Blake.
11 AC_DEFUN([gl_FUNC_READLINKAT],
13 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 AC_CHECK_FUNCS_ONCE([readlinkat])
16 AC_REQUIRE([gl_FUNC_READLINK])
17 if test $ac_cv_func_readlinkat = no; then
20 AC_CACHE_CHECK([whether readlinkat signature is correct],
21 [gl_cv_decl_readlinkat_works],
25 /* Check whether original declaration has correct type. */
26 ssize_t readlinkat (int, char const *, char *, size_t);]])],
27 [gl_cv_decl_readlinkat_works=yes],
28 [gl_cv_decl_readlinkat_works=no])])
29 # Assume readlinkat has the same bugs as readlink,
30 # as is the case on OS X 10.10 with trailing slashes.
31 case $gl_cv_decl_readlinkat_works,$gl_cv_func_readlink_trailing_slash,$gl_cv_func_readlink_truncate in