Mercurial > hg > octave-shane > gnulib-hg
annotate m4/mknod.m4 @ 13850:c39e4e516aee
mknod: avoid false failure with dash
* m4/mknod.m4 (gl_FUNC_MKNOD): Use portable shell syntax.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Christian Weisgerber <naddy@mips.inka.de> |
---|---|
date | Thu, 11 Nov 2010 11:08:18 -0700 |
parents | a4b0494e2b96 |
children | 97fc9a21a8fb |
rev | line source |
---|---|
13850
c39e4e516aee
mknod: avoid false failure with dash
Christian Weisgerber <naddy@mips.inka.de>
parents:
13540
diff
changeset
|
1 # serial 3 |
12267 | 2 # See if we need to provide mknod replacement. |
3 | |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12267
diff
changeset
|
4 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
12267 | 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_MKNOD], | |
12 [ | |
13 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | |
14 AC_REQUIRE([gl_FUNC_MKFIFO]) | |
15 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | |
16 AC_CHECK_FUNCS_ONCE([mknod]) | |
17 if test $ac_cv_func_mknod = no; then | |
18 HAVE_MKNOD=0 | |
19 AC_LIBOBJ([mknod]) | |
20 else | |
21 dnl Detect BSD bug, where mknod requires root privileges to create fifo. | |
22 AC_CACHE_CHECK([whether mknod can create fifo without root privileges], | |
23 [gl_cv_func_mknod_works], | |
24 [AC_RUN_IFELSE( | |
25 [AC_LANG_PROGRAM( | |
26 [[#include <sys/stat.h> | |
27 #include <unistd.h> | |
28 ]], [[/* Indeterminate for super-user, assume no. Why are you running | |
29 configure as root, anyway? */ | |
13540
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
30 if (!geteuid ()) return 99; |
12267 | 31 if (mknod ("conftest.fifo", S_IFIFO | 0600, 0)) return 2;]])], |
13540
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
32 [gl_cv_func_mknod_works=yes], |
13850
c39e4e516aee
mknod: avoid false failure with dash
Christian Weisgerber <naddy@mips.inka.de>
parents:
13540
diff
changeset
|
33 [if test $? = 99 && test x"$FORCE_UNSAFE_CONFIGURE" = x; then |
13540
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
34 AC_MSG_FAILURE([you should not run configure as root ]dnl |
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
35 [(set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)]) |
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
36 fi |
a4b0494e2b96
mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
37 gl_cv_func_mknod_works=no], |
12267 | 38 [gl_cv_func_mknod_works="guessing no"]) |
39 rm -f conftest.fifo]) | |
40 if test "$gl_cv_func_mknod_works" != yes; then | |
41 AC_DEFINE([MKNOD_FIFO_BUG], [1], [Define to 1 if mknod cannot create | |
42 a fifo without super-user privileges]) | |
43 fi | |
44 dnl Systems that mishandle trailing slash on mkfifo also goof on mknod. | |
45 if test $REPLACE_MKFIFO = 1 || test "$gl_cv_func_mknod_works" != yes; then | |
46 REPLACE_MKNOD=1 | |
47 AC_LIBOBJ([mknod]) | |
48 fi | |
49 fi | |
50 ]) |