2 # See if we need to provide mkfifo replacement.
4 dnl Copyright (C) 2009-2011 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_CHECK_FUNCS_ONCE([mkfifo])
15 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],
41 [gl_cv_func_mkfifo_works="guessing no"])
42 rm -f conftest.tmp conftest.lnk])
43 if test "$gl_cv_func_mkfifo_works" != yes; then
44 AC_DEFINE([MKFIFO_TRAILING_SLASH_BUG], [1], [Define to 1 if mkfifo
45 does not reject trailing slash])