• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# sys_stat_h.m4 serial 10   -*- Autoconf -*-
2dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Eric Blake.
8dnl Test whether <sys/stat.h> contains lstat and mkdir or must be substituted.
9
10AC_DEFUN([gl_HEADER_SYS_STAT_H],
11[
12  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
13
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
18    HAVE_LSTAT=1
19  else
20    HAVE_LSTAT=0
21  fi
22  AC_SUBST([HAVE_LSTAT])
23
24  dnl For the mkdir substitute.
25  AC_REQUIRE([AC_C_INLINE])
26
27  dnl Check for broken stat macros.
28  AC_REQUIRE([AC_HEADER_STAT])
29
30  gl_CHECK_NEXT_HEADERS([sys/stat.h])
31  SYS_STAT_H='sys/stat.h'
32  AC_SUBST([SYS_STAT_H])
33
34  dnl Define types that are supposed to be defined in <sys/types.h> or
35  dnl <sys/stat.h>.
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>])
41
42]) # gl_HEADER_SYS_STAT_H
43
44AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
45[
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
49])
50
51AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
52[
53  GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
54  GNULIB_LSTAT=0;  AC_SUBST([GNULIB_LSTAT])
55  dnl Assume proper GNU behavior unless another module says otherwise.
56  HAVE_LCHMOD=1;   AC_SUBST([HAVE_LCHMOD])
57  REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
58  REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
59])
60