diff mbox

[v3.1,24/31] configure: add Linux libnuma detection

Message ID c88cdd884506be541c4b7dd7e2bb3bbacd38ad95.1399365798.git.hutao@cn.fujitsu.com
State New
Headers show

Commit Message

Hu Tao May 6, 2014, 9:27 a.m. UTC
From: Wanlong Gao <gaowanlong@cn.fujitsu.com>

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 <andre.przywara@amd.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 configure | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Michael S. Tsirkin May 7, 2014, 2:57 p.m. UTC | #1
On Tue, May 06, 2014 at 05:27:45PM +0800, Hu Tao wrote:
> From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> 
> 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 <andre.przywara@amd.com>
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  configure | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/configure b/configure
> index 870c939..c3df5e6 100755
> --- a/configure
> +++ b/configure
> @@ -324,6 +324,7 @@ tpm="no"
>  libssh2=""
>  vhdx=""
>  quorum="no"
> +numa=""
>  
>  # parse CC options first
>  for opt do
> @@ -1087,6 +1088,10 @@ for opt do
>    ;;
>    --enable-quorum) quorum="yes"
>    ;;
> +  --disable-numa) numa="no"
> +  ;;
> +  --enable-numa) numa="yes"
> +  ;;
>    *)
>        echo "ERROR: unknown option $opt"
>        echo "Try '$0 --help' for more information"
> @@ -1354,6 +1359,8 @@ Advanced options (experts only):
>    --enable-vhdx            enable support for the Microsoft VHDX image format
>    --disable-quorum         disable quorum block filter support
>    --enable-quorum          enable quorum block filter support
> +  --disable-numa           disable libnuma support
> +  --enable-numa            enable libnuma support
>  
>  NOTE: The object files are built at the place where configure is launched
>  EOF
> @@ -3113,6 +3120,27 @@ if compile_prog "" "" ; then
>  fi
>  
>  ##########################################
> +# libnuma probe
> +
> +if test "$numa" != "no" ; then
> +  numa=no
> +  cat > $TMPC << EOF
> +#include <numa.h>
> +int main(void) { return numa_available(); }
> +EOF
> +
> +  if compile_prog "" "-lnuma" ; then
> +    numa=yes
> +    libs_softmmu="-lnuma $libs_softmmu"
> +  else
> +    if test "$numa" = "yes" ; then
> +      feature_not_found "linux NUMA (install numactl?)"

Which distro?
At least for Fedora I think one needs numactl-devel?

> +    fi
> +    numa=no
> +  fi
> +fi
> +
> +##########################################
>  # signalfd probe
>  signalfd="no"
>  cat > $TMPC << EOF
> @@ -4186,6 +4214,7 @@ echo "vhdx              $vhdx"
>  echo "Quorum            $quorum"
>  echo "lzo support       $lzo"
>  echo "snappy support    $snappy"
> +echo "NUMA host support $numa"
>  
>  if test "$sdl_too_old" = "yes"; then
>  echo "-> Your SDL version is too old - please upgrade to have SDL support"
> @@ -5153,6 +5182,10 @@ if [ "$dtc_internal" = "yes" ]; then
>    echo "config-host.h: subdir-dtc" >> $config_host_mak
>  fi
>  
> +if test "$numa" = "yes"; then
> +  echo "CONFIG_NUMA=y" >> $config_host_mak
> +fi
> +
>  # build tree in object directory in case the source is not in the current directory
>  DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
>  DIRS="$DIRS fsdev"
> -- 
> 1.8.5.2.229.g4448466
>
Hu Tao May 8, 2014, 8:34 a.m. UTC | #2
On Wed, May 07, 2014 at 05:57:13PM +0300, Michael S. Tsirkin wrote:
> On Tue, May 06, 2014 at 05:27:45PM +0800, Hu Tao wrote:
> > From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> > 
> > 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 <andre.przywara@amd.com>
> > Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> > ---
> >  configure | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/configure b/configure
> > index 870c939..c3df5e6 100755
> > --- a/configure
> > +++ b/configure
> > @@ -324,6 +324,7 @@ tpm="no"
> >  libssh2=""
> >  vhdx=""
> >  quorum="no"
> > +numa=""
> >  
> >  # parse CC options first
> >  for opt do
> > @@ -1087,6 +1088,10 @@ for opt do
> >    ;;
> >    --enable-quorum) quorum="yes"
> >    ;;
> > +  --disable-numa) numa="no"
> > +  ;;
> > +  --enable-numa) numa="yes"
> > +  ;;
> >    *)
> >        echo "ERROR: unknown option $opt"
> >        echo "Try '$0 --help' for more information"
> > @@ -1354,6 +1359,8 @@ Advanced options (experts only):
> >    --enable-vhdx            enable support for the Microsoft VHDX image format
> >    --disable-quorum         disable quorum block filter support
> >    --enable-quorum          enable quorum block filter support
> > +  --disable-numa           disable libnuma support
> > +  --enable-numa            enable libnuma support
> >  
> >  NOTE: The object files are built at the place where configure is launched
> >  EOF
> > @@ -3113,6 +3120,27 @@ if compile_prog "" "" ; then
> >  fi
> >  
> >  ##########################################
> > +# libnuma probe
> > +
> > +if test "$numa" != "no" ; then
> > +  numa=no
> > +  cat > $TMPC << EOF
> > +#include <numa.h>
> > +int main(void) { return numa_available(); }
> > +EOF
> > +
> > +  if compile_prog "" "-lnuma" ; then
> > +    numa=yes
> > +    libs_softmmu="-lnuma $libs_softmmu"
> > +  else
> > +    if test "$numa" = "yes" ; then
> > +      feature_not_found "linux NUMA (install numactl?)"
> 
> Which distro?
> At least for Fedora I think one needs numactl-devel?

Yes, on Fedora the package is called numactl-devel. But, to
follow other similar messages I'll change it into
'install numactl devel'.

Regards,
Hu Tao
diff mbox

Patch

diff --git a/configure b/configure
index 870c939..c3df5e6 100755
--- a/configure
+++ b/configure
@@ -324,6 +324,7 @@  tpm="no"
 libssh2=""
 vhdx=""
 quorum="no"
+numa=""
 
 # parse CC options first
 for opt do
@@ -1087,6 +1088,10 @@  for opt do
   ;;
   --enable-quorum) quorum="yes"
   ;;
+  --disable-numa) numa="no"
+  ;;
+  --enable-numa) numa="yes"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -1354,6 +1359,8 @@  Advanced options (experts only):
   --enable-vhdx            enable support for the Microsoft VHDX image format
   --disable-quorum         disable quorum block filter support
   --enable-quorum          enable quorum block filter support
+  --disable-numa           disable libnuma support
+  --enable-numa            enable libnuma support
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -3113,6 +3120,27 @@  if compile_prog "" "" ; then
 fi
 
 ##########################################
+# libnuma probe
+
+if test "$numa" != "no" ; then
+  numa=no
+  cat > $TMPC << EOF
+#include <numa.h>
+int main(void) { return numa_available(); }
+EOF
+
+  if compile_prog "" "-lnuma" ; then
+    numa=yes
+    libs_softmmu="-lnuma $libs_softmmu"
+  else
+    if test "$numa" = "yes" ; then
+      feature_not_found "linux NUMA (install numactl?)"
+    fi
+    numa=no
+  fi
+fi
+
+##########################################
 # signalfd probe
 signalfd="no"
 cat > $TMPC << EOF
@@ -4186,6 +4214,7 @@  echo "vhdx              $vhdx"
 echo "Quorum            $quorum"
 echo "lzo support       $lzo"
 echo "snappy support    $snappy"
+echo "NUMA host support $numa"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5153,6 +5182,10 @@  if [ "$dtc_internal" = "yes" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
 
+if test "$numa" = "yes"; then
+  echo "CONFIG_NUMA=y" >> $config_host_mak
+fi
+
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
 DIRS="$DIRS fsdev"