diff --git a/config/hwloc.m4 b/config/hwloc.m4 index a5677b5..340aeac 100644 --- a/config/hwloc.m4 +++ b/config/hwloc.m4 @@ -1,6 +1,6 @@ dnl -*- Autoconf -*- dnl -dnl Copyright © 2009-2012 Inria. All rights reserved. +dnl Copyright © 2009-2013 Inria. All rights reserved. dnl Copyright (c) 2009-2012 Université Bordeaux 1 dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana dnl University Research and Technology @@ -615,8 +615,13 @@ EOF]) fi # PCI support - hwloc_pci_happy=no - if test "x$enable_pci" != "xno"; then + if test "x$enable_pci" != xno -a "x$enable_libpci" != "xyes"; then + hwloc_pci_happy=yes + HWLOC_PKG_CHECK_MODULES([PCIACCESS], [pciaccess], [pci_slot_match_iterator_create], [:], [hwloc_pci_happy=no]) + if test x$hwloc_pci_happy = xyes; then hwloc_pci_lib=pciaccess; fi + fi + # PCI support with pciutils instead of pciaccess + if test "x$enable_pci" != "xno" -a "x$hwloc_pci_lib" != "xpciaccess"; then hwloc_pci_happy=yes HWLOC_PKG_CHECK_MODULES([PCI], [libpci], [pci_cleanup], [:], [ # manually check pciutils in case a old one without .pc is installed @@ -656,19 +661,39 @@ EOF]) [hwloc_pci_happy=no])]) ], [hwloc_pci_happy=no]) ]) + if test x$hwloc_pci_happy = xyes; then + # pciutils could be used, but we don't want to force use it since it may GPL-taint hwloc + if test x$enable_libpci = xyes; then + hwloc_pci_lib=pciutils + else + # user didn't explicit request pciutils, disable PCI and warn the user + hwloc_pci_happy=no + hwloc_warn_may_use_libpci=yes + fi + fi fi AC_SUBST(HWLOC_PCI_LIBS) HWLOC_LIBS="$HWLOC_LIBS $HWLOC_PCI_LIBS" # If we asked for pci support but couldn't deliver, fail - AS_IF([test "$enable_pci" = "yes" -a "$hwloc_pci_happy" = "no"], + AS_IF([test "$enable_pci" = "yes" -a "$hwloc_pci_happy" = "no" -a "$hwloc_warn_may_use_libpci" != "yes"], [AC_MSG_WARN([Specified --enable-pci switch, but could not]) AC_MSG_WARN([find appropriate support]) AC_MSG_ERROR([Cannot continue])]) - if test "x$hwloc_pci_happy" = "xyes"; then + # pciaccess specific enabling + if test "x$hwloc_pci_lib" = "xpciaccess"; then + HWLOC_PCIACCESS_REQUIRES=pciaccess + AC_DEFINE([HWLOC_HAVE_LIBPCIACCESS], [1], [Define to 1 if you have the `libpciaccess' library.]) + + hwloc_components="$hwloc_components libpci" + hwloc_libpci_component_maybeplugin=1 + fi + # pciutils specific checks and enabling + if test "x$hwloc_pci_lib" = "xpciutils"; then tmp_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $HWLOC_PCI_CFLAGS" tmp_save_LIBS="$LIBS" LIBS="$LIBS $HWLOC_PCI_LIBS" + AC_CHECK_DECLS([PCI_LOOKUP_NO_NUMBERS],,[:],[[#include ]]) AC_CHECK_DECLS([PCI_LOOKUP_NO_NUMBERS],,[:],[[#include ]]) AC_CHECK_LIB([pci], [pci_find_cap], [enable_pci_caps=yes], [enable_pci_caps=no], [$HWLOC_PCI_ADDITIONAL_LIBS]) @@ -694,15 +719,15 @@ EOF]) AC_DEFINE([HWLOC_HAVE_PCIDEV_DOMAIN], [1], [Define to 1 if struct pci_dev has a `domain' field.]) fi - HWLOC_REQUIRES="libpci $HWLOC_REQUIRES" - AC_DEFINE([HWLOC_HAVE_LIBPCI], [1], [Define to 1 if you have the `libpci' library.]) - AC_SUBST([HWLOC_HAVE_LIBPCI], [1]) CFLAGS="$tmp_save_CFLAGS" LIBS="$tmp_save_LIBS" - else - AC_SUBST([HWLOC_HAVE_LIBPCI], [0]) + + HWLOC_PCI_REQUIRES=libpci + AC_DEFINE([HWLOC_HAVE_LIBPCI], [1], [Define to 1 if you have the `libpci' library.]) fi - HWLOC_CFLAGS="$HWLOC_CFLAGS $HWLOC_PCI_CFLAGS" + HWLOC_LIBS="$HWLOC_LIBS $HWLOC_PCI_LIBS $HWLOC_PCIACCESS_LIBS" + HWLOC_CFLAGS="$HWLOC_CFLAGS $HWLOC_PCI_CFLAGS $HWLOC_PCIACCESS_CFLAGS" + HWLOC_REQUIRES="$HWLOC_PCI_REQUIRES $HWLOC_PCIACCESS_REQUIRES $HWLOC_REQUIRES" # libxml2 support hwloc_libxml2_happy= @@ -822,7 +847,7 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[ [test "x$hwloc_have_cudart" = "xyes"]) AM_CONDITIONAL([HWLOC_HAVE_LIBXML2], [test "$hwloc_libxml2_happy" = "yes"]) AM_CONDITIONAL([HWLOC_HAVE_CAIRO], [test "$hwloc_cairo_happy" = "yes"]) - AM_CONDITIONAL([HWLOC_HAVE_LIBPCI], [test "$hwloc_pci_happy" = "yes"]) + AM_CONDITIONAL([HWLOC_HAVE_PCI], [test "$hwloc_pci_happy" = "yes"]) AM_CONDITIONAL([HWLOC_HAVE_SET_MEMPOLICY], [test "x$enable_set_mempolicy" != "xno"]) AM_CONDITIONAL([HWLOC_HAVE_MBIND], [test "x$enable_mbind" != "xno"]) AM_CONDITIONAL([HWLOC_HAVE_BUNZIPP], [test "x$BUNZIPP" != "xfalse"]) diff --git a/config/hwloc_internal.m4 b/config/hwloc_internal.m4 index aafb20f..804aedf 100644 --- a/config/hwloc_internal.m4 +++ b/config/hwloc_internal.m4 @@ -9,7 +9,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. -dnl Copyright © 2010 inria. All rights reserved. +dnl Copyright © 2010-2013 Inria. All rights reserved. dnl Copyright © 2006-2011 Cisco Systems, Inc. All rights reserved. dnl dnl See COPYING in top-level directory. @@ -63,7 +63,10 @@ AC_DEFUN([HWLOC_DEFINE_ARGS],[ # PCI? AC_ARG_ENABLE([pci], AS_HELP_STRING([--disable-pci], - [Disable the PCI device discovery using libpci])) + [Disable the PCI device discovery])) + AC_ARG_ENABLE([libpci], + AS_HELP_STRING([--enable-libpci], + [Use libpci for PCI support. Note that hwloc may be tainted by the pciutils GPL license.])) # Linux libnuma AC_ARG_ENABLE([libnuma], diff --git a/configure.ac b/configure.ac index 680b10c..b4fbd56 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- shell-script -*- # # Copyright © 2009 CNRS -# Copyright © 2009-2010 inria. All rights reserved. +# Copyright © 2009-2013 Inria. All rights reserved. # Copyright © 2009, 2011-2012 Université Bordeaux 1 # Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved. # @@ -180,6 +180,16 @@ append_env() { eval "[$]1=\"$new_value\"" } +# Warn about PCI support +if test x$hwloc_warn_may_use_libpci = xyes; then + echo + echo "**********************************************************************" + echo "PCI support could not be enable because libpciaccess is not available." + echo "libpci could be used instead but hwloc may be tainted by the GPL" + echo "license of pciutils. Add --enable-libpci to enable it." + echo "**********************************************************************" +fi + # Show which optional support we'll be building hwloc_xml_status=basic AS_IF([test "$hwloc_libxml2_happy" = "yes"], [hwloc_xml_status=full]) diff --git a/doc/hwloc.doxy b/doc/hwloc.doxy index b81342c..599a169 100644 --- a/doc/hwloc.doxy +++ b/doc/hwloc.doxy @@ -1,6 +1,6 @@ /* * Copyright © 2009 CNRS - * Copyright © 2009-2012 inria. All rights reserved. + * Copyright © 2009-2013 Inria. All rights reserved. * Copyright © 2009-2011 Université Bordeaux 1 * Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. @@ -144,7 +144,9 @@ is configured and build. The hwloc core may also benefit from the following development packages: