platform/meson: Port pciutils/pci.h workaround to Meson
Change-Id: Idc6f442361ea3860d7ad3932ad1b72c6ff56ba45
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/130
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/platform/meson.build b/platform/meson.build
index e4dc7c5..cd8810d 100644
--- a/platform/meson.build
+++ b/platform/meson.build
@@ -1,3 +1,5 @@
+fs = import('fs')
+
srcs += files(
('endian_' + host_machine.endian() + '.c'),
'memaccess.c',
@@ -21,8 +23,8 @@
endif
endif
-# NetBSD requires libi386 or libx86_64 for I/O port handling
if host_machine.system() == 'netbsd'
+ # NetBSD requires libi386 or libx86_64 for I/O port handling
if host_machine.cpu_family() == 'x86'
libi386 = cc.find_library('i386')
deps += libi386
@@ -30,6 +32,10 @@
libx86_64 = cc.find_library('x86_64')
deps += libx86_64
endif
+ # and special handling for `pci.h` not being inside `pci/`
+ if fs.exists('/usr/pkg/include/pciutils/pci.h')
+ add_project_arguments('-DPCIUTILS_PCI_H', language : 'c')
+ endif
endif