AN_FUNCTION([chown], [AC_FUNC_CHOWN])
AC_DEFUN([AC_FUNC_CHOWN],
[AC_REQUIRE([AC_TYPE_UID_T])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_CHECK_HEADERS(unistd.h)
AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works,
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
]])],
[ac_cv_func_chown_works=yes],
[ac_cv_func_chown_works=no],
- [ac_cv_func_chown_works=no])
+ [case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_chown_works=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_chown_works=no ;;
+ esac])
rm -f conftest.chown
])
if test $ac_cv_func_chown_works = yes; then
AC_DEFUN([AC_FUNC_GETGROUPS],
[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_CHECK_FUNC(getgroups)
# If we don't yet have getgroups, see if it's in -lbsd.
return getgroups (0, 0) == -1;]])],
[ac_cv_func_getgroups_works=yes],
[ac_cv_func_getgroups_works=no],
- [ac_cv_func_getgroups_works=no])
+ [case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_getgroups_works="guessing no" ;;
+ esac])
])
else
ac_cv_func_getgroups_works=no
fi
-if test $ac_cv_func_getgroups_works = yes; then
- AC_DEFINE(HAVE_GETGROUPS, 1,
- [Define to 1 if your system has a working `getgroups' function.])
-fi
+case "$ac_cv_func_getgroups_works" in
+ *yes)
+ AC_DEFINE(HAVE_GETGROUPS, 1,
+ [Define to 1 if your system has a working `getgroups' function.])
+ ;;
+esac
LIBS=$ac_save_LIBS
])# AC_FUNC_GETGROUPS
# calls lstat a second time when necessary.
AN_FUNCTION([lstat], [AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
-[AC_CACHE_CHECK(
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+AC_CACHE_CHECK(
[whether lstat correctly handles trailing slash],
[ac_cv_func_lstat_dereferences_slashed_symlink],
[rm -f conftest.sym conftest.file
return lstat ("conftest.sym/", &sbuf) == 0;])],
[ac_cv_func_lstat_dereferences_slashed_symlink=yes],
[ac_cv_func_lstat_dereferences_slashed_symlink=no],
- [ac_cv_func_lstat_dereferences_slashed_symlink=no])
+ [case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_lstat_dereferences_slashed_symlink=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_lstat_dereferences_slashed_symlink=no ;;
+ esac])
else
# If the `ln -s' command failed, then we probably don't even
# have an lstat function.
# If `malloc (0)' properly handled, run IF-WORKS, otherwise, IF-NOT.
AC_DEFUN([_AC_FUNC_MALLOC_IF],
[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_CHECK_HEADERS(stdlib.h)
AC_CACHE_CHECK([for GNU libc compatible malloc], ac_cv_func_malloc_0_nonnull,
[AC_RUN_IFELSE(
[return ! malloc (0);])],
[ac_cv_func_malloc_0_nonnull=yes],
[ac_cv_func_malloc_0_nonnull=no],
- [ac_cv_func_malloc_0_nonnull=no])])
+ [case "$host_os" in # ((
+ # Guess yes on platforms where we know the result.
+ *-gnu* | freebsd* | netbsd* | openbsd* \
+ | hpux* | solaris* | cygwin* | mingw*)
+ ac_cv_func_malloc_0_nonnull=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_malloc_0_nonnull=no ;;
+ esac])])
AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
])# _AC_FUNC_MALLOC_IF
# ------------
AN_FUNCTION([mmap], [AC_FUNC_MMAP])
AC_DEFUN([AC_FUNC_MMAP],
-[AC_CHECK_HEADERS_ONCE([stdlib.h unistd.h sys/param.h])
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+AC_CHECK_HEADERS_ONCE([stdlib.h unistd.h sys/param.h])
AC_CHECK_FUNCS([getpagesize])
AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped],
[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT]
}]])],
[ac_cv_func_mmap_fixed_mapped=yes],
[ac_cv_func_mmap_fixed_mapped=no],
- [ac_cv_func_mmap_fixed_mapped=no])])
+ [case "$host_os" in # ((
+ # Guess yes on platforms where we know the result.
+ linux*) ac_cv_func_mmap_fixed_mapped=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_mmap_fixed_mapped=no ;;
+ esac])])
if test $ac_cv_func_mmap_fixed_mapped = yes; then
AC_DEFINE([HAVE_MMAP], [1],
[Define to 1 if you have a working `mmap' system call.])
# If `realloc (0, 0)' is properly handled, run IF-WORKS, otherwise, IF-NOT.
AC_DEFUN([_AC_FUNC_REALLOC_IF],
[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_CHECK_HEADERS(stdlib.h)
AC_CACHE_CHECK([for GNU libc compatible realloc], ac_cv_func_realloc_0_nonnull,
[AC_RUN_IFELSE(
[return ! realloc (0, 0);])],
[ac_cv_func_realloc_0_nonnull=yes],
[ac_cv_func_realloc_0_nonnull=no],
- [ac_cv_func_realloc_0_nonnull=no])])
+ [case "$host_os" in # ((
+ # Guess yes on platforms where we know the result.
+ *-gnu* | freebsd* | netbsd* | openbsd* \
+ | hpux* | solaris* | cygwin* | mingw*)
+ ac_cv_func_realloc_0_nonnull=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_realloc_0_nonnull=no ;;
+ esac])])
AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2])
])# AC_FUNC_REALLOC
# ---------------
AN_FUNCTION([strcoll], [AC_FUNC_STRCOLL])
AC_DEFUN([AC_FUNC_STRCOLL],
-[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[return (strcoll ("abc", "def") >= 0 ||
strcoll ("ABC", "DEF") >= 0 ||
strcoll ("123", "456") >= 0)]])],
ac_cv_func_strcoll_works=yes,
ac_cv_func_strcoll_works=no,
- ac_cv_func_strcoll_works=no)])
+ [case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_strcoll_works=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_strcoll_works=no ;;
+ esac])])
if test $ac_cv_func_strcoll_works = yes; then
AC_DEFINE(HAVE_STRCOLL, 1,
[Define to 1 if you have the `strcoll' function and it is properly