Use Gnulib's `inet_ntop' and `inet_pton' modules.
[bpt/guile.git] / m4 / stat.m4
CommitLineData
8912421c
LC
1# serial 2
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
9AC_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 on directories],
16 [gl_cv_func_stat_dir_slash],
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_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
22 [case $host_os in
23 mingw*) gl_cv_func_stat_dir_slash="guessing no";;
24 *) gl_cv_func_stat_dir_slash="guessing yes";;
25 esac])])
26 dnl Solaris 9 mistakenly succeeds on stat("file/")
27 AC_CACHE_CHECK([whether stat handles trailing slashes on files],
28 [gl_cv_func_stat_file_slash],
29 [touch conftest.tmp
30 AC_RUN_IFELSE(
31 [AC_LANG_PROGRAM(
32 [[#include <sys/stat.h>
33]], [[struct stat st; return !stat ("conftest.tmp/", &st);]])],
34 [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
35 [gl_cv_func_stat_file_slash="guessing no"])])
36 case $gl_cv_func_stat_dir_slash in
37 *no) REPLACE_STAT=1
38 AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
39 help when passed a directory name with a trailing slash]);;
40 esac
41 case $gl_cv_func_stat_file_slash in
42 *no) REPLACE_STAT=1
43 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
44 help when passed a file name with a trailing slash]);;
45 esac
46 if test $REPLACE_STAT = 1; then
47 AC_LIBOBJ([stat])
48 fi
49])