diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2017-04-02 23:21:53 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2017-06-28 00:49:32 +0000 |
commit | 4988af8ca8f3323a5a6b63a0b83ebda1fc2d2a81 (patch) | |
tree | 005c7f875ef56d0adcada835b3bbb9c5322986b1 /util | |
parent | 3b633bbf1dfcd9107b8a1cc86ce8c34f6fc06fdb (diff) | |
download | coreboot-4988af8ca8f3323a5a6b63a0b83ebda1fc2d2a81.tar.xz |
util/superiotool: Check for libpci before builing
Check is adapted from inteltool's Makefile.
Change-Id: Ife01ef20d9284cb0a68719757856f9a66a4de452
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/19074
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/superiotool/Makefile | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile index f6d9685585..f05e1f9d1f 100644 --- a/util/superiotool/Makefile +++ b/util/superiotool/Makefile @@ -60,7 +60,7 @@ LIBS += -lpciutils endif endif -all: $(PROGRAM) +all: pciutils $(PROGRAM) superiotool.o: *.c superiotool.h @@ -79,3 +79,34 @@ clean: 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 |