Arthur Heymans has uploaded a new change for review. ( https://review.coreboot.org/19074 )
Change subject: util/superiotool: Check for libpci before builing ......................................................................
util/superiotool: Check for libpci before builing
Check is adapted from inteltools Makefile.
Change-Id: Ife01ef20d9284cb0a68719757856f9a66a4de452 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M util/superiotool/Makefile 1 file changed, 32 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/19074/1
diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile index f6d9685..f05e1f9 100644 --- a/util/superiotool/Makefile +++ b/util/superiotool/Makefile @@ -60,7 +60,7 @@ endif endif
-all: $(PROGRAM) +all: pciutils $(PROGRAM)
superiotool.o: *.c superiotool.h
@@ -79,3 +79,34 @@ distclean: clean
.PHONY: all install clean distclean + +ifeq ($(CONFIG_PCI), yes) +define LIBPCI_TEST +/* Avoid a failing test due to libpci header symbol shadowing breakage */ +#define index shadow_workaround_index +#ifdef __NetBSD__ +#include <pciutils/pci.h> +#else +#include <pci/pci.h> +#endif +struct pci_access *pacc; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + pacc = pci_alloc(); + return 0; +} +endef +export LIBPCI_TEST + +pciutils: + @printf "\nChecking for pciutils and zlib... " + @echo "$$LIBPCI_TEST" > .test.c + @$(CC) $(CFLAGS) .test.c -o .test $(LIBS) >/dev/null 2>&1 && \ + printf "found.\n" || ( printf "not found.\n\n"; \ + printf "Please install pciutils-devel and zlib-devel.\n"; \ + printf "See README for more information.\n\n"; \ + rm -f .test.c .test; exit 1) + @rm -rf .test.c .test .test.dSYM +endif