Debian Codegraph @

m4/readlinkat.m4

raw
1 # serial 8
2 # See if we need to provide readlinkat replacement.
3
4 dnl Copyright (C) 2009-2023 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.
8
9 # Written by Eric Blake.
10
11 AC_DEFUN([gl_FUNC_READLINKAT],
12 [
13 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
16 AC_REQUIRE([gl_FUNC_READLINK])
17 if test $ac_cv_func_readlinkat = no; then
18 HAVE_READLINKAT=0
19 case "$gl_cv_onwards_func_readlinkat" in
20 future*) REPLACE_READLINKAT=1 ;;
21 esac
22 else
23 AC_CACHE_CHECK([whether readlinkat signature is correct],
24 [gl_cv_decl_readlinkat_works],
25 [AC_COMPILE_IFELSE(
26 [AC_LANG_PROGRAM(
27 [[#include <unistd.h>
28 /* Check whether original declaration has correct type. */
29 ssize_t readlinkat (int, char const *, char *, size_t);]])],
30 [gl_cv_decl_readlinkat_works=yes],
31 [gl_cv_decl_readlinkat_works=no])])
32 # Assume readlinkat has the same bugs as readlink,
33 # as is the case on OS X 10.10 with trailing slashes.
34 case $gl_cv_decl_readlinkat_works,$gl_cv_func_readlink_trailing_slash,$gl_cv_func_readlink_truncate in
35 *yes,*yes,*yes)
36 ;;
37 *)
38 REPLACE_READLINKAT=1
39 ;;
40 esac
41 fi
42 ])