diff options
author | Nathan Scott <natoscott@users.noreply.github.com> | 2020-09-28 16:47:47 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 16:47:47 +1000 |
commit | e75077a9f8c325d8f30afbec235a2b255f78cdc2 (patch) | |
tree | 3981b61d35b1fd5c9da784cc6cfc95fbab556bb7 /configure.ac | |
parent | 61913364986adff8b207db0cd7d06c49d4dd1875 (diff) | |
parent | 005c4d1f2321b45f484fab0127db315927c2207b (diff) |
Merge pull request #107 from cgzones/hwlock_linuxaffinity
Make --enable-hwloc and --enable-linux-affinity mutual exclusive
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index a220155f..d06c598f 100644 --- a/configure.ac +++ b/configure.ac @@ -214,33 +214,43 @@ if test "$my_htop_platform" = "solaris"; then AC_CHECK_LIB([malloc], [free], [], [missing_libraries="$missing_libraries libmalloc"]) fi -AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_linux_affinity="yes") -if test "x$enable_linux_affinity" = xyes; then - AC_MSG_CHECKING([for usable sched_setaffinity]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - #include <sched.h> - #include <errno.h> - static cpu_set_t cpuset; - ]], [[ - CPU_ZERO(&cpuset); - sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); - if (errno == ENOSYS) return 1; - ]])], - [AC_MSG_RESULT([yes])], - [enable_linux_affinity=no - AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes (assumed while cross compiling)])]) +AC_ARG_ENABLE(hwloc, [AS_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity, disables Linux affinity])],, enable_hwloc="no") +if test "x$enable_hwloc" = xyes +then + AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [missing_libraries="$missing_libraries libhwloc"]) + AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"]) +fi + +AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, conflicts with hwloc])], ,enable_linux_affinity="check") +if test "x$enable_linux_affinity" = xcheck; then + if test "x$enable_hwloc" = xyes; then + enable_linux_affinity=no + else + AC_MSG_CHECKING([for usable sched_setaffinity]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + #include <sched.h> + #include <errno.h> + static cpu_set_t cpuset; + ]], [[ + CPU_ZERO(&cpuset); + sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); + if (errno == ENOSYS) return 1; + ]])], + [enable_linux_affinity=yes + AC_MSG_RESULT([yes])], + [enable_linux_affinity=no + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes (assumed while cross compiling)])]) + fi fi if test "x$enable_linux_affinity" = xyes; then AC_DEFINE(HAVE_LINUX_AFFINITY, 1, [Define if Linux sched_setaffinity and sched_getaffinity are to be used.]) fi -AC_ARG_ENABLE(hwloc, [AS_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="no") -if test "x$enable_hwloc" = xyes +if test "x$enable_linux_affinity" = xyes -a "x$enable_hwloc" = xyes then - AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [missing_libraries="$missing_libraries libhwloc"]) - AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"]) + AC_MSG_ERROR([--enable-hwloc and --enable-linux-affinity are mutual exclusive. Specify at most one of them.]) fi AC_ARG_ENABLE(setuid, [AS_HELP_STRING([--enable-setuid], [enable setuid support for platforms that need it])],, enable_setuid="no") |