Skip to content

Commit a99d57b

Browse files
gaowanlongmstsirkin
authored andcommitted
configure: add Linux libnuma detection
Add detection of libnuma (mostly contained in the numactl package) to the configure script. Can be enabled or disabled on the command line, default is use if available. Signed-off-by: Andre Przywara <[email protected]> Signed-off-by: Wanlong Gao <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Hu Tao <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 7bd4f43 commit a99d57b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

configure

+32
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ tpm="no"
334334
libssh2=""
335335
vhdx=""
336336
quorum=""
337+
numa=""
337338

338339
# parse CC options first
339340
for opt do
@@ -1118,6 +1119,10 @@ for opt do
11181119
;;
11191120
--enable-quorum) quorum="yes"
11201121
;;
1122+
--disable-numa) numa="no"
1123+
;;
1124+
--enable-numa) numa="yes"
1125+
;;
11211126
*)
11221127
echo "ERROR: unknown option $opt"
11231128
echo "Try '$0 --help' for more information"
@@ -1384,6 +1389,8 @@ Advanced options (experts only):
13841389
--enable-vhdx enable support for the Microsoft VHDX image format
13851390
--disable-quorum disable quorum block filter support
13861391
--enable-quorum enable quorum block filter support
1392+
--disable-numa disable libnuma support
1393+
--enable-numa enable libnuma support
13871394
13881395
NOTE: The object files are built at the place where configure is launched
13891396
EOF
@@ -3167,6 +3174,26 @@ if compile_prog "" "" ; then
31673174
splice=yes
31683175
fi
31693176

3177+
##########################################
3178+
# libnuma probe
3179+
3180+
if test "$numa" != "no" ; then
3181+
cat > $TMPC << EOF
3182+
#include <numa.h>
3183+
int main(void) { return numa_available(); }
3184+
EOF
3185+
3186+
if compile_prog "" "-lnuma" ; then
3187+
numa=yes
3188+
libs_softmmu="-lnuma $libs_softmmu"
3189+
else
3190+
if test "$numa" = "yes" ; then
3191+
feature_not_found "numa" "install numactl devel"
3192+
fi
3193+
numa=no
3194+
fi
3195+
fi
3196+
31703197
##########################################
31713198
# signalfd probe
31723199
signalfd="no"
@@ -4241,6 +4268,7 @@ echo "vhdx $vhdx"
42414268
echo "Quorum $quorum"
42424269
echo "lzo support $lzo"
42434270
echo "snappy support $snappy"
4271+
echo "NUMA host support $numa"
42444272

42454273
if test "$sdl_too_old" = "yes"; then
42464274
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5210,6 +5238,10 @@ if [ "$dtc_internal" = "yes" ]; then
52105238
echo "config-host.h: subdir-dtc" >> $config_host_mak
52115239
fi
52125240

5241+
if test "$numa" = "yes"; then
5242+
echo "CONFIG_NUMA=y" >> $config_host_mak
5243+
fi
5244+
52135245
# build tree in object directory in case the source is not in the current directory
52145246
DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
52155247
DIRS="$DIRS fsdev"

0 commit comments

Comments
 (0)