Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

meson.build 52KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660
  1. # Copyright © 2017-2019 Intel Corporation
  2. # Permission is hereby granted, free of charge, to any person obtaining a copy
  3. # of this software and associated documentation files (the "Software"), to deal
  4. # in the Software without restriction, including without limitation the rights
  5. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6. # copies of the Software, and to permit persons to whom the Software is
  7. # furnished to do so, subject to the following conditions:
  8. # The above copyright notice and this permission notice shall be included in
  9. # all copies or substantial portions of the Software.
  10. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. # SOFTWARE.
  17. project(
  18. 'mesa',
  19. ['c', 'cpp'],
  20. version : run_command(
  21. [find_program('python', 'python2', 'python3'), 'bin/meson_get_version.py']
  22. ).stdout(),
  23. license : 'MIT',
  24. meson_version : '>= 0.46',
  25. default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c99', 'cpp_std=c++14']
  26. )
  27. cc = meson.get_compiler('c')
  28. cpp = meson.get_compiler('cpp')
  29. null_dep = dependency('', required : false)
  30. # Arguments for the preprocessor, put these in a separate array from the C and
  31. # C++ (cpp in meson terminology) arguments since they need to be added to the
  32. # default arguments for both C and C++.
  33. pre_args = [
  34. '-D__STDC_CONSTANT_MACROS',
  35. '-D__STDC_FORMAT_MACROS',
  36. '-D__STDC_LIMIT_MACROS',
  37. '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
  38. '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/issues"',
  39. ]
  40. with_vulkan_icd_dir = get_option('vulkan-icd-dir')
  41. with_tests = get_option('build-tests')
  42. with_valgrind = get_option('valgrind')
  43. with_libunwind = get_option('libunwind')
  44. with_glx_read_only_text = get_option('glx-read-only-text')
  45. with_glx_direct = get_option('glx-direct')
  46. with_osmesa = get_option('osmesa')
  47. with_swr_arches = get_option('swr-arches')
  48. with_tools = get_option('tools')
  49. if with_tools.contains('all')
  50. with_tools = [
  51. 'drm-shim',
  52. 'etnaviv',
  53. 'freedreno',
  54. 'glsl',
  55. 'intel',
  56. 'intel-ui',
  57. 'lima',
  58. 'nir',
  59. 'nouveau',
  60. 'xvmc',
  61. ]
  62. endif
  63. dri_drivers_path = get_option('dri-drivers-path')
  64. if dri_drivers_path == ''
  65. dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
  66. endif
  67. dri_search_path = get_option('dri-search-path')
  68. if dri_search_path == ''
  69. dri_search_path = dri_drivers_path
  70. endif
  71. with_gles1 = get_option('gles1')
  72. with_gles2 = get_option('gles2')
  73. if host_machine.system() == 'windows'
  74. if with_gles1 == 'auto'
  75. with_gles1 = 'false'
  76. endif
  77. if with_gles2 == 'auto'
  78. with_gles2 = 'false'
  79. endif
  80. endif
  81. with_opengl = get_option('opengl')
  82. # Default shared glapi off for windows, on elsewhere.
  83. _sg = get_option('shared-glapi')
  84. if _sg == 'auto'
  85. with_shared_glapi = host_machine.system() != 'windows'
  86. else
  87. with_shared_glapi = _sg == 'true'
  88. endif
  89. # shared-glapi is required if at least two OpenGL APIs are being built
  90. if not with_shared_glapi
  91. if ((with_gles1 == 'true' and with_gles2 == 'true') or
  92. (with_gles1 == 'true' and with_opengl) or
  93. (with_gles2 == 'true' and with_opengl))
  94. error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
  95. endif
  96. with_gles1 = 'false'
  97. with_gles2 = 'false'
  98. endif
  99. # We require OpenGL for OpenGL ES
  100. if not with_opengl
  101. if (with_gles1 == 'true' or with_gles2 == 'true') and not with_opengl
  102. error('building OpenGL ES without OpenGL is not supported.')
  103. endif
  104. with_gles1 = 'false'
  105. with_gles2 = 'false'
  106. endif
  107. with_gles1 = with_gles1 != 'false'
  108. with_gles2 = with_gles2 != 'false'
  109. with_any_opengl = with_opengl or with_gles1 or with_gles2
  110. # Only build shared_glapi if at least one OpenGL API is enabled
  111. with_shared_glapi = with_shared_glapi and with_any_opengl
  112. system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux'].contains(host_machine.system())
  113. dri_drivers = get_option('dri-drivers')
  114. if dri_drivers.contains('auto')
  115. if system_has_kms_drm
  116. # TODO: PPC, Sparc
  117. if ['x86', 'x86_64'].contains(host_machine.cpu_family())
  118. dri_drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau']
  119. elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
  120. dri_drivers = []
  121. else
  122. error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  123. host_machine.cpu_family()))
  124. endif
  125. elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
  126. # only swrast would make sense here, but gallium swrast is a much better default
  127. dri_drivers = []
  128. else
  129. error('Unknown OS @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  130. host_machine.system()))
  131. endif
  132. endif
  133. with_dri_i915 = dri_drivers.contains('i915')
  134. with_dri_i965 = dri_drivers.contains('i965')
  135. with_dri_r100 = dri_drivers.contains('r100')
  136. with_dri_r200 = dri_drivers.contains('r200')
  137. with_dri_nouveau = dri_drivers.contains('nouveau')
  138. with_dri_swrast = dri_drivers.contains('swrast')
  139. with_dri = dri_drivers.length() != 0 and dri_drivers != ['']
  140. gallium_drivers = get_option('gallium-drivers')
  141. if gallium_drivers.contains('auto')
  142. if system_has_kms_drm
  143. # TODO: PPC, Sparc
  144. if ['x86', 'x86_64'].contains(host_machine.cpu_family())
  145. gallium_drivers = [
  146. 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast'
  147. ]
  148. elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
  149. gallium_drivers = [
  150. 'kmsro', 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau',
  151. 'tegra', 'virgl', 'lima', 'panfrost', 'swrast'
  152. ]
  153. else
  154. error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  155. host_machine.cpu_family()))
  156. endif
  157. elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
  158. gallium_drivers = ['swrast']
  159. else
  160. error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  161. host_machine.system()))
  162. endif
  163. endif
  164. with_gallium_kmsro = gallium_drivers.contains('kmsro')
  165. with_gallium_radeonsi = gallium_drivers.contains('radeonsi')
  166. with_gallium_r300 = gallium_drivers.contains('r300')
  167. with_gallium_r600 = gallium_drivers.contains('r600')
  168. with_gallium_nouveau = gallium_drivers.contains('nouveau')
  169. with_gallium_freedreno = gallium_drivers.contains('freedreno')
  170. with_gallium_softpipe = gallium_drivers.contains('swrast')
  171. with_gallium_vc4 = gallium_drivers.contains('vc4')
  172. with_gallium_v3d = gallium_drivers.contains('v3d')
  173. with_gallium_panfrost = gallium_drivers.contains('panfrost')
  174. with_gallium_etnaviv = gallium_drivers.contains('etnaviv')
  175. with_gallium_tegra = gallium_drivers.contains('tegra')
  176. with_gallium_iris = gallium_drivers.contains('iris')
  177. with_gallium_i915 = gallium_drivers.contains('i915')
  178. with_gallium_svga = gallium_drivers.contains('svga')
  179. with_gallium_virgl = gallium_drivers.contains('virgl')
  180. with_gallium_swr = gallium_drivers.contains('swr')
  181. with_gallium_lima = gallium_drivers.contains('lima')
  182. if cc.get_id() == 'intel'
  183. if meson.version().version_compare('< 0.49.0')
  184. error('Meson does not have sufficient support of ICC before 0.49.0 to compile mesa')
  185. elif with_gallium_swr and meson.version().version_compare('== 0.49.0')
  186. warning('Meson as of 0.49.0 is sufficient for compiling mesa with ICC, but there are some caveats with SWR. 0.49.1 should resolve all of these')
  187. endif
  188. endif
  189. with_gallium = gallium_drivers.length() != 0 and gallium_drivers != ['']
  190. if with_gallium and system_has_kms_drm
  191. _glx = get_option('glx')
  192. _egl = get_option('egl')
  193. if _glx == 'dri' or _egl == 'true' or (_glx == 'disabled' and _egl != 'false')
  194. with_dri = true
  195. endif
  196. endif
  197. _vulkan_drivers = get_option('vulkan-drivers')
  198. if _vulkan_drivers.contains('auto')
  199. if system_has_kms_drm
  200. if host_machine.cpu_family().startswith('x86')
  201. _vulkan_drivers = ['amd', 'intel']
  202. elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
  203. _vulkan_drivers = []
  204. else
  205. error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  206. host_machine.cpu_family()))
  207. endif
  208. elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
  209. # No vulkan driver supports windows or macOS currently
  210. _vulkan_drivers = []
  211. else
  212. error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
  213. host_machine.system()))
  214. endif
  215. endif
  216. with_intel_vk = _vulkan_drivers.contains('intel')
  217. with_amd_vk = _vulkan_drivers.contains('amd')
  218. with_freedreno_vk = _vulkan_drivers.contains('freedreno')
  219. with_any_vk = _vulkan_drivers.length() != 0 and _vulkan_drivers != ['']
  220. if with_freedreno_vk and get_option('I-love-half-baked-turnips') != true
  221. error('Cannot enable freedreno vulkan driver')
  222. endif
  223. if with_dri_swrast and (with_gallium_softpipe or with_gallium_swr)
  224. error('Only one swrast provider can be built')
  225. endif
  226. if with_dri_i915 and with_gallium_i915
  227. error('Only one i915 provider can be built')
  228. endif
  229. if with_gallium_kmsro and not (with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_freedreno or with_gallium_panfrost or with_gallium_lima)
  230. error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv, freedreno, panfrost, lima)')
  231. endif
  232. if with_gallium_tegra and not with_gallium_nouveau
  233. error('tegra driver requires nouveau driver')
  234. endif
  235. if host_machine.system() == 'darwin'
  236. with_dri_platform = 'apple'
  237. pre_args += '-DBUILDING_MESA'
  238. elif ['windows', 'cygwin'].contains(host_machine.system())
  239. with_dri_platform = 'windows'
  240. elif system_has_kms_drm
  241. with_dri_platform = 'drm'
  242. else
  243. # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
  244. # assert here that one of those cases has been met.
  245. # FIXME: illumos ends up here as well
  246. with_dri_platform = 'none'
  247. endif
  248. _platforms = get_option('platforms')
  249. if _platforms.contains('auto')
  250. if system_has_kms_drm
  251. _platforms = ['x11', 'wayland', 'drm', 'surfaceless']
  252. elif ['darwin', 'cygwin'].contains(host_machine.system())
  253. _platforms = ['x11', 'surfaceless']
  254. elif ['haiku'].contains(host_machine.system())
  255. _platforms = ['haiku']
  256. elif host_machine.system() == 'windows'
  257. _platforms = ['windows']
  258. else
  259. error('Unknown OS @0@. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.'.format(
  260. host_machine.system()))
  261. endif
  262. endif
  263. with_platform_android = _platforms.contains('android')
  264. with_platform_x11 = _platforms.contains('x11')
  265. with_platform_wayland = _platforms.contains('wayland')
  266. with_platform_drm = _platforms.contains('drm')
  267. with_platform_haiku = _platforms.contains('haiku')
  268. with_platform_surfaceless = _platforms.contains('surfaceless')
  269. with_platform_windows = _platforms.contains('windows')
  270. with_platforms = false
  271. if _platforms.length() != 0 and _platforms != ['']
  272. # sanity check that list contains no empty strings
  273. if _platforms.contains('')
  274. error('Invalid argument list given to -Dplatforms, please fix.')
  275. endif
  276. with_platforms = true
  277. egl_native_platform = _platforms[0]
  278. endif
  279. _xlib_lease = get_option('xlib-lease')
  280. if _xlib_lease == 'auto'
  281. with_xlib_lease = with_platform_x11 and with_platform_drm
  282. else
  283. with_xlib_lease = _xlib_lease == 'true'
  284. endif
  285. with_glx = get_option('glx')
  286. if with_glx == 'auto'
  287. if with_dri
  288. with_glx = 'dri'
  289. elif with_platform_haiku
  290. with_glx = 'disabled'
  291. elif host_machine.system() == 'windows'
  292. with_glx = 'disabled'
  293. elif with_gallium
  294. # Even when building just gallium drivers the user probably wants dri
  295. with_glx = 'dri'
  296. elif with_platform_x11 and with_any_opengl and not with_any_vk
  297. # The automatic behavior should not be to turn on xlib based glx when
  298. # building only vulkan drivers
  299. with_glx = 'xlib'
  300. else
  301. with_glx = 'disabled'
  302. endif
  303. endif
  304. if with_glx == 'dri'
  305. if with_gallium
  306. with_dri = true
  307. endif
  308. endif
  309. if not (with_dri or with_gallium or with_glx != 'disabled')
  310. with_gles1 = false
  311. with_gles2 = false
  312. with_opengl = false
  313. with_any_opengl = false
  314. with_shared_glapi = false
  315. endif
  316. _gbm = get_option('gbm')
  317. if _gbm == 'auto'
  318. with_gbm = system_has_kms_drm and with_dri
  319. else
  320. with_gbm = _gbm == 'true'
  321. endif
  322. if with_gbm and not system_has_kms_drm
  323. error('GBM only supports DRM/KMS platforms')
  324. endif
  325. _egl = get_option('egl')
  326. if _egl == 'auto'
  327. with_egl = (
  328. not ['darwin', 'windows'].contains(host_machine.system()) and
  329. with_dri and with_shared_glapi and with_platforms
  330. )
  331. elif _egl == 'true'
  332. if not with_dri
  333. error('EGL requires dri')
  334. elif not with_shared_glapi
  335. error('EGL requires shared-glapi')
  336. elif not with_platforms
  337. error('No platforms specified, consider -Dplatforms=drm,x11,surfaceless at least')
  338. elif not ['disabled', 'dri'].contains(with_glx)
  339. error('EGL requires dri, but a GLX is being built without dri')
  340. elif ['darwin', 'windows'].contains(host_machine.system())
  341. error('EGL is not available on Windows or MacOS')
  342. endif
  343. with_egl = true
  344. else
  345. with_egl = false
  346. endif
  347. if with_egl and not (with_platform_drm or with_platform_surfaceless or with_platform_android)
  348. if with_gallium_radeonsi
  349. error('RadeonSI requires the drm, surfaceless or android platform when using EGL')
  350. endif
  351. if with_gallium_virgl
  352. error('Virgl requires the drm, surfaceless or android platform when using EGL')
  353. endif
  354. endif
  355. # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
  356. if not with_platform_android or get_option('platform-sdk-version') >= 29
  357. pre_args += '-DUSE_ELF_TLS'
  358. endif
  359. if with_glx != 'disabled'
  360. if not (with_platform_x11 and with_any_opengl)
  361. error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
  362. elif with_glx == 'gallium-xlib'
  363. if not with_gallium
  364. error('Gallium-xlib based GLX requires at least one gallium driver')
  365. elif not with_gallium_softpipe
  366. error('Gallium-xlib based GLX requires softpipe or llvmpipe.')
  367. elif with_dri
  368. error('gallium-xlib conflicts with any dri driver')
  369. endif
  370. elif with_glx == 'xlib'
  371. if with_dri
  372. error('xlib conflicts with any dri driver')
  373. endif
  374. elif with_glx == 'dri'
  375. if not with_shared_glapi
  376. error('dri based GLX requires shared-glapi')
  377. endif
  378. endif
  379. endif
  380. with_glvnd = get_option('glvnd')
  381. if with_glvnd
  382. if with_platform_windows
  383. error('glvnd cannot be used on Windows')
  384. elif with_glx == 'xlib' or with_glx == 'gallium-xlib'
  385. error('Cannot build glvnd support for GLX that is not DRI based.')
  386. elif with_glx == 'disabled' and not with_egl
  387. error('glvnd requires DRI based GLX and/or EGL')
  388. endif
  389. if get_option('egl-lib-suffix') != ''
  390. error('''EGL lib suffix can't be used with libglvnd''')
  391. endif
  392. endif
  393. if with_vulkan_icd_dir == ''
  394. with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
  395. endif
  396. with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or
  397. host_machine.system() == 'gnu')
  398. _dri3 = get_option('dri3')
  399. if _dri3 == 'auto'
  400. with_dri3 = system_has_kms_drm and with_dri2
  401. else
  402. with_dri3 = _dri3 == 'true'
  403. endif
  404. if with_any_vk and (with_platform_x11 and not with_dri3)
  405. error('Vulkan drivers require dri3 for X11 support')
  406. endif
  407. if with_dri
  408. if with_glx == 'disabled' and not with_egl and not with_gbm and with_osmesa != 'classic'
  409. error('building dri drivers require at least one windowing system or classic osmesa')
  410. endif
  411. endif
  412. prog_pkgconfig = find_program('pkg-config')
  413. _vdpau = get_option('gallium-vdpau')
  414. if not system_has_kms_drm
  415. if _vdpau == 'true'
  416. error('VDPAU state tracker can only be build on unix-like OSes.')
  417. else
  418. _vdpau = 'false'
  419. endif
  420. elif not with_platform_x11
  421. if _vdpau == 'true'
  422. error('VDPAU state tracker requires X11 support.')
  423. else
  424. _vdpau = 'false'
  425. endif
  426. elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or
  427. with_gallium_nouveau)
  428. if _vdpau == 'true'
  429. error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau.')
  430. else
  431. _vdpau = 'false'
  432. endif
  433. endif
  434. dep_vdpau = null_dep
  435. with_gallium_vdpau = false
  436. if _vdpau != 'false'
  437. dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'true')
  438. if dep_vdpau.found()
  439. dep_vdpau = declare_dependency(
  440. compile_args : run_command(prog_pkgconfig, ['vdpau', '--cflags']).stdout().split()
  441. )
  442. with_gallium_vdpau = true
  443. endif
  444. endif
  445. if with_gallium_vdpau
  446. pre_args += '-DHAVE_ST_VDPAU'
  447. endif
  448. vdpau_drivers_path = get_option('vdpau-libs-path')
  449. if vdpau_drivers_path == ''
  450. vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
  451. endif
  452. _xvmc = get_option('gallium-xvmc')
  453. if not system_has_kms_drm
  454. if _xvmc == 'true'
  455. error('XVMC state tracker can only be build on unix-like OSes.')
  456. else
  457. _xvmc = 'false'
  458. endif
  459. elif not with_platform_x11
  460. if _xvmc == 'true'
  461. error('XVMC state tracker requires X11 support.')
  462. else
  463. _xvmc = 'false'
  464. endif
  465. elif not (with_gallium_r600 or with_gallium_nouveau)
  466. if _xvmc == 'true'
  467. error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.')
  468. else
  469. _xvmc = 'false'
  470. endif
  471. endif
  472. dep_xvmc = null_dep
  473. with_gallium_xvmc = false
  474. if _xvmc != 'false'
  475. dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'true')
  476. with_gallium_xvmc = dep_xvmc.found()
  477. endif
  478. xvmc_drivers_path = get_option('xvmc-libs-path')
  479. if xvmc_drivers_path == ''
  480. xvmc_drivers_path = get_option('libdir')
  481. endif
  482. _omx = get_option('gallium-omx')
  483. if not system_has_kms_drm
  484. if ['auto', 'disabled'].contains(_omx)
  485. _omx = 'disabled'
  486. else
  487. error('OMX state tracker can only be built on unix-like OSes.')
  488. endif
  489. elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
  490. if ['auto', 'disabled'].contains(_omx)
  491. _omx = 'disabled'
  492. else
  493. error('OMX state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
  494. endif
  495. endif
  496. with_gallium_omx = _omx
  497. dep_omx = null_dep
  498. dep_omx_other = []
  499. if ['auto', 'bellagio'].contains(_omx)
  500. dep_omx = dependency(
  501. 'libomxil-bellagio', required : _omx == 'bellagio'
  502. )
  503. if dep_omx.found()
  504. with_gallium_omx = 'bellagio'
  505. endif
  506. endif
  507. if ['auto', 'tizonia'].contains(_omx)
  508. if with_dri and with_egl
  509. dep_omx = dependency(
  510. 'libtizonia', version : '>= 0.10.0',
  511. required : _omx == 'tizonia',
  512. )
  513. dep_omx_other = [
  514. dependency('libtizplatform', required : _omx == 'tizonia'),
  515. dependency('tizilheaders', required : _omx == 'tizonia'),
  516. ]
  517. if dep_omx.found() and dep_omx_other[0].found() and dep_omx_other[1].found()
  518. with_gallium_omx = 'tizonia'
  519. endif
  520. elif _omx == 'tizonia'
  521. error('OMX-Tizonia state tracker requires dri and egl')
  522. endif
  523. endif
  524. if _omx == 'auto'
  525. with_gallium_omx = 'disabled'
  526. else
  527. with_gallium_omx = _omx
  528. endif
  529. pre_args += [
  530. '-DENABLE_ST_OMX_BELLAGIO=' + (with_gallium_omx == 'bellagio' ? '1' : '0'),
  531. '-DENABLE_ST_OMX_TIZONIA=' + (with_gallium_omx == 'tizonia' ? '1' : '0'),
  532. ]
  533. omx_drivers_path = get_option('omx-libs-path')
  534. if with_gallium_omx != 'disabled'
  535. # Figure out where to put the omx driver.
  536. # FIXME: this could all be vastly simplified by adding a 'defined_variable'
  537. # argument to meson's get_pkgconfig_variable method.
  538. if omx_drivers_path == ''
  539. _omx_libdir = dep_omx.get_pkgconfig_variable('libdir')
  540. _omx_drivers_dir = dep_omx.get_pkgconfig_variable('pluginsdir')
  541. if _omx_libdir == get_option('libdir')
  542. omx_drivers_path = _omx_drivers_dir
  543. else
  544. _omx_base_dir = []
  545. # This will fail on windows. Does OMX run on windows?
  546. _omx_libdir = _omx_libdir.split('/')
  547. _omx_drivers_dir = _omx_drivers_dir.split('/')
  548. foreach o : _omx_drivers_dir
  549. if not _omx_libdir.contains(o)
  550. _omx_base_dir += o
  551. endif
  552. endforeach
  553. omx_drivers_path = join_paths(get_option('libdir'), _omx_base_dir)
  554. endif
  555. endif
  556. endif
  557. _va = get_option('gallium-va')
  558. if not system_has_kms_drm
  559. if _va == 'true'
  560. error('VA state tracker can only be built on unix-like OSes.')
  561. else
  562. _va = 'false'
  563. endif
  564. elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
  565. if _va == 'true'
  566. error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
  567. else
  568. _va = 'false'
  569. endif
  570. endif
  571. with_gallium_va = false
  572. dep_va = null_dep
  573. if _va != 'false'
  574. dep_va = dependency('libva', version : '>= 0.38.0', required : _va == 'true')
  575. if dep_va.found()
  576. dep_va_headers = declare_dependency(
  577. compile_args : run_command(prog_pkgconfig, ['libva', '--cflags']).stdout().split()
  578. )
  579. with_gallium_va = true
  580. endif
  581. endif
  582. va_drivers_path = get_option('va-libs-path')
  583. if va_drivers_path == ''
  584. va_drivers_path = join_paths(get_option('libdir'), 'dri')
  585. endif
  586. _xa = get_option('gallium-xa')
  587. if not system_has_kms_drm
  588. if _xa == 'true'
  589. error('XA state tracker can only be built on unix-like OSes.')
  590. else
  591. _xa = 'false'
  592. endif
  593. elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915
  594. or with_gallium_svga)
  595. if _xa == 'true'
  596. error('XA state tracker requires at least one of the following gallium drivers: nouveau, freedreno, i915, svga.')
  597. else
  598. _xa = 'false'
  599. endif
  600. endif
  601. with_gallium_xa = _xa != 'false'
  602. d3d_drivers_path = get_option('d3d-drivers-path')
  603. if d3d_drivers_path == ''
  604. d3d_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'd3d')
  605. endif
  606. with_gallium_st_nine = get_option('gallium-nine')
  607. if with_gallium_st_nine
  608. if not with_gallium_softpipe
  609. error('The nine state tracker requires gallium softpipe/llvmpipe.')
  610. elif not (with_gallium_radeonsi or with_gallium_nouveau or with_gallium_r600
  611. or with_gallium_r300 or with_gallium_svga or with_gallium_i915
  612. or with_gallium_iris)
  613. error('The nine state tracker requires at least one non-swrast gallium driver.')
  614. endif
  615. if not with_dri3
  616. error('Using nine with wine requires dri3')
  617. endif
  618. endif
  619. if get_option('power8') != 'false'
  620. # on old versions of meson the cpu family would return as ppc64le on little
  621. # endian power8, this was changed in 0.48 such that the family would always
  622. # be ppc64 regardless of endianness, and then the machine.endian() value
  623. # should be checked. Since we support versions < 0.48 we need to use
  624. # startswith.
  625. if host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
  626. if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
  627. error('Altivec is not supported with gcc version < 4.8.')
  628. endif
  629. if cc.compiles('''
  630. #include <altivec.h>
  631. int main() {
  632. vector unsigned char r;
  633. vector unsigned int v = vec_splat_u32 (1);
  634. r = __builtin_vec_vgbbd ((vector unsigned char) v);
  635. return 0;
  636. }''',
  637. args : '-mpower8-vector',
  638. name : 'POWER8 intrinsics')
  639. pre_args += ['-D_ARCH_PWR8', '-mpower8-vector']
  640. elif get_option('power8') == 'true'
  641. error('POWER8 intrinsic support required but not found.')
  642. endif
  643. endif
  644. endif
  645. _opencl = get_option('gallium-opencl')
  646. clover_cpp_std = []
  647. if _opencl != 'disabled'
  648. if not with_gallium
  649. error('OpenCL Clover implementation requires at least one gallium driver.')
  650. endif
  651. dep_clc = dependency('libclc')
  652. with_gallium_opencl = true
  653. with_opencl_icd = _opencl == 'icd'
  654. if host_machine.cpu_family().startswith('ppc') and cpp.compiles('''
  655. #if !defined(__VEC__) || !defined(__ALTIVEC__)
  656. #error "AltiVec not enabled"
  657. #endif''',
  658. name : 'Altivec')
  659. clover_cpp_std += ['cpp_std=gnu++11']
  660. endif
  661. else
  662. dep_clc = null_dep
  663. with_gallium_opencl = false
  664. with_opencl_icd = false
  665. endif
  666. gl_pkgconfig_c_flags = []
  667. if with_platform_x11
  668. if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
  669. pre_args += '-DHAVE_X11_PLATFORM'
  670. endif
  671. if with_glx == 'xlib' or with_glx == 'gallium-xlib'
  672. pre_args += '-DUSE_XSHM'
  673. else
  674. pre_args += '-DGLX_INDIRECT_RENDERING'
  675. if with_glx_direct
  676. pre_args += '-DGLX_DIRECT_RENDERING'
  677. endif
  678. if with_dri_platform == 'drm'
  679. pre_args += '-DGLX_USE_DRM'
  680. elif with_dri_platform == 'apple'
  681. pre_args += '-DGLX_USE_APPLEGL'
  682. elif with_dri_platform == 'windows'
  683. pre_args += '-DGLX_USE_WINDOWSGL'
  684. endif
  685. endif
  686. else
  687. pre_args += '-DMESA_EGL_NO_X11_HEADERS'
  688. gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
  689. endif
  690. if with_platform_drm
  691. if with_egl and not with_gbm
  692. error('EGL drm platform requires gbm')
  693. endif
  694. pre_args += '-DHAVE_DRM_PLATFORM'
  695. endif
  696. if with_platform_surfaceless
  697. pre_args += '-DHAVE_SURFACELESS_PLATFORM'
  698. endif
  699. if with_platform_android
  700. dep_android = [
  701. dependency('cutils'),
  702. dependency('hardware'),
  703. dependency('sync'),
  704. ]
  705. if get_option('platform-sdk-version') >= 26
  706. dep_android += dependency('nativewindow')
  707. endif
  708. pre_args += '-DHAVE_ANDROID_PLATFORM'
  709. endif
  710. if with_platform_haiku
  711. pre_args += '-DHAVE_HAIKU_PLATFORM'
  712. endif
  713. if meson.version().version_compare('>=0.50')
  714. prog_python = import('python').find_installation('python3')
  715. else
  716. prog_python = import('python3').find_python()
  717. endif
  718. has_mako = run_command(
  719. prog_python, '-c',
  720. '''
  721. from distutils.version import StrictVersion
  722. import mako
  723. assert StrictVersion(mako.__version__) > StrictVersion("0.8.0")
  724. ''')
  725. if has_mako.returncode() != 0
  726. error('Python (3.x) mako module >= 0.8.0 required to build mesa.')
  727. endif
  728. if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
  729. error('When using GCC, version 4.4.6 or later is required.')
  730. endif
  731. # Support systems without ETIME (e.g. FreeBSD)
  732. if cc.get_define('ETIME', prefix : '#include <errno.h>') == ''
  733. pre_args += '-DETIME=ETIMEDOUT'
  734. endif
  735. # Define DEBUG for debug builds only (debugoptimized is not included on this one)
  736. if get_option('buildtype') == 'debug'
  737. pre_args += '-DDEBUG'
  738. endif
  739. with_shader_cache = false
  740. _shader_cache = get_option('shader-cache')
  741. if _shader_cache != 'false'
  742. if host_machine.system() == 'windows'
  743. if _shader_cache == 'true'
  744. error('Shader Cache does not currently work on Windows')
  745. endif
  746. else
  747. pre_args += '-DENABLE_SHADER_CACHE'
  748. with_shader_cache = true
  749. endif
  750. endif
  751. if with_amd_vk and not with_shader_cache
  752. error('Radv requires shader cache support')
  753. endif
  754. # Check for GCC style builtins
  755. foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
  756. 'ffsll', 'popcount', 'popcountll', 'unreachable']
  757. if cc.has_function(b)
  758. pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
  759. endif
  760. endforeach
  761. # check for GCC __attribute__
  762. foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
  763. 'warn_unused_result', 'weak',]
  764. if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
  765. name : '__attribute__((@0@))'.format(a))
  766. pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper())
  767. endif
  768. endforeach
  769. if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
  770. name : '__attribute__((format(...)))')
  771. pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
  772. endif
  773. if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
  774. name : '__attribute__((packed))')
  775. pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
  776. endif
  777. if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
  778. name : '__attribute__((returns_nonnull))')
  779. pre_args += '-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL'
  780. endif
  781. if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
  782. int foo_hid(void) __attribute__((visibility("hidden")));
  783. int foo_int(void) __attribute__((visibility("internal")));
  784. int foo_pro(void) __attribute__((visibility("protected")));''',
  785. name : '__attribute__((visibility(...)))')
  786. pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY'
  787. endif
  788. if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
  789. name : '__attribute__((alias(...)))')
  790. pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
  791. endif
  792. if cc.compiles('int foo(void) __attribute__((__noreturn__));',
  793. name : '__attribute__((__noreturn__))')
  794. pre_args += '-DHAVE_FUNC_ATTRIBUTE_NORETURN'
  795. endif
  796. if cc.compiles('__uint128_t foo(void) { return 0; }',
  797. name : '__uint128_t')
  798. pre_args += '-DHAVE_UINT128'
  799. endif
  800. # TODO: this is very incomplete
  801. if ['linux', 'cygwin', 'gnu', 'gnu/kfreebsd'].contains(host_machine.system())
  802. pre_args += '-D_GNU_SOURCE'
  803. endif
  804. # Check for generic C arguments
  805. c_args = []
  806. foreach a : ['-Werror=implicit-function-declaration',
  807. '-Werror=missing-prototypes', '-Werror=return-type',
  808. '-Werror=incompatible-pointer-types',
  809. '-Werror=format',
  810. '-Wformat-security',
  811. '-fno-math-errno',
  812. '-fno-trapping-math', '-Qunused-arguments']
  813. if cc.has_argument(a)
  814. c_args += a
  815. endif
  816. endforeach
  817. foreach a : ['missing-field-initializers', 'format-truncation']
  818. if cc.has_argument('-W' + a)
  819. c_args += '-Wno-' + a
  820. endif
  821. endforeach
  822. c_vis_args = []
  823. if cc.has_argument('-fvisibility=hidden')
  824. c_vis_args += '-fvisibility=hidden'
  825. endif
  826. # Check for generic C++ arguments
  827. cpp_args = []
  828. foreach a : ['-Werror=return-type',
  829. '-Werror=format',
  830. '-Wformat-security',
  831. '-fno-math-errno', '-fno-trapping-math',
  832. '-Qunused-arguments']
  833. if cpp.has_argument(a)
  834. cpp_args += a
  835. endif
  836. endforeach
  837. # For some reason, the test for -Wno-foo always succeeds with gcc, even if the
  838. # option is not supported. Hence, check for -Wfoo instead.
  839. foreach a : ['non-virtual-dtor', 'missing-field-initializers', 'format-truncation']
  840. if cpp.has_argument('-W' + a)
  841. cpp_args += '-Wno-' + a
  842. endif
  843. endforeach
  844. no_override_init_args = []
  845. foreach a : ['override-init', 'initializer-overrides']
  846. if cc.has_argument('-W' + a)
  847. no_override_init_args += '-Wno-' + a
  848. endif
  849. endforeach
  850. cpp_vis_args = []
  851. if cpp.has_argument('-fvisibility=hidden')
  852. cpp_vis_args += '-fvisibility=hidden'
  853. endif
  854. # Check for C and C++ arguments for MSVC2013 compatibility. These are only used
  855. # in parts of the mesa code base that need to compile with old versions of
  856. # MSVC, mainly common code
  857. c_msvc_compat_args = []
  858. cpp_msvc_compat_args = []
  859. foreach a : ['-Werror=pointer-arith', '-Werror=vla']
  860. if cc.has_argument(a)
  861. c_msvc_compat_args += a
  862. endif
  863. if cpp.has_argument(a)
  864. cpp_msvc_compat_args += a
  865. endif
  866. endforeach
  867. if host_machine.cpu_family().startswith('x86')
  868. pre_args += '-DUSE_SSE41'
  869. with_sse41 = true
  870. sse41_args = ['-msse4.1']
  871. # GCC on x86 (not x86_64) with -msse* assumes a 16 byte aligned stack, but
  872. # that's not guaranteed
  873. if host_machine.cpu_family() == 'x86'
  874. sse41_args += '-mstackrealign'
  875. endif
  876. else
  877. with_sse41 = false
  878. sse41_args = []
  879. endif
  880. # Check for GCC style atomics
  881. dep_atomic = null_dep
  882. if cc.compiles('''#include <stdint.h>
  883. int main() {
  884. struct {
  885. uint64_t *v;
  886. } x;
  887. return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
  888. (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
  889. }''',
  890. name : 'GCC atomic builtins')
  891. pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
  892. # Not all atomic calls can be turned into lock-free instructions, in which
  893. # GCC will make calls into the libatomic library. Check whether we need to
  894. # link with -latomic.
  895. #
  896. # This can happen for 64-bit atomic operations on 32-bit architectures such
  897. # as ARM.
  898. if not cc.links('''#include <stdint.h>
  899. int main() {
  900. struct {
  901. uint64_t *v;
  902. } x;
  903. return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
  904. (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
  905. }''',
  906. name : 'GCC atomic builtins required -latomic')
  907. dep_atomic = cc.find_library('atomic')
  908. endif
  909. endif
  910. if not cc.links('''#include <stdint.h>
  911. uint64_t v;
  912. int main() {
  913. return __sync_add_and_fetch(&v, (uint64_t)1);
  914. }''',
  915. dependencies : dep_atomic,
  916. name : 'GCC 64bit atomics')
  917. pre_args += '-DMISSING_64BIT_ATOMICS'
  918. endif
  919. # TODO: shared/static? Is this even worth doing?
  920. with_asm_arch = ''
  921. if host_machine.cpu_family() == 'x86'
  922. if system_has_kms_drm or host_machine.system() == 'gnu'
  923. with_asm_arch = 'x86'
  924. pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
  925. '-DUSE_SSE_ASM']
  926. if with_glx_read_only_text
  927. pre_args += ['-DGLX_X86_READONLY_TEXT']
  928. endif
  929. endif
  930. elif host_machine.cpu_family() == 'x86_64'
  931. if system_has_kms_drm
  932. with_asm_arch = 'x86_64'
  933. pre_args += ['-DUSE_X86_64_ASM']
  934. endif
  935. elif host_machine.cpu_family() == 'arm'
  936. if system_has_kms_drm
  937. with_asm_arch = 'arm'
  938. pre_args += ['-DUSE_ARM_ASM']
  939. endif
  940. elif host_machine.cpu_family() == 'aarch64'
  941. if system_has_kms_drm
  942. with_asm_arch = 'aarch64'
  943. pre_args += ['-DUSE_AARCH64_ASM']
  944. endif
  945. elif host_machine.cpu_family() == 'sparc64'
  946. if system_has_kms_drm
  947. with_asm_arch = 'sparc'
  948. pre_args += ['-DUSE_SPARC_ASM']
  949. endif
  950. elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
  951. if system_has_kms_drm
  952. with_asm_arch = 'ppc64le'
  953. pre_args += ['-DUSE_PPC64LE_ASM']
  954. endif
  955. endif
  956. # Check for standard headers and functions
  957. if cc.has_header_symbol('sys/sysmacros.h', 'major')
  958. pre_args += '-DMAJOR_IN_SYSMACROS'
  959. elif cc.has_header_symbol('sys/mkdev.h', 'major')
  960. pre_args += '-DMAJOR_IN_MKDEV'
  961. endif
  962. foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
  963. if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
  964. pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
  965. endif
  966. endforeach
  967. foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r']
  968. if cc.has_function(f)
  969. pre_args += '-DHAVE_@0@'.format(f.to_upper())
  970. endif
  971. endforeach
  972. if cc.has_header_symbol('errno.h', 'program_invocation_name',
  973. args : '-D_GNU_SOURCE')
  974. pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
  975. elif with_tools.contains('intel')
  976. error('Intel tools require the program_invocation_name variable')
  977. endif
  978. # strtod locale support
  979. if cc.links('''
  980. #define _GNU_SOURCE
  981. #include <stdlib.h>
  982. #include <locale.h>
  983. #ifdef HAVE_XLOCALE_H
  984. #include <xlocale.h>
  985. #endif
  986. int main() {
  987. locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
  988. const char *s = "1.0";
  989. char *end;
  990. double d = strtod_l(s, end, loc);
  991. float f = strtof_l(s, end, loc);
  992. freelocale(loc);
  993. return 0;
  994. }''',
  995. args : pre_args,
  996. name : 'strtod has locale support')
  997. pre_args += '-DHAVE_STRTOD_L'
  998. endif
  999. # Check for some linker flags
  1000. ld_args_bsymbolic = []
  1001. if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 'Bsymbolic')
  1002. ld_args_bsymbolic += '-Wl,-Bsymbolic'
  1003. endif
  1004. ld_args_gc_sections = []
  1005. if cc.links('static char unused() { return 5; } int main() { return 0; }',
  1006. args : '-Wl,--gc-sections', name : 'gc-sections')
  1007. ld_args_gc_sections += '-Wl,--gc-sections'
  1008. endif
  1009. with_ld_version_script = false
  1010. if cc.links('int main() { return 0; }',
  1011. args : '-Wl,--version-script=@0@'.format(
  1012. join_paths(meson.source_root(), 'build-support/conftest.map')),
  1013. name : 'version-script')
  1014. with_ld_version_script = true
  1015. endif
  1016. with_ld_dynamic_list = false
  1017. if cc.links('int main() { return 0; }',
  1018. args : '-Wl,--dynamic-list=@0@'.format(
  1019. join_paths(meson.source_root(), 'build-support/conftest.dyn')),
  1020. name : 'dynamic-list')
  1021. with_ld_dynamic_list = true
  1022. endif
  1023. ld_args_build_id = []
  1024. if build_machine.system() != 'darwin'
  1025. ld_args_build_id += '-Wl,--build-id=sha1'
  1026. endif
  1027. # check for dl support
  1028. dep_dl = null_dep
  1029. if host_machine.system() != 'windows'
  1030. if not cc.has_function('dlopen')
  1031. dep_dl = cc.find_library('dl')
  1032. endif
  1033. if cc.has_function('dladdr', dependencies : dep_dl)
  1034. # This is really only required for megadrivers
  1035. pre_args += '-DHAVE_DLADDR'
  1036. endif
  1037. endif
  1038. if cc.has_function('dl_iterate_phdr')
  1039. pre_args += '-DHAVE_DL_ITERATE_PHDR'
  1040. elif with_intel_vk
  1041. error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function')
  1042. elif with_dri_i965 and with_shader_cache
  1043. error('Intel i965 GL driver requires dl_iterate_phdr when built with shader caching.')
  1044. endif
  1045. # Determine whether or not the rt library is needed for time functions
  1046. if cc.has_function('clock_gettime')
  1047. dep_clock = null_dep
  1048. else
  1049. dep_clock = cc.find_library('rt')
  1050. endif
  1051. # TODO: some of these may be conditional
  1052. dep_zlib = dependency('zlib', version : '>= 1.2.3', fallback : ['zlib', 'zlib_dep'])
  1053. pre_args += '-DHAVE_ZLIB'
  1054. dep_thread = dependency('threads')
  1055. if dep_thread.found() and host_machine.system() != 'windows'
  1056. pre_args += '-DHAVE_PTHREAD'
  1057. if cc.has_function(
  1058. 'pthread_setaffinity_np',
  1059. dependencies : dep_thread,
  1060. prefix : '#include <pthread.h>',
  1061. args : '-D_GNU_SOURCE')
  1062. pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
  1063. endif
  1064. if cc.has_function(
  1065. 'pthread_setaffinity_np',
  1066. dependencies : dep_thread,
  1067. prefix : '#include <pthread_np.h>')
  1068. pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
  1069. endif
  1070. endif
  1071. dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'])
  1072. # this only exists on linux so either this is linux and it will be found, or
  1073. # it's not linux and wont
  1074. dep_m = cc.find_library('m', required : false)
  1075. # Check for libdrm. Various drivers have different libdrm version requirements,
  1076. # but we always want to use the same version for all libdrm modules. That means
  1077. # even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
  1078. # bar are both on use 2.4.3 for both of them
  1079. dep_libdrm_amdgpu = null_dep
  1080. dep_libdrm_radeon = null_dep
  1081. dep_libdrm_nouveau = null_dep
  1082. dep_libdrm_intel = null_dep
  1083. _drm_amdgpu_ver = '2.4.99'
  1084. _drm_radeon_ver = '2.4.71'
  1085. _drm_nouveau_ver = '2.4.66'
  1086. _drm_intel_ver = '2.4.75'
  1087. _drm_ver = '2.4.81'
  1088. _libdrm_checks = [
  1089. ['intel', with_dri_i915 or with_gallium_i915],
  1090. ['amdgpu', with_amd_vk or with_gallium_radeonsi],
  1091. ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
  1092. with_gallium_r300 or with_gallium_r600)],
  1093. ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
  1094. ]
  1095. # VC4 only needs core libdrm support of this version, not a libdrm_vc4
  1096. # library.
  1097. if with_gallium_vc4
  1098. _drm_ver = '2.4.89'
  1099. endif
  1100. # etnaviv only needs core libdrm
  1101. if with_gallium_etnaviv
  1102. _drm_ver = '2.4.89'
  1103. endif
  1104. # Loop over the enables versions and get the highest libdrm requirement for all
  1105. # active drivers.
  1106. _drm_blame = ''
  1107. foreach d : _libdrm_checks
  1108. ver = get_variable('_drm_@0@_ver'.format(d[0]))
  1109. if d[1] and ver.version_compare('>' + _drm_ver)
  1110. _drm_ver = ver
  1111. _drm_blame = d[0]
  1112. endif
  1113. endforeach
  1114. if _drm_blame != ''
  1115. message('libdrm @0@ needed because @1@ has the highest requirement'.format(_drm_ver, _drm_blame))
  1116. endif
  1117. # Then get each libdrm module
  1118. foreach d : _libdrm_checks
  1119. if d[1]
  1120. set_variable(
  1121. 'dep_libdrm_' + d[0],
  1122. dependency('libdrm_' + d[0], version : '>=' + _drm_ver)
  1123. )
  1124. endif
  1125. endforeach
  1126. with_gallium_drisw_kms = false
  1127. dep_libdrm = dependency(
  1128. 'libdrm', version : '>=' + _drm_ver,
  1129. required : with_dri2 or with_dri3
  1130. )
  1131. if dep_libdrm.found()
  1132. pre_args += '-DHAVE_LIBDRM'
  1133. if with_dri_platform == 'drm' and with_dri
  1134. with_gallium_drisw_kms = true
  1135. endif
  1136. endif
  1137. llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
  1138. llvm_optional_modules = []
  1139. if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
  1140. llvm_modules += ['amdgpu', 'native', 'bitreader', 'ipo']
  1141. if with_gallium_r600
  1142. llvm_modules += 'asmparser'
  1143. endif
  1144. endif
  1145. if with_gallium_opencl
  1146. llvm_modules += [
  1147. 'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
  1148. 'lto', 'option', 'objcarcopts', 'profiledata',
  1149. ]
  1150. endif
  1151. if with_gallium_opencl or with_gallium_softpipe
  1152. llvm_optional_modules += ['coroutines']
  1153. endif
  1154. if with_amd_vk or with_gallium_radeonsi
  1155. _llvm_version = '>= 8.0.0'
  1156. elif with_gallium_swr
  1157. _llvm_version = '>= 6.0.0'
  1158. else
  1159. _llvm_version = '>= 3.9.0'
  1160. endif
  1161. _shared_llvm = get_option('shared-llvm')
  1162. _llvm = get_option('llvm')
  1163. dep_llvm = null_dep
  1164. with_llvm = false
  1165. if _llvm != 'false'
  1166. dep_llvm = dependency(
  1167. 'llvm',
  1168. version : _llvm_version,
  1169. modules : llvm_modules,
  1170. optional_modules : llvm_optional_modules,
  1171. required : (
  1172. with_amd_vk or with_gallium_radeonsi or with_gallium_swr or
  1173. with_gallium_opencl or _llvm == 'true'
  1174. ),
  1175. static : not _shared_llvm,
  1176. method : 'config-tool',
  1177. )
  1178. with_llvm = dep_llvm.found()
  1179. endif
  1180. if with_llvm
  1181. pre_args += '-DLLVM_AVAILABLE'
  1182. pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
  1183. # LLVM can be built without rtti, turning off rtti changes the ABI of C++
  1184. # programs, so we need to build all C++ code in mesa without rtti as well to
  1185. # ensure that linking works.
  1186. if dep_llvm.get_configtool_variable('has-rtti') == 'NO'
  1187. if with_gallium_nouveau
  1188. error('The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI.')
  1189. elif with_gallium_opencl
  1190. error('The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI.')
  1191. endif
  1192. cpp_args += '-fno-rtti'
  1193. endif
  1194. elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr
  1195. error('The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.')
  1196. elif with_gallium_opencl
  1197. error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
  1198. endif
  1199. if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
  1200. (with_gallium_r600 and with_llvm))
  1201. dep_elf = dependency('libelf', required : false)
  1202. if not dep_elf.found()
  1203. dep_elf = cc.find_library('elf')
  1204. endif
  1205. else
  1206. dep_elf = null_dep
  1207. endif
  1208. dep_glvnd = null_dep
  1209. if with_glvnd
  1210. dep_glvnd = dependency('libglvnd', version : '>= 0.2.0')
  1211. pre_args += '-DUSE_LIBGLVND=1'
  1212. endif
  1213. if with_valgrind != 'false'
  1214. dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
  1215. if dep_valgrind.found()
  1216. pre_args += '-DHAVE_VALGRIND'
  1217. endif
  1218. else
  1219. dep_valgrind = null_dep
  1220. endif
  1221. # pthread stubs. Lets not and say we didn't
  1222. prog_bison = find_program('bison', required : with_any_opengl)
  1223. prog_flex = find_program('flex', required : with_any_opengl)
  1224. dep_selinux = null_dep
  1225. if get_option('selinux')
  1226. dep_selinux = dependency('libselinux')
  1227. pre_args += '-DMESA_SELINUX'
  1228. endif
  1229. if with_libunwind != 'false'
  1230. dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
  1231. if dep_unwind.found()
  1232. pre_args += '-DHAVE_LIBUNWIND'
  1233. endif
  1234. else
  1235. dep_unwind = null_dep
  1236. endif
  1237. if with_osmesa != 'none'
  1238. if with_osmesa == 'gallium' and not with_gallium_softpipe
  1239. error('OSMesa gallium requires gallium softpipe or llvmpipe.')
  1240. endif
  1241. osmesa_lib_name = 'OSMesa'
  1242. osmesa_bits = get_option('osmesa-bits')
  1243. if osmesa_bits != '8'
  1244. if with_dri or with_glx != 'disabled'
  1245. error('OSMesa bits must be 8 if building glx or dir based drivers')
  1246. endif
  1247. osmesa_lib_name = osmesa_lib_name + osmesa_bits
  1248. pre_args += [
  1249. '-DCHAN_BITS=@0@'.format(osmesa_bits), '-DDEFAULT_SOFTWARE_DEPTH_BITS=31'
  1250. ]
  1251. endif
  1252. endif
  1253. # TODO: symbol mangling
  1254. if with_platform_wayland
  1255. dep_wl_scanner = dependency('wayland-scanner', native: true)
  1256. prog_wl_scanner = find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
  1257. if dep_wl_scanner.version().version_compare('>= 1.15')
  1258. wl_scanner_arg = 'private-code'
  1259. else
  1260. wl_scanner_arg = 'code'
  1261. endif
  1262. dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
  1263. dep_wayland_client = dependency('wayland-client', version : '>=1.11')
  1264. dep_wayland_server = dependency('wayland-server', version : '>=1.11')
  1265. if with_egl
  1266. dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
  1267. dep_wayland_egl_headers = declare_dependency(
  1268. compile_args : run_command(prog_pkgconfig, ['wayland-egl-backend', '--cflags']).stdout().split())
  1269. endif
  1270. wayland_dmabuf_xml = join_paths(
  1271. dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
  1272. 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
  1273. )
  1274. pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
  1275. endif
  1276. dep_x11 = null_dep
  1277. dep_xext = null_dep
  1278. dep_xdamage = null_dep
  1279. dep_xfixes = null_dep
  1280. dep_x11_xcb = null_dep
  1281. dep_xcb = null_dep
  1282. dep_xcb_glx = null_dep
  1283. dep_xcb_dri2 = null_dep
  1284. dep_xcb_dri3 = null_dep
  1285. dep_dri2proto = null_dep
  1286. dep_glproto = null_dep
  1287. dep_xxf86vm = null_dep
  1288. dep_xcb_dri3 = null_dep
  1289. dep_xcb_present = null_dep
  1290. dep_xcb_sync = null_dep
  1291. dep_xcb_xfixes = null_dep
  1292. dep_xshmfence = null_dep
  1293. dep_xcb_xrandr = null_dep
  1294. dep_xlib_xrandr = null_dep
  1295. if with_platform_x11
  1296. if with_glx == 'xlib' or with_glx == 'gallium-xlib'
  1297. dep_x11 = dependency('x11')
  1298. dep_xext = dependency('xext')
  1299. dep_xcb = dependency('xcb')
  1300. elif with_glx == 'dri'
  1301. dep_x11 = dependency('x11')
  1302. dep_xext = dependency('xext')
  1303. dep_xdamage = dependency('xdamage', version : '>= 1.1')
  1304. dep_xfixes = dependency('xfixes')
  1305. dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
  1306. endif
  1307. if (with_any_vk or with_glx == 'dri' or with_egl or
  1308. (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
  1309. with_gallium_omx != 'disabled'))
  1310. dep_xcb = dependency('xcb')
  1311. dep_x11_xcb = dependency('x11-xcb')
  1312. endif
  1313. if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
  1314. dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
  1315. if with_dri3
  1316. pre_args += '-DHAVE_DRI3'
  1317. dep_xcb_dri3 = dependency('xcb-dri3')
  1318. dep_xcb_present = dependency('xcb-present')
  1319. # until xcb-dri3 has been around long enough to make a hard-dependency:
  1320. if (dep_xcb_dri3.version().version_compare('>= 1.13') and
  1321. dep_xcb_present.version().version_compare('>= 1.13'))
  1322. pre_args += '-DHAVE_DRI3_MODIFIERS'
  1323. endif
  1324. dep_xcb_sync = dependency('xcb-sync')
  1325. dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
  1326. endif
  1327. endif
  1328. if with_glx == 'dri' or with_glx == 'gallium-xlib'
  1329. dep_glproto = dependency('glproto', version : '>= 1.4.14')
  1330. endif
  1331. if with_glx == 'dri'
  1332. if with_dri_platform == 'drm'
  1333. dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
  1334. dep_xxf86vm = dependency('xxf86vm')
  1335. endif
  1336. endif
  1337. if (with_egl or (
  1338. with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
  1339. with_gallium_omx != 'disabled'))
  1340. dep_xcb_xfixes = dependency('xcb-xfixes')
  1341. endif
  1342. if with_xlib_lease
  1343. dep_xcb_xrandr = dependency('xcb-randr')
  1344. dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
  1345. endif
  1346. endif
  1347. if get_option('gallium-extra-hud')
  1348. pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
  1349. endif
  1350. _sensors = get_option('lmsensors')
  1351. if _sensors != 'false'
  1352. dep_lmsensors = cc.find_library('sensors', required : _sensors == 'true')
  1353. if dep_lmsensors.found()
  1354. pre_args += '-DHAVE_LIBSENSORS=1'
  1355. endif
  1356. else
  1357. dep_lmsensors = null_dep
  1358. endif
  1359. foreach a : pre_args
  1360. add_project_arguments(a, language : ['c', 'cpp'])
  1361. endforeach
  1362. foreach a : c_args
  1363. add_project_arguments(a, language : ['c'])
  1364. endforeach
  1365. foreach a : cpp_args
  1366. add_project_arguments(a, language : ['cpp'])
  1367. endforeach
  1368. gl_priv_reqs = []
  1369. if with_glx == 'xlib' or with_glx == 'gallium-xlib'
  1370. gl_priv_reqs += ['x11', 'xext', 'xcb']
  1371. elif with_glx == 'dri'
  1372. gl_priv_reqs += [
  1373. 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
  1374. 'xcb-glx >= 1.8.1']
  1375. if with_dri_platform == 'drm'
  1376. gl_priv_reqs += 'xcb-dri2 >= 1.8'
  1377. gl_priv_reqs += 'xxf86vm'
  1378. endif
  1379. endif
  1380. if dep_libdrm.found()
  1381. gl_priv_reqs += 'libdrm >= 2.4.75'
  1382. endif
  1383. gl_priv_libs = []
  1384. if dep_thread.found()
  1385. gl_priv_libs += ['-lpthread', '-pthread']
  1386. endif
  1387. if dep_m.found()
  1388. gl_priv_libs += '-lm'
  1389. endif
  1390. if dep_dl.found()
  1391. gl_priv_libs += '-ldl'
  1392. endif
  1393. pkg = import('pkgconfig')
  1394. prog_nm = find_program('nm', required : false)
  1395. # This quirk needs to be applied to sources with functions defined in assembly
  1396. # as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
  1397. gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
  1398. subdir('include')
  1399. subdir('bin')
  1400. subdir('src')
  1401. # Meson 0.49 and earlier seems to have a bug that fails to evaluate the string-
  1402. # formatting below unless the first argument is passed as a variable. This has
  1403. # been fixed in Meson 0.50 and beyond, but we need to keep it like this for now
  1404. # for backwards compatibility.
  1405. _with_opengl_string = with_opengl ? 'yes' : 'no'
  1406. lines = ['',
  1407. 'prefix: ' + get_option('prefix'),
  1408. 'libdir: ' + get_option('libdir'),
  1409. 'includedir: ' + get_option('includedir'),
  1410. '',
  1411. 'OpenGL: @0@ (ES1: @1@ ES2: @2@)'.format(_with_opengl_string,
  1412. with_gles1 ? 'yes' : 'no',
  1413. with_gles2 ? 'yes' : 'no'),
  1414. ]
  1415. if with_osmesa != 'none'
  1416. lines += ''
  1417. suffix = ''
  1418. if with_osmesa == 'gallium'
  1419. suffix = '(Gallium)'
  1420. endif
  1421. lines += 'OSMesa: lib' + osmesa_lib_name + suffix
  1422. else
  1423. lines += 'OSMesa: no'
  1424. endif
  1425. if with_dri
  1426. lines += ''
  1427. lines += 'DRI platform: ' + with_dri_platform
  1428. if dri_drivers.length() != 0 and dri_drivers != ['']
  1429. lines += 'DRI drivers: ' + ' '.join(dri_drivers)
  1430. else
  1431. lines += 'DRI drivers: no'
  1432. endif
  1433. lines += 'DRI driver dir: ' + dri_drivers_path
  1434. endif
  1435. if with_glx != 'disabled'
  1436. lines += ''
  1437. if with_glx == 'dri'
  1438. lines += 'GLX: DRI-based'
  1439. elif with_glx == 'xlib'
  1440. lines += 'GLX: Xlib-based'
  1441. elif with_glx == 'gallium-xlib'
  1442. lines += 'GLX: Xlib-based (Gallium)'
  1443. else
  1444. lines += 'GLX: ' + with_glx
  1445. endif
  1446. endif
  1447. lines += ''
  1448. lines += 'EGL: ' + (with_egl ? 'yes' : 'no')
  1449. if with_egl
  1450. egl_drivers = []
  1451. if with_dri
  1452. egl_drivers += 'builtin:egl_dri2'
  1453. endif
  1454. if with_dri3
  1455. egl_drivers += 'builtin:egl_dri3'
  1456. endif
  1457. lines += 'EGL drivers: ' + ' '.join(egl_drivers)
  1458. endif
  1459. lines += 'GBM: ' + (with_gbm ? 'yes' : 'no')
  1460. if with_platforms
  1461. lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms)
  1462. endif
  1463. lines += ''
  1464. if with_any_vk
  1465. lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers)
  1466. lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir
  1467. else
  1468. lines += 'Vulkan drivers: no'
  1469. endif
  1470. lines += ''
  1471. if with_llvm
  1472. lines += 'llvm: yes'
  1473. lines += 'llvm-version: ' + dep_llvm.version()
  1474. else
  1475. lines += 'llvm: no'
  1476. endif
  1477. lines += ''
  1478. if with_gallium
  1479. lines += 'Gallium drivers: ' + ' '.join(gallium_drivers)
  1480. gallium_st = ['mesa']
  1481. if with_gallium_xa
  1482. gallium_st += 'xa'
  1483. endif
  1484. if with_gallium_xvmc
  1485. gallium_st += 'xvmc'
  1486. endif
  1487. if with_gallium_xvmc
  1488. gallium_st += 'xvmc'
  1489. endif
  1490. if with_gallium_vdpau
  1491. gallium_st += 'vdpau'
  1492. endif
  1493. if with_gallium_omx != 'disabled'
  1494. gallium_st += 'omx' + with_gallium_omx
  1495. endif
  1496. if with_gallium_va
  1497. gallium_st += 'va'
  1498. endif
  1499. if with_gallium_st_nine
  1500. gallium_st += 'nine'
  1501. endif
  1502. if with_gallium_opencl
  1503. gallium_st += 'clover'
  1504. endif
  1505. lines += 'Gallium st: ' + ' '.join(gallium_st)
  1506. else
  1507. lines += 'Gallium: no'
  1508. endif
  1509. lines += 'HUD lmsensors: ' + (dep_lmsensors.found() ? 'yes' : 'no')
  1510. lines += ''
  1511. lines += 'Shared-glapi: ' + (with_shared_glapi ? 'yes' : 'no')
  1512. indent = ' '
  1513. summary = indent + ('\n' + indent).join(lines)
  1514. message('Configuration summary:\n@0@\n'.format(summary))