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

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

Torque/PBS DRMAA initial commit

Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_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#   2007-12-14
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_GETTID],[
28AC_MSG_CHECKING([for gettid])
29AC_REQUIRE([AC_PROG_CC])
30
31AC_LANG_PUSH([C])
32AC_COMPILE_IFELSE(
33        AC_LANG_PROGRAM([[
34@%:@include <sys/types.h>
35@%:@include <sys/syscall.h>
36@%:@include <unistd.h>
37pid_t gettid(void) { return (pid_t)syscall(__NR_gettid); }]],
38        [[pid_t tid = gettid(); return 0;]]),
39[ax_gettid_ok=yes], [ax_gettid_ok=no])
40AC_LANG_POP([C])
41
42AC_MSG_RESULT([$ax_gettid_ok])
43if test x$ax_gettid_ok = xyes; then
44        AC_DEFINE([HAVE_GETTID],1,[Define to 1 if you have the gettid() syscall.])
45fi
46if test x$ax_gettid_ok = xyes; then
47        $1
48        :
49else
50        $2
51        :
52fi
53])
Note: See TracBrowser for help on using the repository browser.