|
338 | 338 | AC_CHECK_FUNCS([clock_gettime])
|
339 | 339 | ])
|
340 | 340 |
|
| 341 | + # Check for ptrace support |
| 342 | + hwloc_have_ptrace=1 |
| 343 | + AC_CHECK_HEADERS([sys/ptrace.h],, [hwloc_have_ptrace=0]) |
| 344 | + AC_CHECK_FUNCS([ptrace],, [hwloc_have_ptrace=0]) |
| 345 | + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 346 | + #include "sys/ptrace.h" |
| 347 | + int main(void){ |
| 348 | + return ptrace(PTRACE_SEIZE, |
| 349 | + -1, |
| 350 | + 0, |
| 351 | + (void*)(PTRACE_O_TRACECLONE|PTRACE_O_TRACEFORK)); |
| 352 | + } |
| 353 | + ]])],, [hwloc_have_ptrace=0]) |
| 354 | + AM_CONDITIONAL([HWLOC_HAVE_PTRACE],[test $hwloc_have_ptrace -eq 1]) |
| 355 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTRACE], [$hwloc_have_ptrace], [Whether ptrace is present and supports PTRACE_SEIZE or not]) |
| 356 | +
|
| 357 | + # Check if syscall gettid is available. |
| 358 | + hwloc_have_sys_gettid=1 |
| 359 | + AC_CHECK_HEADERS([sys/syscall.h],, [hwloc_have_sys_gettid=0]) |
| 360 | + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 361 | + #include "sys/syscall.h" |
| 362 | + #ifndef SYS_gettid |
| 363 | + #error "syscall SYS_gettid not found" |
| 364 | + #endif |
| 365 | + int main(void){ return syscall(SYS_gettid) > 0;} |
| 366 | + ]])],,[hwloc_have_sys_gettid=0]) |
| 367 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_SYS_GETTID], [$hwloc_have_sys_gettid], [Whether syscall header is present and SYS_gettid macro is defined or not]) |
| 368 | +
|
341 | 369 | # Only generate this if we're building the utilities
|
342 | 370 | # Even the netloc library Makefile is here because
|
343 | 371 | # we don't embed libnetloc yet, it's useless without tools
|
@@ -368,7 +396,11 @@ AC_DEFUN([HWLOC_SETUP_TESTS],[
|
368 | 396 | ###
|
369 | 397 | EOF
|
370 | 398 |
|
371 |
| - AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes]) |
| 399 | + # Check thread support. |
| 400 | + AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=1], [hwloc_have_pthread=0]) |
| 401 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTHREAD], [$hwloc_have_pthread], [Whether we have the pthread library or not]) |
| 402 | + AM_CONDITIONAL([HWLOC_HAVE_PTHREAD], [test $hwloc_have_pthread -eq 1]) AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes]) |
| 403 | + AC_OPENMP |
372 | 404 |
|
373 | 405 | HWLOC_PKG_CHECK_MODULES([NUMA], [numa], [numa_available], [numa.h],
|
374 | 406 | [hwloc_have_linux_libnuma=yes],
|
|
0 commit comments