[Qemu-devel] [PATCH] configure: fix seccomp check

2012-09-06 Thread Yann E. MORIN
Currently, if libseccomp is missing but the user explicitly requested
seccomp support using --enable-seccomp, configure silently ignores the
situation and disables seccomp support.

This is unlike all other tests that explicitly fail in such situation.

Fix that.

Signed-off-by: "Yann E. MORIN" 
---
 configure |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index c5888fa..23abb46 100755
--- a/configure
+++ b/configure
@@ -1429,10 +1429,10 @@ if test "$seccomp" != "no" ; then
 LIBS=`$pkg_config --libs libseccomp`
seccomp="yes"
 else
-   seccomp="no"
if test "$seccomp" = "yes"; then
 feature_not_found "libseccomp"
fi
+   seccomp="no"
 fi
 fi
 ##
-- 
1.7.2.5




Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Yann E. MORIN
Peter, All,

On Monday 03 September 2012 18:38:48 Peter Maydell wrote:
> On 3 September 2012 17:28, Yann E. MORIN  wrote:
> > On Monday 03 September 2012 17:44:51 Peter Maydell wrote:
> >> Personally I think it might indeed be a good idea to just say
> >> "statically linked softmmu isn't supported" and forbid it, unless
> >> somebody has a good use case for it...
> >
> > I personnally have such a use-case: provide run-everywhere qemu softmmu
> > binaries that do have minimal requirements on the distro they'll be
> > running on, especially when the distros can be very different (in kinds
> > and in age).
> 
> ...have you audited all of qemu's library usage to confirm that it
> doesn't use any of the bits of glibc that don't work in the static
> linking scenario? I'm reasonably confident that the linux-user binaries
> are OK, much less so for the system binaries...

I guess you mean the nsswitch stuff?

I'm using a uClibc-based toolchain that does not have such libs, and allows
a truly static link.

Regards,
Yann E. MORIN.

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN |  ___   |
| +33 223 225 172 `.---:  X  AGAINST  |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL|   v   conspiracy.  |
'--^---^--^'



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Yann E. MORIN
Hello All,

On Monday 03 September 2012 17:44:51 Peter Maydell wrote:
> On 3 September 2012 16:41, Andreas Färber  wrote:
> > The only use case for QEMU's --static compilation I know is linux-user,
> > and that doesn't need cURL or SDL AFAIK. Shouldn't we rather sanitize
> > our configure-time checks to only look for the actually needed stuff
> > than making sure that unnecessary dependencies are generated nicely?
> 
> In particular it might be nice to be able to build in a single
> run both (a) dynamically linked softmmu targets and (b) statically
> linked linux-user targets (and maybe even also (c) dynamically
> linked linux-user targets?).
> 
> Personally I think it might indeed be a good idea to just say
> "statically linked softmmu isn't supported" and forbid it, unless
> somebody has a good use case for it...

I personnally have such a use-case: provide run-everywhere qemu softmmu
binaries that do have minimal requirements on the distro they'll be
running on, especially when the distros can be very different (in kinds
and in age).

For example, I can use it to provide:
  - a qemu binary
  - a VM image
  - a script
that users can simply drop anywhere they want (without needing root
access) and run the VM, without requiring them to install a myriad
packages, especially on older distros that may lack those packages,
or whose packaged versions are too old for qemu.

Regards,
Yann E. MORIN.

-- 
.-----..--..
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN |  ___   |
| +33 223 225 172 `.---:  X  AGAINST  |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL|   v   conspiracy.  |
'--^---^--^'



[Qemu-devel] [PATCH 1/2] configure: fix detection for cURL libs when static linking

2012-09-02 Thread Yann E. MORIN
Currently, to check for cURL, configure uses either pkg-config (the default),
or curl-config (as a fallback).

But curl-config and pkg-config do not have the same set of options:
  - to check for shared libs, both use the option: --libs
  - to check for static libs:
- pkg-config uses: --static --libs
- curl-config uses: --static-libs

To add to the complexity, pkg-config is called through the querry_pkg_config
wrapper, that already passes --static when static linking is required, but
there is no such wrapper for curl-config, so we miss the occasion to pass
--static-libs

To fix this:
  - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
xxx-config scripts (eg. curl-config, but later sdl-config too).
Default it to '--libs', which is for shared linking;
  - properly use either --libs for pkg-config (--static is already taken
care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for curl-config.

Signed-off-by: "Yann E. MORIN" 
Reviewed-by: Stefan Hajnoczi 
---
 configure |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d97fd81..67c9238 100755
--- a/configure
+++ b/configure
@@ -126,7 +126,7 @@ audio_win_int=""
 cc_i386=i386-pc-linux-gnu-gcc
 libs_qga=""
 debug_info="yes"
-
+QEMU_XXX_CONFIG_LIBS_FLAGS="--libs"
 target_list=""
 
 # Default value for a variable defining feature "foo".
@@ -626,6 +626,7 @@ for opt do
 static="yes"
 LDFLAGS="-static $LDFLAGS"
 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
+QEMU_XXX_CONFIG_LIBS_FLAGS="--static-libs"
   ;;
   --mandir=*) mandir="$optarg"
   ;;
@@ -2077,8 +2078,10 @@ fi
 
 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
   curlconfig="$pkg_config libcurl"
+  curlconfiglibs="--libs"
 else
   curlconfig=curl-config
+  curlconfiglibs="$QEMU_XXX_CONFIG_LIBS_FLAGS"
 fi
 
 if test "$curl" != "no" ; then
@@ -2087,7 +2090,7 @@ if test "$curl" != "no" ; then
 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
 EOF
   curl_cflags=`$curlconfig --cflags 2>/dev/null`
-  curl_libs=`$curlconfig --libs 2>/dev/null`
+  curl_libs=`$curlconfig $curlconfiglibs 2>/dev/null`
   if compile_prog "$curl_cflags" "$curl_libs" ; then
 curl=yes
 libs_tools="$curl_libs $libs_tools"
-- 
1.7.2.5




[Qemu-devel] [PATCH 2/2] configure: fix detection for SDL libs when static linking

2012-09-02 Thread Yann E. MORIN
Currently, configure checks for SDL libs either with pkg-config (the
default), or with sdl-config (as a fallback).

But sdl-config does not have the same set of options as pkg-config:
  - to check for shared libs, both use the option: --libs
  - to check for static libs:
- pkg-config uses: --static --libs
- sdl-config uses: --static-libs

Fix that by using the previously introduced $QEMU_XXX_CONFIG_LIBS_FLAGS
variable, the way it was done previously for cURL.

Also, simplify the code-path for checking for SDL libs with a single,
non-conditional call to $sdlconfig, which is either pkg-config or
sdl-config, as checked just above.

Signed-off-by: "Yann E. MORIN" 
Reviewed-by: Stefan Hajnoczi 
---
 configure |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 67c9238..c5888fa 100755
--- a/configure
+++ b/configure
@@ -1646,9 +1646,11 @@ fi
 
 if $pkg_config sdl --modversion >/dev/null 2>&1; then
   sdlconfig="$pkg_config sdl"
+  sdlconfiglibs="--libs"
   _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
 elif has ${sdl_config}; then
   sdlconfig="$sdl_config"
+  sdlconfiglibs="$QEMU_XXX_CONFIG_LIBS_FLAGS"
   _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
 else
   if test "$sdl" = "yes" ; then
@@ -1668,11 +1670,7 @@ if test "$sdl" != "no" ; then
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
   sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
-  if test "$static" = "yes" ; then
-sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
-  else
-sdl_libs=`$sdlconfig --libs 2> /dev/null`
-  fi
+  sdl_libs=`$sdlconfig $sdlconfiglibs 2> /dev/null`
   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
 if test "$_sdlversion" -lt 121 ; then
   sdl_too_old=yes
-- 
1.7.2.5




[Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-02 Thread Yann E. MORIN
Hello All!

Currently, configure checks for cURL and SDL with either pkg-config (the
default), or with {curl,sdl}-config (as a fallback).

But pkg-config and {curl,sdl}-config do not have the same set of options:
  - to check for shared libs, both use the option: --libs
  - to check for static libs:
- pkg-config uses  : --static --libs
- {curl,sdl}-config use: --static-libs

To add to the complexity, pkg-config is called through the querry_pkg_config
wrapper, that already passes --static when static linking is required, but
there is no such wrapper for {curl,sdl}-config, so we miss the occasion to
pass --static-libs.

To fix this:
  - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
xxx-config scripts (eg. curl-config, but later sdl-config too).
Default it to '--libs', which is for shared linking.
  - properly use either --libs for pkg-config (--static is already taken
care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for
{curl,sdl}-config.


Changes since v2:
  - remove trailing reference to cURL in the SDL patch (Stefan Hajnoczi)
  - sent to qemu-devel and cc qemu-trivial (Peter Maydell, Stefan)
  - fix type in the name of the new variable

Changes since v1:
  - drop the spice fix, it is not needed (bad env locally)
  - drop the added --static to calls to pkg-config, as it's already in the
wrapper (Stefan Hajnoczi)

Regards,
Yann E. MORIN.