From 1afef1899dde3b0ead9c556bce360afdba42c097 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 26 Sep 2011 03:24:22 +0000 Subject: [PATCH] Add flag to allow using the system install of hwloc. --- Makefile.am | 4 ++-- configure.ac | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 57651a93..1c09ae90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -if HAVE_HWLOC +if HAVE_BUNDLED_HWLOC SUBDIRS = hwloc-1.2.1 endif @@ -41,7 +41,7 @@ SUFFIXES = .h BUILT_SOURCES = $(myhtopheaders) htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h -if HAVE_HWLOC +if HAVE_BUNDLED_HWLOC htop_LDADD = $(HWLOC_EMBEDDED_LDADD) $(HWLOC_EMBEDDED_LIBS) AM_CFLAGS += $(HWLOC_EMBEDDED_CFLAGS) AM_CPPFLAGS += $(HWLOC_EMBEDDED_CPPFLAGS) diff --git a/configure.ac b/configure.ac index b63ef6b6..b049215b 100644 --- a/configure.ac +++ b/configure.ac @@ -111,15 +111,28 @@ AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find /proc/meminfo. Make sur fi ##### hwloc +AC_ARG_ENABLE(system-hwloc, [AC_HELP_STRING([--enable-system-hwloc], [use the copy of hwloc from your system and not the one bundled with the htop sources. (hwloc required)])], ,enable_system_hwloc="no") enable_xml=no AC_ARG_ENABLE(hwloc, [AC_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="yes") if test "x$enable_hwloc" = xyes then - HWLOC_SETUP_CORE([hwloc-1.2.1], [hwloc_happy=yes], [hwloc_happy=no]) + if test "x$enable_system_hwloc" = xyes + then + AC_CHECK_LIB([hwloc], [hwloc_linux_get_tid_cpubind], [], [missing_libraries="$missing_libraries libhwloc"]) + AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"]) + + else + HWLOC_SETUP_CORE([hwloc-1.2.1], [hwloc_bundled=yes], [hwloc_bundled=no]) + fi fi HWLOC_DO_AM_CONDITIONALS -AM_CONDITIONAL([HAVE_HWLOC], [test "x$hwloc_happy" = "xyes"]) -if test "x$hwloc_happy" = "xyes"; then +AM_CONDITIONAL([HAVE_HWLOC], [test "x$hwloc_bundled" = "xyes" -o "x$hwloc_system" = "xyes"]) +AM_CONDITIONAL([HAVE_BUNDLED_HWLOC], [test "x$hwloc_bundled" = "xyes"]) +if test "x$hwloc_system" = "xyes"; then + AC_DEFINE([HAVE_SYSTEM_HWLOC], 1, [Have system hwloc]) + AC_DEFINE([HAVE_HWLOC], 1, [Have hwloc]) +elif test "x$hwloc_bundled" = "xyes"; then + AC_DEFINE([HAVE_BUNDLED_HWLOC], 1, [Use bundled hwloc]) AC_DEFINE([HAVE_HWLOC], 1, [Have hwloc]) fi #####