From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz54N-0005cW-UM for qemu-devel@nongnu.org; Wed, 18 Nov 2015 10:54:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz54J-0003Ii-QM for qemu-devel@nongnu.org; Wed, 18 Nov 2015 10:54:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz54J-0003Ie-J5 for qemu-devel@nongnu.org; Wed, 18 Nov 2015 10:54:47 -0500 References: <1447842704-4759-1-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <564C9F41.8060201@redhat.com> Date: Wed, 18 Nov 2015 08:54:41 -0700 MIME-Version: 1.0 In-Reply-To: <1447842704-4759-1-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fLlEqbveveWSvbSiKkG10P3EQdnJUhKEC" Subject: Re: [Qemu-devel] [PATCH v2] configure: preserve various environment variables in config.status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Peter Maydell , "Dr. David Alan Gilbert" , Gerd Hoffmann This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fLlEqbveveWSvbSiKkG10P3EQdnJUhKEC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/2015 03:31 AM, Daniel P. Berrange 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 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 the > 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. Would be worth mentioning in the commit message that we are explicitly deviating from autoconf's practice of preserving CFLAGS. >=20 > Signed-off-by: Daniel P. Berrange > --- > configure | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) >=20 > diff --git a/configure b/configure > index d7472d7..09a503c 100755 > --- a/configure > +++ b/configure > @@ -5925,6 +5925,44 @@ cat <config.status > # Compiler output produced by configure, useful for debugging > # configure, is in config.log if it exists. > EOD > + > +preserve_env() { > + envname=3D$1 > + > + eval envval=3D\$$envname > + > + if test -n "$envval" > + then > + echo "$envname=3D'$envval'" >> config.status Works as long as $envval doesn't contain '; I'm not sure if it is worth worrying about someone compiling in /path/to'evil/location. > + echo "export $envname" >> config.status > + fi You missed Stefan Weil's suggestion of an else clause to unset variables that were added after the fact but not present during the original configure. I'm not sure if that matters. > +} > + > +# 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 >=20 It's better than before, even if we could think of further tweaks. If you enhance the commit message, I can live with: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --fLlEqbveveWSvbSiKkG10P3EQdnJUhKEC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWTJ9BAAoJEKeha0olJ0Nqvu4H/1CSy/nKbDKjzFCBbkITfKBw JS06Y1jZ5xcmStvLFeSPSCAfCnqoQFqX92G32luBMlMD7EYDmngwlmWsOX26fq/+ gJAEwAzOnoO90CKRY2w/PjUBZ009OI5ruJ4Zb5TkV9z1p9lyKlpl6RG1X7KcgAZ3 9cfBA0SKYuFGkqZ7vUb8fznxw/PIpZLtc4gnru9lTBvksqtz812iz5+pKJD/APXq 5eK6wflwCnUvbCF+pscV8+sntJdLOlLUylGYybcv5PsV4xklqZ9n/SYLA/Yyh6yn SPQ61D+Kv4s6It/IS3F5oWL+bMnuWUiAO+1g/K23JDSBrDL9lx9xqWKHSmcgNBA= =oslM -----END PGP SIGNATURE----- --fLlEqbveveWSvbSiKkG10P3EQdnJUhKEC--