Use `scheme-mode` for the Guile init file
[emacs.git] / m4 / utimens.m4
blob9996e3ef3365b11ea551244e22d30db74d61329c
1 # utimens.m4
2 # serial 16
3 dnl Copyright (C) 2003-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.
8 AC_DEFUN([gl_UTIMENS],
10   dnl Prerequisites of lib/utimens.c.
11   AC_REQUIRE([gl_FUNC_UTIMES])
12   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
13   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14   gl_CHECK_FUNCS_ANDROID([futimes], [[#include <sys/time.h>]])
15   gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]])
16   gl_CHECK_FUNCS_ANDROID([lutimes], [[#include <sys/time.h>]])
17   gl_CHECK_FUNCS_ANDROID([futimens], [[#include <sys/stat.h>]])
18   gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
20   if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
21     dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time).  It is not
22     dnl standardized, but Solaris implemented it first and uses it as
23     dnl its only means to set fd time.
24     AC_CACHE_CHECK([whether futimesat handles NULL file],
25       [gl_cv_func_futimesat_works],
26       [touch conftest.file
27        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
28 #include <stddef.h>
29 #include <sys/times.h>
30 #include <fcntl.h>
31 ]GL_MDA_DEFINES],
32         [[int fd = open ("conftest.file", O_RDWR);
33           if (fd < 0) return 1;
34           if (futimesat (fd, NULL, NULL)) return 2;
35         ]])],
36         [gl_cv_func_futimesat_works=yes],
37         [gl_cv_func_futimesat_works=no],
38         [case "$host_os" in
39                               # Guess yes on Linux systems
40                               # and on systems that emulate the Linux system calls.
41            linux* | midipix*) gl_cv_func_futimesat_works="guessing yes" ;;
42                               # Guess yes on glibc systems.
43            *-gnu*)            gl_cv_func_futimesat_works="guessing yes" ;;
44                               # If we don't know, obey --enable-cross-guesses.
45            *)                 gl_cv_func_futimesat_works="$gl_cross_guess_normal" ;;
46          esac
47         ])
48       rm -f conftest.file])
49     case "$gl_cv_func_futimesat_works" in
50       *yes) ;;
51       *)
52         AC_DEFINE([FUTIMESAT_NULL_BUG], [1],
53           [Define to 1 if futimesat mishandles a NULL file name.])
54         ;;
55     esac
56   fi