meson.build 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180
  1. project('qemu', ['c'], meson_version: '>=0.55.0',
  2. default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
  3. 'b_colorout=auto'],
  4. version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
  5. not_found = dependency('', required: false)
  6. if meson.version().version_compare('>=0.56.0')
  7. keyval = import('keyval')
  8. else
  9. keyval = import('unstable-keyval')
  10. endif
  11. ss = import('sourceset')
  12. fs = import('fs')
  13. sh = find_program('sh')
  14. cc = meson.get_compiler('c')
  15. config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
  16. enable_modules = 'CONFIG_MODULES' in config_host
  17. enable_static = 'CONFIG_STATIC' in config_host
  18. build_docs = 'BUILD_DOCS' in config_host
  19. if get_option('qemu_suffix').startswith('/')
  20. error('qemu_suffix cannot start with a /')
  21. endif
  22. qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
  23. qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
  24. config_host_data = configuration_data()
  25. genh = []
  26. target_dirs = config_host['TARGET_DIRS'].split()
  27. have_user = false
  28. have_system = false
  29. foreach target : target_dirs
  30. have_user = have_user or target.endswith('-user')
  31. have_system = have_system or target.endswith('-softmmu')
  32. endforeach
  33. have_tools = 'CONFIG_TOOLS' in config_host
  34. have_block = have_system or have_tools
  35. python = import('python').find_installation()
  36. supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
  37. supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64',
  38. 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
  39. cpu = host_machine.cpu_family()
  40. targetos = host_machine.system()
  41. configure_file(input: files('scripts/ninjatool.py'),
  42. output: 'ninjatool',
  43. configuration: config_host)
  44. if cpu in ['x86', 'x86_64']
  45. kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
  46. elif cpu == 'aarch64'
  47. kvm_targets = ['aarch64-softmmu']
  48. elif cpu == 's390x'
  49. kvm_targets = ['s390x-softmmu']
  50. elif cpu in ['ppc', 'ppc64']
  51. kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
  52. elif cpu in ['mips', 'mips64']
  53. kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu']
  54. else
  55. kvm_targets = []
  56. endif
  57. accelerator_targets = { 'CONFIG_KVM': kvm_targets }
  58. if cpu in ['x86', 'x86_64']
  59. accelerator_targets += {
  60. 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
  61. 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
  62. 'CONFIG_HVF': ['x86_64-softmmu'],
  63. 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
  64. }
  65. endif
  66. ##################
  67. # Compiler flags #
  68. ##################
  69. # Specify linker-script with add_project_link_arguments so that it is not placed
  70. # within a linker --start-group/--end-group pair
  71. if 'CONFIG_FUZZ' in config_host
  72. add_project_link_arguments(['-Wl,-T,',
  73. (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
  74. native: false, language: ['c', 'cpp', 'objc'])
  75. endif
  76. add_project_arguments(config_host['QEMU_CFLAGS'].split(),
  77. native: false, language: ['c', 'objc'])
  78. add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
  79. native: false, language: 'cpp')
  80. add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
  81. native: false, language: ['c', 'cpp', 'objc'])
  82. add_project_arguments(config_host['QEMU_INCLUDES'].split(),
  83. language: ['c', 'cpp', 'objc'])
  84. link_language = meson.get_external_property('link_language', 'cpp')
  85. if link_language == 'cpp'
  86. add_languages('cpp', required: true, native: false)
  87. endif
  88. if host_machine.system() == 'darwin'
  89. add_languages('objc', required: false, native: false)
  90. endif
  91. sparse = find_program('cgcc', required: get_option('sparse'))
  92. if sparse.found()
  93. run_target('sparse',
  94. command: [find_program('scripts/check_sparse.py'),
  95. 'compile_commands.json', sparse.full_path(), '-Wbitwise',
  96. '-Wno-transparent-union', '-Wno-old-initializer',
  97. '-Wno-non-pointer-null'])
  98. endif
  99. ###########################################
  100. # Target-specific checks and dependencies #
  101. ###########################################
  102. if targetos != 'linux' and get_option('mpath').enabled()
  103. error('Multipath is supported only on Linux')
  104. endif
  105. m = cc.find_library('m', required: false)
  106. util = cc.find_library('util', required: false)
  107. winmm = []
  108. socket = []
  109. version_res = []
  110. coref = []
  111. iokit = []
  112. emulator_link_args = []
  113. cocoa = not_found
  114. hvf = not_found
  115. if targetos == 'windows'
  116. socket = cc.find_library('ws2_32')
  117. winmm = cc.find_library('winmm')
  118. win = import('windows')
  119. version_res = win.compile_resources('version.rc',
  120. depend_files: files('pc-bios/qemu-nsis.ico'),
  121. include_directories: include_directories('.'))
  122. elif targetos == 'darwin'
  123. coref = dependency('appleframeworks', modules: 'CoreFoundation')
  124. iokit = dependency('appleframeworks', modules: 'IOKit', required: 'CONFIG_IOS' not in config_host)
  125. cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
  126. elif targetos == 'sunos'
  127. socket = [cc.find_library('socket'),
  128. cc.find_library('nsl'),
  129. cc.find_library('resolv')]
  130. elif targetos == 'haiku'
  131. socket = [cc.find_library('posix_error_mapper'),
  132. cc.find_library('network'),
  133. cc.find_library('bsd')]
  134. elif targetos == 'openbsd'
  135. if not get_option('tcg').disabled() and target_dirs.length() > 0
  136. # Disable OpenBSD W^X if available
  137. emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
  138. endif
  139. endif
  140. accelerators = []
  141. if not get_option('kvm').disabled() and targetos == 'linux'
  142. accelerators += 'CONFIG_KVM'
  143. endif
  144. if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
  145. accelerators += 'CONFIG_XEN'
  146. have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
  147. else
  148. have_xen_pci_passthrough = false
  149. endif
  150. if not get_option('whpx').disabled() and targetos == 'windows'
  151. if get_option('whpx').enabled() and cpu != 'x86_64'
  152. error('WHPX requires 64-bit host')
  153. elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
  154. cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
  155. accelerators += 'CONFIG_WHPX'
  156. endif
  157. endif
  158. if not get_option('hvf').disabled()
  159. hvf = dependency('appleframeworks', modules: 'Hypervisor',
  160. required: get_option('hvf'))
  161. if hvf.found()
  162. accelerators += 'CONFIG_HVF'
  163. endif
  164. endif
  165. if not get_option('hax').disabled()
  166. if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
  167. accelerators += 'CONFIG_HAX'
  168. endif
  169. endif
  170. if not get_option('tcg').disabled()
  171. if cpu not in supported_cpus
  172. if 'CONFIG_TCG_INTERPRETER' in config_host
  173. warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
  174. else
  175. error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
  176. endif
  177. endif
  178. accelerators += 'CONFIG_TCG'
  179. config_host += { 'CONFIG_TCG': 'y' }
  180. endif
  181. if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
  182. error('KVM not available on this platform')
  183. endif
  184. if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
  185. error('HVF not available on this platform')
  186. endif
  187. if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
  188. error('WHPX not available on this platform')
  189. endif
  190. if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
  191. if 'CONFIG_XEN' in accelerators
  192. error('Xen PCI passthrough not available on this platform')
  193. else
  194. error('Xen PCI passthrough requested but Xen not enabled')
  195. endif
  196. endif
  197. if not cocoa.found() and get_option('cocoa').enabled()
  198. error('Cocoa not available on this platform')
  199. endif
  200. ################
  201. # Dependencies #
  202. ################
  203. # The path to glib.h is added to all compilation commands. This was
  204. # grandfathered in from the QEMU Makefiles.
  205. add_project_arguments(config_host['GLIB_CFLAGS'].split(),
  206. native: false, language: ['c', 'cpp', 'objc'])
  207. glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
  208. gio = not_found
  209. if 'CONFIG_GIO' in config_host
  210. gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
  211. link_args: config_host['GIO_LIBS'].split())
  212. endif
  213. lttng = not_found
  214. if 'CONFIG_TRACE_UST' in config_host
  215. lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
  216. endif
  217. urcubp = not_found
  218. if 'CONFIG_TRACE_UST' in config_host
  219. urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
  220. endif
  221. gcrypt = not_found
  222. if 'CONFIG_GCRYPT' in config_host
  223. gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
  224. link_args: config_host['GCRYPT_LIBS'].split())
  225. endif
  226. nettle = not_found
  227. if 'CONFIG_NETTLE' in config_host
  228. nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
  229. link_args: config_host['NETTLE_LIBS'].split())
  230. endif
  231. gnutls = not_found
  232. if 'CONFIG_GNUTLS' in config_host
  233. gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
  234. link_args: config_host['GNUTLS_LIBS'].split())
  235. endif
  236. pixman = not_found
  237. if have_system or have_tools
  238. pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
  239. method: 'pkg-config', static: enable_static)
  240. endif
  241. pam = not_found
  242. if 'CONFIG_AUTH_PAM' in config_host
  243. pam = cc.find_library('pam')
  244. endif
  245. libaio = cc.find_library('aio', required: false)
  246. zlib = dependency('zlib', required: true, static: enable_static)
  247. linux_io_uring = not_found
  248. if 'CONFIG_LINUX_IO_URING' in config_host
  249. linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
  250. link_args: config_host['LINUX_IO_URING_LIBS'].split())
  251. endif
  252. libxml2 = not_found
  253. if 'CONFIG_LIBXML2' in config_host
  254. libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
  255. link_args: config_host['LIBXML2_LIBS'].split())
  256. endif
  257. libnfs = not_found
  258. if 'CONFIG_LIBNFS' in config_host
  259. libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
  260. endif
  261. libattr = not_found
  262. if 'CONFIG_ATTR' in config_host
  263. libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
  264. endif
  265. seccomp = not_found
  266. if 'CONFIG_SECCOMP' in config_host
  267. seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
  268. link_args: config_host['SECCOMP_LIBS'].split())
  269. endif
  270. libcap_ng = not_found
  271. if 'CONFIG_LIBCAP_NG' in config_host
  272. libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
  273. endif
  274. if get_option('xkbcommon').auto() and not have_system and not have_tools
  275. xkbcommon = not_found
  276. else
  277. xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
  278. method: 'pkg-config', static: enable_static)
  279. endif
  280. vde = not_found
  281. if config_host.has_key('CONFIG_VDE')
  282. vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
  283. endif
  284. pulse = not_found
  285. if 'CONFIG_LIBPULSE' in config_host
  286. pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
  287. link_args: config_host['PULSE_LIBS'].split())
  288. endif
  289. alsa = not_found
  290. if 'CONFIG_ALSA' in config_host
  291. alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
  292. link_args: config_host['ALSA_LIBS'].split())
  293. endif
  294. jack = not_found
  295. if 'CONFIG_LIBJACK' in config_host
  296. jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
  297. endif
  298. spice = not_found
  299. spice_headers = not_found
  300. if 'CONFIG_SPICE' in config_host
  301. spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
  302. link_args: config_host['SPICE_LIBS'].split())
  303. spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split())
  304. endif
  305. rt = cc.find_library('rt', required: false)
  306. libdl = not_found
  307. if 'CONFIG_PLUGIN' in config_host
  308. libdl = cc.find_library('dl', required: true)
  309. endif
  310. libiscsi = not_found
  311. if 'CONFIG_LIBISCSI' in config_host
  312. libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
  313. link_args: config_host['LIBISCSI_LIBS'].split())
  314. endif
  315. zstd = not_found
  316. if 'CONFIG_ZSTD' in config_host
  317. zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
  318. link_args: config_host['ZSTD_LIBS'].split())
  319. endif
  320. gbm = not_found
  321. if 'CONFIG_GBM' in config_host
  322. gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
  323. link_args: config_host['GBM_LIBS'].split())
  324. endif
  325. virgl = not_found
  326. if 'CONFIG_VIRGL' in config_host
  327. virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
  328. link_args: config_host['VIRGL_LIBS'].split())
  329. endif
  330. curl = not_found
  331. if 'CONFIG_CURL' in config_host
  332. curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
  333. link_args: config_host['CURL_LIBS'].split())
  334. endif
  335. libudev = not_found
  336. if targetos == 'linux' and (have_system or have_tools)
  337. libudev = dependency('libudev',
  338. required: get_option('mpath').enabled(),
  339. static: enable_static)
  340. endif
  341. mpathpersist = not_found
  342. mpathpersist_new_api = false
  343. if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
  344. mpath_test_source_new = '''
  345. #include <libudev.h>
  346. #include <mpath_persist.h>
  347. unsigned mpath_mx_alloc_len = 1024;
  348. int logsink;
  349. static struct config *multipath_conf;
  350. extern struct udev *udev;
  351. extern struct config *get_multipath_config(void);
  352. extern void put_multipath_config(struct config *conf);
  353. struct udev *udev;
  354. struct config *get_multipath_config(void) { return multipath_conf; }
  355. void put_multipath_config(struct config *conf) { }
  356. int main(void) {
  357. udev = udev_new();
  358. multipath_conf = mpath_lib_init();
  359. return 0;
  360. }'''
  361. mpath_test_source_old = '''
  362. #include <libudev.h>
  363. #include <mpath_persist.h>
  364. unsigned mpath_mx_alloc_len = 1024;
  365. int logsink;
  366. int main(void) {
  367. struct udev *udev = udev_new();
  368. mpath_lib_init(udev);
  369. return 0;
  370. }'''
  371. mpathlibs = [libudev]
  372. if enable_static
  373. mpathlibs += cc.find_library('devmapper',
  374. required: get_option('mpath'),
  375. static: enable_static)
  376. endif
  377. mpathlibs += cc.find_library('multipath',
  378. required: get_option('mpath'),
  379. static: enable_static)
  380. mpathlibs += cc.find_library('mpathpersist',
  381. required: get_option('mpath'),
  382. static: enable_static)
  383. foreach lib: mpathlibs
  384. if not lib.found()
  385. mpathlibs = []
  386. break
  387. endif
  388. endforeach
  389. if mpathlibs.length() > 0
  390. if cc.links(mpath_test_source_new, dependencies: mpathlibs)
  391. mpathpersist = declare_dependency(dependencies: mpathlibs)
  392. mpathpersist_new_api = true
  393. elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
  394. mpathpersist = declare_dependency(dependencies: mpathlibs)
  395. else
  396. if get_option('mpath').enabled()
  397. error('Cannot detect libmpathpersist API')
  398. else
  399. warning('Cannot detect libmpathpersist API, disabling')
  400. endif
  401. endif
  402. endif
  403. endif
  404. iconv = not_found
  405. if not get_option('iconv').disabled()
  406. libiconv = cc.find_library('iconv',
  407. required: false,
  408. static: enable_static)
  409. if libiconv.found()
  410. if cc.links('''
  411. #include <iconv.h>
  412. int main(void) {
  413. iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
  414. return conv != (iconv_t) -1;
  415. }''', dependencies: [libiconv])
  416. iconv = declare_dependency(dependencies: [libiconv])
  417. endif
  418. endif
  419. endif
  420. if get_option('iconv').enabled() and not iconv.found()
  421. error('Cannot detect iconv API')
  422. endif
  423. curses = not_found
  424. if iconv.found() and not get_option('curses').disabled()
  425. curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses']
  426. curses_test = '''
  427. #include <locale.h>
  428. #include <curses.h>
  429. #include <wchar.h>
  430. int main(void) {
  431. wchar_t wch = L'w';
  432. setlocale(LC_ALL, "");
  433. resize_term(0, 0);
  434. addwstr(L"wide chars\n");
  435. addnwstr(&wch, 1);
  436. add_wch(WACS_DEGREE);
  437. return 0;
  438. }'''
  439. foreach curses_libname : curses_libname_list
  440. libcurses = dependency(curses_libname,
  441. required: false,
  442. method: 'pkg-config',
  443. static: enable_static)
  444. if not libcurses.found()
  445. dirs = ['/usr/include/ncursesw']
  446. if targetos == 'windows'
  447. dirs = []
  448. endif
  449. libcurses = cc.find_library(curses_libname,
  450. required: false,
  451. dirs: dirs,
  452. static: enable_static)
  453. endif
  454. if libcurses.found()
  455. if cc.links(curses_test, dependencies: [libcurses])
  456. curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [libcurses])
  457. break
  458. endif
  459. endif
  460. endforeach
  461. endif
  462. if get_option('curses').enabled() and not curses.found()
  463. if not iconv.found()
  464. error('Cannot detect iconv API')
  465. else
  466. error('Cannot detect curses API')
  467. endif
  468. endif
  469. brlapi = not_found
  470. if 'CONFIG_BRLAPI' in config_host
  471. brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
  472. endif
  473. sdl = not_found
  474. if have_system
  475. sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
  476. sdl_image = not_found
  477. endif
  478. if sdl.found()
  479. # work around 2.0.8 bug
  480. sdl = declare_dependency(compile_args: '-Wno-undef',
  481. dependencies: sdl)
  482. sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
  483. method: 'pkg-config', static: enable_static)
  484. else
  485. if get_option('sdl_image').enabled()
  486. error('sdl-image required, but SDL was @0@'.format(
  487. get_option('sdl').disabled() ? 'disabled' : 'not found'))
  488. endif
  489. sdl_image = not_found
  490. endif
  491. rbd = not_found
  492. if 'CONFIG_RBD' in config_host
  493. rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
  494. endif
  495. glusterfs = not_found
  496. if 'CONFIG_GLUSTERFS' in config_host
  497. glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
  498. link_args: config_host['GLUSTERFS_LIBS'].split())
  499. endif
  500. libssh = not_found
  501. if 'CONFIG_LIBSSH' in config_host
  502. libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
  503. link_args: config_host['LIBSSH_LIBS'].split())
  504. endif
  505. libbzip2 = not_found
  506. if 'CONFIG_BZIP2' in config_host
  507. libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
  508. endif
  509. liblzfse = not_found
  510. if 'CONFIG_LZFSE' in config_host
  511. liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
  512. endif
  513. oss = not_found
  514. if 'CONFIG_AUDIO_OSS' in config_host
  515. oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
  516. endif
  517. dsound = not_found
  518. if 'CONFIG_AUDIO_DSOUND' in config_host
  519. dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
  520. endif
  521. coreaudio = not_found
  522. if 'CONFIG_AUDIO_COREAUDIO' in config_host
  523. coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
  524. endif
  525. opengl = not_found
  526. if 'CONFIG_OPENGL' in config_host
  527. opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
  528. link_args: config_host['OPENGL_LIBS'].split())
  529. endif
  530. gtk = not_found
  531. if 'CONFIG_GTK' in config_host
  532. gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
  533. link_args: config_host['GTK_LIBS'].split())
  534. endif
  535. vte = not_found
  536. if 'CONFIG_VTE' in config_host
  537. vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
  538. link_args: config_host['VTE_LIBS'].split())
  539. endif
  540. x11 = not_found
  541. if 'CONFIG_X11' in config_host
  542. x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
  543. link_args: config_host['X11_LIBS'].split())
  544. endif
  545. vnc = not_found
  546. png = not_found
  547. jpeg = not_found
  548. sasl = not_found
  549. if get_option('vnc').enabled()
  550. vnc = declare_dependency() # dummy dependency
  551. png = dependency('libpng', required: get_option('vnc_png'),
  552. method: 'pkg-config', static: enable_static)
  553. jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
  554. required: get_option('vnc_jpeg'),
  555. static: enable_static)
  556. sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
  557. required: get_option('vnc_sasl'),
  558. static: enable_static)
  559. if sasl.found()
  560. sasl = declare_dependency(dependencies: sasl,
  561. compile_args: '-DSTRUCT_IOVEC_DEFINED')
  562. endif
  563. endif
  564. snappy = not_found
  565. if 'CONFIG_SNAPPY' in config_host
  566. snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
  567. endif
  568. lzo = not_found
  569. if 'CONFIG_LZO' in config_host
  570. lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
  571. endif
  572. rdma = not_found
  573. if 'CONFIG_RDMA' in config_host
  574. rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
  575. endif
  576. numa = not_found
  577. if 'CONFIG_NUMA' in config_host
  578. numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
  579. endif
  580. xen = not_found
  581. if 'CONFIG_XEN_BACKEND' in config_host
  582. xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
  583. link_args: config_host['XEN_LIBS'].split())
  584. endif
  585. cacard = not_found
  586. if 'CONFIG_SMARTCARD' in config_host
  587. cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
  588. link_args: config_host['SMARTCARD_LIBS'].split())
  589. endif
  590. u2f = not_found
  591. if have_system
  592. u2f = dependency('u2f-emu', required: get_option('u2f'),
  593. method: 'pkg-config',
  594. static: enable_static)
  595. endif
  596. usbredir = not_found
  597. if 'CONFIG_USB_REDIR' in config_host
  598. usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
  599. link_args: config_host['USB_REDIR_LIBS'].split())
  600. endif
  601. libusb = not_found
  602. if 'CONFIG_USB_LIBUSB' in config_host
  603. libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
  604. link_args: config_host['LIBUSB_LIBS'].split())
  605. endif
  606. libpmem = not_found
  607. if 'CONFIG_LIBPMEM' in config_host
  608. libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
  609. link_args: config_host['LIBPMEM_LIBS'].split())
  610. endif
  611. libdaxctl = not_found
  612. if 'CONFIG_LIBDAXCTL' in config_host
  613. libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
  614. endif
  615. tasn1 = not_found
  616. if 'CONFIG_TASN1' in config_host
  617. tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
  618. link_args: config_host['TASN1_LIBS'].split())
  619. endif
  620. keyutils = dependency('libkeyutils', required: false,
  621. method: 'pkg-config', static: enable_static)
  622. has_gettid = cc.has_function('gettid')
  623. # Malloc tests
  624. malloc = []
  625. if get_option('malloc') == 'system'
  626. has_malloc_trim = \
  627. not get_option('malloc_trim').disabled() and \
  628. cc.links('''#include <malloc.h>
  629. int main(void) { malloc_trim(0); return 0; }''')
  630. else
  631. has_malloc_trim = false
  632. malloc = cc.find_library(get_option('malloc'), required: true)
  633. endif
  634. if not has_malloc_trim and get_option('malloc_trim').enabled()
  635. if get_option('malloc') == 'system'
  636. error('malloc_trim not available on this platform.')
  637. else
  638. error('malloc_trim not available with non-libc memory allocator')
  639. endif
  640. endif
  641. #################
  642. # config-host.h #
  643. #################
  644. config_host_data.set('CONFIG_COCOA', cocoa.found())
  645. config_host_data.set('CONFIG_LIBUDEV', libudev.found())
  646. config_host_data.set('CONFIG_MPATH', mpathpersist.found())
  647. config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
  648. config_host_data.set('CONFIG_CURSES', curses.found())
  649. config_host_data.set('CONFIG_SDL', sdl.found())
  650. config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
  651. config_host_data.set('CONFIG_VNC', vnc.found())
  652. config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
  653. config_host_data.set('CONFIG_VNC_PNG', png.found())
  654. config_host_data.set('CONFIG_VNC_SASL', sasl.found())
  655. config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
  656. config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
  657. config_host_data.set('CONFIG_GETTID', has_gettid)
  658. config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
  659. config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
  660. config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
  661. config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
  662. config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
  663. ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
  664. arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
  665. strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
  666. 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
  667. 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
  668. foreach k, v: config_host
  669. if ignored.contains(k)
  670. # do nothing
  671. elif arrays.contains(k)
  672. if v != ''
  673. v = '"' + '", "'.join(v.split()) + '", '
  674. endif
  675. config_host_data.set(k, v)
  676. elif k == 'ARCH'
  677. config_host_data.set('HOST_' + v.to_upper(), 1)
  678. elif strings.contains(k)
  679. if not k.startswith('CONFIG_')
  680. k = 'CONFIG_' + k.to_upper()
  681. endif
  682. config_host_data.set_quoted(k, v)
  683. elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
  684. config_host_data.set(k, v == 'y' ? 1 : v)
  685. endif
  686. endforeach
  687. ########################
  688. # Target configuration #
  689. ########################
  690. minikconf = find_program('scripts/minikconf.py')
  691. config_all = {}
  692. config_all_devices = {}
  693. config_all_disas = {}
  694. config_devices_mak_list = []
  695. config_devices_h = {}
  696. config_target_h = {}
  697. config_target_mak = {}
  698. disassemblers = {
  699. 'alpha' : ['CONFIG_ALPHA_DIS'],
  700. 'arm' : ['CONFIG_ARM_DIS'],
  701. 'avr' : ['CONFIG_AVR_DIS'],
  702. 'cris' : ['CONFIG_CRIS_DIS'],
  703. 'hppa' : ['CONFIG_HPPA_DIS'],
  704. 'i386' : ['CONFIG_I386_DIS'],
  705. 'x86_64' : ['CONFIG_I386_DIS'],
  706. 'x32' : ['CONFIG_I386_DIS'],
  707. 'lm32' : ['CONFIG_LM32_DIS'],
  708. 'm68k' : ['CONFIG_M68K_DIS'],
  709. 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
  710. 'mips' : ['CONFIG_MIPS_DIS'],
  711. 'moxie' : ['CONFIG_MOXIE_DIS'],
  712. 'nios2' : ['CONFIG_NIOS2_DIS'],
  713. 'or1k' : ['CONFIG_OPENRISC_DIS'],
  714. 'ppc' : ['CONFIG_PPC_DIS'],
  715. 'riscv' : ['CONFIG_RISCV_DIS'],
  716. 'rx' : ['CONFIG_RX_DIS'],
  717. 's390' : ['CONFIG_S390_DIS'],
  718. 'sh4' : ['CONFIG_SH4_DIS'],
  719. 'sparc' : ['CONFIG_SPARC_DIS'],
  720. 'xtensa' : ['CONFIG_XTENSA_DIS'],
  721. }
  722. if link_language == 'cpp'
  723. disassemblers += {
  724. 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
  725. 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
  726. 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
  727. }
  728. endif
  729. kconfig_external_symbols = [
  730. 'CONFIG_KVM',
  731. 'CONFIG_XEN',
  732. 'CONFIG_TPM',
  733. 'CONFIG_SPICE',
  734. 'CONFIG_IVSHMEM',
  735. 'CONFIG_OPENGL',
  736. 'CONFIG_X11',
  737. 'CONFIG_VHOST_USER',
  738. 'CONFIG_VHOST_VDPA',
  739. 'CONFIG_VHOST_KERNEL',
  740. 'CONFIG_VIRTFS',
  741. 'CONFIG_LINUX',
  742. 'CONFIG_PVRDMA',
  743. ]
  744. ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
  745. default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
  746. actual_target_dirs = []
  747. fdt_required = []
  748. foreach target : target_dirs
  749. config_target = { 'TARGET_NAME': target.split('-')[0] }
  750. if target.endswith('linux-user')
  751. if targetos != 'linux'
  752. if default_targets
  753. continue
  754. endif
  755. error('Target @0@ is only available on a Linux host'.format(target))
  756. endif
  757. config_target += { 'CONFIG_LINUX_USER': 'y' }
  758. elif target.endswith('bsd-user')
  759. if 'CONFIG_BSD' not in config_host
  760. if default_targets
  761. continue
  762. endif
  763. error('Target @0@ is only available on a BSD host'.format(target))
  764. endif
  765. config_target += { 'CONFIG_BSD_USER': 'y' }
  766. elif target.endswith('softmmu')
  767. config_target += { 'CONFIG_SOFTMMU': 'y' }
  768. endif
  769. if target.endswith('-user')
  770. config_target += {
  771. 'CONFIG_USER_ONLY': 'y',
  772. 'CONFIG_QEMU_INTERP_PREFIX':
  773. config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
  774. }
  775. endif
  776. have_accel = false
  777. foreach sym: accelerators
  778. if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
  779. config_target += { sym: 'y' }
  780. config_all += { sym: 'y' }
  781. if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
  782. config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
  783. endif
  784. have_accel = true
  785. endif
  786. endforeach
  787. if not have_accel
  788. if default_targets
  789. continue
  790. endif
  791. error('No accelerator available for target @0@'.format(target))
  792. endif
  793. actual_target_dirs += target
  794. config_target += keyval.load('default-configs/targets' / target + '.mak')
  795. config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
  796. if 'TARGET_NEED_FDT' in config_target
  797. fdt_required += target
  798. endif
  799. # Add default keys
  800. if 'TARGET_BASE_ARCH' not in config_target
  801. config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']}
  802. endif
  803. if 'TARGET_ABI_DIR' not in config_target
  804. config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']}
  805. endif
  806. foreach k, v: disassemblers
  807. if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
  808. foreach sym: v
  809. config_target += { sym: 'y' }
  810. config_all_disas += { sym: 'y' }
  811. endforeach
  812. endif
  813. endforeach
  814. config_target_data = configuration_data()
  815. foreach k, v: config_target
  816. if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
  817. # do nothing
  818. elif ignored.contains(k)
  819. # do nothing
  820. elif k == 'TARGET_BASE_ARCH'
  821. # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
  822. # not used to select files from sourcesets.
  823. config_target_data.set('TARGET_' + v.to_upper(), 1)
  824. elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
  825. config_target_data.set_quoted(k, v)
  826. elif v == 'y'
  827. config_target_data.set(k, 1)
  828. else
  829. config_target_data.set(k, v)
  830. endif
  831. endforeach
  832. config_target_h += {target: configure_file(output: target + '-config-target.h',
  833. configuration: config_target_data)}
  834. if target.endswith('-softmmu')
  835. base_kconfig = []
  836. foreach sym : kconfig_external_symbols
  837. if sym in config_target or sym in config_host
  838. base_kconfig += '@0@=y'.format(sym)
  839. endif
  840. endforeach
  841. config_devices_mak = target + '-config-devices.mak'
  842. config_devices_mak = configure_file(
  843. input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
  844. output: config_devices_mak,
  845. depfile: config_devices_mak + '.d',
  846. capture: true,
  847. command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
  848. config_devices_mak, '@DEPFILE@', '@INPUT@',
  849. base_kconfig])
  850. config_devices_data = configuration_data()
  851. config_devices = keyval.load(config_devices_mak)
  852. foreach k, v: config_devices
  853. config_devices_data.set(k, 1)
  854. endforeach
  855. config_devices_mak_list += config_devices_mak
  856. config_devices_h += {target: configure_file(output: target + '-config-devices.h',
  857. configuration: config_devices_data)}
  858. config_target += config_devices
  859. config_all_devices += config_devices
  860. endif
  861. config_target_mak += {target: config_target}
  862. endforeach
  863. target_dirs = actual_target_dirs
  864. # This configuration is used to build files that are shared by
  865. # multiple binaries, and then extracted out of the "common"
  866. # static_library target.
  867. #
  868. # We do not use all_sources()/all_dependencies(), because it would
  869. # build literally all source files, including devices only used by
  870. # targets that are not built for this compilation. The CONFIG_ALL
  871. # pseudo symbol replaces it.
  872. config_all += config_all_devices
  873. config_all += config_host
  874. config_all += config_all_disas
  875. config_all += {
  876. 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
  877. 'CONFIG_SOFTMMU': have_system,
  878. 'CONFIG_USER_ONLY': have_user,
  879. 'CONFIG_ALL': true,
  880. }
  881. ##############
  882. # Submodules #
  883. ##############
  884. capstone = not_found
  885. capstone_opt = get_option('capstone')
  886. if capstone_opt in ['enabled', 'auto', 'system']
  887. have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile')
  888. capstone = dependency('capstone', version: '>=4.0',
  889. static: enable_static, method: 'pkg-config',
  890. required: capstone_opt == 'system' or
  891. capstone_opt == 'enabled' and not have_internal)
  892. if capstone.found()
  893. capstone_opt = 'system'
  894. elif have_internal
  895. capstone_opt = 'internal'
  896. else
  897. capstone_opt = 'disabled'
  898. endif
  899. endif
  900. if capstone_opt == 'internal'
  901. capstone_data = configuration_data()
  902. capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1')
  903. capstone_files = files(
  904. 'capstone/cs.c',
  905. 'capstone/MCInst.c',
  906. 'capstone/MCInstrDesc.c',
  907. 'capstone/MCRegisterInfo.c',
  908. 'capstone/SStream.c',
  909. 'capstone/utils.c'
  910. )
  911. if 'CONFIG_ARM_DIS' in config_all_disas
  912. capstone_data.set('CAPSTONE_HAS_ARM', '1')
  913. capstone_files += files(
  914. 'capstone/arch/ARM/ARMDisassembler.c',
  915. 'capstone/arch/ARM/ARMInstPrinter.c',
  916. 'capstone/arch/ARM/ARMMapping.c',
  917. 'capstone/arch/ARM/ARMModule.c'
  918. )
  919. endif
  920. # FIXME: This config entry currently depends on a c++ compiler.
  921. # Which is needed for building libvixl, but not for capstone.
  922. if 'CONFIG_ARM_A64_DIS' in config_all_disas
  923. capstone_data.set('CAPSTONE_HAS_ARM64', '1')
  924. capstone_files += files(
  925. 'capstone/arch/AArch64/AArch64BaseInfo.c',
  926. 'capstone/arch/AArch64/AArch64Disassembler.c',
  927. 'capstone/arch/AArch64/AArch64InstPrinter.c',
  928. 'capstone/arch/AArch64/AArch64Mapping.c',
  929. 'capstone/arch/AArch64/AArch64Module.c'
  930. )
  931. endif
  932. if 'CONFIG_PPC_DIS' in config_all_disas
  933. capstone_data.set('CAPSTONE_HAS_POWERPC', '1')
  934. capstone_files += files(
  935. 'capstone/arch/PowerPC/PPCDisassembler.c',
  936. 'capstone/arch/PowerPC/PPCInstPrinter.c',
  937. 'capstone/arch/PowerPC/PPCMapping.c',
  938. 'capstone/arch/PowerPC/PPCModule.c'
  939. )
  940. endif
  941. if 'CONFIG_S390_DIS' in config_all_disas
  942. capstone_data.set('CAPSTONE_HAS_SYSZ', '1')
  943. capstone_files += files(
  944. 'capstone/arch/SystemZ/SystemZDisassembler.c',
  945. 'capstone/arch/SystemZ/SystemZInstPrinter.c',
  946. 'capstone/arch/SystemZ/SystemZMapping.c',
  947. 'capstone/arch/SystemZ/SystemZModule.c',
  948. 'capstone/arch/SystemZ/SystemZMCTargetDesc.c'
  949. )
  950. endif
  951. if 'CONFIG_I386_DIS' in config_all_disas
  952. capstone_data.set('CAPSTONE_HAS_X86', 1)
  953. capstone_files += files(
  954. 'capstone/arch/X86/X86Disassembler.c',
  955. 'capstone/arch/X86/X86DisassemblerDecoder.c',
  956. 'capstone/arch/X86/X86ATTInstPrinter.c',
  957. 'capstone/arch/X86/X86IntelInstPrinter.c',
  958. 'capstone/arch/X86/X86InstPrinterCommon.c',
  959. 'capstone/arch/X86/X86Mapping.c',
  960. 'capstone/arch/X86/X86Module.c'
  961. )
  962. endif
  963. configure_file(output: 'capstone-defs.h', configuration: capstone_data)
  964. capstone_cargs = [
  965. # FIXME: There does not seem to be a way to completely replace the c_args
  966. # that come from add_project_arguments() -- we can only add to them.
  967. # So: disable all warnings with a big hammer.
  968. '-Wno-error', '-w',
  969. # Include all configuration defines via a header file, which will wind up
  970. # as a dependency on the object file, and thus changes here will result
  971. # in a rebuild.
  972. '-include', 'capstone-defs.h'
  973. ]
  974. libcapstone = static_library('capstone',
  975. sources: capstone_files,
  976. c_args: capstone_cargs,
  977. include_directories: 'capstone/include')
  978. capstone = declare_dependency(link_with: libcapstone,
  979. include_directories: 'capstone/include/capstone')
  980. endif
  981. slirp = not_found
  982. slirp_opt = 'disabled'
  983. if have_system
  984. slirp_opt = get_option('slirp')
  985. if slirp_opt in ['enabled', 'auto', 'system']
  986. have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
  987. slirp = dependency('slirp', static: enable_static,
  988. method: 'pkg-config',
  989. required: slirp_opt == 'system' or
  990. slirp_opt == 'enabled' and not have_internal)
  991. if slirp.found()
  992. slirp_opt = 'system'
  993. elif have_internal
  994. slirp_opt = 'internal'
  995. else
  996. slirp_opt = 'disabled'
  997. endif
  998. endif
  999. if slirp_opt == 'internal'
  1000. slirp_deps = []
  1001. if targetos == 'windows'
  1002. slirp_deps = cc.find_library('iphlpapi')
  1003. elif targetos == 'darwin'
  1004. slirp_deps = cc.find_library('resolv')
  1005. endif
  1006. slirp_conf = configuration_data()
  1007. slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0])
  1008. slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1])
  1009. slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2])
  1010. slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version())
  1011. slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"']
  1012. slirp_files = [
  1013. 'slirp/src/arp_table.c',
  1014. 'slirp/src/bootp.c',
  1015. 'slirp/src/cksum.c',
  1016. 'slirp/src/dhcpv6.c',
  1017. 'slirp/src/dnssearch.c',
  1018. 'slirp/src/if.c',
  1019. 'slirp/src/ip6_icmp.c',
  1020. 'slirp/src/ip6_input.c',
  1021. 'slirp/src/ip6_output.c',
  1022. 'slirp/src/ip_icmp.c',
  1023. 'slirp/src/ip_input.c',
  1024. 'slirp/src/ip_output.c',
  1025. 'slirp/src/mbuf.c',
  1026. 'slirp/src/misc.c',
  1027. 'slirp/src/ncsi.c',
  1028. 'slirp/src/ndp_table.c',
  1029. 'slirp/src/sbuf.c',
  1030. 'slirp/src/slirp.c',
  1031. 'slirp/src/socket.c',
  1032. 'slirp/src/state.c',
  1033. 'slirp/src/stream.c',
  1034. 'slirp/src/tcp_input.c',
  1035. 'slirp/src/tcp_output.c',
  1036. 'slirp/src/tcp_subr.c',
  1037. 'slirp/src/tcp_timer.c',
  1038. 'slirp/src/tftp.c',
  1039. 'slirp/src/udp.c',
  1040. 'slirp/src/udp6.c',
  1041. 'slirp/src/util.c',
  1042. 'slirp/src/version.c',
  1043. 'slirp/src/vmstate.c',
  1044. ]
  1045. configure_file(
  1046. input : 'slirp/src/libslirp-version.h.in',
  1047. output : 'libslirp-version.h',
  1048. configuration: slirp_conf)
  1049. slirp_inc = include_directories('slirp', 'slirp/src')
  1050. libslirp = static_library('slirp',
  1051. sources: slirp_files,
  1052. c_args: slirp_cargs,
  1053. include_directories: slirp_inc)
  1054. slirp = declare_dependency(link_with: libslirp,
  1055. dependencies: slirp_deps,
  1056. include_directories: slirp_inc)
  1057. endif
  1058. endif
  1059. fdt = not_found
  1060. fdt_opt = get_option('fdt')
  1061. if have_system
  1062. if fdt_opt in ['enabled', 'auto', 'system']
  1063. have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt')
  1064. fdt = cc.find_library('fdt', static: enable_static,
  1065. required: fdt_opt == 'system' or
  1066. fdt_opt == 'enabled' and not have_internal)
  1067. if fdt.found() and cc.links('''
  1068. #include <libfdt.h>
  1069. #include <libfdt_env.h>
  1070. int main(void) { fdt_check_full(NULL, 0); return 0; }''',
  1071. dependencies: fdt)
  1072. fdt_opt = 'system'
  1073. elif have_internal
  1074. fdt_opt = 'internal'
  1075. else
  1076. fdt_opt = 'disabled'
  1077. endif
  1078. endif
  1079. if fdt_opt == 'internal'
  1080. fdt_files = files(
  1081. 'dtc/libfdt/fdt.c',
  1082. 'dtc/libfdt/fdt_ro.c',
  1083. 'dtc/libfdt/fdt_wip.c',
  1084. 'dtc/libfdt/fdt_sw.c',
  1085. 'dtc/libfdt/fdt_rw.c',
  1086. 'dtc/libfdt/fdt_strerror.c',
  1087. 'dtc/libfdt/fdt_empty_tree.c',
  1088. 'dtc/libfdt/fdt_addresses.c',
  1089. 'dtc/libfdt/fdt_overlay.c',
  1090. 'dtc/libfdt/fdt_check.c',
  1091. )
  1092. fdt_inc = include_directories('dtc/libfdt')
  1093. libfdt = static_library('fdt',
  1094. sources: fdt_files,
  1095. include_directories: fdt_inc)
  1096. fdt = declare_dependency(link_with: libfdt,
  1097. include_directories: fdt_inc)
  1098. endif
  1099. endif
  1100. if not fdt.found() and fdt_required.length() > 0
  1101. error('fdt not available but required by targets ' + ', '.join(fdt_required))
  1102. endif
  1103. ucontext = not_found
  1104. slirp_opt = 'disabled'
  1105. if get_option('ucontext').enabled()
  1106. if not fs.is_dir(meson.current_source_dir() / 'libucontext/arch' / cpu)
  1107. error('libucontext is wanted but not implemented for host ' + cpu)
  1108. endif
  1109. arch = host_machine.cpu()
  1110. ucontext_cargs = ['-DG_LOG_DOMAIN="ucontext"', '-DCUSTOM_IMPL']
  1111. ucontext_files = [
  1112. 'libucontext/arch' / arch / 'getcontext.S',
  1113. 'libucontext/arch' / arch / 'setcontext.S',
  1114. 'libucontext/arch' / arch / 'makecontext.c',
  1115. 'libucontext/arch' / arch / 'startcontext.S',
  1116. 'libucontext/arch' / arch / 'swapcontext.S',
  1117. ]
  1118. ucontext_inc = include_directories('libucontext/include')
  1119. libucontext = static_library('ucontext',
  1120. sources: ucontext_files,
  1121. c_args: ucontext_cargs,
  1122. include_directories: ucontext_inc)
  1123. ucontext = declare_dependency(link_with: libucontext,
  1124. include_directories: ucontext_inc)
  1125. endif
  1126. config_host_data.set('CONFIG_CAPSTONE', capstone.found())
  1127. config_host_data.set('CONFIG_FDT', fdt.found())
  1128. config_host_data.set('CONFIG_SLIRP', slirp.found())
  1129. config_host_data.set('CONFIG_LIBUCONTEXT', ucontext.found())
  1130. #####################
  1131. # Generated sources #
  1132. #####################
  1133. genh += configure_file(output: 'config-host.h', configuration: config_host_data)
  1134. hxtool = find_program('scripts/hxtool')
  1135. shaderinclude = find_program('scripts/shaderinclude.pl')
  1136. qapi_gen = find_program('scripts/qapi-gen.py')
  1137. qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
  1138. meson.source_root() / 'scripts/qapi/commands.py',
  1139. meson.source_root() / 'scripts/qapi/common.py',
  1140. meson.source_root() / 'scripts/qapi/error.py',
  1141. meson.source_root() / 'scripts/qapi/events.py',
  1142. meson.source_root() / 'scripts/qapi/expr.py',
  1143. meson.source_root() / 'scripts/qapi/gen.py',
  1144. meson.source_root() / 'scripts/qapi/introspect.py',
  1145. meson.source_root() / 'scripts/qapi/parser.py',
  1146. meson.source_root() / 'scripts/qapi/schema.py',
  1147. meson.source_root() / 'scripts/qapi/source.py',
  1148. meson.source_root() / 'scripts/qapi/types.py',
  1149. meson.source_root() / 'scripts/qapi/visit.py',
  1150. meson.source_root() / 'scripts/qapi/common.py',
  1151. meson.source_root() / 'scripts/qapi-gen.py'
  1152. ]
  1153. tracetool = [
  1154. python, files('scripts/tracetool.py'),
  1155. '--backend=' + config_host['TRACE_BACKENDS']
  1156. ]
  1157. qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
  1158. meson.current_source_dir(),
  1159. config_host['PKGVERSION'], meson.project_version()]
  1160. qemu_version = custom_target('qemu-version.h',
  1161. output: 'qemu-version.h',
  1162. command: qemu_version_cmd,
  1163. capture: true,
  1164. build_by_default: true,
  1165. build_always_stale: true)
  1166. genh += qemu_version
  1167. hxdep = []
  1168. hx_headers = [
  1169. ['qemu-options.hx', 'qemu-options.def'],
  1170. ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
  1171. ]
  1172. if have_system
  1173. hx_headers += [
  1174. ['hmp-commands.hx', 'hmp-commands.h'],
  1175. ['hmp-commands-info.hx', 'hmp-commands-info.h'],
  1176. ]
  1177. endif
  1178. foreach d : hx_headers
  1179. hxdep += custom_target(d[1],
  1180. input: files(d[0]),
  1181. output: d[1],
  1182. capture: true,
  1183. build_by_default: true, # to be removed when added to a target
  1184. command: [hxtool, '-h', '@INPUT0@'])
  1185. endforeach
  1186. genh += hxdep
  1187. SPHINX_ARGS = [config_host['SPHINX_BUILD'],
  1188. '-Dversion=' + meson.project_version(),
  1189. '-Drelease=' + config_host['PKGVERSION']]
  1190. if get_option('werror')
  1191. SPHINX_ARGS += [ '-W' ]
  1192. endif
  1193. sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
  1194. meson.source_root() / 'docs/sphinx/hxtool.py',
  1195. meson.source_root() / 'docs/sphinx/kerneldoc.py',
  1196. meson.source_root() / 'docs/sphinx/kernellog.py',
  1197. meson.source_root() / 'docs/sphinx/qapidoc.py',
  1198. meson.source_root() / 'docs/sphinx/qmp_lexer.py',
  1199. qapi_gen_depends ]
  1200. ###################
  1201. # Collect sources #
  1202. ###################
  1203. authz_ss = ss.source_set()
  1204. blockdev_ss = ss.source_set()
  1205. block_ss = ss.source_set()
  1206. bsd_user_ss = ss.source_set()
  1207. chardev_ss = ss.source_set()
  1208. common_ss = ss.source_set()
  1209. crypto_ss = ss.source_set()
  1210. io_ss = ss.source_set()
  1211. linux_user_ss = ss.source_set()
  1212. qmp_ss = ss.source_set()
  1213. qom_ss = ss.source_set()
  1214. softmmu_ss = ss.source_set()
  1215. specific_fuzz_ss = ss.source_set()
  1216. specific_ss = ss.source_set()
  1217. stub_ss = ss.source_set()
  1218. trace_ss = ss.source_set()
  1219. user_ss = ss.source_set()
  1220. util_ss = ss.source_set()
  1221. modules = {}
  1222. hw_arch = {}
  1223. target_arch = {}
  1224. target_softmmu_arch = {}
  1225. ###############
  1226. # Trace files #
  1227. ###############
  1228. # TODO: add each directory to the subdirs from its own meson.build, once
  1229. # we have those
  1230. trace_events_subdirs = [
  1231. 'accel/kvm',
  1232. 'accel/tcg',
  1233. 'crypto',
  1234. 'monitor',
  1235. ]
  1236. if have_user
  1237. trace_events_subdirs += [ 'linux-user' ]
  1238. endif
  1239. if have_block
  1240. trace_events_subdirs += [
  1241. 'authz',
  1242. 'block',
  1243. 'io',
  1244. 'nbd',
  1245. 'scsi',
  1246. ]
  1247. endif
  1248. if have_system
  1249. trace_events_subdirs += [
  1250. 'audio',
  1251. 'backends',
  1252. 'backends/tpm',
  1253. 'chardev',
  1254. 'hw/9pfs',
  1255. 'hw/acpi',
  1256. 'hw/alpha',
  1257. 'hw/arm',
  1258. 'hw/audio',
  1259. 'hw/block',
  1260. 'hw/block/dataplane',
  1261. 'hw/char',
  1262. 'hw/display',
  1263. 'hw/dma',
  1264. 'hw/hppa',
  1265. 'hw/hyperv',
  1266. 'hw/i2c',
  1267. 'hw/i386',
  1268. 'hw/i386/xen',
  1269. 'hw/ide',
  1270. 'hw/input',
  1271. 'hw/intc',
  1272. 'hw/isa',
  1273. 'hw/mem',
  1274. 'hw/mips',
  1275. 'hw/misc',
  1276. 'hw/misc/macio',
  1277. 'hw/net',
  1278. 'hw/nvram',
  1279. 'hw/pci',
  1280. 'hw/pci-host',
  1281. 'hw/ppc',
  1282. 'hw/rdma',
  1283. 'hw/rdma/vmw',
  1284. 'hw/rtc',
  1285. 'hw/s390x',
  1286. 'hw/scsi',
  1287. 'hw/sd',
  1288. 'hw/sparc',
  1289. 'hw/sparc64',
  1290. 'hw/ssi',
  1291. 'hw/timer',
  1292. 'hw/tpm',
  1293. 'hw/usb',
  1294. 'hw/vfio',
  1295. 'hw/virtio',
  1296. 'hw/watchdog',
  1297. 'hw/xen',
  1298. 'hw/gpio',
  1299. 'migration',
  1300. 'net',
  1301. 'softmmu',
  1302. 'ui',
  1303. ]
  1304. endif
  1305. trace_events_subdirs += [
  1306. 'hw/core',
  1307. 'qapi',
  1308. 'qom',
  1309. 'target/arm',
  1310. 'target/hppa',
  1311. 'target/i386',
  1312. 'target/mips',
  1313. 'target/ppc',
  1314. 'target/riscv',
  1315. 'target/s390x',
  1316. 'target/sparc',
  1317. 'util',
  1318. ]
  1319. subdir('qapi')
  1320. subdir('qobject')
  1321. subdir('stubs')
  1322. subdir('trace')
  1323. subdir('util')
  1324. subdir('qom')
  1325. subdir('authz')
  1326. subdir('crypto')
  1327. subdir('ui')
  1328. if enable_modules
  1329. libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
  1330. modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
  1331. endif
  1332. stub_ss = stub_ss.apply(config_all, strict: false)
  1333. util_ss.add_all(trace_ss)
  1334. util_ss = util_ss.apply(config_all, strict: false)
  1335. libqemuutil = static_library('qemuutil',
  1336. sources: util_ss.sources() + stub_ss.sources() + genh,
  1337. dependencies: [util_ss.dependencies(), m, glib, socket, malloc, ucontext])
  1338. qemuutil = declare_dependency(link_with: libqemuutil,
  1339. sources: genh + version_res)
  1340. decodetree = generator(find_program('scripts/decodetree.py'),
  1341. output: 'decode-@BASENAME@.c.inc',
  1342. arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
  1343. subdir('audio')
  1344. subdir('io')
  1345. subdir('chardev')
  1346. subdir('fsdev')
  1347. subdir('libdecnumber')
  1348. subdir('target')
  1349. subdir('dump')
  1350. block_ss.add(files(
  1351. 'block.c',
  1352. 'blockdev-nbd.c',
  1353. 'blockjob.c',
  1354. 'job.c',
  1355. 'qemu-io-cmds.c',
  1356. ))
  1357. block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
  1358. subdir('nbd')
  1359. subdir('scsi')
  1360. subdir('block')
  1361. blockdev_ss.add(files(
  1362. 'blockdev.c',
  1363. 'iothread.c',
  1364. 'job-qmp.c',
  1365. ))
  1366. # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
  1367. # os-win32.c does not
  1368. blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
  1369. softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
  1370. softmmu_ss.add_all(blockdev_ss)
  1371. common_ss.add(files('cpus-common.c'))
  1372. subdir('softmmu')
  1373. common_ss.add(capstone)
  1374. specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
  1375. specific_ss.add(files('exec-vary.c'))
  1376. specific_ss.add(when: 'CONFIG_TCG', if_true: files(
  1377. 'fpu/softfloat.c',
  1378. 'tcg/optimize.c',
  1379. 'tcg/tcg-common.c',
  1380. 'tcg/tcg-op-gvec.c',
  1381. 'tcg/tcg-op-vec.c',
  1382. 'tcg/tcg-op.c',
  1383. 'tcg/tcg.c',
  1384. ))
  1385. specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
  1386. subdir('backends')
  1387. subdir('disas')
  1388. subdir('migration')
  1389. subdir('monitor')
  1390. subdir('net')
  1391. subdir('replay')
  1392. subdir('hw')
  1393. subdir('accel')
  1394. subdir('plugins')
  1395. subdir('bsd-user')
  1396. subdir('linux-user')
  1397. bsd_user_ss.add(files('gdbstub.c'))
  1398. specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
  1399. linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
  1400. specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
  1401. # needed for fuzzing binaries
  1402. subdir('tests/qtest/libqos')
  1403. subdir('tests/qtest/fuzz')
  1404. ########################
  1405. # Library dependencies #
  1406. ########################
  1407. block_mods = []
  1408. softmmu_mods = []
  1409. foreach d, list : modules
  1410. foreach m, module_ss : list
  1411. if enable_modules and targetos != 'windows'
  1412. module_ss = module_ss.apply(config_all, strict: false)
  1413. sl = static_library(d + '-' + m, [genh, module_ss.sources()],
  1414. dependencies: [modulecommon, module_ss.dependencies()], pic: true)
  1415. if d == 'block'
  1416. block_mods += sl
  1417. else
  1418. softmmu_mods += sl
  1419. endif
  1420. else
  1421. if d == 'block'
  1422. block_ss.add_all(module_ss)
  1423. else
  1424. softmmu_ss.add_all(module_ss)
  1425. endif
  1426. endif
  1427. endforeach
  1428. endforeach
  1429. nm = find_program('nm')
  1430. undefsym = find_program('scripts/undefsym.py')
  1431. block_syms = custom_target('block.syms', output: 'block.syms',
  1432. input: [libqemuutil, block_mods],
  1433. capture: true,
  1434. command: [undefsym, nm, '@INPUT@'])
  1435. qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
  1436. input: [libqemuutil, softmmu_mods],
  1437. capture: true,
  1438. command: [undefsym, nm, '@INPUT@'])
  1439. qom_ss = qom_ss.apply(config_host, strict: false)
  1440. libqom = static_library('qom', qom_ss.sources() + genh,
  1441. dependencies: [qom_ss.dependencies()],
  1442. name_suffix: 'fa')
  1443. qom = declare_dependency(link_whole: libqom)
  1444. authz_ss = authz_ss.apply(config_host, strict: false)
  1445. libauthz = static_library('authz', authz_ss.sources() + genh,
  1446. dependencies: [authz_ss.dependencies()],
  1447. name_suffix: 'fa',
  1448. build_by_default: false)
  1449. authz = declare_dependency(link_whole: libauthz,
  1450. dependencies: qom)
  1451. crypto_ss = crypto_ss.apply(config_host, strict: false)
  1452. libcrypto = static_library('crypto', crypto_ss.sources() + genh,
  1453. dependencies: [crypto_ss.dependencies()],
  1454. name_suffix: 'fa',
  1455. build_by_default: false)
  1456. crypto = declare_dependency(link_whole: libcrypto,
  1457. dependencies: [authz, qom])
  1458. io_ss = io_ss.apply(config_host, strict: false)
  1459. libio = static_library('io', io_ss.sources() + genh,
  1460. dependencies: [io_ss.dependencies()],
  1461. link_with: libqemuutil,
  1462. name_suffix: 'fa',
  1463. build_by_default: false)
  1464. io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
  1465. libmigration = static_library('migration', sources: migration_files + genh,
  1466. name_suffix: 'fa',
  1467. build_by_default: false)
  1468. migration = declare_dependency(link_with: libmigration,
  1469. dependencies: [zlib, qom, io])
  1470. softmmu_ss.add(migration)
  1471. block_ss = block_ss.apply(config_host, strict: false)
  1472. libblock = static_library('block', block_ss.sources() + genh,
  1473. dependencies: block_ss.dependencies(),
  1474. link_depends: block_syms,
  1475. name_suffix: 'fa',
  1476. build_by_default: false)
  1477. block = declare_dependency(link_whole: [libblock],
  1478. link_args: '@block.syms',
  1479. dependencies: [crypto, io])
  1480. qmp_ss = qmp_ss.apply(config_host, strict: false)
  1481. libqmp = static_library('qmp', qmp_ss.sources() + genh,
  1482. dependencies: qmp_ss.dependencies(),
  1483. name_suffix: 'fa',
  1484. build_by_default: false)
  1485. qmp = declare_dependency(link_whole: [libqmp])
  1486. libchardev = static_library('chardev', chardev_ss.sources() + genh,
  1487. name_suffix: 'fa',
  1488. build_by_default: false)
  1489. chardev = declare_dependency(link_whole: libchardev)
  1490. libhwcore = static_library('hwcore', sources: hwcore_files + genh,
  1491. name_suffix: 'fa',
  1492. build_by_default: false)
  1493. hwcore = declare_dependency(link_whole: libhwcore)
  1494. common_ss.add(hwcore)
  1495. ###########
  1496. # Targets #
  1497. ###########
  1498. foreach m : block_mods + softmmu_mods
  1499. shared_module(m.name(),
  1500. name_prefix: '',
  1501. link_whole: m,
  1502. install: true,
  1503. install_dir: config_host['qemu_moddir'])
  1504. endforeach
  1505. softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
  1506. common_ss.add(qom, qemuutil)
  1507. common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
  1508. common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
  1509. common_all = common_ss.apply(config_all, strict: false)
  1510. common_all = static_library('common',
  1511. build_by_default: false,
  1512. sources: common_all.sources() + genh,
  1513. dependencies: common_all.dependencies(),
  1514. name_suffix: 'fa')
  1515. feature_to_c = find_program('scripts/feature_to_c.sh')
  1516. emulators = {}
  1517. foreach target : target_dirs
  1518. config_target = config_target_mak[target]
  1519. target_name = config_target['TARGET_NAME']
  1520. arch = config_target['TARGET_BASE_ARCH']
  1521. arch_srcs = [config_target_h[target]]
  1522. arch_deps = []
  1523. c_args = ['-DNEED_CPU_H',
  1524. '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
  1525. '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
  1526. link_args = emulator_link_args
  1527. config_target += config_host
  1528. target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
  1529. if targetos == 'linux'
  1530. target_inc += include_directories('linux-headers', is_system: true)
  1531. endif
  1532. if target.endswith('-softmmu')
  1533. qemu_target_name = 'qemu-system-' + target_name
  1534. target_type='system'
  1535. t = target_softmmu_arch[arch].apply(config_target, strict: false)
  1536. arch_srcs += t.sources()
  1537. arch_deps += t.dependencies()
  1538. hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
  1539. hw = hw_arch[hw_dir].apply(config_target, strict: false)
  1540. arch_srcs += hw.sources()
  1541. arch_deps += hw.dependencies()
  1542. arch_srcs += config_devices_h[target]
  1543. link_args += ['@block.syms', '@qemu.syms']
  1544. else
  1545. abi = config_target['TARGET_ABI_DIR']
  1546. target_type='user'
  1547. qemu_target_name = 'qemu-' + target_name
  1548. if 'CONFIG_LINUX_USER' in config_target
  1549. base_dir = 'linux-user'
  1550. target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
  1551. else
  1552. base_dir = 'bsd-user'
  1553. endif
  1554. target_inc += include_directories(
  1555. base_dir,
  1556. base_dir / abi,
  1557. )
  1558. if 'CONFIG_LINUX_USER' in config_target
  1559. dir = base_dir / abi
  1560. arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
  1561. if config_target.has_key('TARGET_SYSTBL_ABI')
  1562. arch_srcs += \
  1563. syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
  1564. extra_args : config_target['TARGET_SYSTBL_ABI'])
  1565. endif
  1566. endif
  1567. endif
  1568. if 'TARGET_XML_FILES' in config_target
  1569. gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
  1570. output: target + '-gdbstub-xml.c',
  1571. input: files(config_target['TARGET_XML_FILES'].split()),
  1572. command: [feature_to_c, '@INPUT@'],
  1573. capture: true)
  1574. arch_srcs += gdbstub_xml
  1575. endif
  1576. t = target_arch[arch].apply(config_target, strict: false)
  1577. arch_srcs += t.sources()
  1578. arch_deps += t.dependencies()
  1579. target_common = common_ss.apply(config_target, strict: false)
  1580. objects = common_all.extract_objects(target_common.sources())
  1581. deps = target_common.dependencies()
  1582. target_specific = specific_ss.apply(config_target, strict: false)
  1583. arch_srcs += target_specific.sources()
  1584. arch_deps += target_specific.dependencies()
  1585. if get_option('shared-lib')
  1586. build_lib_args = {
  1587. 'target_type': 'shared_library',
  1588. 'install': true,
  1589. 'dependencies': arch_deps + deps,
  1590. 'link_language': link_language,
  1591. 'link_depends': [block_syms, qemu_syms],
  1592. 'link_args': link_args + cc.get_supported_link_arguments(['-Wl,-U,_qemu_main'])
  1593. }
  1594. else
  1595. build_lib_args = {
  1596. 'target_type': 'static_library',
  1597. 'install': false,
  1598. 'dependencies': arch_deps,
  1599. 'name_suffix': 'fa'
  1600. }
  1601. endif
  1602. lib = build_target('qemu-' + target,
  1603. sources: arch_srcs + genh,
  1604. objects: objects,
  1605. include_directories: target_inc,
  1606. c_args: c_args,
  1607. build_by_default: false,
  1608. kwargs: build_lib_args)
  1609. if target.endswith('-softmmu')
  1610. execs = [{
  1611. 'name': 'qemu-system-' + target_name,
  1612. 'gui': false,
  1613. 'sources': files('softmmu/main.c'),
  1614. 'dependencies': []
  1615. }]
  1616. if targetos == 'windows' and (sdl.found() or gtk.found())
  1617. execs += [{
  1618. 'name': 'qemu-system-' + target_name + 'w',
  1619. 'gui': true,
  1620. 'sources': files('softmmu/main.c'),
  1621. 'dependencies': []
  1622. }]
  1623. endif
  1624. if config_host.has_key('CONFIG_FUZZ')
  1625. specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
  1626. execs += [{
  1627. 'name': 'qemu-fuzz-' + target_name,
  1628. 'gui': false,
  1629. 'sources': specific_fuzz.sources(),
  1630. 'dependencies': specific_fuzz.dependencies(),
  1631. }]
  1632. endif
  1633. else
  1634. execs = [{
  1635. 'name': 'qemu-' + target_name,
  1636. 'gui': false,
  1637. 'sources': [],
  1638. 'dependencies': []
  1639. }]
  1640. endif
  1641. if get_option('shared-lib')
  1642. build_exe_args = {
  1643. 'link_with': lib,
  1644. 'link_args': link_args + cc.get_supported_link_arguments(['-Wl,--exclude-libs,ALL'])
  1645. }
  1646. else
  1647. build_exe_args = {
  1648. 'objects': lib.extract_all_objects(recursive: true),
  1649. 'link_args': link_args
  1650. }
  1651. endif
  1652. foreach exe: execs
  1653. emulators += {exe['name']:
  1654. executable(exe['name'], exe['sources'],
  1655. install: true,
  1656. c_args: c_args,
  1657. dependencies: arch_deps + deps + exe['dependencies'],
  1658. link_language: link_language,
  1659. link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
  1660. gui_app: exe['gui'],
  1661. kwargs: build_exe_args)
  1662. }
  1663. if 'CONFIG_TRACE_SYSTEMTAP' in config_host
  1664. foreach stp: [
  1665. {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
  1666. {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
  1667. {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
  1668. {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
  1669. ]
  1670. custom_target(exe['name'] + stp['ext'],
  1671. input: trace_events_all,
  1672. output: exe['name'] + stp['ext'],
  1673. capture: true,
  1674. install: stp['install'],
  1675. install_dir: qemu_datadir / '../systemtap/tapset',
  1676. command: [
  1677. tracetool, '--group=all', '--format=' + stp['fmt'],
  1678. '--binary=' + stp['bin'],
  1679. '--target-name=' + target_name,
  1680. '--target-type=' + target_type,
  1681. '--probe-prefix=qemu.' + target_type + '.' + target_name,
  1682. '@INPUT@',
  1683. ])
  1684. endforeach
  1685. endif
  1686. endforeach
  1687. endforeach
  1688. # Other build targets
  1689. if 'CONFIG_PLUGIN' in config_host
  1690. install_headers('include/qemu/qemu-plugin.h')
  1691. endif
  1692. if 'CONFIG_GUEST_AGENT' in config_host
  1693. subdir('qga')
  1694. endif
  1695. # Don't build qemu-keymap if xkbcommon is not explicitly enabled
  1696. # when we don't build tools or system
  1697. if xkbcommon.found()
  1698. # used for the update-keymaps target, so include rules even if !have_tools
  1699. qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
  1700. dependencies: [qemuutil, xkbcommon], install: have_tools)
  1701. endif
  1702. if have_tools
  1703. qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
  1704. dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
  1705. qemu_io = executable('qemu-io', files('qemu-io.c'),
  1706. dependencies: [block, qemuutil], install: true)
  1707. qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
  1708. dependencies: [block, qemuutil], install: true)
  1709. subdir('storage-daemon')
  1710. subdir('contrib/rdmacm-mux')
  1711. subdir('contrib/elf2dmp')
  1712. executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
  1713. dependencies: qemuutil,
  1714. install: true)
  1715. if 'CONFIG_VHOST_USER' in config_host
  1716. subdir('contrib/libvhost-user')
  1717. subdir('contrib/vhost-user-blk')
  1718. subdir('contrib/vhost-user-gpu')
  1719. subdir('contrib/vhost-user-input')
  1720. subdir('contrib/vhost-user-scsi')
  1721. endif
  1722. if targetos == 'linux'
  1723. executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
  1724. dependencies: [qemuutil, libcap_ng],
  1725. install: true,
  1726. install_dir: get_option('libexecdir'))
  1727. executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
  1728. dependencies: [authz, crypto, io, qom, qemuutil,
  1729. libcap_ng, mpathpersist],
  1730. install: true)
  1731. endif
  1732. if 'CONFIG_IVSHMEM' in config_host
  1733. subdir('contrib/ivshmem-client')
  1734. subdir('contrib/ivshmem-server')
  1735. endif
  1736. endif
  1737. subdir('scripts')
  1738. subdir('tools')
  1739. subdir('pc-bios')
  1740. subdir('tests')
  1741. subdir('docs')
  1742. if 'CONFIG_GTK' in config_host
  1743. subdir('po')
  1744. endif
  1745. if host_machine.system() == 'windows'
  1746. nsis_cmd = [
  1747. find_program('scripts/nsis.py'),
  1748. '@OUTPUT@',
  1749. get_option('prefix'),
  1750. meson.current_source_dir(),
  1751. host_machine.cpu_family(),
  1752. '--',
  1753. '-DDISPLAYVERSION=' + meson.project_version(),
  1754. ]
  1755. if build_docs
  1756. nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
  1757. endif
  1758. if 'CONFIG_GTK' in config_host
  1759. nsis_cmd += '-DCONFIG_GTK=y'
  1760. endif
  1761. nsis = custom_target('nsis',
  1762. output: 'qemu-setup-' + meson.project_version() + '.exe',
  1763. input: files('qemu.nsi'),
  1764. build_always_stale: true,
  1765. command: nsis_cmd + ['@INPUT@'])
  1766. alias_target('installer', nsis)
  1767. endif
  1768. #########################
  1769. # Configuration summary #
  1770. #########################
  1771. summary_info = {}
  1772. summary_info += {'Install prefix': config_host['prefix']}
  1773. summary_info += {'BIOS directory': config_host['qemu_datadir']}
  1774. summary_info += {'firmware path': config_host['qemu_firmwarepath']}
  1775. summary_info += {'binary directory': config_host['bindir']}
  1776. summary_info += {'library directory': config_host['libdir']}
  1777. summary_info += {'module directory': config_host['qemu_moddir']}
  1778. summary_info += {'libexec directory': config_host['libexecdir']}
  1779. summary_info += {'include directory': config_host['includedir']}
  1780. summary_info += {'config directory': config_host['sysconfdir']}
  1781. if targetos != 'windows'
  1782. summary_info += {'local state directory': config_host['qemu_localstatedir']}
  1783. summary_info += {'Manual directory': get_option('mandir')}
  1784. else
  1785. summary_info += {'local state directory': 'queried at runtime'}
  1786. endif
  1787. summary_info += {'Doc directory': get_option('docdir')}
  1788. summary_info += {'Build directory': meson.current_build_dir()}
  1789. summary_info += {'Source path': meson.current_source_dir()}
  1790. summary_info += {'build shared lib': get_option('shared-lib')}
  1791. summary_info += {'GIT binary': config_host['GIT']}
  1792. summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
  1793. summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
  1794. summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
  1795. if link_language == 'cpp'
  1796. summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
  1797. else
  1798. summary_info += {'C++ compiler': false}
  1799. endif
  1800. if targetos == 'darwin'
  1801. summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
  1802. endif
  1803. summary_info += {'ARFLAGS': config_host['ARFLAGS']}
  1804. summary_info += {'CFLAGS': ' '.join(get_option('c_args')
  1805. + ['-O' + get_option('optimization')]
  1806. + (get_option('debug') ? ['-g'] : []))}
  1807. if link_language == 'cpp'
  1808. summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args')
  1809. + ['-O' + get_option('optimization')]
  1810. + (get_option('debug') ? ['-g'] : []))}
  1811. endif
  1812. link_args = get_option(link_language + '_link_args')
  1813. if link_args.length() > 0
  1814. summary_info += {'LDFLAGS': ' '.join(link_args)}
  1815. endif
  1816. summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
  1817. summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
  1818. summary_info += {'make': config_host['MAKE']}
  1819. summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
  1820. summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
  1821. summary_info += {'genisoimage': config_host['GENISOIMAGE']}
  1822. # TODO: add back version
  1823. summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt}
  1824. if slirp_opt != 'disabled'
  1825. summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
  1826. endif
  1827. summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
  1828. if config_host.has_key('CONFIG_MODULES')
  1829. summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
  1830. endif
  1831. summary_info += {'host CPU': cpu}
  1832. summary_info += {'host endianness': build_machine.endian()}
  1833. summary_info += {'target list': ' '.join(target_dirs)}
  1834. summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
  1835. summary_info += {'sparse enabled': sparse.found()}
  1836. summary_info += {'strip binaries': get_option('strip')}
  1837. summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
  1838. summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
  1839. if targetos == 'darwin'
  1840. summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
  1841. endif
  1842. # TODO: add back version
  1843. summary_info += {'SDL support': sdl.found()}
  1844. summary_info += {'SDL image support': sdl_image.found()}
  1845. # TODO: add back version
  1846. summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
  1847. summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
  1848. summary_info += {'pixman': pixman.found()}
  1849. # TODO: add back version
  1850. summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
  1851. summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
  1852. summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
  1853. # TODO: add back version
  1854. summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
  1855. if config_host.has_key('CONFIG_GCRYPT')
  1856. summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
  1857. summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
  1858. endif
  1859. # TODO: add back version
  1860. summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
  1861. if config_host.has_key('CONFIG_NETTLE')
  1862. summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
  1863. endif
  1864. summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
  1865. summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
  1866. summary_info += {'iconv support': iconv.found()}
  1867. summary_info += {'curses support': curses.found()}
  1868. # TODO: add back version
  1869. summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
  1870. summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
  1871. summary_info += {'mingw32 support': targetos == 'windows'}
  1872. summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
  1873. summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
  1874. summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
  1875. summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
  1876. summary_info += {'Multipath support': mpathpersist.found()}
  1877. summary_info += {'VNC support': vnc.found()}
  1878. if vnc.found()
  1879. summary_info += {'VNC SASL support': sasl.found()}
  1880. summary_info += {'VNC JPEG support': jpeg.found()}
  1881. summary_info += {'VNC PNG support': png.found()}
  1882. endif
  1883. summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
  1884. if config_host.has_key('CONFIG_XEN_BACKEND')
  1885. summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
  1886. endif
  1887. summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
  1888. summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
  1889. summary_info += {'PIE': get_option('b_pie')}
  1890. summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
  1891. summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
  1892. summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
  1893. summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
  1894. summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
  1895. summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
  1896. summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
  1897. summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
  1898. summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
  1899. summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
  1900. summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
  1901. if config_all.has_key('CONFIG_TCG')
  1902. summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
  1903. summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
  1904. endif
  1905. summary_info += {'malloc trim support': has_malloc_trim}
  1906. summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
  1907. summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
  1908. summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
  1909. summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
  1910. summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
  1911. summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
  1912. summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
  1913. summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
  1914. summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
  1915. summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
  1916. summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
  1917. summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
  1918. summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
  1919. summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
  1920. summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
  1921. summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
  1922. summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
  1923. summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
  1924. if config_host['TRACE_BACKENDS'].split().contains('simple')
  1925. summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
  1926. endif
  1927. # TODO: add back protocol and server version
  1928. summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
  1929. summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
  1930. summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
  1931. summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
  1932. summary_info += {'U2F support': u2f.found()}
  1933. summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
  1934. summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
  1935. summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
  1936. summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
  1937. summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
  1938. summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
  1939. summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
  1940. if targetos == 'windows'
  1941. if 'WIN_SDK' in config_host
  1942. summary_info += {'Windows SDK': config_host['WIN_SDK']}
  1943. endif
  1944. summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
  1945. summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
  1946. summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
  1947. endif
  1948. summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
  1949. summary_info += {'libucontext support': ucontext.found()}
  1950. summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
  1951. summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
  1952. summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
  1953. summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
  1954. summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
  1955. summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
  1956. summary_info += {'gcov': get_option('b_coverage')}
  1957. summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
  1958. summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
  1959. summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
  1960. summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
  1961. summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
  1962. summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
  1963. summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
  1964. summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
  1965. summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
  1966. summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
  1967. summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
  1968. summary_info += {'memory allocator': get_option('malloc')}
  1969. summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
  1970. summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
  1971. summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
  1972. summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
  1973. summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
  1974. summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
  1975. summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
  1976. summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
  1977. summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
  1978. summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
  1979. summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
  1980. summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
  1981. summary_info += {'host block dev support': config_host.has_key('CONFIG_HOST_BLOCK_DEVICE')}
  1982. summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
  1983. summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
  1984. summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
  1985. summary_info += {'libudev': libudev.found()}
  1986. summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
  1987. summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
  1988. summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
  1989. if config_host.has_key('HAVE_GDB_BIN')
  1990. summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
  1991. endif
  1992. summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
  1993. summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
  1994. summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
  1995. summary(summary_info, bool_yn: true)
  1996. if not supported_cpus.contains(cpu)
  1997. message()
  1998. warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
  1999. message()
  2000. message('CPU host architecture ' + cpu + ' support is not currently maintained.')
  2001. message('The QEMU project intends to remove support for this host CPU in')
  2002. message('a future release if nobody volunteers to maintain it and to')
  2003. message('provide a build host for our continuous integration setup.')
  2004. message('configure has succeeded and you can continue to build, but')
  2005. message('if you care about QEMU on this platform you should contact')
  2006. message('us upstream at qemu-devel@nongnu.org.')
  2007. endif
  2008. if not supported_oses.contains(targetos)
  2009. message()
  2010. warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
  2011. message()
  2012. message('Host OS ' + targetos + 'support is not currently maintained.')
  2013. message('The QEMU project intends to remove support for this host OS in')
  2014. message('a future release if nobody volunteers to maintain it and to')
  2015. message('provide a build host for our continuous integration setup.')
  2016. message('configure has succeeded and you can continue to build, but')
  2017. message('if you care about QEMU on this platform you should contact')
  2018. message('us upstream at qemu-devel@nongnu.org.')
  2019. endif