X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=m4%2Fgetcwd.m4;h=50b96c666c3429a514e2b15de36b75886cfa66d9;hb=f6c2431e873d1c9972f97cb610ab26491d626410;hp=982ef4ed9c2c637daff57ebd68c6abcc3193f5d2;hpb=4b79a20516739258867f4cfc629d6f646f2b260e;p=gnulib.git diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 982ef4ed9..50b96c666 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -1,12 +1,12 @@ # getcwd.m4 - check for working getcwd that is compatible with glibc -# Copyright (C) 2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003-2007, 2009-2012 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. # Written by Paul Eggert. -# serial 10 +# serial 12 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -45,15 +45,14 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], ]])], [gl_cv_func_getcwd_null=yes], [gl_cv_func_getcwd_null=no], - [[ - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_getcwd_null="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_getcwd_null="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_getcwd_null="guessing no";; - esac + [[case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_getcwd_null="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_getcwd_null="guessing no";; + esac ]])]) ]) @@ -113,21 +112,38 @@ 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 - - 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) ;; - *) - dnl Full replacement lib/getcwd.c, overrides LGPL replacement. - REPLACE_GETCWD=1;; + 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 + + if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \ + || test $gl_cv_func_getcwd_posix_signature != yes \ + || test "$gl_cv_func_getcwd_path_max" != yes \ + || test $gl_abort_bug = yes; then + REPLACE_GETCWD=1 + fi ]) # Prerequisites of lib/getcwd.c, when full replacement is in effect.