annotate m4/stat.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17187
4cd6b652c293 fflush, stat: no 'static inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
1 # serial 11
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
2
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 17187
diff changeset
3 # Copyright (C) 2009-2013 Free Software Foundation, Inc.
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
4 #
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 # This file is free software; the Free Software Foundation
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
6 # gives unlimited permission to copy and/or distribute it,
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
7 # with or without modifications, as long as this notice is preserved.
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9 AC_DEFUN([gl_FUNC_STAT],
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10 [
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
13 AC_CHECK_FUNCS_ONCE([lstat])
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
14 dnl mingw is the only known platform where stat(".") and stat("./") differ
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
15 AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
16 [gl_cv_func_stat_dir_slash],
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
17 [AC_RUN_IFELSE(
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
18 [AC_LANG_PROGRAM(
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
19 [[#include <sys/stat.h>
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
20 ]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
21 [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
22 [case $host_os in
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
23 mingw*) gl_cv_func_stat_dir_slash="guessing no";;
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
24 *) gl_cv_func_stat_dir_slash="guessing yes";;
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
25 esac])])
16781
f3d643af663d stat: Bypass buggy override in mingw64.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
26 dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
f3d643af663d stat: Bypass buggy override in mingw64.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
27 dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
f3d643af663d stat: Bypass buggy override in mingw64.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
28 dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
29 AC_CACHE_CHECK([whether stat handles trailing slashes on files],
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
30 [gl_cv_func_stat_file_slash],
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
31 [touch conftest.tmp
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
32 # Assume that if we have lstat, we can also check symlinks.
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
33 if test $ac_cv_func_lstat = yes; then
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
34 ln -s conftest.tmp conftest.lnk
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
35 fi
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
36 AC_RUN_IFELSE(
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
37 [AC_LANG_PROGRAM(
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
38 [[#include <sys/stat.h>
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
39 ]], [[int result = 0;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
40 struct stat st;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
41 if (!stat ("conftest.tmp/", &st))
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
42 result |= 1;
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
43 #if HAVE_LSTAT
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
44 if (!stat ("conftest.lnk/", &st))
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
45 result |= 2;
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
46 #endif
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13499
diff changeset
47 return result;
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
48 ]])],
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
49 [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
50 [case "$host_os" in
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
51 # Guess yes on glibc systems.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
52 *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
53 # 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: 16781
diff changeset
54 *) gl_cv_func_stat_file_slash="guessing no" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
55 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16781
diff changeset
56 ])
12258
150adbe92b27 stat: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12037
diff changeset
57 rm -f conftest.tmp conftest.lnk])
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
58 case $gl_cv_func_stat_dir_slash in
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
59 *no) REPLACE_STAT=1
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
60 AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
61 help when passed a directory name with a trailing slash]);;
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
62 esac
12037
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
63 case $gl_cv_func_stat_file_slash in
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
64 *no) REPLACE_STAT=1
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
65 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
66 help when passed a file name with a trailing slash]);;
eb6b9da995d7 stat: fix Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12036
diff changeset
67 esac
12036
1762604ec0a7 stat: new module, for mingw bug
Eric Blake <ebb9@byu.net>
parents:
diff changeset
68 ])
15097
93a1703f75df stat: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14393
diff changeset
69
93a1703f75df stat: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14393
diff changeset
70 # Prerequisites of lib/stat.c.
17187
4cd6b652c293 fflush, stat: no 'static inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16811
diff changeset
71 AC_DEFUN([gl_PREREQ_STAT], [:])