Le 06/02/2013 19:01, Brice Goglin a écrit :
> Le 06/02/2013 16:10, Jeff Squyres (jsquyres) a écrit :
>> On Feb 6, 2013, at 7:02 AM, Brice Goglin <[email protected]> wrote:
>>
>>> Just pushed Samuel's patch + the configury + one fix for object names.
>>> The code currently uses libpciaccess by default. pciutils is only used
>>> when libpciaccess isn't available.
>> I think that this will still result in many GPL-enabled hwlocs by default
>> because libpci is installed on many distros by default, but libpciaccess is
>> not.
>>
>> How about:
>>
>> - Check for libpciaccess. If found, use it. STOP.
>> - If not found:
>> - check for libpci.
>> - if found, and if --enable-gpl-taint was specified, use it. STOP.
>> - if not found, display the usual "no pci support" message at the end.
>> STOP.
>> - if found:
>> - display the usual "no pci support" message at the end
>> - but also display a big, bold, flashing message saying "We can enable
>> PCI support in one of two ways: 1) download/install libpciaccess
>> (http://cgit.freedesktop.org/xorg/lib/libpciaccess/), or 2) pass
>> --enable-gpl-taint to allow hwloc to use libpci, BUT BE AWARE THAT THIS
>> MAKES THIS HWLOC BINARY AND EVERYTHING THAT IT LINKS TO BE GPL!"
> If "configure --help" and the big warning both say that enabling it
> *may* taint as GPL, the option could just be "--enable-libpci".
>
See the attached patch.
By the way, libpciaccess looks OK in a FreeBSD 9.1 VM. On NetBSD 6, the
only problem I see is that it doesn't find vendor/device names, but I am
far from being sure I have everything needed installed.
Brice
diff --git a/config/hwloc.m4 b/config/hwloc.m4
index 2fdc198..037c9b4 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -640,7 +640,7 @@ EOF])
# 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_system_init], [:], [hwloc_pci_happy=no])
if test x$hwloc_pci_happy = xyes; then hwloc_pci_lib=pciaccess; fi
@@ -686,11 +686,18 @@ EOF])
[hwloc_pci_happy=no])])
], [hwloc_pci_happy=no])
])
- if test x$hwloc_pci_happy = xyes; then hwloc_pci_lib=pciutils; fi
+ if test x$hwloc_pci_happy = xyes; then
+ if test x$enable_libpci = xyes; then
+ hwloc_pci_lib=pciutils
+ else
+ hwloc_pci_happy=no
+ hwloc_warn_may_use_libpci=yes
+ fi
+ fi
fi
AC_SUBST(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])])
diff --git a/config/hwloc_internal.m4 b/config/hwloc_internal.m4
index 3a79ae6..5970185 100644
--- a/config/hwloc_internal.m4
+++ b/config/hwloc_internal.m4
@@ -64,6 +64,9 @@ AC_DEFUN([HWLOC_DEFINE_ARGS],[
AC_ARG_ENABLE([pci],
AS_HELP_STRING([--disable-pci],
[Disable the PCI device discovery using libpci]))
+ AC_ARG_ENABLE([libpci],
+ AS_HELP_STRING([--enable-libpci],
+ [Use libpci for PCI support. Note that this may taint hwloc as GPL.]))
# OpenCL?
AC_ARG_ENABLE([opencl],
diff --git a/configure.ac b/configure.ac
index d85de3b..c9f5064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,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 it may taint hwloc as GPL."
+ echo "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])