annotate m4/mknod.m4 @ 18070:d460ec17f09f

autoupdate
author Karl Berry <karl@freefriends.org>
date Tue, 28 Jul 2015 13:57:32 -0700
parents ab58d4870664
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
1 # serial 5
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
2 # See if we need to provide mknod replacement.
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
3
17848
ab58d4870664 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 17587
diff changeset
4 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 dnl This file is free software; the Free Software Foundation
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
6 dnl gives unlimited permission to copy and/or distribute it,
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
7 dnl with or without modifications, as long as this notice is preserved.
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9 # Written by Eric Blake.
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 AC_DEFUN([gl_FUNC_MKNOD],
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
12 [
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
13 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
14 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
15 AC_REQUIRE([gl_FUNC_MKFIFO])
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
16 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
17 AC_CHECK_FUNCS_ONCE([mknod])
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
18 if test $ac_cv_func_mknod = no; then
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
19 HAVE_MKNOD=0
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
20 else
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
21 dnl Detect BSD bug, where mknod requires root privileges to create fifo.
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
22 AC_CACHE_CHECK([whether mknod can create fifo without root privileges],
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
23 [gl_cv_func_mknod_works],
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
24 [AC_RUN_IFELSE(
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
25 [AC_LANG_PROGRAM(
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
26 [[#include <sys/stat.h>
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
27 #include <unistd.h>
16951
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
28
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
29 /* Copied from root-uid.h. FIXME: Just use root-uid.h. */
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
30 #ifdef __TANDEM
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
31 # define ROOT_UID 65535
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
32 #else
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
33 # define ROOT_UID 0
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
34 #endif
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
35 ]], [[/* Indeterminate for super-user, assume no. Why are you running
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
36 configure as root, anyway? */
16951
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
37 if (geteuid () == ROOT_UID) return 99;
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
38 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
39 [gl_cv_func_mknod_works=yes],
13850
c39e4e516aee mknod: avoid false failure with dash
Christian Weisgerber <naddy@mips.inka.de>
parents: 13540
diff changeset
40 [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
41 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
42 [(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
43 fi
a4b0494e2b96 mknod: be more vocal about danger of running tests as root
Eric Blake <eblake@redhat.com>
parents: 12559
diff changeset
44 gl_cv_func_mknod_works=no],
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
45 [case "$host_os" in
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
46 # Guess yes on glibc systems.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
47 *-gnu*) gl_cv_func_mknod_works="guessing yes" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
48 # If we don't know, assume the worst.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
49 *) gl_cv_func_mknod_works="guessing no" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
50 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
51 ])
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
52 rm -f conftest.fifo])
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
53 case "$gl_cv_func_mknod_works" in
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
54 *yes) ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
55 *)
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
56 REPLACE_MKNOD=1
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
57 AC_DEFINE([MKNOD_FIFO_BUG], [1], [Define to 1 if mknod cannot create
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
58 a fifo without super-user privileges])
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
59 ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
60 esac
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
61 dnl Systems that mishandle trailing slash on mkfifo also goof on mknod.
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
62 if test $REPLACE_MKFIFO = 1; then
12267
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
63 REPLACE_MKNOD=1
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
64 fi
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
65 fi
c400da5f66bb mknod: new module
Eric Blake <ebb9@byu.net>
parents:
diff changeset
66 ])