meson: add sparse support
[qemu/ar7.git] / meson.build
blob86219e500ac50cf36710efbdcef60d928df22945
1 project('qemu', ['c'], meson_version: '>=0.55.0',
2         default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_lundef=false'],
3         version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5 not_found = dependency('', required: false)
6 keyval = import('unstable-keyval')
7 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
9 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
10                       native: false, language: ['c', 'objc'])
11 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
12                       native: false, language: 'cpp')
13 add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
14                            native: false, language: ['c', 'cpp', 'objc'])
15 add_project_arguments(config_host['QEMU_INCLUDES'].split(),
16                       language: ['c', 'cpp', 'objc'])
18 python = import('python').find_installation()
20 link_language = meson.get_external_property('link_language', 'cpp')
21 if link_language == 'cpp'
22   add_languages('cpp', required: true, native: false)
23 endif
24 if host_machine.system() == 'darwin'
25   add_languages('objc', required: false, native: false)
26 endif
28 if 'SPARSE_CFLAGS' in config_host
29   run_target('sparse',
30              command: [find_program('scripts/check_sparse.py'),
31                        config_host['SPARSE_CFLAGS'].split(),
32                        'compile_commands.json'])
33 endif
35 configure_file(input: files('scripts/ninjatool.py'),
36                output: 'ninjatool',
37                configuration: config_host)
39 supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
40 supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
41   'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
43 cpu = host_machine.cpu_family()
44 targetos = host_machine.system()
46 summary_info = {}
47 summary_info += {'Install prefix':    config_host['prefix']}
48 summary_info += {'BIOS directory':    config_host['qemu_datadir']}
49 summary_info += {'firmware path':     config_host['qemu_firmwarepath']}
50 summary_info += {'binary directory':  config_host['bindir']}
51 summary_info += {'library directory': config_host['libdir']}
52 summary_info += {'module directory':  config_host['qemu_moddir']}
53 summary_info += {'libexec directory': config_host['libexecdir']}
54 summary_info += {'include directory': config_host['includedir']}
55 summary_info += {'config directory':  config_host['sysconfdir']}
56 if targetos != 'windows'
57   summary_info += {'local state directory': config_host['qemu_localstatedir']}
58   summary_info += {'Manual directory':      config_host['mandir']}
59 else
60   summary_info += {'local state directory': 'queried at runtime'}
61 endif
62 summary_info += {'Build directory':   meson.current_build_dir()}
63 summary_info += {'Source path':       meson.current_source_dir()}
64 summary_info += {'GIT binary':        config_host['GIT']}
65 summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
66 summary_info += {'C compiler':        meson.get_compiler('c').cmd_array()[0]}
67 summary_info += {'Host C compiler':   meson.get_compiler('c', native: true).cmd_array()[0]}
68 if link_language == 'cpp'
69   summary_info += {'C++ compiler':      meson.get_compiler('cpp').cmd_array()[0]}
70 else
71   summary_info += {'C++ compiler':      false}
72 endif
73 if targetos == 'darwin'
74   summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
75 endif
76 summary_info += {'ARFLAGS':           config_host['ARFLAGS']}
77 summary_info += {'CFLAGS':            config_host['CFLAGS']}
78 summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
79 summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
80 summary_info += {'make':              config_host['MAKE']}
81 summary_info += {'install':           config_host['INSTALL']}
82 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
83 summary_info += {'sphinx-build':      config_host['SPHINX_BUILD']}
84 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
85 # TODO: add back version
86 summary_info += {'slirp support':     config_host.has_key('CONFIG_SLIRP')}
87 if config_host.has_key('CONFIG_SLIRP')
88   summary_info += {'smbd':            config_host['CONFIG_SMBD_COMMAND']}
89 endif
90 summary_info += {'module support':    config_host.has_key('CONFIG_MODULES')}
91 if config_host.has_key('CONFIG_MODULES')
92   summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
93 endif
94 summary_info += {'host CPU':          cpu}
95 summary_info += {'host endianness':   build_machine.endian()}
96 summary_info += {'target list':       config_host['TARGET_DIRS']}
97 summary_info += {'gprof enabled':     config_host.has_key('CONFIG_GPROF')}
98 summary_info += {'sparse enabled':    meson.get_compiler('c').cmd_array().contains('cgcc')}
99 summary_info += {'strip binaries':    get_option('strip')}
100 summary_info += {'profiler':          config_host.has_key('CONFIG_PROFILER')}
101 summary_info += {'static build':      config_host.has_key('CONFIG_TOOLS')}
102 if targetos == 'darwin'
103   summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
104 endif
105 # TODO: add back version
106 summary_info += {'SDL support':       config_host.has_key('CONFIG_SDL')}
107 summary_info += {'SDL image support': config_host.has_key('CONFIG_SDL_IMAGE')}
108 # TODO: add back version
109 summary_info += {'GTK support':       config_host.has_key('CONFIG_GTK')}
110 summary_info += {'GTK GL support':    config_host.has_key('CONFIG_GTK_GL')}
111 # TODO: add back version
112 summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
113 summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
114 summary_info += {'GNUTLS support':    config_host.has_key('CONFIG_GNUTLS')}
115 # TODO: add back version
116 summary_info += {'libgcrypt':         config_host.has_key('CONFIG_GCRYPT')}
117 if config_host.has_key('CONFIG_GCRYPT')
118    summary_info += {'  hmac':            config_host.has_key('CONFIG_GCRYPT_HMAC')}
119    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
120 endif
121 # TODO: add back version
122 summary_info += {'nettle':            config_host.has_key('CONFIG_NETTLE')}
123 if config_host.has_key('CONFIG_NETTLE')
124    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
125 endif
126 summary_info += {'libtasn1':          config_host.has_key('CONFIG_TASN1')}
127 summary_info += {'PAM':               config_host.has_key('CONFIG_AUTH_PAM')}
128 summary_info += {'iconv support':     config_host.has_key('CONFIG_ICONV')}
129 summary_info += {'curses support':    config_host.has_key('CONFIG_CURSES')}
130 # TODO: add back version
131 summary_info += {'virgl support':     config_host.has_key('CONFIG_VIRGL')}
132 summary_info += {'curl support':      config_host.has_key('CONFIG_CURL')}
133 summary_info += {'mingw32 support':   targetos == 'windows'}
134 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
135 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
136 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
137 summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
138 summary_info += {'Multipath support': config_host.has_key('CONFIG_MPATH')}
139 summary_info += {'VNC support':       config_host.has_key('CONFIG_VNC')}
140 if config_host.has_key('CONFIG_VNC')
141   summary_info += {'VNC SASL support':  config_host.has_key('CONFIG_VNC_SASL')}
142   summary_info += {'VNC JPEG support':  config_host.has_key('CONFIG_VNC_JPEG')}
143   summary_info += {'VNC PNG support':   config_host.has_key('CONFIG_VNC_PNG')}
144 endif
145 summary_info += {'xen support':       config_host.has_key('CONFIG_XEN_BACKEND')}
146 if config_host.has_key('CONFIG_XEN_BACKEND')
147   summary_info += {'xen ctrl version':  config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
148 endif
149 summary_info += {'brlapi support':    config_host.has_key('CONFIG_BRLAPI')}
150 summary_info += {'Documentation':     config_host.has_key('BUILD_DOCS')}
151 summary_info += {'PIE':               get_option('b_pie')}
152 summary_info += {'vde support':       config_host.has_key('CONFIG_VDE')}
153 summary_info += {'netmap support':    config_host.has_key('CONFIG_NETMAP')}
154 summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
155 summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
156 summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
157 summary_info += {'Install blobs':     config_host.has_key('INSTALL_BLOBS')}
158 # TODO: add back KVM/HAX/HVF/WHPX/TCG
159 #summary_info += {'KVM support':       have_kvm'}
160 #summary_info += {'HAX support':       have_hax'}
161 #summary_info += {'HVF support':       have_hvf'}
162 #summary_info += {'WHPX support':      have_whpx'}
163 #summary_info += {'TCG support':       have_tcg'}
164 #if get_option('tcg')
165 #  summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
166 #  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
167 #endif
168 summary_info += {'malloc trim support': config_host.has_key('CONFIG_MALLOC_TRIM')}
169 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
170 summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
171 summary_info += {'fdt support':       config_host.has_key('CONFIG_FDT')}
172 summary_info += {'membarrier':        config_host.has_key('CONFIG_MEMBARRIER')}
173 summary_info += {'preadv support':    config_host.has_key('CONFIG_PREADV')}
174 summary_info += {'fdatasync':         config_host.has_key('CONFIG_FDATASYNC')}
175 summary_info += {'madvise':           config_host.has_key('CONFIG_MADVISE')}
176 summary_info += {'posix_madvise':     config_host.has_key('CONFIG_POSIX_MADVISE')}
177 summary_info += {'posix_memalign':    config_host.has_key('CONFIG_POSIX_MEMALIGN')}
178 summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
179 summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
180 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
181 summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
182 summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
183 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
184 summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
185 summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
186 summary_info += {'Trace backends':    config_host['TRACE_BACKENDS']}
187 if config_host['TRACE_BACKENDS'].split().contains('simple')
188   summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
189 endif
190 # TODO: add back protocol and server version
191 summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
192 summary_info += {'rbd support':       config_host.has_key('CONFIG_RBD')}
193 summary_info += {'xfsctl support':    config_host.has_key('CONFIG_XFS')}
194 summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
195 summary_info += {'libusb':            config_host.has_key('CONFIG_USB_LIBUSB')}
196 summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
197 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
198 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
199 summary_info += {'libiscsi support':  config_host.has_key('CONFIG_LIBISCSI')}
200 summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
201 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
202 if targetos == 'windows'
203   if 'WIN_SDK' in config_host
204     summary_info += {'Windows SDK':       config_host['WIN_SDK']}
205   endif
206   summary_info += {'QGA VSS support':   config_host.has_key('CONFIG_QGA_VSS')}
207   summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
208   summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI_ENABLED')}
209 endif
210 summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
211 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
212 summary_info += {'coroutine pool':    config_host['CONFIG_COROUTINE_POOL'] == '1'}
213 summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
214 summary_info += {'mutex debugging':   config_host.has_key('CONFIG_DEBUG_MUTEX')}
215 summary_info += {'crypto afalg':      config_host.has_key('CONFIG_AF_ALG')}
216 summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
217 summary_info += {'gcov':              get_option('b_coverage')}
218 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
219 summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
220 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
221 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
222 summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
223 summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
224 summary_info += {'bzip2 support':     config_host.has_key('CONFIG_BZIP2')}
225 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
226 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
227 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
228 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
229 summary_info += {'tcmalloc support':  config_host.has_key('CONFIG_TCMALLOC')}
230 summary_info += {'jemalloc support':  config_host.has_key('CONFIG_JEMALLOC')}
231 summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
232 summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
233 summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
234 summary_info += {'bochs support':     config_host.has_key('CONFIG_BOCHS')}
235 summary_info += {'cloop support':     config_host.has_key('CONFIG_CLOOP')}
236 summary_info += {'dmg support':       config_host.has_key('CONFIG_DMG')}
237 summary_info += {'qcow v1 support':   config_host.has_key('CONFIG_QCOW1')}
238 summary_info += {'vdi support':       config_host.has_key('CONFIG_VDI')}
239 summary_info += {'vvfat support':     config_host.has_key('CONFIG_VVFAT')}
240 summary_info += {'qed support':       config_host.has_key('CONFIG_QED')}
241 summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
242 summary_info += {'sheepdog support':  config_host.has_key('CONFIG_SHEEPDOG')}
243 summary_info += {'capstone':          config_host.has_key('CONFIG_CAPSTONE')}
244 summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
245 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
246 summary_info += {'libudev':           config_host.has_key('CONFIG_LIBUDEV')}
247 summary_info += {'default devices':   config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
248 summary_info += {'plugin support':    config_host.has_key('CONFIG_PLUGIN')}
249 summary_info += {'fuzzing support':   config_host.has_key('CONFIG_FUZZ')}
250 if config_host.has_key('HAVE_GDB_BIN')
251   summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
252 endif
253 summary_info += {'thread sanitizer':  config_host.has_key('CONFIG_TSAN')}
254 summary_info += {'rng-none':          config_host.has_key('CONFIG_RNG_NONE')}
255 summary_info += {'Linux keyring':     config_host.has_key('CONFIG_SECRET_KEYRING')}
256 summary(summary_info, bool_yn: true)
258 if not supported_cpus.contains(cpu)
259   message()
260   warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
261   message()
262   message('CPU host architecture ' + cpu + ' support is not currently maintained.')
263   message('The QEMU project intends to remove support for this host CPU in')
264   message('a future release if nobody volunteers to maintain it and to')
265   message('provide a build host for our continuous integration setup.')
266   message('configure has succeeded and you can continue to build, but')
267   message('if you care about QEMU on this platform you should contact')
268   message('us upstream at qemu-devel@nongnu.org.')
269 endif
271 if not supported_oses.contains(targetos)
272   message()
273   warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
274   message()
275   message('Host OS ' + targetos + 'support is not currently maintained.')
276   message('The QEMU project intends to remove support for this host OS in')
277   message('a future release if nobody volunteers to maintain it and to')
278   message('provide a build host for our continuous integration setup.')
279   message('configure has succeeded and you can continue to build, but')
280   message('if you care about QEMU on this platform you should contact')
281   message('us upstream at qemu-devel@nongnu.org.')
282 endif