From c433910718cf5d5664aab87773ae473061e6b87b Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Mon, 27 Feb 2023 15:37:25 +0100 Subject: include/pci.h: Use __has_include() macro to test pci.h path Some NetBSDs have the pci.h under pciutils/ instead of pci/. But we can't say for sure which variants uses which include path. Just test them with the __has_include() compiler macro. https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html Change-Id: Ib20de6bffede910b89937f554b4d56f4799f0762 Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/73292 Reviewed-by: Edward O'Callaghan Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- include/platform/pci.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/platform/pci.h b/include/platform/pci.h index 93bc163b..a0324f88 100644 --- a/include/platform/pci.h +++ b/include/platform/pci.h @@ -14,12 +14,16 @@ */ #define index shadow_workaround_index -#if defined (__NetBSD__) -#include +/* Some NetBSDs are using an other include path for pci.h + * e.g. NetBSD 9.0 on sparc64 pciutils-3.7.0nb2. + * Other NetBSD platforms and versions uses the default path under pci/pci.h + */ +#if __has_include() +#include #else #include #endif #undef index -#endif /* __PLATFORM_PCI_H__ */ \ No newline at end of file +#endif /* __PLATFORM_PCI_H__ */ -- cgit v1.2.3