2 # serial 3 (libsigsegv-2.15)
3 dnl Copyright (C) 2009 Eric Blake <ebb9@byu.net>
4 dnl Copyright (C) 2023-2024 Bruno Haible <bruno@clisp.org>
5 dnl This file is free software, distributed under the terms of the GNU
6 dnl General Public License as published by the Free Software Foundation;
7 dnl either version 2 of the License, or (at your option) any later version.
8 dnl As a special exception to the GNU General Public License, this file
9 dnl may be distributed as part of a program that contains a configuration
10 dnl script generated by Autoconf, under the same distribution terms as
11 dnl the rest of that program.
13 dnl Determine whether the behaviour of system calls, when passed an invalid
14 dnl memory reference, is the traditional behaviour, namely to return with
16 AC_DEFUN([SV_SYSCALLS_EFAULT], [
17 AC_REQUIRE([AC_PROG_CC])
18 AC_REQUIRE([AC_CANONICAL_HOST])
20 AC_CACHE_CHECK([whether system calls support EFAULT error],
21 [sv_cv_syscalls_EFAULT],
22 [dnl On MacOS X 10.2 or newer: If we were to perform the tests, a
23 dnl Crash Report dialog window would pop up.
25 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*)
26 sv_cv_syscalls_EFAULT=yes ;;
35 If we were to use a literal NULL, gcc would give a warning on glibc systems:
36 "warning: null argument where non-null required". */
37 const char *null_pointer = NULL;
39 [[return !(open (null_pointer, O_RDONLY) < 0
42 [sv_cv_syscalls_EFAULT=yes],
43 [sv_cv_syscalls_EFAULT=no],
44 [dnl When cross-compiling, guess yes everywhere except on
47 mingw* | windows*) sv_cv_syscalls_EFAULT="guessing no" ;;
48 *) sv_cv_syscalls_EFAULT="guessing yes" ;;
54 case "$sv_cv_syscalls_EFAULT" in
56 AC_DEFINE([HAVE_EFAULT_SUPPORT], [1],
57 [Define to 1 if system calls detect invalid memory references and
58 return error EFAULT.])