Makefile: Make pkg-config mandatory to find libpci

Use `make HAS_LIBPCI=yes/no` to override the pkg-config detection and
`CONFIG_LIBPCI_CFLAGS` and `CONFIG_LIBPCI_LDFLAGS` to set cflags and
ldflags manually. The optional dependency of libpci libz, is
automatically handled by pkg-config.

Change-Id: I21b4a261b34b7e688635fc6e20b7beebfa64c7ed
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/59050
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72281
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/Makefile.d/pci_old_get_dev_test.c b/Makefile.d/pci_old_get_dev_test.c
new file mode 100644
index 0000000..35739c1
--- /dev/null
+++ b/Makefile.d/pci_old_get_dev_test.c
@@ -0,0 +1,17 @@
+/* Avoid a failing test due to libpci header symbol shadowing breakage */
+#define index shadow_workaround_index
+#if defined (PCIUTILS_PCI_H)
+#include <pciutils/pci.h>
+#else
+#include <pci/pci.h>
+#endif
+struct pci_access *pacc;
+struct pci_dev *dev = {0};
+int main(int argc, char **argv)
+{
+	(void) argc;
+	(void) argv;
+	pacc = pci_alloc();
+	dev = pci_get_dev(pacc, dev->bus, dev->dev, 1);
+	return 0;
+}