qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Eric Blake <eblake@redhat.com>, Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3] configure: preserve various environment variables in config.status
Date: Tue, 11 Sep 2018 15:11:22 +0200	[thread overview]
Message-ID: <83d10cc6-2fb3-c04d-5809-13a617226d39@redhat.com> (raw)
In-Reply-To: <20180904123603.10016-1-berrange@redhat.com>

On 04/09/2018 14:36, Daniel P. Berrangé wrote:
> The config.status script is auto-generated by configure upon
> completion. The intention is that config.status can be later invoked by
> the developer directly, or by make indirectly, to re-detect the same
> environment that configure originally used.
> 
> The current config.status script, however, only contains a record of the
> command line arguments to configure. Various environment variables have
> an effect on what configure will find. In particular PKG_CONFIG_LIBDIR &
> PKG_CONFIG_PATH vars will affect what libraries pkg-config finds. The
> PATH var will affect what toolchain binaries and XXXX-config scripts are
> found. The LD_LIBRARY_PATH var will affect what libraries are
> found. Most commands have env variables that will override the name/path
> of the default version configure finds.
> 
> All these key env variables should be recorded in the config.status script.
> 
> Autoconf would also preserve CFLAGS, LDFLAGS, LIBS, CPPFLAGS, but QEMU
> deals with those differently, expecting extra flags to be set using
> configure args, rather than env variables. At the end of the script we
> also don't have the original values of those env vars, as we modify them
> during configure.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  configure | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> Previously sent 3 (!) years ago:
> 
>   v1: http://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03953.html
>   v2: http://lists.gnu.org/archive/html/qemu-devel/2015-11/msg04074.html
> 
> Changed in v3:
> 
>  - Added 'unset' code (Stefan)
>  - Clarify CFLAGS handling (Eric)
> 
> 
> diff --git a/configure b/configure
> index e7bddc04b0..718e89724a 100755
> --- a/configure
> +++ b/configure
> @@ -7518,6 +7518,46 @@ cat <<EOD >config.status
>  # Compiler output produced by configure, useful for debugging
>  # configure, is in config.log if it exists.
>  EOD
> +
> +preserve_env() {
> +    envname=$1
> +
> +    eval envval=\$$envname
> +
> +    if test -n "$envval"
> +    then
> +	echo "$envname='$envval'" >> config.status
> +	echo "export $envname" >> config.status
> +    else
> +	echo "unset $envname" >> config.status
> +    fi
> +}
> +
> +# Preserve various env variables that influence what
> +# features/build target configure will detect
> +preserve_env AR
> +preserve_env AS
> +preserve_env CC
> +preserve_env CPP
> +preserve_env CXX
> +preserve_env INSTALL
> +preserve_env LD
> +preserve_env LD_LIBRARY_PATH
> +preserve_env LIBTOOL
> +preserve_env MAKE
> +preserve_env NM
> +preserve_env OBJCOPY
> +preserve_env PATH
> +preserve_env PKG_CONFIG
> +preserve_env PKG_CONFIG_LIBDIR
> +preserve_env PKG_CONFIG_PATH
> +preserve_env PYTHON
> +preserve_env SDL_CONFIG
> +preserve_env SDL2_CONFIG
> +preserve_env SMBD
> +preserve_env STRIP
> +preserve_env WINDRES
> +
>  printf "exec" >>config.status
>  printf " '%s'" "$0" "$@" >>config.status
>  echo ' "$@"' >>config.status
> 

Queued, thanks.

Paolo

      parent reply	other threads:[~2018-09-11 13:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 12:36 [Qemu-devel] [PATCH v3] configure: preserve various environment variables in config.status Daniel P. Berrangé
2018-09-04 16:21 ` Eric Blake
2018-09-04 21:16   ` Peter Maydell
2018-09-05  8:39     ` Daniel P. Berrangé
2018-09-04 18:37 ` Thomas Huth
2018-09-11 13:11 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d10cc6-2fb3-c04d-5809-13a617226d39@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).