2 # See if we need to provide mkfifo replacement.
4 dnl Copyright (C) 2009-2018 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_MKFIFO],
13 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16 dnl We can't use AC_CHECK_FUNC here, because mkfifo() is defined as a
17 dnl static inline function when compiling for Android 4.4 or older.
18 AC_CACHE_CHECK([for mkfifo], [gl_cv_func_mkfifo],
21 [[#include <sys/stat.h>]],
22 [[return mkfifo("/",0);]])
24 [gl_cv_func_mkfifo=yes],
25 [gl_cv_func_mkfifo=no])
27 if test $gl_cv_func_mkfifo = no; then
30 dnl Check for Solaris 9 and FreeBSD bug with trailing slash.
31 AC_CHECK_FUNCS_ONCE([lstat])
32 AC_CACHE_CHECK([whether mkfifo rejects trailing slashes],
33 [gl_cv_func_mkfifo_works],
34 [# Assume that if we have lstat, we can also check symlinks.
35 if test $ac_cv_func_lstat = yes; then
36 ln -s conftest.tmp conftest.lnk
40 [[#include <sys/stat.h>
43 if (!mkfifo ("conftest.tmp/", 0600))
46 if (!mkfifo ("conftest.lnk/", 0600))
51 [gl_cv_func_mkfifo_works=yes], [gl_cv_func_mkfifo_works=no],
53 # Guess yes on Linux systems.
54 linux-* | linux) gl_cv_func_mkfifo_works="guessing yes" ;;
55 # Guess yes on glibc systems.
56 *-gnu* | gnu*) gl_cv_func_mkfifo_works="guessing yes" ;;
57 # If we don't know, assume the worst.
58 *) gl_cv_func_mkfifo_works="guessing no" ;;
61 rm -f conftest.tmp conftest.lnk])
62 case "$gl_cv_func_mkfifo_works" in
65 AC_DEFINE([MKFIFO_TRAILING_SLASH_BUG], [1], [Define to 1 if mkfifo
66 does not reject trailing slash])