Mercurial > gnulib
annotate m4/chown.m4 @ 17363:5a51fb7777a9
sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Problem reported by Marco Atzeri in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
* lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
Simply delegate to the system <sys/select.h> in this case too.
Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
be needed on Solaris either.
* lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
Simply delgate to the system <sys/time.h> in this case.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 19 Mar 2013 09:08:47 -0700 |
parents | e542fd46ad6f |
children | 344018b6e5d7 |
rev | line source |
---|---|
16813
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
1 # serial 27 |
5591
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
2 # Determine whether we need the chown wrapper. |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
3 |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
16813
diff
changeset
|
4 dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2013 Free Software |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12518
diff
changeset
|
5 dnl Foundation, Inc. |
5591
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
6 |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
7 dnl This file is free software; the Free Software Foundation |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
8 dnl gives unlimited permission to copy and/or distribute it, |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
9 dnl with or without modifications, as long as this notice is preserved. |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
10 |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
11 # chown should accept arguments of -1 for uid and gid, and it should |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
12 # dereference symlinks. If it doesn't, arrange to use the replacement |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
13 # function. |
487bb44907f4
(gl_FUNC_CHOWN): When cross-compiling, assume that chown
Paul Eggert <eggert@cs.ucla.edu>
parents:
5078
diff
changeset
|
14 |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
15 # From Jim Meyering. |
889 | 16 |
16813
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
17 m4_version_prereq([2.70], [] ,[ |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
18 |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
19 # This is taken from the following Autoconf patch: |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
20 # http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
21 AC_DEFUN([AC_FUNC_CHOWN], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
22 [ |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
23 AC_REQUIRE([AC_TYPE_UID_T])dnl |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
24 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
25 AC_CHECK_HEADERS([unistd.h]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
26 AC_CACHE_CHECK([for working chown], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
27 [ac_cv_func_chown_works], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
28 [AC_RUN_IFELSE( |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
29 [AC_LANG_PROGRAM( |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
30 [AC_INCLUDES_DEFAULT |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
31 [#include <fcntl.h> |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
32 ]], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
33 [[ |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
34 char *f = "conftest.chown"; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
35 struct stat before, after; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
36 |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
37 if (creat (f, 0600) < 0) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
38 return 1; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
39 if (stat (f, &before) < 0) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
40 return 1; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
41 if (chown (f, (uid_t) -1, (gid_t) -1) == -1) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
42 return 1; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
43 if (stat (f, &after) < 0) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
44 return 1; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
45 return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
46 ]]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
47 ], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
48 [ac_cv_func_chown_works=yes], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
49 [ac_cv_func_chown_works=no], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
50 [case "$host_os" in # (( |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
51 # Guess yes on glibc systems. |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
52 *-gnu*) ac_cv_func_chown_works=yes ;; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
53 # If we don't know, assume the worst. |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
54 *) ac_cv_func_chown_works=no ;; |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
55 esac |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
56 ]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
57 rm -f conftest.chown |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
58 ]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
59 if test $ac_cv_func_chown_works = yes; then |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
60 AC_DEFINE([HAVE_CHOWN], [1], |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
61 [Define to 1 if your system has a working `chown' function.]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
62 fi |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
63 ])# AC_FUNC_CHOWN |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
64 |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
65 ]) |
9a21d15ea645
chown: Avoid "guessing no" when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
66 |
12298
6cb1877033fc
better AC_REQUIRE expanded-before-required-warning avoidance
Jim Meyering <meyering@redhat.com>
parents:
12289
diff
changeset
|
67 AC_DEFUN_ONCE([gl_FUNC_CHOWN], |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3486
diff
changeset
|
68 [ |
8199
51d32a83a7df
Move more declarations into <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents:
6275
diff
changeset
|
69 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
70 AC_REQUIRE([AC_TYPE_UID_T]) |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3486
diff
changeset
|
71 AC_REQUIRE([AC_FUNC_CHOWN]) |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
72 AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK]) |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
73 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
74 AC_CHECK_FUNCS_ONCE([chown fchown]) |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
75 |
12314 | 76 dnl mingw lacks chown altogether. |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
77 if test $ac_cv_func_chown = no; then |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
78 HAVE_CHOWN=0 |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
79 else |
12314 | 80 dnl Some old systems treated chown like lchown. |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
81 if test $gl_cv_func_chown_follows_symlink = no; then |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
82 REPLACE_CHOWN=1 |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
83 fi |
12314 | 84 |
85 dnl Some old systems tried to use uid/gid -1 literally. | |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
86 if test $ac_cv_func_chown_works = no; then |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
87 AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
88 [Define if chown is not POSIX compliant regarding IDs of -1.]) |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
89 REPLACE_CHOWN=1 |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
90 fi |
12314 | 91 |
92 dnl Solaris 9 ignores trailing slash. | |
93 dnl FreeBSD 7.2 mishandles trailing slash on symlinks. | |
13489
e8f90629eda6
chown: Update doc regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
94 dnl Likewise for AIX 7.1. |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
95 AC_CACHE_CHECK([whether chown honors trailing slash], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
96 [gl_cv_func_chown_slash_works], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
97 [touch conftest.file && rm -f conftest.link |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
98 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
99 #include <unistd.h> |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
100 #include <stdlib.h> |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
101 #include <errno.h> |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
102 ]], [[ if (symlink ("conftest.file", "conftest.link")) return 1; |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
103 if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2; |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
104 ]])], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
105 [gl_cv_func_chown_slash_works=yes], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
106 [gl_cv_func_chown_slash_works=no], |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
107 [case "$host_os" in |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
108 # 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
|
109 *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
110 # 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
|
111 *) gl_cv_func_chown_slash_works="guessing no" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
112 esac |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
113 ]) |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
114 rm -f conftest.link conftest.file]) |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
115 case "$gl_cv_func_chown_slash_works" in |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
116 *yes) ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
117 *) |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
118 AC_DEFINE([CHOWN_TRAILING_SLASH_BUG], [1], |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
119 [Define to 1 if chown mishandles trailing slash.]) |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
120 REPLACE_CHOWN=1 |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
121 ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
122 esac |
12314 | 123 |
124 dnl OpenBSD fails to update ctime if ownership does not change. | |
125 AC_CACHE_CHECK([whether chown always updates ctime], | |
126 [gl_cv_func_chown_ctime_works], | |
127 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
128 #include <unistd.h> | |
129 #include <stdlib.h> | |
130 #include <errno.h> | |
131 #include <fcntl.h> | |
132 #include <sys/stat.h> | |
133 ]], [[ struct stat st1, st2; | |
134 if (close (creat ("conftest.file", 0600))) return 1; | |
135 if (stat ("conftest.file", &st1)) return 2; | |
136 sleep (1); | |
137 if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3; | |
138 if (stat ("conftest.file", &st2)) return 4; | |
139 if (st2.st_ctime <= st1.st_ctime) return 5; | |
140 ]])], | |
141 [gl_cv_func_chown_ctime_works=yes], | |
142 [gl_cv_func_chown_ctime_works=no], | |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
143 [case "$host_os" in |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
144 # 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
|
145 *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
146 # 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
|
147 *) gl_cv_func_chown_ctime_works="guessing no" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
148 esac |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
149 ]) |
12314 | 150 rm -f conftest.file]) |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
151 case "$gl_cv_func_chown_ctime_works" in |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
152 *yes) ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
153 *) |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
154 AC_DEFINE([CHOWN_CHANGE_TIME_BUG], [1], [Define to 1 if chown fails |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
155 to change ctime when at least one argument was not -1.]) |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
156 REPLACE_CHOWN=1 |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
157 ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
158 esac |
889 | 159 fi |
160 ]) | |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3486
diff
changeset
|
161 |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
162 # Determine whether chown follows symlinks (it should). |
12298
6cb1877033fc
better AC_REQUIRE expanded-before-required-warning avoidance
Jim Meyering <meyering@redhat.com>
parents:
12289
diff
changeset
|
163 AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK], |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
164 [ |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
165 AC_CACHE_CHECK( |
12289
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
166 [whether chown dereferences symlinks], |
e973be2fb39f
chown: detect Solaris and FreeBSD bug
Eric Blake <ebb9@byu.net>
parents:
11920
diff
changeset
|
167 [gl_cv_func_chown_follows_symlink], |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
168 [ |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
169 AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
6275 | 170 #include <unistd.h> |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
171 #include <stdlib.h> |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
172 #include <errno.h> |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
173 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
174 int |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
175 main () |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
176 { |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
177 int result = 0; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
178 char const *dangling_symlink = "conftest.dangle"; |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
179 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
180 unlink (dangling_symlink); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
181 if (symlink ("conftest.no-such", dangling_symlink)) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
182 abort (); |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
183 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
184 /* Exit successfully on a conforming system, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
185 i.e., where chown must fail with ENOENT. */ |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
186 if (chown (dangling_symlink, getuid (), getgid ()) == 0) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
187 result |= 1; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
188 if (errno != ENOENT) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
189 result |= 2; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13489
diff
changeset
|
190 return result; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
191 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
192 ]])], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
193 [gl_cv_func_chown_follows_symlink=yes], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
194 [gl_cv_func_chown_follows_symlink=no], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12314
diff
changeset
|
195 [gl_cv_func_chown_follows_symlink=yes] |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
196 ) |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
197 ] |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
198 ) |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
199 |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
200 if test $gl_cv_func_chown_follows_symlink = no; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
8199
diff
changeset
|
201 AC_DEFINE([CHOWN_MODIFIES_SYMLINK], [1], |
5078
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
202 [Define if chown modifies symlinks.]) |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
203 fi |
146129232fe0
Merge from coreutils CVS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
204 ]) |