buildsystem: evaluate the USE_IOPL, USE_DEV_IO, USE_IOPERM macros
Determine which macro has to be set for the target system.
Do this in the buildsystem instead of using preprocessor macros.
Change-Id: Ic41ea025e35feb93f07ce7a94c0d15e6e84f38b9
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/58278
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72247
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/meson.build b/meson.build
index 29a57a9..dceadc8 100644
--- a/meson.build
+++ b/meson.build
@@ -42,6 +42,24 @@
add_project_arguments('-DIS_WINDOWS=0', language : 'c')
endif
+if host_machine.system() in ['linux', 'darwin', 'netbsd', 'openbsd']
+ add_project_arguments('-DUSE_IOPL=1', language : 'c')
+else
+ add_project_arguments('-DUSE_IOPL=0', language : 'c')
+endif
+
+if host_machine.system() in ['freebsd', 'dragonfly']
+ add_project_arguments('-DUSE_DEV_IO=1', language : 'c')
+else
+ add_project_arguments('-DUSE_DEV_IO=0', language : 'c')
+endif
+
+if host_machine.system() in ['gnu']
+ add_project_arguments('-DUSE_IOPERM=1', language : 'c')
+else
+ add_project_arguments('-DUSE_IOPERM=0', language : 'c')
+endif
+
# get defaults from configure
config_atahpt = get_option('config_atahpt')
config_atapromise = get_option('config_atapromise')