Annotation of embedaddon/libiconv/srcm4/stat.m4, revision 1.1.1.2

1.1.1.2 ! misho       1: # serial 15
1.1       misho       2: 
1.1.1.2 ! misho       3: # Copyright (C) 2009-2019 Free Software Foundation, Inc.
1.1       misho       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: [
1.1.1.2 ! misho      11:   AC_REQUIRE([AC_CANONICAL_HOST])
1.1       misho      12:   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
                     13:   AC_CHECK_FUNCS_ONCE([lstat])
1.1.1.2 ! misho      14:   case "$host_os" in
        !            15:     mingw*)
        !            16:       dnl On this platform, the original stat() returns st_atime, st_mtime,
        !            17:       dnl st_ctime values that are affected by the time zone.
        !            18:       REPLACE_STAT=1
        !            19:       ;;
        !            20:     *)
        !            21:       dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
        !            22:       dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
        !            23:       dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
        !            24:       AC_CACHE_CHECK([whether stat handles trailing slashes on files],
        !            25:         [gl_cv_func_stat_file_slash],
        !            26:         [touch conftest.tmp
        !            27:          # Assume that if we have lstat, we can also check symlinks.
        !            28:          if test $ac_cv_func_lstat = yes; then
        !            29:            ln -s conftest.tmp conftest.lnk
        !            30:          fi
        !            31:          AC_RUN_IFELSE(
        !            32:            [AC_LANG_PROGRAM(
        !            33:              [[#include <sys/stat.h>
1.1       misho      34: ]], [[int result = 0;
1.1.1.2 ! misho      35:                struct stat st;
        !            36:                if (!stat ("conftest.tmp/", &st))
        !            37:                  result |= 1;
1.1       misho      38: #if HAVE_LSTAT
1.1.1.2 ! misho      39:                if (!stat ("conftest.lnk/", &st))
        !            40:                  result |= 2;
1.1       misho      41: #endif
1.1.1.2 ! misho      42:                return result;
        !            43:              ]])],
        !            44:            [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
        !            45:            [case "$host_os" in
        !            46:                                # Guess yes on Linux systems.
        !            47:               linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;;
        !            48:                                # Guess yes on glibc systems.
        !            49:               *-gnu* | gnu*)   gl_cv_func_stat_file_slash="guessing yes" ;;
        !            50:                                # If we don't know, assume the worst.
        !            51:               *)               gl_cv_func_stat_file_slash="guessing no" ;;
        !            52:             esac
        !            53:            ])
        !            54:          rm -f conftest.tmp conftest.lnk])
        !            55:       case $gl_cv_func_stat_file_slash in
        !            56:         *no)
        !            57:           REPLACE_STAT=1
        !            58:           AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
        !            59:             help when passed a file name with a trailing slash]);;
        !            60:       esac
        !            61:       case $host_os in
        !            62:         dnl Solaris stat can return a negative tv_nsec.
        !            63:         solaris*)
        !            64:           REPLACE_FSTAT=1 ;;
        !            65:       esac
        !            66:       ;;
1.1       misho      67:   esac
                     68: ])
                     69: 
1.1.1.2 ! misho      70: # Prerequisites of lib/stat.c and lib/stat-w32.c.
        !            71: AC_DEFUN([gl_PREREQ_STAT], [
        !            72:   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
1.1       misho      73:   :
                     74: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>