[libvirt] [PATCH 05/28] Convert numactl checks to use LIBVIRT_CHECK_LIB

Daniel P. Berrange berrange at redhat.com
Fri Jan 11 11:05:45 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 configure.ac       | 53 ++++-------------------------------------------------
 m4/virt-numactl.m4 | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 49 deletions(-)
 create mode 100644 m4/virt-numactl.m4

diff --git a/configure.ac b/configure.ac
index a02694b..4c1d12e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,7 @@ LIBVIRT_COMPILE_WARNINGS
 
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_AUDIT
+LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_SASL
 LIBVIRT_CHECK_SELINUX
@@ -1330,34 +1331,6 @@ fi
 AM_CONDITIONAL([WITH_DTRACE_PROBES], [test "$with_dtrace" != "no"])
 
 
-dnl NUMA lib
-AC_ARG_WITH([numactl],
-  AC_HELP_STRING([--with-numactl], [use numactl for host topology info @<:@default=check@:>@]),
-  [],
-  [with_numactl=check])
-
-NUMACTL_CFLAGS=
-NUMACTL_LIBS=
-if test "$with_qemu" = "yes" && test "$with_numactl" != "no"; then
-  old_cflags="$CFLAGS"
-  old_libs="$LIBS"
-  if test "$with_numactl" = "check"; then
-    AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
-    AC_CHECK_LIB([numa], [numa_available],[],[with_numactl=no])
-    if test "$with_numactl" != "no"; then
-      with_numactl="yes"
-    fi
-  else
-    fail=0
-    AC_CHECK_HEADER([numa.h],[],[fail=1])
-    AC_CHECK_LIB([numa], [numa_available],[],[fail=1])
-    test $fail = 1 &&
-      AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])
-  fi
-  CFLAGS="$old_cflags"
-  LIBS="$old_libs"
-fi
-
 dnl numad
 AC_ARG_WITH([numad],
   AC_HELP_STRING([--with-numad], [use numad to manage CPU placement dynamically @<:@default=check@:>@]),
@@ -1365,15 +1338,12 @@ AC_ARG_WITH([numad],
   [with_numad=check])
 
 if test "$with_numad" != "no" ; then
-  old_cflags="$CFLAGS"
-  old_libs="$LIBS"
   fail=0
 
   AC_PATH_PROG([NUMAD], [numad], [], [/bin:/usr/bin])
 
   if test "$with_numad" = "check"; then
-    AC_CHECK_HEADER([numa.h], [], [fail=1])
-    AC_CHECK_LIB([numa], [numa_available], [], [fail=1])
+    test "$with_numactl" = "yes" || fail=1
     if test -z "$NUMAD" || test $fail = 1; then
       with_numad="no"
     else
@@ -1383,27 +1353,16 @@ if test "$with_numad" != "no" ; then
     test -z  "$NUMAD" &&
       AC_MSG_ERROR([You must install numad package to manage CPU and memory placement dynamically])
 
-    AC_CHECK_HEADER([numa.h], [], [fail=1])
-    AC_CHECK_LIB([numa], [numa_available], [], [fail=1])
+    test "$with_numactl" = "yes" || fail=1
     test $fail = 1 &&
       AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])
   fi
-
-  CFLAGS="$old_cflags"
-  LIBS="$old_libs"
 fi
 if test "$with_numad" = "yes"; then
   AC_DEFINE_UNQUOTED([HAVE_NUMAD], 1, [whether numad is available])
   AC_DEFINE_UNQUOTED([NUMAD],["$NUMAD"], [Location or name of the numad program])
 fi
-if test "$with_numactl" = "yes" || test "$with_numad" = "yes"; then
-  NUMACTL_LIBS="-lnuma"
-  AC_DEFINE_UNQUOTED([WITH_NUMACTL], 1, [whether numactl-devel is available])
-fi
 AM_CONDITIONAL([HAVE_NUMAD], [test "$with_numad" != "no"])
-AM_CONDITIONAL([WITH_NUMACTL], [test "$with_numad" != "no" || test "$with_numactl" != "no"])
-AC_SUBST([NUMACTL_CFLAGS])
-AC_SUBST([NUMACTL_LIBS])
 
 dnl pcap lib
 LIBPCAP_CONFIG="pcap-config"
@@ -2831,6 +2790,7 @@ AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_APPARMOR
 LIBVIRT_RESULT_AUDIT
+LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_SASL
 LIBVIRT_RESULT_SELINUX
@@ -2872,11 +2832,6 @@ fi
 else
 AC_MSG_NOTICE([  polkit: no])
 fi
-if test "$with_numactl" = "yes" ; then
-AC_MSG_NOTICE([ numactl: $NUMACTL_CFLAGS $NUMACTL_LIBS])
-else
-AC_MSG_NOTICE([ numactl: no])
-fi
 if test "$with_capng" = "yes" ; then
 AC_MSG_NOTICE([   capng: $CAPNG_CFLAGS $CAPNG_LIBS])
 else
diff --git a/m4/virt-numactl.m4 b/m4/virt-numactl.m4
new file mode 100644
index 0000000..1dcb029
--- /dev/null
+++ b/m4/virt-numactl.m4
@@ -0,0 +1,26 @@
+dnl The libnuma.so library
+dnl
+dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_NUMACTL],[
+  LIBVIRT_CHECK_LIB([NUMACTL], [numa], [numa_available], [numa.h])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_NUMACTL],[
+  LIBVIRT_RESULT_LIB([NUMACTL])
+])
-- 
1.7.11.7




More information about the libvir-list mailing list