Configure output when cross-compiling: checking for working chown... no
This message comes from AC_FUNC_CHOWN in Autoconf. Here's a proposed patch that touches Gnulib only. Should I submit a patch for Autoconf? Or is Autoconf always preferring pessimistic guesses, regardless of platform? 2012-05-01 Bruno Haible <br...@clisp.org> chown: Avoid "guessing no" when cross-compiling to glibc systems. * m4/chown.m4 (gl_FUNC_CHOWN): When cross-compiling, set ac_cv_func_chown_works without invoking AC_FUNC_CHOWN. --- m4/chown.m4.orig Tue May 1 22:57:37 2012 +++ m4/chown.m4 Tue May 1 22:56:51 2012 @@ -1,4 +1,4 @@ -# serial 26 +# serial 27 # Determine whether we need the chown wrapper. dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2012 Free Software @@ -18,7 +18,6 @@ [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_UID_T]) - AC_REQUIRE([AC_FUNC_CHOWN]) AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([chown fchown]) @@ -33,11 +32,28 @@ fi dnl Some old systems tried to use uid/gid -1 literally. - if test $ac_cv_func_chown_works = no; then - AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1], - [Define if chown is not POSIX compliant regarding IDs of -1.]) - REPLACE_CHOWN=1 + if test $cross_compiling = no; then + AC_FUNC_CHOWN + else + dnl Improved cross-compilation guess. + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) ac_cv_func_chown_works="guessing yes" ;; + # If we don't know, assume the worst. + *) ac_cv_func_chown_works="guessing no" ;; + esac fi + case "$ac_cv_func_chown_works" in + *yes) + AC_DEFINE([HAVE_CHOWN], [1], + [Define to 1 if your system has a working 'chown' function.]) + ;; + *) + AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1], + [Define if chown is not POSIX compliant regarding IDs of -1.]) + REPLACE_CHOWN=1 + ;; + esac dnl Solaris 9 ignores trailing slash. dnl FreeBSD 7.2 mishandles trailing slash on symlinks.