source: trunk/drmaa_utils/m4/ax_func_gettid.m4 @ 1

Revision 1, 1.2 KB checked in by mmamonski, 13 years ago (diff)

Torque/PBS DRMAA initial commit

Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_FUNC_GETTID([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
6#
7# DESCRIPTION
8#
9#   Check for gettid system call.  When found this macro
10#   defines HAVE_GETTID.  It may be used after following
11#   definition (it is not defined in Linux headers)::
12#
13#     #include <sys/types.h>
14#     #include <sys/syscall.h>
15#     pid_t gettid(void) {  return (pid_t)syscall( __NR_gettid );  }
16#
17# LAST MODIFICATION
18#
19#   2008-06-13
20#
21# LICENSE
22#
23#   Written by Łukasz Cieśnik <lukasz.ciesnik@fedstage.com>
24#   and placed under Public Domain
25#
26
27AC_DEFUN([AX_FUNC_GETTID],[
28AC_MSG_CHECKING([for gettid])
29AC_REQUIRE([AC_PROG_CC])
30AH_TEMPLATE([HAVE_GETTID], [Define to 1 if you have the gettid() syscall.])
31
32AC_LANG_PUSH([C])
33AC_COMPILE_IFELSE(
34        AC_LANG_PROGRAM([[
35@%:@include <sys/types.h>
36@%:@include <sys/syscall.h>
37@%:@include <unistd.h>
38pid_t gettid(void) { return (pid_t)syscall(__NR_gettid); }]],
39        [[pid_t tid = gettid(); return 0;]]),
40[ax_func_gettid_ok=yes], [ax_func_gettid_ok=no])
41AC_LANG_POP([C])
42
43AC_MSG_RESULT([$ax_func_gettid_ok])
44if test x$ax_func_gettid_ok = xyes; then
45        AC_DEFINE([HAVE_GETTID], [1])
46        ifelse([$1], , :, [$1])
47else
48        ifelse([$2], , :, [$2])
49fi
50])
Note: See TracBrowser for help on using the repository browser.