1 # sys_stat_h.m4 serial 13 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
8 dnl Test whether <sys/stat.h> contains lstat and mkdir or must be substituted.
10 AC_DEFUN([gl_HEADER_SYS_STAT_H],
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14 dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so
15 dnl stat is a good replacement.
16 AC_CHECK_FUNCS_ONCE([lstat])
17 if test $ac_cv_func_lstat = yes; then
22 AC_SUBST([HAVE_LSTAT])
24 dnl For the mkdir substitute.
25 AC_REQUIRE([AC_C_INLINE])
27 dnl Check for broken stat macros.
28 AC_REQUIRE([AC_HEADER_STAT])
30 gl_CHECK_NEXT_HEADERS([sys/stat.h])
32 dnl Define types that are supposed to be defined in <sys/types.h> or
34 AC_CHECK_TYPE([nlink_t], [],
35 [AC_DEFINE([nlink_t], [int],
36 [Define to the type of st_nlink in struct stat, or a supertype.])],
37 [#include <sys/types.h>
38 #include <sys/stat.h>])
40 ]) # gl_HEADER_SYS_STAT_H
42 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
44 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
45 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
46 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
49 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
51 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
52 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
53 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
54 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
55 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
56 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
57 dnl Assume proper GNU behavior unless another module says otherwise.
58 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
59 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
60 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
61 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
62 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
63 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
64 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])