build-sys: eliminate dependencies for the NUMA support

Oh that poor ol' build system. With this patch it will
have gone through three separate incarnations in terms
of NUMA/Node support. Those 3 iterations consisted of:

1. A 'porridge too hot' where the top numa support was
enabled if it was built in the presence of libnuma and
the numa.h header. But if the numa library wasn't part
of core packages, that would have broken poor old top.

2. A 'porridge too cold' where numa support was off by
default and must have been explicitly enabled when the
./configure script was run. This could have meant that
distros might not distribute a numa-aware procps, even
though their numa library would have been distributed.

3. And this 'porridge' where the top numa support will
become a 'plug-in' feature activated when the presence
of libnuma.so can be verified at runtime. We'll do our
own loading and symbol resolution (with some help from
dlopen in libdl). Thus maintainers' responsibility for
enabling numa support and then satisfying that library
dependency is now an entirely optional --disable-numa.

As Goldilocks might say about our current configure.ac
"Ummm, I think this porridge tastes just about right".

Reference(s):
. 1) too-hot
commit 87ac6383bb
. 2) too-cold
commit 53fd7dd1ed
. original idea from: Dr. Fink <werner@suse.de>
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,18

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-04-25 00:00:00 -05:00 committed by Craig Small
parent a076c37d07
commit 5686877cd4
2 changed files with 9 additions and 20 deletions

View File

@ -49,6 +49,7 @@ fi
# Checks for header files.
AC_HEADER_MAJOR
AC_CHECK_HEADERS([\
dlfcn.h \
fcntl.h \
langinfo.h \
libintl.h \
@ -221,25 +222,14 @@ if test "x$enable_sigwinch" = xyes; then
AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
fi
NUMA_LIB=
AC_SEARCH_LIBS([numa_node_of_cpu], [numa],
if test x"$ac_cv_search_numa_node_of_cpu" != x"no"; then
NUMA_LIB="$ac_cv_search_numa_node_of_cpu";
fi)
AC_SUBST([NUMA_LIB])
AC_CHECK_HEADERS([numa.h])
AC_ARG_ENABLE([numa],
AS_HELP_STRING([--enable-numa], [enable NUMA/Node support in top]),
[enable_numa=yes], []
)
if test "x$enable_numa" = x"yes"; then
if test x"$ac_cv_header_numa_h" = x"no"; then
AC_MSG_ERROR([top numa support requires header 'numa.h'])
fi
if test x"$ac_cv_search_numa_node_of_cpu" = x"no"; then
AC_MSG_ERROR([top numa support requires library 'libnuma'])
fi
AC_DEFINE([NUMA_ENABLED], [1], [enable NUMA/Node support in top])
AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
[disable_numa=yes], [])
if test "x$disable_numa" = x"yes"; then
AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
else
AC_SEARCH_LIBS([dlopen], [dl], [],
[AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa])])
fi
AC_ARG_ENABLE([w-from],

View File

@ -3,8 +3,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-DLOCALEDIR=\"$(localedir)\"
AM_LDFLAGS = ../proc/libprocps.la
AM_LDFLAGS += $(NUMA_LIB)
AM_LDFLAGS = ../proc/libprocps.la -ldl
if WITH_NCURSES
usrbin_exec_PROGRAMS = \