2 # See if we need to provide mkfifo replacement.
4 dnl Copyright (C) 2009-2017 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
15 AC_CHECK_FUNCS_ONCE([mkfifo])
16 if test $ac_cv_func_mkfifo = no; then
19 dnl Check for Solaris 9 and FreeBSD bug with trailing slash.
20 AC_CHECK_FUNCS_ONCE([lstat])
21 AC_CACHE_CHECK([whether mkfifo rejects trailing slashes],
22 [gl_cv_func_mkfifo_works],
23 [# Assume that if we have lstat, we can also check symlinks.
24 if test $ac_cv_func_lstat = yes; then
25 ln -s conftest.tmp conftest.lnk
29 [[#include <sys/stat.h>
32 if (!mkfifo ("conftest.tmp/", 0600))
35 if (!mkfifo ("conftest.lnk/", 0600))
40 [gl_cv_func_mkfifo_works=yes], [gl_cv_func_mkfifo_works=no],
42 # Guess yes on glibc systems.
43 *-gnu*) gl_cv_func_mkfifo_works="guessing yes" ;;
44 # If we don't know, assume the worst.
45 *) gl_cv_func_mkfifo_works="guessing no" ;;
48 rm -f conftest.tmp conftest.lnk])
49 case "$gl_cv_func_mkfifo_works" in
52 AC_DEFINE([MKFIFO_TRAILING_SLASH_BUG], [1], [Define to 1 if mkfifo
53 does not reject trailing slash])