source: box/trunk/infrastructure/m4/ax_func_syscall.m4 @ 2365

Revision 2365, 2.0 KB checked in by chris, 4 years ago (diff)

Reverse the test for syscall(), remove the test for syscall(),
remove the definition and reverse the sense in ax_func_syscall.m4
(which checks for
syscall() needing definition).

Autoconf's AC_CHECK_FUNC defines it when testing for its presence,
so HAVE_SYSCALL will be true even if syscall has no definition
in the system libraries, and this is precisely the case that we
want to test for, so now we test whether the test program compiles
with no explicit definition (only the system headers) and if that
fails, we set HAVE_SYSCALL_NEED_DEFN to 1.

  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_FUNC_SYSCALL
2dnl
3dnl This macro will find out how to call syscall. One or more of the following
4dnl defines will be made as appropriate:
5dnl HAVE_UNISTD_H            - If unistd.h is available
6dnl HAVE_SYS_SYSCALL_H       - If sys/syscall.h is available
7dnl HAVE_SYSCALL             - If syscall() is available and is defined in unistd.h
8dnl HAVE___SYSCALL           - If __syscall() is available and is defined in unistd.h
9dnl HAVE___SYSCALL_NEED_DEFN - If __syscall() is available but is not defined in unistd.h
10dnl
11dnl @category C
12dnl @author Martin Ebourne
13dnl @version 2005/07/01
14dnl @license AllPermissive
15dnl
16dnl Changed by Chris on 081026:
17dnl
18dnl Reversed the test for __syscall(), remove the test for syscall(),
19dnl remove the definition and reverse the sense in ax_func_syscall.m4
20dnl (which checks for __syscall() needing definition).
21dnl
22dnl Autoconf's AC_CHECK_FUNC defines it when testing for its presence,
23dnl so HAVE___SYSCALL will be true even if __syscall has no definition
24dnl in the system libraries, and this is precisely the case that we
25dnl want to test for, so now we test whether the test program compiles
26dnl with no explicit definition (only the system headers) and if that
27dnl fails, we set HAVE___SYSCALL_NEED_DEFN to 1.
28
29AC_DEFUN([AX_FUNC_SYSCALL], [
30  AC_CHECK_HEADERS([sys/syscall.h unistd.h])
31  AC_CHECK_FUNCS([syscall __syscall])
32  if test "x$ac_cv_func___syscall" = "xyes"; then
33    AC_CACHE_CHECK([for __syscall needing definition], [box_cv_have___syscall_need_defn],
34      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
35          $ac_includes_default
36          #ifdef HAVE_SYS_SYSCALL_H
37            #include <sys/syscall.h>
38          #endif
39          ]], [[
40          __syscall(SYS_exit, 0);
41          return 1;
42        ]])],
43        [box_cv_have___syscall_need_defn=no], [box_cv_have___syscall_need_defn=yes]
44      )])
45    if test "x$box_cv_have___syscall_need_defn" = "xyes"; then
46      AC_DEFINE([HAVE___SYSCALL_NEED_DEFN], 1,
47                [Define to 1 if __syscall is available but needs a definition])
48    fi
49  fi
50  ])dnl
Note: See TracBrowser for help on using the repository browser.