1 # efault.m4 serial 1 (libsigsegv-2.8)
2 dnl Copyright (C) 2009 Eric Blake <ebb9@byu.net>
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
9 dnl Determine whether the behaviour of system calls, when passed an invalid
10 dnl memory reference, is the traditional behaviour, namely to return with
12 AC_DEFUN([SV_SYSCALLS_EFAULT], [
13 AC_REQUIRE([AC_PROG_CC])
14 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_CACHE_CHECK([whether system calls support EFAULT error],
17 [sv_cv_syscalls_EFAULT],
18 [dnl On MacOS X 10.2 or newer: If we were to perform the tests, a
19 dnl Crash Report dialog window would pop up.
21 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*)
22 sv_cv_syscalls_EFAULT=yes ;;
31 If we were to use a literal NULL, gcc would give a warning on glibc systems:
32 "warning: null argument where non-null required". */
33 const char *null_pointer = NULL;
35 [[return !(open (null_pointer, O_RDONLY) < 0
38 [sv_cv_syscalls_EFAULT=yes],
39 [sv_cv_syscalls_EFAULT=no],
40 [dnl When cross-compiling, guess yes everywhere except on
43 mingw*) sv_cv_syscalls_EFAULT="guessing no" ;;
44 *) sv_cv_syscalls_EFAULT="guessing yes" ;;
50 case "$sv_cv_syscalls_EFAULT" in
52 AC_DEFINE([HAVE_EFAULT_SUPPORT], [1],
53 [Define to 1 if system calls detect invalid memory references and
54 return error EFAULT.])