diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-04-30 00:38:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-04-30 00:40:33 -0700 |
commit | 7e4dae99d619315179a90461b42ae8d734c5bb45 (patch) | |
tree | 98a34f046bd50c1a38bf19cb96e5e0fb77ecf441 | |
parent | a3f3fea14abbc59a2b47cae5bec6252ec3a1f8cf (diff) | |
download | emacs-7e4dae99d619315179a90461b42ae8d734c5bb45.tar.gz |
Merge from gnulib
This avoids incorporating the following, which I suspect are
more trouble for Emacs than they’re worth:
2017-04-29 stat, fstat: fix time_t etc. on native Windows platforms
* admin/merge-gnulib (AVOIDED_MODULES): Avoid stat, too.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/pathmax.h, lib/stat.c, m4/pathmax.m4, m4/stat.m4: Remove.
-rwxr-xr-x | admin/merge-gnulib | 2 | ||||
-rw-r--r-- | lib/gnulib.mk.in | 28 | ||||
-rw-r--r-- | lib/pathmax.h | 83 | ||||
-rw-r--r-- | lib/stat.c | 138 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 44 | ||||
-rw-r--r-- | m4/pathmax.m4 | 42 | ||||
-rw-r--r-- | m4/stat.m4 | 71 |
7 files changed, 2 insertions, 406 deletions
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 52fcd41b1cd..1f0e55f5860 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -48,7 +48,7 @@ AVOIDED_MODULES=' close dup fchdir fstat malloc-posix msvc-inval msvc-nothrow open openat-die opendir raise - save-cwd select setenv sigprocmask stdarg stdbool + save-cwd select setenv sigprocmask stat stdarg stdbool threadlib unsetenv ' diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 4a76f0a5aed..af26648c0e0 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings MOSTLYCLEANFILES += core *.stackdump @@ -885,9 +885,7 @@ gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@ gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@ gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@ gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@ -gl_GNULIB_ENABLED_pathmax = @gl_GNULIB_ENABLED_pathmax@ gl_GNULIB_ENABLED_secure_getenv = @gl_GNULIB_ENABLED_secure_getenv@ -gl_GNULIB_ENABLED_stat = @gl_GNULIB_ENABLED_stat@ gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@ gl_GNULIB_ENABLED_strtoull = @gl_GNULIB_ENABLED_strtoull@ gl_GNULIB_ENABLED_tempname = @gl_GNULIB_ENABLED_tempname@ @@ -1765,17 +1763,6 @@ EXTRA_DIST += openat.h endif ## end gnulib module openat-h -## begin gnulib module pathmax -ifeq (,$(OMIT_GNULIB_MODULE_pathmax)) - -ifneq (,$(gl_GNULIB_ENABLED_pathmax)) - -endif -EXTRA_DIST += pathmax.h - -endif -## end gnulib module pathmax - ## begin gnulib module pipe2 ifeq (,$(OMIT_GNULIB_MODULE_pipe2)) @@ -1982,19 +1969,6 @@ EXTRA_DIST += warn-on-use.h endif ## end gnulib module snippet/warn-on-use -## begin gnulib module stat -ifeq (,$(OMIT_GNULIB_MODULE_stat)) - -ifneq (,$(gl_GNULIB_ENABLED_stat)) - -endif -EXTRA_DIST += stat.c - -EXTRA_libgnu_a_SOURCES += stat.c - -endif -## end gnulib module stat - ## begin gnulib module stat-time ifeq (,$(OMIT_GNULIB_MODULE_stat-time)) diff --git a/lib/pathmax.h b/lib/pathmax.h deleted file mode 100644 index aa0730e27a8..00000000000 --- a/lib/pathmax.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2017 Free Software - Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _PATHMAX_H -# define _PATHMAX_H - -/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, - including the terminating NUL byte. - <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html> - PATH_MAX is not defined on systems which have no limit on filename length, - such as GNU/Hurd. - - This file does *not* define PATH_MAX always. Programs that use this file - can handle the GNU/Hurd case in several ways: - - Either with a package-wide handling, or with a per-file handling, - - Either through a - #ifdef PATH_MAX - or through a fallback like - #ifndef PATH_MAX - # define PATH_MAX 8192 - #endif - or through a fallback like - #ifndef PATH_MAX - # define PATH_MAX pathconf ("/", _PC_PATH_MAX) - #endif - */ - -# include <unistd.h> - -# include <limits.h> - -# ifndef _POSIX_PATH_MAX -# define _POSIX_PATH_MAX 256 -# endif - -/* Don't include sys/param.h if it already has been. */ -# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN -# include <sys/param.h> -# endif - -# if !defined PATH_MAX && defined MAXPATHLEN -# define PATH_MAX MAXPATHLEN -# endif - -# ifdef __hpux -/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, - *not* including the terminating NUL byte, and is set to 1023. - Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is - not defined at all any more. */ -# undef PATH_MAX -# define PATH_MAX 1024 -# endif - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, - section "Maximum Path Length Limitation", - <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath> - explains that the maximum size of a filename, including the terminating - NUL byte, is 260 = 3 + 256 + 1. - This is the same value as - - FILENAME_MAX in <stdio.h>, - - _MAX_PATH in <stdlib.h>, - - MAX_PATH in <windef.h>. - Undefine the original value, because mingw's <limits.h> gets it wrong. */ -# undef PATH_MAX -# define PATH_MAX 260 -# endif - -#endif /* _PATHMAX_H */ diff --git a/lib/stat.c b/lib/stat.c deleted file mode 100644 index 7e7c2f6f887..00000000000 --- a/lib/stat.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Work around platform bugs in stat. - Copyright (C) 2009-2017 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* written by Eric Blake */ - -/* If the user's config.h happens to include <sys/stat.h>, let it include only - the system's <sys/stat.h> here, so that orig_stat doesn't recurse to - rpl_stat. */ -#define __need_system_sys_stat_h -#include <config.h> - -/* Get the original definition of stat. It might be defined as a macro. */ -#include <sys/types.h> -#include <sys/stat.h> -#undef __need_system_sys_stat_h - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# elif REPLACE_FUNC_STAT_FILE -/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a. - Bypass it. */ -# define stat _stat -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# endif -#endif - -static int -orig_stat (const char *filename, struct stat *buf) -{ - return stat (filename, buf); -} - -/* Specification. */ -/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include <sys/stat.h> - above. */ -#include "sys/stat.h" - -#include <errno.h> -#include <limits.h> -#include <stdbool.h> -#include <string.h> -#include "dosname.h" -#include "verify.h" - -#if REPLACE_FUNC_STAT_DIR -# include "pathmax.h" - /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also - have a constant PATH_MAX. */ -# ifndef PATH_MAX -# error "Please port this replacement to your platform" -# endif -#endif - -/* Store information about NAME into ST. Work around bugs with - trailing slashes. Mingw has other bugs (such as st_ino always - being 0 on success) which this wrapper does not work around. But - at least this implementation provides the ability to emulate fchdir - correctly. */ - -int -rpl_stat (char const *name, struct stat *st) -{ - int result = orig_stat (name, st); -#if REPLACE_FUNC_STAT_FILE - /* Solaris 9 mistakenly succeeds when given a non-directory with a - trailing slash. */ - if (result == 0 && !S_ISDIR (st->st_mode)) - { - size_t len = strlen (name); - if (ISSLASH (name[len - 1])) - { - errno = ENOTDIR; - return -1; - } - } -#endif /* REPLACE_FUNC_STAT_FILE */ -#if REPLACE_FUNC_STAT_DIR - - if (result == -1 && errno == ENOENT) - { - /* Due to mingw's oddities, there are some directories (like - c:\) where stat() only succeeds with a trailing slash, and - other directories (like c:\windows) where stat() only - succeeds without a trailing slash. But we want the two to be - synonymous, since chdir() manages either style. Likewise, Mingw also - reports ENOENT for names longer than PATH_MAX, when we want - ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. - Fortunately, mingw PATH_MAX is small enough for stack - allocation. */ - char fixed_name[PATH_MAX + 1] = {0}; - size_t len = strlen (name); - bool check_dir = false; - verify (PATH_MAX <= 4096); - if (PATH_MAX <= len) - errno = ENAMETOOLONG; - else if (len) - { - strcpy (fixed_name, name); - if (ISSLASH (fixed_name[len - 1])) - { - check_dir = true; - while (len && ISSLASH (fixed_name[len - 1])) - fixed_name[--len] = '\0'; - if (!len) - fixed_name[0] = '/'; - } - else - fixed_name[len++] = '/'; - result = orig_stat (fixed_name, st); - if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) - { - result = -1; - errno = ENOTDIR; - } - } - } -#endif /* REPLACE_FUNC_STAT_DIR */ - return result; -} diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 030304d6777..7dbfb9ae70d 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -110,7 +110,6 @@ AC_DEFUN([gl_EARLY], # Code from module multiarch: # Code from module nocrash: # Code from module openat-h: - # Code from module pathmax: # Code from module pipe2: # Code from module pselect: # Code from module pthread_sigmask: @@ -128,7 +127,6 @@ AC_DEFUN([gl_EARLY], # Code from module snippet/warn-on-use: # Code from module socklen: # Code from module ssize_t: - # Code from module stat: # Code from module stat-time: # Code from module std-gnu11: # Code from module stdalign: @@ -417,10 +415,8 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false - gl_gnulib_enabled_pathmax=false gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false gl_gnulib_enabled_secure_getenv=false - gl_gnulib_enabled_stat=false gl_gnulib_enabled_strtoll=false gl_gnulib_enabled_strtoull=false gl_gnulib_enabled_tempname=false @@ -465,9 +461,6 @@ AC_DEFUN([gl_INIT], func_gl_gnulib_m4code_a9786850e999ae65a836a6041e8e5ed1 fi func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c - if test $HAVE_EUIDACCESS = 0; then - func_gl_gnulib_m4code_stat - fi fi } func_gl_gnulib_m4code_getdtablesize () @@ -536,13 +529,6 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=true fi } - func_gl_gnulib_m4code_pathmax () - { - if ! $gl_gnulib_enabled_pathmax; then - gl_PATHMAX - gl_gnulib_enabled_pathmax=true - fi - } func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c () { if ! $gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c; then @@ -561,24 +547,6 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_secure_getenv=true fi } - func_gl_gnulib_m4code_stat () - { - if ! $gl_gnulib_enabled_stat; then - gl_FUNC_STAT - if test $REPLACE_STAT = 1; then - AC_LIBOBJ([stat]) - gl_PREREQ_STAT - fi - gl_SYS_STAT_MODULE_INDICATOR([stat]) - gl_gnulib_enabled_stat=true - if test $REPLACE_STAT = 1; then - func_gl_gnulib_m4code_dosname - fi - if test $REPLACE_STAT = 1; then - func_gl_gnulib_m4code_pathmax - fi - fi - } func_gl_gnulib_m4code_strtoll () { if ! $gl_gnulib_enabled_strtoll; then @@ -653,15 +621,9 @@ AC_DEFUN([gl_INIT], if test $REPLACE_LSTAT = 1; then func_gl_gnulib_m4code_dosname fi - if test $REPLACE_LSTAT = 1; then - func_gl_gnulib_m4code_stat - fi if test $HAVE_MKOSTEMP = 0; then func_gl_gnulib_m4code_tempname fi - if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then - func_gl_gnulib_m4code_stat - fi if test $HAVE_READLINKAT = 0; then func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b fi @@ -691,10 +653,8 @@ AC_DEFUN([gl_INIT], AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], [$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31]) AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], [$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax]) AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) AM_CONDITIONAL([gl_GNULIB_ENABLED_secure_getenv], [$gl_gnulib_enabled_secure_getenv]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull]) AM_CONDITIONAL([gl_GNULIB_ENABLED_tempname], [$gl_gnulib_enabled_tempname]) @@ -930,7 +890,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/openat-priv.h lib/openat-proc.c lib/openat.h - lib/pathmax.h lib/pipe2.c lib/pselect.c lib/pthread_sigmask.c @@ -952,7 +911,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/signal.in.h lib/stat-time.c lib/stat-time.h - lib/stat.c lib/stdalign.in.h lib/stddef.in.h lib/stdint.in.h @@ -1049,7 +1007,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/multiarch.m4 m4/nocrash.m4 m4/off_t.m4 - m4/pathmax.m4 m4/pipe2.m4 m4/pselect.m4 m4/pthread_sigmask.m4 @@ -1066,7 +1023,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/ssize_t.m4 m4/st_dm_mode.m4 m4/stat-time.m4 - m4/stat.m4 m4/std-gnu11.m4 m4/stdalign.m4 m4/stddef_h.m4 diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 deleted file mode 100644 index c6c9f24d06f..00000000000 --- a/m4/pathmax.m4 +++ /dev/null @@ -1,42 +0,0 @@ -# pathmax.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2017 Free Software Foundation, -dnl Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_PATHMAX], -[ - dnl Prerequisites of lib/pathmax.h. - AC_CHECK_HEADERS_ONCE([sys/param.h]) -]) - -# Expands to a piece of C program that defines PATH_MAX in the same way as -# "pathmax.h" will do. -AC_DEFUN([gl_PATHMAX_SNIPPET], [[ -/* Arrange to define PATH_MAX, like "pathmax.h" does. */ -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <limits.h> -#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN -# include <sys/param.h> -#endif -#if !defined PATH_MAX && defined MAXPATHLEN -# define PATH_MAX MAXPATHLEN -#endif -#ifdef __hpux -# undef PATH_MAX -# define PATH_MAX 1024 -#endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# undef PATH_MAX -# define PATH_MAX 260 -#endif -]]) - -# Prerequisites of gl_PATHMAX_SNIPPET. -AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], -[ - AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) -]) diff --git a/m4/stat.m4 b/m4/stat.m4 deleted file mode 100644 index 9ff77df9e1f..00000000000 --- a/m4/stat.m4 +++ /dev/null @@ -1,71 +0,0 @@ -# serial 11 - -# Copyright (C) 2009-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_FUNC_STAT], -[ - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([lstat]) - dnl mingw is the only known platform where stat(".") and stat("./") differ - AC_CACHE_CHECK([whether stat handles trailing slashes on directories], - [gl_cv_func_stat_dir_slash], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/stat.h> -]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], - [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], - [case $host_os in - mingw*) gl_cv_func_stat_dir_slash="guessing no";; - *) gl_cv_func_stat_dir_slash="guessing yes";; - esac])]) - dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). - dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) - dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). - AC_CACHE_CHECK([whether stat handles trailing slashes on files], - [gl_cv_func_stat_file_slash], - [touch conftest.tmp - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.tmp conftest.lnk - fi - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/stat.h> -]], [[int result = 0; - struct stat st; - if (!stat ("conftest.tmp/", &st)) - result |= 1; -#if HAVE_LSTAT - if (!stat ("conftest.lnk/", &st)) - result |= 2; -#endif - return result; - ]])], - [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_stat_file_slash="guessing no" ;; - esac - ]) - rm -f conftest.tmp conftest.lnk]) - case $gl_cv_func_stat_dir_slash in - *no) REPLACE_STAT=1 - AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs - help when passed a directory name with a trailing slash]);; - esac - case $gl_cv_func_stat_file_slash in - *no) REPLACE_STAT=1 - AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs - help when passed a file name with a trailing slash]);; - esac -]) - -# Prerequisites of lib/stat.c. -AC_DEFUN([gl_PREREQ_STAT], [:]) |