| 1 |
# unlinkat.m4 |
| 2 |
# serial 2 |
| 3 |
dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
# Written by Jim Meyering. |
| 10 |
|
| 11 |
AC_DEFUN([gl_FUNC_UNLINKAT], |
| 12 |
[ |
| 13 |
AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 14 |
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 15 |
AC_CHECK_FUNCS_ONCE([unlinkat]) |
| 16 |
AC_REQUIRE([gl_FUNC_UNLINK]) |
| 17 |
AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) |
| 18 |
if test $ac_cv_func_unlinkat = no; then |
| 19 |
HAVE_UNLINKAT=0 |
| 20 |
else |
| 21 |
case "$gl_cv_func_lstat_dereferences_slashed_symlink" in |
| 22 |
*no) |
| 23 |
# Solaris 9 has *at functions, but uniformly mishandles trailing |
| 24 |
# slash in all of them. |
| 25 |
REPLACE_UNLINKAT=1 |
| 26 |
;; |
| 27 |
*) |
| 28 |
# GNU/Hurd has unlinkat, but it has the same bug as unlink. |
| 29 |
# Darwin has unlinkat, but it has the same UNLINK_PARENT_BUG. |
| 30 |
if test $REPLACE_UNLINK = 1; then |
| 31 |
REPLACE_UNLINKAT=1 |
| 32 |
fi |
| 33 |
;; |
| 34 |
esac |
| 35 |
fi |
| 36 |
]) |