Skip to content

Commit ff66f3e

Browse files
committed
configure, meson: move libaio check to meson.build
Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 10f6b23 commit ff66f3e

File tree

5 files changed

+18
-31
lines changed

5 files changed

+18
-31
lines changed

block/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit
6565
block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
6666
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
6767
block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
68-
block_ss.add(when: ['CONFIG_LINUX_AIO', libaio], if_true: files('linux-aio.c'))
68+
block_ss.add(when: libaio, if_true: files('linux-aio.c'))
6969
block_ss.add(when: linux_io_uring, if_true: files('io_uring.c'))
7070

7171
block_modules = {}

configure

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pa="auto"
315315
xen=${default_feature:+disabled}
316316
xen_ctrl_version="$default_feature"
317317
xen_pci_passthrough="auto"
318-
linux_aio="$default_feature"
318+
linux_aio="auto"
319319
linux_io_uring="auto"
320320
cap_ng="auto"
321321
attr="auto"
@@ -1196,9 +1196,9 @@ for opt do
11961196
;;
11971197
--enable-fdt=system) fdt="system"
11981198
;;
1199-
--disable-linux-aio) linux_aio="no"
1199+
--disable-linux-aio) linux_aio="disabled"
12001200
;;
1201-
--enable-linux-aio) linux_aio="yes"
1201+
--enable-linux-aio) linux_aio="enabled"
12021202
;;
12031203
--disable-linux-io-uring) linux_io_uring="disabled"
12041204
;;
@@ -3163,26 +3163,6 @@ if test "$libssh" != "no" ; then
31633163
fi
31643164
fi
31653165

3166-
##########################################
3167-
# linux-aio probe
3168-
3169-
if test "$linux_aio" != "no" ; then
3170-
cat > $TMPC <<EOF
3171-
#include <libaio.h>
3172-
#include <sys/eventfd.h>
3173-
#include <stddef.h>
3174-
int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3175-
EOF
3176-
if compile_prog "" "-laio" ; then
3177-
linux_aio=yes
3178-
else
3179-
if test "$linux_aio" = "yes" ; then
3180-
feature_not_found "linux AIO" "Install libaio devel"
3181-
fi
3182-
linux_aio=no
3183-
fi
3184-
fi
3185-
31863166
##########################################
31873167
# TPM emulation is only on POSIX
31883168

@@ -4272,9 +4252,6 @@ if test "$xen" = "enabled" ; then
42724252
echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
42734253
echo "XEN_LIBS=$xen_libs" >> $config_host_mak
42744254
fi
4275-
if test "$linux_aio" = "yes" ; then
4276-
echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4277-
fi
42784255
if test "$vhost_scsi" = "yes" ; then
42794256
echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
42804257
fi
@@ -4774,7 +4751,7 @@ if test "$skip_meson" = no; then
47744751
$(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
47754752
-Dalsa=$alsa -Dcoreaudio=$coreaudio -Ddsound=$dsound -Djack=$jack -Doss=$oss \
47764753
-Dpa=$pa -Daudio_drv_list=$audio_drv_list -Dtcg_interpreter=$tcg_interpreter \
4777-
-Dtrace_backends=$trace_backends -Dtrace_file=$trace_file \
4754+
-Dtrace_backends=$trace_backends -Dtrace_file=$trace_file -Dlinux_aio=$linux_aio \
47784755
$cross_arg \
47794756
"$PWD" "$source_path"
47804757

meson.build

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,14 @@ if have_system or have_tools
400400
pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
401401
method: 'pkg-config', kwargs: static_kwargs)
402402
endif
403-
libaio = cc.find_library('aio', required: false)
404403
zlib = dependency('zlib', required: true, kwargs: static_kwargs)
405404

405+
libaio = not_found
406+
if not get_option('linux_aio').auto() or have_block
407+
libaio = cc.find_library('aio', has_headers: ['libaio.h'],
408+
required: get_option('linux_aio'),
409+
kwargs: static_kwargs)
410+
endif
406411
linux_io_uring = not_found
407412
if not get_option('linux_io_uring').auto() or have_block
408413
linux_io_uring = dependency('liburing', required: get_option('linux_io_uring'),
@@ -1427,6 +1432,7 @@ config_host_data.set('CONFIG_EBPF', libbpf.found())
14271432
config_host_data.set('CONFIG_LIBDAXCTL', libdaxctl.found())
14281433
config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
14291434
config_host_data.set('CONFIG_LIBNFS', libnfs.found())
1435+
config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
14301436
config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
14311437
config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
14321438
config_host_data.set('CONFIG_RBD', rbd.found())
@@ -3286,7 +3292,7 @@ summary_info += {'JACK support': jack}
32863292
summary_info += {'brlapi support': brlapi}
32873293
summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
32883294
summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
3289-
summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
3295+
summary_info += {'Linux AIO support': libaio}
32903296
summary_info += {'Linux io_uring support': linux_io_uring}
32913297
summary_info += {'ATTR/XATTR support': libattr}
32923298
summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ option('libusb', type : 'feature', value : 'auto',
103103
description: 'libusb support for USB passthrough')
104104
option('libxml2', type : 'feature', value : 'auto',
105105
description: 'libxml2 support for Parallels image format')
106+
option('linux_aio', type : 'feature', value : 'auto',
107+
description: 'Linux AIO support')
106108
option('linux_io_uring', type : 'feature', value : 'auto',
107109
description: 'Linux io_uring support')
108110
option('lzfse', type : 'feature', value : 'auto',

stubs/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ endif
2020
stub_ss.add(files('iothread-lock.c'))
2121
stub_ss.add(files('isa-bus.c'))
2222
stub_ss.add(files('is-daemonized.c'))
23-
stub_ss.add(when: 'CONFIG_LINUX_AIO', if_true: files('linux-aio.c'))
23+
if libaio.found()
24+
stub_ss.add(files('linux-aio.c'))
25+
endif
2426
stub_ss.add(files('migr-blocker.c'))
2527
stub_ss.add(files('module-opts.c'))
2628
stub_ss.add(files('monitor.c'))

0 commit comments

Comments
 (0)