diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | m4/chdir-long.m4 | 12 | ||||
-rw-r--r-- | m4/getcwd-abort-bug.m4 | 6 | ||||
-rw-r--r-- | m4/getcwd-path-max.m4 | 5 | ||||
-rw-r--r-- | m4/pathmax.m4 | 32 | ||||
-rw-r--r-- | modules/chdir-long | 1 | ||||
-rw-r--r-- | modules/getcwd | 1 |
7 files changed, 57 insertions, 12 deletions
@@ -1,5 +1,17 @@ 2011-09-21 Bruno Haible <bruno@clisp.org> + Consolidate all uses of PATH_MAX in *.m4 files. + * m4/pathmax.m4 (gl_PATHMAX_SNIPPET, gl_PATHMAX_SNIPPET_PREREQ): New + macros. + * m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Use gl_PATHMAX_SNIPPET_PREREQ + and gl_PATHMAX_SNIPPET. + * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise. + * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise. + * modules/chdir-long (Files): Add m4/pathmax.m4. + * modules/getcwd (Files): Likewise. + +2011-09-21 Bruno Haible <bruno@clisp.org> + ftruncate: Un-deprecate, concentrate on Win32 support. * modules/ftruncate (Status, Notice): Remove sections. (Depends-on): Add largefile. diff --git a/m4/chdir-long.m4 b/m4/chdir-long.m4 index fdba1914dd..8c38c04b36 100644 --- a/m4/chdir-long.m4 +++ b/m4/chdir-long.m4 @@ -1,4 +1,4 @@ -#serial 13 +#serial 14 # Use Gnulib's robust chdir function. # It can handle arbitrarily long directory names, which means @@ -15,16 +15,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CHDIR_LONG], [ - AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CACHE_CHECK([whether this system has an arbitrary file name length limit], gl_cv_have_arbitrary_file_name_length_limit, [AC_EGREP_CPP([have_arbitrary_file_name_length_limit], - [ -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <limits.h> -#if defined PATH_MAX || defined MAXPATHLEN + gl_PATHMAX_SNIPPET[ +#ifdef PATH_MAX have_arbitrary_file_name_length_limit #endif], gl_cv_have_arbitrary_file_name_length_limit=yes, diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4 index 0d3f34f840..60ea03cde2 100644 --- a/m4/getcwd-abort-bug.m4 +++ b/m4/getcwd-abort-bug.m4 @@ -1,4 +1,4 @@ -# serial 5 +# serial 6 # Determine whether getcwd aborts when the length of the working directory # name is unusually large. Any length between 4k and 16k trigger the bug # when using glibc-2.4.90-9 or older. @@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG], [ AC_CHECK_DECLS_ONCE([getcwd]) AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CHECK_FUNCS([getpagesize]) AC_CACHE_CHECK([whether getcwd aborts when 4k < cwd_length < 16k], gl_cv_func_getcwd_abort_bug, @@ -32,10 +33,11 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG], #else /* on Windows with MSVC */ # include <direct.h> #endif -#include <limits.h> #include <string.h> #include <sys/stat.h> +]gl_PATHMAX_SNIPPET[ + /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4 index 65ee491037..6be4b2ce6d 100644 --- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -1,4 +1,4 @@ -# serial 17 +# serial 18 # Check for several getcwd bugs with long file names. # If so, arrange to compile the wrapper function. @@ -18,6 +18,7 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX], AC_CHECK_DECLS_ONCE([getcwd]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CACHE_CHECK([whether getcwd handles long file names properly], gl_cv_func_getcwd_path_max, [# Arrange for deletion of the temporary directory this test creates. @@ -39,6 +40,8 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX], #include <sys/types.h> #include <fcntl.h> +]gl_PATHMAX_SNIPPET[ + #ifndef AT_FDCWD # define AT_FDCWD 0 #endif diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 index 0856722c39..4913fa06cb 100644 --- a/m4/pathmax.m4 +++ b/m4/pathmax.m4 @@ -1,4 +1,4 @@ -# pathmax.m4 serial 9 +# pathmax.m4 serial 10 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -10,3 +10,33 @@ 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/modules/chdir-long b/modules/chdir-long index a456b1385b..7f54760ee4 100644 --- a/modules/chdir-long +++ b/modules/chdir-long @@ -5,6 +5,7 @@ Files: lib/chdir-long.h lib/chdir-long.c m4/chdir-long.m4 +m4/pathmax.m4 Depends-on: unistd diff --git a/modules/getcwd b/modules/getcwd index 6a030bac51..c68cd8ea98 100644 --- a/modules/getcwd +++ b/modules/getcwd @@ -6,6 +6,7 @@ lib/getcwd.c m4/getcwd-abort-bug.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 +m4/pathmax.m4 Depends-on: unistd |