From 9bc5a7193fb422ee53187601eba577ee5d195522 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Thu, 4 Jan 2018 19:39:36 +0200 Subject: oslib-posix: check for posix_memalign in configure script Check for the presence of posix_memalign() in the configure script, not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This lets qemu use posix_memalign() on NetBSD versions that have it, instead of falling back to valloc() which is wasteful when the required alignment is smaller than a page. Signed-off-by: Andreas Gustafsson Signed-off-by: Michael Tokarev Reviewed-by: Kamil Rytarowski Reviewed-by: Peter Maydell --- configure | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'configure') diff --git a/configure b/configure index c1bbf17559..fe9eea9218 100755 --- a/configure +++ b/configure @@ -4658,6 +4658,21 @@ if compile_prog "" "" ; then posix_madvise=yes fi +########################################## +# check if we have posix_memalign() + +posix_memalign=no +cat > $TMPC << EOF +#include +int main(void) { + void *p; + return posix_memalign(&p, 8, 8); +} +EOF +if compile_prog "" "" ; then + posix_memalign=yes +fi + ########################################## # check if we have posix_syslog @@ -5746,6 +5761,7 @@ echo "preadv support $preadv" echo "fdatasync $fdatasync" echo "madvise $madvise" echo "posix_madvise $posix_madvise" +echo "posix_memalign $posix_memalign" echo "libcap-ng support $cap_ng" echo "vhost-net support $vhost_net" echo "vhost-scsi support $vhost_scsi" @@ -6232,6 +6248,9 @@ fi if test "$posix_madvise" = "yes" ; then echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak fi +if test "$posix_memalign" = "yes" ; then + echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak +fi if test "$spice" = "yes" ; then echo "CONFIG_SPICE=y" >> $config_host_mak -- cgit v1.2.1