Blame m4/getpagesize.m4

Packit Service 4684c1
# getpagesize.m4 serial 10
Packit Service 4684c1
dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2020 Free Software Foundation,
Packit Service 4684c1
dnl Inc.
Packit Service 4684c1
dnl This file is free software; the Free Software Foundation
Packit Service 4684c1
dnl gives unlimited permission to copy and/or distribute it,
Packit Service 4684c1
dnl with or without modifications, as long as this notice is preserved.
Packit Service 4684c1
Packit Service 4684c1
AC_DEFUN([gl_FUNC_GETPAGESIZE],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
Packit Service 4684c1
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit Service 4684c1
  gl_CHECK_FUNC_GETPAGESIZE
Packit Service 4684c1
  if test $gl_cv_func_getpagesize = no; then
Packit Service 4684c1
    HAVE_GETPAGESIZE=0
Packit Service 4684c1
    AC_CHECK_HEADERS([OS.h])
Packit Service 4684c1
    if test $ac_cv_header_OS_h = yes; then
Packit Service 4684c1
      HAVE_OS_H=1
Packit Service 4684c1
    fi
Packit Service 4684c1
    AC_CHECK_HEADERS([sys/param.h])
Packit Service 4684c1
    if test $ac_cv_header_sys_param_h = yes; then
Packit Service 4684c1
      HAVE_SYS_PARAM_H=1
Packit Service 4684c1
    fi
Packit Service 4684c1
  fi
Packit Service 4684c1
  case "$host_os" in
Packit Service 4684c1
    mingw*)
Packit Service 4684c1
      REPLACE_GETPAGESIZE=1
Packit Service 4684c1
      ;;
Packit Service 4684c1
  esac
Packit Service 4684c1
  dnl Also check whether it's declared.
Packit Service 4684c1
  dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
Packit Service 4684c1
  AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
Packit Service 4684c1
])
Packit Service 4684c1
Packit Service 4684c1
dnl Tests whether the function getpagesize() exists.
Packit Service 4684c1
dnl Sets gl_cv_func_getpagesize.
Packit Service 4684c1
AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE],
Packit Service 4684c1
[
Packit Service 4684c1
  dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a
Packit Service 4684c1
  dnl static inline function when compiling for Android 4.4 or older.
Packit Service 4684c1
  AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize],
Packit Service 4684c1
    [AC_LINK_IFELSE(
Packit Service 4684c1
       [AC_LANG_PROGRAM(
Packit Service 4684c1
          [[#include <unistd.h>]],
Packit Service 4684c1
          [[return getpagesize();]])
Packit Service 4684c1
       ],
Packit Service 4684c1
       [gl_cv_func_getpagesize=yes],
Packit Service 4684c1
       [gl_cv_func_getpagesize=no])
Packit Service 4684c1
    ])
Packit Service 4684c1
])