|
355 | 355 | AC_CHECK_FUNCS([clock_gettime])
|
356 | 356 | ])
|
357 | 357 |
|
| 358 | + # Check for ptrace support |
| 359 | + hwloc_have_ptrace=1 |
| 360 | + AC_CHECK_HEADERS([sys/ptrace.h],, [hwloc_have_ptrace=0]) |
| 361 | + AC_CHECK_FUNCS([ptrace],, [hwloc_have_ptrace=0]) |
| 362 | + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 363 | + #include "sys/ptrace.h" |
| 364 | + int main(void){ |
| 365 | + return ptrace(PTRACE_SEIZE, |
| 366 | + -1, |
| 367 | + 0, |
| 368 | + (void*)(PTRACE_O_TRACECLONE|PTRACE_O_TRACEFORK)); |
| 369 | + } |
| 370 | + ]])],, [hwloc_have_ptrace=0]) |
| 371 | + AM_CONDITIONAL([HWLOC_HAVE_PTRACE],[test $hwloc_have_ptrace -eq 1]) |
| 372 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTRACE], [$hwloc_have_ptrace], [Whether ptrace is present and supports PTRACE_SEIZE or not]) |
| 373 | +
|
| 374 | + # Check if syscall gettid is available. |
| 375 | + hwloc_have_sys_gettid=1 |
| 376 | + AC_CHECK_HEADERS([sys/syscall.h],, [hwloc_have_sys_gettid=0]) |
| 377 | + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 378 | + #include "sys/syscall.h" |
| 379 | + #ifndef SYS_gettid |
| 380 | + #error "syscall SYS_gettid not found" |
| 381 | + #endif |
| 382 | + int main(void){ return syscall(SYS_gettid) > 0;} |
| 383 | + ]])],,[hwloc_have_sys_gettid=0]) |
| 384 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_SYS_GETTID], [$hwloc_have_sys_gettid], [Whether syscall header is present and SYS_gettid macro is defined or not]) |
| 385 | +
|
358 | 386 | # Only generate this if we're building the utilities
|
359 | 387 | # Even the netloc library Makefile is here because
|
360 | 388 | # we don't embed libnetloc yet, it's useless without tools
|
@@ -385,7 +413,11 @@ AC_DEFUN([HWLOC_SETUP_TESTS],[
|
385 | 413 | ###
|
386 | 414 | EOF
|
387 | 415 |
|
388 |
| - AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes]) |
| 416 | + # Check thread support. |
| 417 | + AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=1], [hwloc_have_pthread=0]) |
| 418 | + AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTHREAD], [$hwloc_have_pthread], [Whether we have the pthread library or not]) |
| 419 | + AM_CONDITIONAL([HWLOC_HAVE_PTHREAD], [test $hwloc_have_pthread -eq 1]) AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes]) |
| 420 | + AC_OPENMP |
389 | 421 |
|
390 | 422 | HWLOC_PKG_CHECK_MODULES([NUMA], [numa], [numa_available], [numa.h],
|
391 | 423 | [hwloc_have_linux_libnuma=yes],
|
|
0 commit comments