1 # sys_stat_h.m4 serial 9 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2008 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])
31 SYS_STAT_H='sys/stat.h'
32 AC_SUBST([SYS_STAT_H])
34 dnl Define types that are supposed to be defined in <sys/types.h> or
36 AC_CHECK_TYPE([nlink_t], [],
37 [AC_DEFINE([nlink_t], [int],
38 [Define to the type of st_nlink in struct stat, or a supertype.])],
39 [#include <sys/types.h>
40 #include <sys/stat.h>])
42 ]) # gl_HEADER_SYS_STAT_H
44 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
46 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
47 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
48 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
51 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
53 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
54 dnl Assume proper GNU behavior unless another module says otherwise.
55 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
56 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])