Debian Codegraph @

m4/mkfifoat.m4

raw
1 # serial 10
2 # See if we need to provide mkfifoat/mknodat 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_MKFIFOAT],
12 [
13 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
15
16 dnl Persuade glibc <sys/stat.h> to declare mkfifoat() and mknodat().
17 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
18
19 AC_REQUIRE([gl_FUNC_OPENAT])
20
21 gl_CHECK_FUNCS_ANDROID_MACOS([mknodat], [[#include <sys/stat.h>]])
22 gl_CHECK_FUNCS_ANDROID_MACOS([mkfifoat], [[#include <sys/stat.h>]])
23 if test $ac_cv_func_mkfifoat = yes; then
24 dnl Check for AIX 7.2 bug with trailing slash.
25 AC_CACHE_CHECK([whether mkfifoat rejects trailing slashes],
26 [gl_cv_func_mkfifoat_works],
27 [rm -f conftest.tmp
28 AC_RUN_IFELSE(
29 [AC_LANG_PROGRAM(
30 [[#include <fcntl.h>
31 #include <sys/stat.h>
32 ]],
33 [[int result = 0;
34 if (!mkfifoat (AT_FDCWD, "conftest.tmp/", 0600))
35 result |= 1;
36 return result;
37 ]])
38 ],
39 [gl_cv_func_mkfifoat_works=yes],
40 [gl_cv_func_mkfifoat_works=no],
41 [case "$host_os" in
42 # Guess yes on Linux systems.
43 linux-* | linux) gl_cv_func_mkfifoat_works="guessing yes" ;;
44 # Guess yes on glibc systems.
45 *-gnu* | gnu*) gl_cv_func_mkfifoat_works="guessing yes" ;;
46 # Guess no on AIX systems.
47 aix*) gl_cv_func_mkfifoat_works="guessing no" ;;
48 # If we don't know, obey --enable-cross-guesses.
49 *) gl_cv_func_mkfifoat_works="$gl_cross_guess_normal" ;;
50 esac
51 ])
52 rm -f conftest.tmp
53 ])
54 case "$gl_cv_func_mkfifoat_works" in
55 *yes) ;;
56 *)
57 REPLACE_MKFIFOAT=1
58 dnl mknodat() has the same bug as mkfifoat().
59 REPLACE_MKNODAT=1
60 ;;
61 esac
62 else
63 # No known system has mkfifoat but not mknodat
64 HAVE_MKFIFOAT=0
65 case "$gl_cv_onwards_func_mkfifoat" in
66 future*) REPLACE_MKFIFOAT=1 ;;
67 esac
68 HAVE_MKNODAT=0
69 case "$gl_cv_onwards_func_mknodat" in
70 future*) REPLACE_MKNODAT=1 ;;
71 esac
72 fi
73 ])