Skip to content

Commit bd87a36

Browse files
committed
configure, meson: move more compiler checks to Meson
Reviewed-by: Marc-André Lureau <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent b524e44 commit bd87a36

File tree

3 files changed

+47
-92
lines changed

3 files changed

+47
-92
lines changed

configure

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -3110,19 +3110,6 @@ elif test "$tpm" = "yes"; then
31103110
fi
31113111
fi
31123112

3113-
##########################################
3114-
# iovec probe
3115-
cat > $TMPC <<EOF
3116-
#include <sys/types.h>
3117-
#include <sys/uio.h>
3118-
#include <unistd.h>
3119-
int main(void) { return sizeof(struct iovec); }
3120-
EOF
3121-
iovec=no
3122-
if compile_prog "" "" ; then
3123-
iovec=yes
3124-
fi
3125-
31263113
##########################################
31273114
# fdt probe
31283115

@@ -3564,42 +3551,6 @@ EOF
35643551
fi
35653552
fi
35663553

3567-
#########################################
3568-
# See if 64-bit atomic operations are supported.
3569-
# Note that without __atomic builtins, we can only
3570-
# assume atomic loads/stores max at pointer size.
3571-
3572-
cat > $TMPC << EOF
3573-
#include <stdint.h>
3574-
int main(void)
3575-
{
3576-
uint64_t x = 0, y = 0;
3577-
y = __atomic_load_n(&x, __ATOMIC_RELAXED);
3578-
__atomic_store_n(&x, y, __ATOMIC_RELAXED);
3579-
__atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
3580-
__atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
3581-
__atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
3582-
return 0;
3583-
}
3584-
EOF
3585-
if compile_prog "" "" ; then
3586-
atomic64=yes
3587-
fi
3588-
3589-
########################################
3590-
# check if getauxval is available.
3591-
3592-
getauxval=no
3593-
cat > $TMPC << EOF
3594-
#include <sys/auxv.h>
3595-
int main(void) {
3596-
return getauxval(AT_HWCAP) == 0;
3597-
}
3598-
EOF
3599-
if compile_prog "" "" ; then
3600-
getauxval=yes
3601-
fi
3602-
36033554
########################################
36043555
# check if ccache is interfering with
36053556
# semantic analysis of macros
@@ -3673,33 +3624,6 @@ else
36733624
membarrier=no
36743625
fi
36753626

3676-
##########################################
3677-
# check for usable AF_VSOCK environment
3678-
have_af_vsock=no
3679-
cat > $TMPC << EOF
3680-
#include <errno.h>
3681-
#include <sys/types.h>
3682-
#include <sys/socket.h>
3683-
#if !defined(AF_VSOCK)
3684-
# error missing AF_VSOCK flag
3685-
#endif
3686-
#include <linux/vm_sockets.h>
3687-
int main(void) {
3688-
int sock, ret;
3689-
struct sockaddr_vm svm;
3690-
socklen_t len = sizeof(svm);
3691-
sock = socket(AF_VSOCK, SOCK_STREAM, 0);
3692-
ret = getpeername(sock, (struct sockaddr *)&svm, &len);
3693-
if ((ret == -1) && (errno == ENOTCONN)) {
3694-
return 0;
3695-
}
3696-
return -1;
3697-
}
3698-
EOF
3699-
if compile_prog "" "" ; then
3700-
have_af_vsock=yes
3701-
fi
3702-
37033627
##########################################
37043628
# check for usable AF_ALG environment
37053629
have_afalg=no
@@ -4175,9 +4099,6 @@ fi
41754099
if test "$vhost_user_fs" = "yes" ; then
41764100
echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
41774101
fi
4178-
if test "$iovec" = "yes" ; then
4179-
echo "CONFIG_IOVEC=y" >> $config_host_mak
4180-
fi
41814102
if test "$membarrier" = "yes" ; then
41824103
echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
41834104
fi
@@ -4247,14 +4168,6 @@ if test "$cmpxchg128" = "yes" ; then
42474168
echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
42484169
fi
42494170

4250-
if test "$atomic64" = "yes" ; then
4251-
echo "CONFIG_ATOMIC64=y" >> $config_host_mak
4252-
fi
4253-
4254-
if test "$getauxval" = "yes" ; then
4255-
echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4256-
fi
4257-
42584171
if test "$libssh" = "yes" ; then
42594172
echo "CONFIG_LIBSSH=y" >> $config_host_mak
42604173
echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
@@ -4282,10 +4195,6 @@ if test "$replication" = "yes" ; then
42824195
echo "CONFIG_REPLICATION=y" >> $config_host_mak
42834196
fi
42844197

4285-
if test "$have_af_vsock" = "yes" ; then
4286-
echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
4287-
fi
4288-
42894198
if test "$debug_mutex" = "yes" ; then
42904199
echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
42914200
fi

meson.build

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,8 @@ config_host_data.set('CONFIG_INOTIFY',
15501550
cc.has_header_symbol('sys/inotify.h', 'inotify_init'))
15511551
config_host_data.set('CONFIG_INOTIFY1',
15521552
cc.has_header_symbol('sys/inotify.h', 'inotify_init1'))
1553+
config_host_data.set('CONFIG_IOVEC',
1554+
cc.has_header_symbol('sys/uio.h', 'struct iovec'))
15531555
config_host_data.set('CONFIG_MACHINE_BSWAP_H',
15541556
cc.has_header_symbol('machine/bswap.h', 'bswap32',
15551557
prefix: '''#include <sys/endian.h>
@@ -1697,6 +1699,48 @@ config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
16971699
return printf("%zu", SIZE_MAX);
16981700
}''', args: ['-Werror']))
16991701

1702+
# See if 64-bit atomic operations are supported.
1703+
# Note that without __atomic builtins, we can only
1704+
# assume atomic loads/stores max at pointer size.
1705+
config_host_data.set('CONFIG_ATOMIC64', cc.links('''
1706+
#include <stdint.h>
1707+
int main(void)
1708+
{
1709+
uint64_t x = 0, y = 0;
1710+
y = __atomic_load_n(&x, __ATOMIC_RELAXED);
1711+
__atomic_store_n(&x, y, __ATOMIC_RELAXED);
1712+
__atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
1713+
__atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
1714+
__atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
1715+
return 0;
1716+
}'''))
1717+
1718+
config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
1719+
#include <sys/auxv.h>
1720+
int main(void) {
1721+
return getauxval(AT_HWCAP) == 0;
1722+
}'''))
1723+
1724+
config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
1725+
#include <errno.h>
1726+
#include <sys/types.h>
1727+
#include <sys/socket.h>
1728+
#if !defined(AF_VSOCK)
1729+
# error missing AF_VSOCK flag
1730+
#endif
1731+
#include <linux/vm_sockets.h>
1732+
int main(void) {
1733+
int sock, ret;
1734+
struct sockaddr_vm svm;
1735+
socklen_t len = sizeof(svm);
1736+
sock = socket(AF_VSOCK, SOCK_STREAM, 0);
1737+
ret = getpeername(sock, (struct sockaddr *)&svm, &len);
1738+
if ((ret == -1) && (errno == ENOTCONN)) {
1739+
return 0;
1740+
}
1741+
return -1;
1742+
}'''))
1743+
17001744
ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
17011745
'HAVE_GDB_BIN']
17021746
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']

util/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
util_ss.add(files('osdep.c', 'cutils.c', 'unicode.c', 'qemu-timer-common.c'))
2-
util_ss.add(when: 'CONFIG_ATOMIC64', if_false: files('atomic64.c'))
2+
if not config_host_data.get('CONFIG_ATOMIC64')
3+
util_ss.add(files('atomic64.c'))
4+
endif
35
util_ss.add(when: 'CONFIG_POSIX', if_true: files('aio-posix.c'))
46
util_ss.add(when: 'CONFIG_POSIX', if_true: files('fdmon-poll.c'))
57
if config_host_data.get('CONFIG_EPOLL_CREATE1')

0 commit comments

Comments
 (0)