| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
AC_DEFUN([ENSC_SYSCALL_ALTERNATIVE], |
|---|
| 21 |
[ |
|---|
| 22 |
AC_MSG_CHECKING([whether to use alternative _syscallX macros]) |
|---|
| 23 |
AC_ARG_ENABLE([alternative-syscalls], |
|---|
| 24 |
[AC_HELP_STRING([--disable-alternative-syscalls], |
|---|
| 25 |
[do not use the alternative _syscallX macros |
|---|
| 26 |
provided by Herbert Poetzl (default: use them)])], |
|---|
| 27 |
[case $enableval in |
|---|
| 28 |
(yes|no) ensc_use_alternative_syscall_macros=$enableval;; |
|---|
| 29 |
(*) AC_MSG_ERROR(['$enableval' is not a valid value for '--disable-alternative-syscalls']);; |
|---|
| 30 |
esac], |
|---|
| 31 |
[ensc_use_alternative_syscall_macros=yes]) |
|---|
| 32 |
|
|---|
| 33 |
case $ensc_use_alternative_syscall_macros in |
|---|
| 34 |
(yes) AC_DEFINE(ENSC_USE_ALTERNATIVE_SYSCALL_MACROS, 1, [Use alternative _syscallX macros]);; |
|---|
| 35 |
esac |
|---|
| 36 |
|
|---|
| 37 |
AC_MSG_RESULT([$ensc_use_alternative_syscall_macros]) |
|---|
| 38 |
]) |
|---|
| 39 |
|
|---|
| 40 |
AC_DEFUN([ENSC_SYSCALL], |
|---|
| 41 |
[ |
|---|
| 42 |
AC_REQUIRE([ENSC_SYSCALL_ALTERNATIVE]) |
|---|
| 43 |
|
|---|
| 44 |
AC_MSG_CHECKING([for syscall(2) invocation method]) |
|---|
| 45 |
AC_ARG_WITH([syscall], |
|---|
| 46 |
[AC_HELP_STRING([--with-syscall=METHOD], |
|---|
| 47 |
[call syscall(2) with the specified METHOD; valid values are 'fast', 'traditional' and 'auto' (default: auto)])], |
|---|
| 48 |
[], |
|---|
| 49 |
[with_syscall=auto]) |
|---|
| 50 |
AC_MSG_RESULT([$with_syscall]) |
|---|
| 51 |
|
|---|
| 52 |
case x"$with_syscall" in |
|---|
| 53 |
(xauto) |
|---|
| 54 |
AC_CACHE_CHECK([which syscall(2) invocation works], [ensc_cv_test_syscall], |
|---|
| 55 |
[ |
|---|
| 56 |
AC_LANG_PUSH(C) |
|---|
| 57 |
AC_COMPILE_IFELSE(AC_LANG_SOURCE([ |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
inline static _syscall0(int, foo0) |
|---|
| 68 |
inline static _syscall1(int, foo1, int, a) |
|---|
| 69 |
inline static _syscall2(int, foo2, int, a, int, b) |
|---|
| 70 |
inline static _syscall3(int, foo3, int, a, int, b, int, c) |
|---|
| 71 |
inline static _syscall4(int, foo4, int, a, int, b, int, c, int, d) |
|---|
| 72 |
inline static _syscall5(int, foo5, int, a, int, b, int, c, int, d, int, e) |
|---|
| 73 |
|
|---|
| 74 |
int main() { |
|---|
| 75 |
return foo0() || \ |
|---|
| 76 |
foo1(1) || \ |
|---|
| 77 |
foo2(1,2) || \ |
|---|
| 78 |
foo3(1,2,3) || \ |
|---|
| 79 |
foo4(1,2,3,4) || \ |
|---|
| 80 |
foo5(1,2,3,4,5); |
|---|
| 81 |
} |
|---|
| 82 |
]), |
|---|
| 83 |
[ensc_cv_test_syscall=fast], |
|---|
| 84 |
[ensc_cv_test_syscall=traditional]) |
|---|
| 85 |
|
|---|
| 86 |
AC_LANG_POP |
|---|
| 87 |
]) |
|---|
| 88 |
with_syscall=$ensc_cv_test_syscall |
|---|
| 89 |
;; |
|---|
| 90 |
(xfast|xtraditional) |
|---|
| 91 |
;; |
|---|
| 92 |
*) |
|---|
| 93 |
AC_MSG_ERROR(['$with_syscall' is not a valid value for '--with-syscall']) |
|---|
| 94 |
;; |
|---|
| 95 |
esac |
|---|
| 96 |
|
|---|
| 97 |
if test x"$with_syscall $ensc_use_alternative_syscall_macros" = 'xfast yes'; then |
|---|
| 98 |
with_syscall='alternative' |
|---|
| 99 |
fi |
|---|
| 100 |
|
|---|
| 101 |
if test x"$with_syscall" = xtraditional; then |
|---|
| 102 |
AC_DEFINE(ENSC_SYSCALL_TRADITIONAL, 1, [Define to 1 when the fast syscall(2) invocation does not work]) |
|---|
| 103 |
fi |
|---|
| 104 |
|
|---|
| 105 |
AH_BOTTOM([ |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
]) |
|---|