@@ -111,6 +111,22 @@ foreach target : edk2_targets
111
111
endif
112
112
endforeach
113
113
114
+ dtrace = not_found
115
+ stap = not_found
116
+ if ' dtrace' in get_option (' trace_backends' )
117
+ dtrace = find_program (' dtrace' , required : true )
118
+ stap = find_program (' stap' , required : false )
119
+ if stap.found()
120
+ # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol
121
+ # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility
122
+ # instead. QEMU --enable-modules depends on this because the SystemTap
123
+ # semaphores are linked into the main binary and not the module's shared
124
+ # object.
125
+ add_global_arguments (' -DSTAP_SDT_V2' ,
126
+ native : false , language : [' c' , ' cpp' , ' objc' ])
127
+ endif
128
+ endif
129
+
114
130
##################
115
131
# Compiler flags #
116
132
##################
@@ -201,6 +217,19 @@ if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
201
217
error (' Your compiler does not support -fsanitize=fuzzer' )
202
218
endif
203
219
220
+ if ' ftrace' in get_option (' trace_backends' ) and targetos != ' linux'
221
+ error (' ftrace is supported only on Linux' )
222
+ endif
223
+ if ' syslog' in get_option (' trace_backends' ) and not cc.compiles('''
224
+ #include <syslog.h>
225
+ int main(void) {
226
+ openlog("qemu", LOG_PID, LOG_DAEMON);
227
+ syslog(LOG_INFO, "configure");
228
+ return 0;
229
+ }''' )
230
+ error (' syslog is not supported on this system' )
231
+ endif
232
+
204
233
if targetos != ' linux' and get_option (' mpath' ).enabled()
205
234
error (' Multipath is supported only on Linux' )
206
235
endif
@@ -359,8 +388,9 @@ if 'CONFIG_GIO' in config_host
359
388
link_args : config_host[' GIO_LIBS' ].split())
360
389
endif
361
390
lttng = not_found
362
- if ' CONFIG_TRACE_UST' in config_host
363
- lttng = declare_dependency (link_args : config_host[' LTTNG_UST_LIBS' ].split())
391
+ if ' ust' in get_option (' trace_backends' )
392
+ lttng = dependency (' lttng-ust' , required : true , method : ' pkg-config' ,
393
+ kwargs : static_kwargs)
364
394
endif
365
395
pixman = not_found
366
396
if have_system or have_tools
@@ -1347,6 +1377,11 @@ elif get_option('virtfs').disabled()
1347
1377
have_virtfs = false
1348
1378
endif
1349
1379
1380
+ foreach k : get_option (' trace_backends' )
1381
+ config_host_data.set(' CONFIG_TRACE_' + k.to_upper(), true )
1382
+ endforeach
1383
+ config_host_data.set_quoted(' CONFIG_TRACE_FILE' , get_option (' trace_file' ))
1384
+
1350
1385
config_host_data.set_quoted(' CONFIG_BINDIR' , get_option (' prefix' ) / get_option (' bindir' ))
1351
1386
config_host_data.set_quoted(' CONFIG_PREFIX' , get_option (' prefix' ))
1352
1387
config_host_data.set_quoted(' CONFIG_QEMU_CONFDIR' , get_option (' prefix' ) / qemu_confdir)
@@ -1571,7 +1606,7 @@ config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
1571
1606
1572
1607
ignored = [' CONFIG_QEMU_INTERP_PREFIX' ] # actually per-target
1573
1608
arrays = [' CONFIG_BDRV_RW_WHITELIST' , ' CONFIG_BDRV_RO_WHITELIST' ]
1574
- strings = [' HOST_DSOSUF' , ' CONFIG_IASL' , ' CONFIG_TRACE_FILE ' ]
1609
+ strings = [' HOST_DSOSUF' , ' CONFIG_IASL' ]
1575
1610
foreach k, v : config_host
1576
1611
if ignored.contains(k)
1577
1612
# do nothing
@@ -2109,7 +2144,7 @@ qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py',
2109
2144
2110
2145
tracetool = [
2111
2146
python, files (' scripts/tracetool.py' ),
2112
- ' --backend=' + config_host[ ' TRACE_BACKENDS ' ]
2147
+ ' --backend=' + ' , ' .join( get_option ( ' trace_backends ' ))
2113
2148
]
2114
2149
tracetool_depends = files (
2115
2150
' scripts/tracetool/backend/log.py' ,
@@ -2826,7 +2861,7 @@ foreach target : target_dirs
2826
2861
emulators += {exe[' name' ]: emulator}
2827
2862
endif
2828
2863
2829
- if ' CONFIG_TRACE_SYSTEMTAP ' in config_host
2864
+ if stap.found()
2830
2865
foreach stp : [
2831
2866
{' ext' : ' .stp-build' , ' fmt' : ' stap' , ' bin' : meson .current_build_dir() / exe[' name' ], ' install' : false },
2832
2867
{' ext' : ' .stp' , ' fmt' : ' stap' , ' bin' : get_option (' prefix' ) / get_option (' bindir' ) / exe[' name' ], ' install' : true },
@@ -3007,9 +3042,9 @@ summary_info += {'fuzzing support': get_option('fuzzing')}
3007
3042
if have_system
3008
3043
summary_info += {' Audio drivers' : ' ' .join(audio_drivers_selected)}
3009
3044
endif
3010
- summary_info += {' Trace backends' : config_host[ ' TRACE_BACKENDS ' ] }
3011
- if config_host[ ' TRACE_BACKENDS ' ].split().contains( ' simple ' )
3012
- summary_info += {' Trace output file' : config_host[ ' CONFIG_TRACE_FILE ' ] + ' -<pid>' }
3045
+ summary_info += {' Trace backends' : ' , ' .join( get_option ( ' trace_backends ' )) }
3046
+ if ' simple ' in get_option ( ' trace_backends ' )
3047
+ summary_info += {' Trace output file' : get_option ( ' trace_file ' ) + ' -<pid>' }
3013
3048
endif
3014
3049
summary_info += {' QOM debugging' : config_host.has_key(' CONFIG_QOM_CAST_DEBUG' )}
3015
3050
summary_info += {' vhost-kernel support' : config_host.has_key(' CONFIG_VHOST_KERNEL' )}
0 commit comments