blob: cd8810d5fec50a58c2a7a246474a701018a1604f [file] [log] [blame]
Nico Huber34582202024-04-21 15:39:45 +02001fs = import('fs')
2
Thomas Heijligen328a64a2022-04-25 14:42:17 +02003srcs += files(
4 ('endian_' + host_machine.endian() + '.c'),
5 'memaccess.c',
6)
7
8if host_machine.endian() == 'little'
Nico Huberc3b02dc2023-08-12 01:13:45 +02009 add_project_arguments('-D__FLASHPROG_LITTLE_ENDIAN__=1', language : 'c')
Thomas Heijligen328a64a2022-04-25 14:42:17 +020010endif
11if host_machine.endian() == 'big'
Nico Huberc3b02dc2023-08-12 01:13:45 +020012 add_project_arguments('-D__FLASHPROG_BIG_ENDIAN__=1', language : 'c')
Thomas Heijligen328a64a2022-04-25 14:42:17 +020013endif
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020014
15# OpenBSD requires libi386 or libamd64 for I/O port handling
16if host_machine.system() == 'openbsd'
17 if host_machine.cpu_family() == 'x86'
18 libi386 = cc.find_library('i386')
19 deps += libi386
20 elif host_machine.cpu_family() == 'x86_64'
21 libamd64 = cc.find_library('amd64')
22 deps += libamd64
23 endif
24endif
25
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020026if host_machine.system() == 'netbsd'
Nico Huber34582202024-04-21 15:39:45 +020027 # NetBSD requires libi386 or libx86_64 for I/O port handling
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020028 if host_machine.cpu_family() == 'x86'
Nico Huberf2797622024-04-21 13:25:17 +020029 libi386 = cc.find_library('i386')
30 deps += libi386
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020031 elif host_machine.cpu_family() == 'x86_64'
32 libx86_64 = cc.find_library('x86_64')
33 deps += libx86_64
34 endif
Nico Huber34582202024-04-21 15:39:45 +020035 # and special handling for `pci.h` not being inside `pci/`
36 if fs.exists('/usr/pkg/include/pciutils/pci.h')
37 add_project_arguments('-DPCIUTILS_PCI_H', language : 'c')
38 endif
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020039endif
40
41
42# SunOS requires external libraries for network sockets
43# they are used to support serial devices via network
44if host_machine.system() == 'sunos'
45 libsocket = cc.find_library('socket')
46 libnsl = cc.find_library('nsl')
47 deps += [ libsocket, libnsl]
48endif