3 dnl Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
9 AC_DEFUN([gl_FUNC_STAT],
11 AC_REQUIRE([AC_CANONICAL_HOST])
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
13 AC_CHECK_FUNCS_ONCE([lstat])
16 dnl On this platform, the original stat() returns st_atime, st_mtime,
17 dnl st_ctime values that are affected by the time zone.
21 dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
22 dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
23 dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
24 AC_CACHE_CHECK([whether stat handles trailing slashes on files],
25 [gl_cv_func_stat_file_slash],
27 # Assume that if we have lstat, we can also check symlinks.
28 if test $ac_cv_func_lstat = yes; then
29 ln -s conftest.tmp conftest.lnk
33 [[#include <sys/stat.h>
36 if (!stat ("conftest.tmp/", &st))
39 if (!stat ("conftest.lnk/", &st))
44 [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
46 # Guess yes on Linux systems.
47 linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;;
48 # Guess yes on systems that emulate the Linux system calls.
49 midipix*) gl_cv_func_stat_file_slash="guessing yes" ;;
50 # Guess yes on glibc systems.
51 *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
52 # If we don't know, obey --enable-cross-guesses.
53 *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;;
56 rm -f conftest.tmp conftest.lnk])
57 case $gl_cv_func_stat_file_slash in
60 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
61 help when passed a file name with a trailing slash]);;
64 dnl macOS and Solaris stat can return a negative tv_nsec.
72 # Prerequisites of lib/stat.c and lib/stat-w32.c.
73 AC_DEFUN([gl_PREREQ_STAT], [
74 AC_REQUIRE([gl_SYS_STAT_H])
75 AC_REQUIRE([gl_PREREQ_STAT_W32])
79 # Prerequisites of lib/stat-w32.c.
80 AC_DEFUN([gl_PREREQ_STAT_W32], [
81 AC_REQUIRE([AC_CANONICAL_HOST])
84 AC_CHECK_HEADERS([sdkddkver.h])