From 81d8eda2419e7a23088a98cdfc52a305c9ceac0d Mon Sep 17 00:00:00 2001 From: Martin Ebourne Date: Wed, 7 Dec 2005 16:34:47 +0000 Subject: Merged martin/autoconf at r35 to trunk --- infrastructure/m4/ax_check_syscall_lseek.m4 | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 infrastructure/m4/ax_check_syscall_lseek.m4 (limited to 'infrastructure/m4/ax_check_syscall_lseek.m4') diff --git a/infrastructure/m4/ax_check_syscall_lseek.m4 b/infrastructure/m4/ax_check_syscall_lseek.m4 new file mode 100644 index 00000000..6bf93c23 --- /dev/null +++ b/infrastructure/m4/ax_check_syscall_lseek.m4 @@ -0,0 +1,54 @@ +dnl @synopsis AX_CHECK_SYSCALL_LSEEK([ACTION-IF-TRUE], [ACTION-IF-FALSE]) +dnl +dnl This macro will find out if the lseek syscall requires a dummy middle +dnl parameter +dnl +dnl The following defines will be set as appropriate: +dnl HAVE_LSEEK_DUMMY_PARAM +dnl Also ACTION-IF-TRUE and ACTION-IF-FALSE are run as appropriate +dnl +dnl @category C +dnl @author Martin Ebourne +dnl @version 2005/07/03 +dnl @license AllPermissive + +AC_DEFUN([AX_CHECK_SYSCALL_LSEEK], [ + AC_REQUIRE([AX_FUNC_SYSCALL])dnl + if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then + AC_CACHE_CHECK([[whether syscall lseek requires dummy parameter]], [have_lseek_dummy_param], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ + $ac_includes_default + #include + #include + #ifdef HAVE___SYSCALL_NEED_DEFN + extern "C" off_t __syscall(quad_t number, ...); + #endif + #ifndef HAVE_SYSCALL + #undef syscall + #define syscall __syscall + #endif + ]], [[ + int fh = creat("lseektest", 0600); + int res = 0; + if(fh>=0) + { + res = syscall(SYS_lseek, fh, 0, SEEK_SET, 99); + close(fh); + } + unlink("lseektest"); + return res!=-1; + ]])], + [have_lseek_dummy_param=yes], [have_lseek_dummy_param=no] + )]) + if test "x$have_lseek_dummy_param" = "xyes"; then + AC_DEFINE([HAVE_LSEEK_DUMMY_PARAM], 1, + [Define to 1 if syscall lseek requires a dummy middle parameter]) + fi + fi + if test "x$have_lseek_dummy_param" = "xno" + then + m4_ifvaln([$1],[$1],[:])dnl + m4_ifvaln([$2],[else $2])dnl + fi + ])dnl -- cgit v1.2.3