diff mbox

[v2,1/2] ./configure: request pkg-config to provide private libs when static linking

Message ID 1327340643-15446-1-git-send-email-slyfox@inbox.ru
State New
Headers show

Commit Message

Sergei Trofimovich Jan. 23, 2012, 5:44 p.m. UTC
From: Sergei Trofimovich <slyfox@gentoo.org>

Added wrapper around pkg-config to allow:
- safe options injection via ${QEMU_PKG_CONFIG_FLAGS}
- spaces in path to pkg-config

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 configure |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

Comments

Peter Maydell Jan. 23, 2012, 6:02 p.m. UTC | #1
On 23 January 2012 17:44, Sergei Trofimovich <slyfox@inbox.ru> wrote:
> @@ -234,7 +234,11 @@ ld="${LD-${cross_prefix}ld}"
>  libtool="${LIBTOOL-${cross_prefix}libtool}"
>  strip="${STRIP-${cross_prefix}strip}"
>  windres="${WINDRES-${cross_prefix}windres}"
> -pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
> +pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
> +query_pkg_config() {
> +    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
> +}
> +pkg_config=query_pkg_config # TODO: sed 's/$pkg_config/pkg_config/g'
>  sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"

Either it's worth making the change suggested in the TODO,
in which case we should have another patch in the series which
does it (and drop the TODO comment here), or it's not worth
making the change, in which case we should just drop the TODO
comment.

If we do make the substitution, I think it should be
s/$pkg_config/query_pkg_config/ because having a local
shell function which silently shadows the well-known
pkg_config binary would be pretty confusing.

I'm happy for us not to make the substitution, I think.

-- PMM
diff mbox

Patch

diff --git a/configure b/configure
index 467e87b..97d51a7 100755
--- a/configure
+++ b/configure
@@ -234,7 +234,11 @@  ld="${LD-${cross_prefix}ld}"
 libtool="${LIBTOOL-${cross_prefix}libtool}"
 strip="${STRIP-${cross_prefix}strip}"
 windres="${WINDRES-${cross_prefix}windres}"
-pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
+pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+query_pkg_config() {
+    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
+}
+pkg_config=query_pkg_config # TODO: sed 's/$pkg_config/pkg_config/g'
 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
 
 # default flags for all hosts
@@ -553,6 +557,7 @@  for opt do
   --static)
     static="yes"
     LDFLAGS="-static $LDFLAGS"
+    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
   ;;
   --mandir=*) mandir="$optarg"
   ;;
@@ -1445,8 +1450,8 @@  fi
 ##########################################
 # pkg-config probe
 
-if ! has $pkg_config; then
-  echo "Error: pkg-config binary '$pkg_config' not found"
+if ! has "$pkg_config_exe"; then
+  echo "Error: pkg-config binary '$pkg_config_exe' not found"
   exit 1
 fi