+2018-05-13 Bruno Haible <bruno@clisp.org>
+
+ getpagesize: Fix compilation error on Android.
+ * m4/getpagesize.m4 (gl_CHECK_FUNC_GETPAGESIZE): New macro.
+ (gl_FUNC_GETPAGESIZE): Invoke it instead of AC_CHECK_FUNC.
+ * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don't invoke
+ AC_CHECK_FUNC. Instead, invoke gl_CHECK_FUNC_GETPAGESIZE and define
+ HAVE_GETPAGESIZE accordingly.
+ * modules/getcwd (Files): Add m4/getpagesize.m4.
+
2018-05-13 Bruno Haible <bruno@clisp.org>
tcgetsid: Fix compilation error on Android.
-# serial 8
+# serial 9
# Determine whether getcwd aborts when the length of the working directory
# name is unusually large. Any length between 4k and 16k trigger the bug
# when using glibc-2.4.90-9 or older.
AC_CHECK_DECLS_ONCE([getcwd])
AC_CHECK_HEADERS_ONCE([unistd.h])
AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
- AC_CHECK_FUNCS([getpagesize])
+
+ gl_CHECK_FUNC_GETPAGESIZE
+ if test $gl_cv_func_getpagesize = yes; then
+ AC_DEFINE_UNQUOTED([HAVE_GETPAGESIZE], [1],
+ [Define to 1 if the system has the 'getpagesize' function.])
+ fi
+
AC_CACHE_CHECK([whether getcwd aborts when 4k < cwd_length < 16k],
[gl_cv_func_getcwd_abort_bug],
[# Remove any remnants of a previous test.
-# getpagesize.m4 serial 9
+# getpagesize.m4 serial 10
dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2018 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CHECK_FUNCS([getpagesize])
- if test $ac_cv_func_getpagesize = no; then
+ gl_CHECK_FUNC_GETPAGESIZE
+ if test $gl_cv_func_getpagesize = no; then
HAVE_GETPAGESIZE=0
AC_CHECK_HEADERS([OS.h])
if test $ac_cv_header_OS_h = yes; then
dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
])
+
+dnl Tests whether the function getpagesize() exists.
+dnl Sets gl_cv_func_getpagesize.
+AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE],
+[
+ dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a
+ dnl static inline function when compiling for Android 4.4 or older.
+ AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>]],
+ [[return getpagesize();]])
+ ],
+ [gl_cv_func_getpagesize=yes],
+ [gl_cv_func_getpagesize=no])
+ ])
+])