Add a ftdi option alongside USB and PCI to control the external dependency, and
ensure that the build is successful in all combinations of options.

Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@arm.com>

diff --git a/meson.build b/meson.build
index 375089c..0df9d69 100644
--- a/meson.build
+++ b/meson.build
@@ -91,6 +91,8 @@ else
   config_digilent_spi = false
   config_developerbox_spi = false
   config_pickit2_spi = false
+  config_stlinkv3_spi = false
+  config_usbblaster_spi = false
 endif
 
 # some programmers require libpci
@@ -118,6 +120,21 @@ else
   config_satasii = false
 endif
 
+# some programmers require libftdi
+if get_option('ftdi')
+  deps += dependency('libftdi1')
+else
+  config_ft2232_spi = false
+  config_usbblaster_spi = false
+endif
+
+if not (target_machine.cpu_family() == 'x86' or target_machine.cpu_family() == 'x86_64')
+  config_satamv = false
+  config_nic3com = false
+  config_rayer_spi = false
+  config_nicrealtek = false
+endif
+
 # set defines for configured programmers
 if config_atahpt
   srcs += 'atahpt.c'
@@ -163,7 +180,6 @@ endif
 if config_ft2232_spi
   srcs += 'ft2232_spi.c'
   cargs += '-DCONFIG_FT2232_SPI=1'
-  deps += dependency('libftdi1')
   cargs += '-DHAVE_FT232H=1'
 endif
 if config_gfxnvidia
@@ -216,6 +232,7 @@ endif
 if config_nicintel
   srcs += 'nicintel.c'
   cargs += '-DCONFIG_NICINTEL=1'
+  need_raw_access = true
 endif
 if config_nicintel_eeprom
   srcs += 'nicintel_eeprom.c'
diff --git a/meson_options.txt b/meson_options.txt
index ea87311..b6b842d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
 option('pciutils', type : 'boolean', value : true, description : 'use pciutils')
 option('usb', type : 'boolean', value : true, description : 'use libusb1')
+option('ftdi', type : 'boolean', value : true, description : 'use libftdi')
 
 option('config_atahpt', type : 'boolean', value : false, description : 'Highpoint (HPT) ATA/RAID controllers')
 option('config_atapromise', type : 'boolean', value : false, description : 'Promise ATA controller')
