diff options
author | Bruno Haible <bruno@clisp.org> | 2011-09-22 14:17:57 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-09-22 14:19:43 +0200 |
commit | b5bfe10b5a7adcb72dad1139c6470c92354952c8 (patch) | |
tree | 7ae6b869b74de276bddfb70b918eb50016092e1b /m4/pathmax.m4 | |
parent | d8710037842f70e32a5b56c685437b51165d2f5b (diff) | |
download | gnulib-b5bfe10b5a7adcb72dad1139c6470c92354952c8.tar.gz |
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.
Diffstat (limited to 'm4/pathmax.m4')
-rw-r--r-- | m4/pathmax.m4 | 32 |
1 files changed, 31 insertions, 1 deletions
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]) +]) |