summaryrefslogtreecommitdiff
path: root/m4/getcwd.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-11-21 00:56:11 +0100
committerBruno Haible <bruno@clisp.org>2011-11-21 00:56:11 +0100
commit69dba6d784566248205fc990673c14d259c4907f (patch)
tree13a28c016f375c5a7178490ce6c19254e71e76c9 /m4/getcwd.m4
parent4b79a20516739258867f4cfc629d6f646f2b260e (diff)
downloadgnulib-69dba6d784566248205fc990673c14d259c4907f.tar.gz
getcwd: Work around getcwd bug on AIX 5..7.
* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Require AC_CANONICAL_HOST. Assign exit code 31 to the bug seen on AIX 5.1..7.1. Use a different value for gl_cv_func_getcwd_path_max. Move the definition of HAVE_PARTLY_WORKING_GETCWD from here... * m4/getcwd.m4 (gl_FUNC_GETCWD): ... to here. Invoke gl_FUNC_GETCWD_PATH_MAX also when $gl_cv_func_getcwd_null is 'no'. Define HAVE_MINIMALLY_WORKING_GETCWD. * lib/getcwd.c (__getcwd): Don't use the system's getcwd on platforms where it is not even minimally working, that is, on AIX. * tests/test-getcwd.c (test_long_name): Distinguish the same cases as m4/getcwd-path-max.m4. (main): Update exit code computation. * doc/posix-functions/getcwd.texi: Mention list of platforms where getcwd does not handle long file names.
Diffstat (limited to 'm4/getcwd.m4')
-rw-r--r--m4/getcwd.m419
1 files changed, 18 insertions, 1 deletions
diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
index 982ef4ed9c..dbdfcd2f41 100644
--- a/m4/getcwd.m4
+++ b/m4/getcwd.m4
@@ -113,14 +113,31 @@ AC_DEFUN([gl_FUNC_GETCWD],
gl_cv_func_getcwd_path_max=yes
;;
*)
+ gl_FUNC_GETCWD_PATH_MAX
case "$gl_cv_func_getcwd_null" in
*yes)
- gl_FUNC_GETCWD_PATH_MAX
gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
;;
esac
;;
esac
+ dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
+ dnl if appropriate.
+ case "$gl_cv_func_getcwd_path_max" in
+ "no, it has the AIX bug") ;;
+ *)
+ AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
+ [Define to 1 if getcwd minimally works, that is, its result can be
+ trusted when it succeeds.])
+ ;;
+ esac
+ case "$gl_cv_func_getcwd_path_max" in
+ "no, but it is partly working")
+ AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
+ [Define to 1 if getcwd works, except it sometimes fails when it
+ shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
+ ;;
+ esac
case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature$gl_cv_func_getcwd_path_max,$gl_abort_bug in
*yes,yes,yes,no) ;;