# HG changeset patch # User Paul Eggert # Date 1361347475 28800 # Node ID 840c32a600aadfba7620f65e7c780bbb4a7ed06c # Parent 892b146403823425c50f519b7a25bf075dcd46c0 getcwd: support coreutils better Like strtod, getcwd incorrectly referred to HAVE_RAW_DECL_GETCWD, but this might not be correct in coreutils, which disables the raw decl checks. Problem reported by Nagendra in . * lib/getcwd.c (__getcwd): Do not depend on HAVE_RAW_DECL_GETCWD. * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Test the getcwd function, not any macro, since getcwd.c wants the function. * m4/getcwd.m4 (gl_FUNC_GETCWD): Don't define HAVE_MINIMALLY_WORKING_GETCWD if the code doesn't compile, as might happen if there's a macro but no function. diff -r 892b14640382 -r 840c32a600aa ChangeLog --- a/ChangeLog Tue Feb 19 23:40:06 2013 -0800 +++ b/ChangeLog Wed Feb 20 00:04:35 2013 -0800 @@ -1,5 +1,18 @@ 2013-02-19 Paul Eggert + getcwd: support coreutils better + Like strtod, getcwd incorrectly referred to HAVE_RAW_DECL_GETCWD, + but this might not be correct in coreutils, which disables + the raw decl checks. Problem reported by Nagendra in + . + * lib/getcwd.c (__getcwd): Do not depend on HAVE_RAW_DECL_GETCWD. + * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): + Test the getcwd function, not any macro, since getcwd.c wants the + function. + * m4/getcwd.m4 (gl_FUNC_GETCWD): + Don't define HAVE_MINIMALLY_WORKING_GETCWD if the code doesn't + compile, as might happen if there's a macro but no function. + strtod: support coreutils better * lib/strtod.c (underlying_strtod): Just invoke the underlying strtod. HAVE_RAW_DECL_STRTOD might not be correct in coreutils, which diff -r 892b14640382 -r 840c32a600aa lib/getcwd.c --- a/lib/getcwd.c Tue Feb 19 23:40:06 2013 -0800 +++ b/lib/getcwd.c Wed Feb 20 00:04:35 2013 -0800 @@ -135,7 +135,7 @@ size_t allocated = size; size_t used; -#if HAVE_RAW_DECL_GETCWD && HAVE_MINIMALLY_WORKING_GETCWD +#if HAVE_MINIMALLY_WORKING_GETCWD /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and this is much slower than the system getcwd (at least on GNU/Linux). So trust the system getcwd's results unless they diff -r 892b14640382 -r 840c32a600aa m4/getcwd-path-max.m4 --- a/m4/getcwd-path-max.m4 Tue Feb 19 23:40:06 2013 -0800 +++ b/m4/getcwd-path-max.m4 Wed Feb 20 00:04:35 2013 -0800 @@ -52,6 +52,9 @@ # define is_ENAMETOOLONG(x) 0 #endif +/* Use the getcwd function, not any macro. */ +#undef getcwd + /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir diff -r 892b14640382 -r 840c32a600aa m4/getcwd.m4 --- a/m4/getcwd.m4 Tue Feb 19 23:40:06 2013 -0800 +++ b/m4/getcwd.m4 Wed Feb 20 00:04:35 2013 -0800 @@ -123,7 +123,7 @@ 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") ;; + "no"|"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