3 dnl Copyright (C) 2009-2024 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.
8 # See if we need to provide mkfifoat/mknodat replacement.
10 # Written by Eric Blake.
12 AC_DEFUN([gl_FUNC_MKFIFOAT],
14 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
15 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
17 dnl Persuade glibc <sys/stat.h> to declare mkfifoat() and mknodat().
18 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
20 AC_REQUIRE([gl_FUNC_OPENAT])
22 gl_CHECK_FUNCS_ANDROID_MACOS([mknodat], [[#include <sys/stat.h>]])
23 gl_CHECK_FUNCS_ANDROID_MACOS([mkfifoat], [[#include <sys/stat.h>]])
24 if test $ac_cv_func_mkfifoat = yes; then
25 dnl Check for AIX 7.2 bug and macOS 14 bugs with trailing slash.
26 AC_CACHE_CHECK([whether mkfifoat rejects trailing slashes],
27 [gl_cv_func_mkfifoat_works],
36 /* This test fails on AIX 7.2. */
37 if (!mkfifoat (AT_FDCWD, "conftest.tmp/", 0600))
39 /* This test fails on macOS 14. */
40 if (!symlink ("conftest.fifo", "conftest.tmp")
41 && !mkfifoat (AT_FDCWD, "conftest.tmp/", 0600))
46 [gl_cv_func_mkfifoat_works=yes],
47 [gl_cv_func_mkfifoat_works=no],
49 # Guess yes on Linux systems.
50 linux-* | linux) gl_cv_func_mkfifoat_works="guessing yes" ;;
51 # Guess yes on glibc systems.
52 *-gnu* | gnu*) gl_cv_func_mkfifoat_works="guessing yes" ;;
53 # Guess no on macOS systems.
54 darwin*) gl_cv_func_mkfifoat_works="guessing no" ;;
55 # Guess no on AIX systems.
56 aix*) gl_cv_func_mkfifoat_works="guessing no" ;;
57 # If we don't know, obey --enable-cross-guesses.
58 *) gl_cv_func_mkfifoat_works="$gl_cross_guess_normal" ;;
63 case "$gl_cv_func_mkfifoat_works" in
67 dnl mknodat() has the same bug as mkfifoat().
72 # No known system has mkfifoat but not mknodat
74 case "$gl_cv_onwards_func_mkfifoat" in
75 future*) REPLACE_MKFIFOAT=1 ;;
78 case "$gl_cv_onwards_func_mknodat" in
79 future*) REPLACE_MKNODAT=1 ;;