Patchwork [RFC,PATCHv2,1/2] Adding support for libseccomp in configure

login
register
mail settings
Submitter Eduardo Otubo
Date June 13, 2012, 7:20 p.m.
Message ID <a4d34c652dab0b0722a425b777c75d2c3c50830a.1339614945.git.otubo@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/164744/
State New
Headers show

Comments

Eduardo Otubo - June 13, 2012, 7:20 p.m.
Adding basic options to the configure script to use libseccomp or not.
The default is set to 'no'. If the flag --enable-libseccomp is used, the
script will check for its existence using pkg-config.

v2: As I removed all the code related to seccomp from vl.c, I created
qemu-seccomp.[ch]. I am also making the configure script to add the specific
line to Makefile.obj in order to compile with appropriate support to seccomp.

Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
---
 configure |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
Blue Swirl - June 13, 2012, 7:45 p.m.
On Wed, Jun 13, 2012 at 7:20 PM, Eduardo Otubo <otubo@linux.vnet.ibm.com> wrote:
> Adding basic options to the configure script to use libseccomp or not.
> The default is set to 'no'. If the flag --enable-libseccomp is used, the
> script will check for its existence using pkg-config.
>
> v2: As I removed all the code related to seccomp from vl.c, I created
> qemu-seccomp.[ch]. I am also making the configure script to add the specific
> line to Makefile.obj in order to compile with appropriate support to seccomp.
>
> Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
> ---
>  configure |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/configure b/configure
> index c2366ee..145956d 100755
> --- a/configure
> +++ b/configure
> @@ -195,6 +195,7 @@ zlib="yes"
>  guest_agent="yes"
>  libiscsi=""
>  coroutine=""
> +libseccomp="no"

Maybe libseccomp should be the default.

>
>  # parse CC options first
>  for opt do
> @@ -825,6 +826,10 @@ for opt do
>   ;;
>   --disable-guest-agent) guest_agent="no"
>   ;;
> +  --enable-libseccomp) libseccomp="yes"
> +  ;;
> +  --disable-libseccomp) libseccomp="no"
> +  ;;
>   *) echo "ERROR: unknown option $opt"; show_help="yes"
>   ;;
>   esac
> @@ -1109,6 +1114,8 @@ echo "  --disable-usb-redir      disable usb network redirection support"
>  echo "  --enable-usb-redir       enable usb network redirection support"
>  echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
>  echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
> +echo "  --disable-libseccomp     disable libseccomp support"
> +echo "  --enable-libseccomp      enable libseccomp support"
>  echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
>  echo "                           gthread, ucontext, sigaltstack, windows"
>  echo ""
> @@ -1354,6 +1361,17 @@ EOF
>  fi
>
>  ##########################################
> +# libseccomp check
> +
> +if test "$libseccomp" = "yes" ; then
> +    if $pkg_config libseccomp --modversion >/dev/null 2>&1; then
> +        LIBS=`$pkg_config --libs libseccomp`
> +    else
> +        feature_not_found "libseccomp"
> +    fi
> +fi
> +
> +##########################################
>  # xen probe
>
>  if test "$xen" != "no" ; then
> @@ -3033,6 +3051,7 @@ echo "usb net redir     $usb_redir"
>  echo "OpenGL support    $opengl"
>  echo "libiscsi support  $libiscsi"
>  echo "build guest agent $guest_agent"
> +echo "seccomp support   $libseccomp"
>  echo "coroutine backend $coroutine_backend"
>
>  if test "$sdl_too_old" = "yes"; then
> @@ -3334,6 +3353,12 @@ if test "$libiscsi" = "yes" ; then
>   echo "CONFIG_LIBISCSI=y" >> $config_host_mak
>  fi
>
> +if test "$libseccomp" = "yes" ; then
> +  echo "CONFIG_LIBSECCOMP=y" >> $config_host_mak
> +  echo "# libseccomp support added by configure script:" >> Makefile.obj
> +  echo "common-obj-y += qemu-seccomp.o" >> Makefile.obj

Please don't modify Makefile.obj (what's that?), but instead add a rule like
common-obj-$(CONFIG_LIBSECCOMP) += qemu-seccomp.o
to Makefile.objs.

> +fi
> +
>  # XXX: suppress that
>  if [ "$bsd" = "yes" ] ; then
>   echo "CONFIG_BSD=y" >> $config_host_mak
> --
> 1.7.9.5
>
>

Patch

diff --git a/configure b/configure
index c2366ee..145956d 100755
--- a/configure
+++ b/configure
@@ -195,6 +195,7 @@  zlib="yes"
 guest_agent="yes"
 libiscsi=""
 coroutine=""
+libseccomp="no"
 
 # parse CC options first
 for opt do
@@ -825,6 +826,10 @@  for opt do
   ;;
   --disable-guest-agent) guest_agent="no"
   ;;
+  --enable-libseccomp) libseccomp="yes"
+  ;;
+  --disable-libseccomp) libseccomp="no"
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -1109,6 +1114,8 @@  echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
 echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
 echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
+echo "  --disable-libseccomp     disable libseccomp support"
+echo "  --enable-libseccomp      enable libseccomp support"
 echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
 echo "                           gthread, ucontext, sigaltstack, windows"
 echo ""
@@ -1354,6 +1361,17 @@  EOF
 fi
 
 ##########################################
+# libseccomp check
+
+if test "$libseccomp" = "yes" ; then
+    if $pkg_config libseccomp --modversion >/dev/null 2>&1; then
+        LIBS=`$pkg_config --libs libseccomp`
+    else
+        feature_not_found "libseccomp"
+    fi
+fi
+
+##########################################
 # xen probe
 
 if test "$xen" != "no" ; then
@@ -3033,6 +3051,7 @@  echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
 echo "libiscsi support  $libiscsi"
 echo "build guest agent $guest_agent"
+echo "seccomp support   $libseccomp"
 echo "coroutine backend $coroutine_backend"
 
 if test "$sdl_too_old" = "yes"; then
@@ -3334,6 +3353,12 @@  if test "$libiscsi" = "yes" ; then
   echo "CONFIG_LIBISCSI=y" >> $config_host_mak
 fi
 
+if test "$libseccomp" = "yes" ; then
+  echo "CONFIG_LIBSECCOMP=y" >> $config_host_mak
+  echo "# libseccomp support added by configure script:" >> Makefile.obj
+  echo "common-obj-y += qemu-seccomp.o" >> Makefile.obj
+fi
+
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak