stat: new module, for mingw bug
[gnulib.git] / m4 / stat.m4
1 # serial 1
2
3 # Copyright (C) 2009 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 AC_DEFUN([gl_FUNC_STAT],
10 [
11   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12   AC_REQUIRE([gl_AC_DOS])
13   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14   dnl mingw is the only known platform where stat(".") and stat("./") differ
15   AC_CACHE_CHECK([whether stat handles trailing slashes],
16       [gl_cv_func_stat_works],
17       [AC_RUN_IFELSE(
18          [AC_LANG_PROGRAM(
19            [[#include <sys/stat.h>
20 ]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
21          [gl_cv_func_stat_works=yes], [gl_cv_func_stat_works=no],
22          [case $host_os in
23             mingw*) gl_cv_func_stat_works="guessing no";;
24             *) gl_cv_func_stat_works="guessing yes";;
25           esac])])
26   case $gl_cv_func_stat_works in
27     *yes) ;;
28     *) REPLACE_STAT=1
29        AC_LIBOBJ([stat]);;
30   esac
31 ])