From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zylas-0002tU-8h for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:07:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zylan-0003Pw-Rf for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:07:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zylan-0003Pr-Jj for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:07:01 -0500 References: <1447783185-32019-1-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <564B7ACF.30701@redhat.com> Date: Tue, 17 Nov 2015 12:06:55 -0700 MIME-Version: 1.0 In-Reply-To: <1447783185-32019-1-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LFAb40EN68ugSX9xOETWQAMONhBAiEieQ" Subject: Re: [Qemu-devel] [PATCH] 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 , Gerd Hoffmann , "Dr. David Alan Gilbert" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LFAb40EN68ugSX9xOETWQAMONhBAiEieQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/17/2015 10:59 AM, Daniel P. Berrange wrote: > Suggested in >=20 > https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03298.html >=20 > 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. > All these key env variables should be recorded in the > config.status script. >=20 > Signed-off-by: Daniel P. Berrange > --- >=20 > Open question: are there more env vars we should preserve ? Yes - anything that autoconf would mark as precious. See below. > +++ b/configure > @@ -5925,6 +5925,24 @@ 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 > + > + if test -n "${!envname}" Bashism, but configure is /bin/sh. This won't work on dash :( I think you'll have to use eval, and we'll just have to audit that preserve_env can never be called with suspicious text where eval would open a security hole. > + then > + echo "$envname=3D\"${!envname}\"" >> config.status Another use of the bashism. > + echo "export $envname" >> config.status > + fi > +} > + > +# Preserve various env variables that influence what > +# features/build target configure will detect > +preserve_env PATH > +preserve_env LD_LIBRARY_PATH > +preserve_env PKG_CONFIG_LIBDIR > +preserve_env PKG_CONFIG_PATH > + Autoconf preserves CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS, and CPP by default. Also, PKG_CONFIG is typically preserved. If you run libvirt's './configure --help', you'll also notice a bunch of *_CFLAGS and *_LIBS in the precious list starting under the label "Some influential environment variables". --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LFAb40EN68ugSX9xOETWQAMONhBAiEieQ 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/ iQEcBAEBCAAGBQJWS3rPAAoJEKeha0olJ0NqNJ8H/icmrS3VeWXDSObAZl2noPQ2 sAQhNwsIiEif4Wsu16mTFCV7daYXCT7DtUKsXZzfxmjIW9UK592YGFoAn6Uph33F hLgTx2pX/28E+qqf1P5u4XjCOoXyGfeCHK8fo0J14yV3fOVMWD181qVqdKuS0ayx dlg2sWLRaUsldjQ/DiRshBLA+/K4Hu4abpNmxUubCJcDpX84zNQIvR9T3KWrR1ZM q65+7l8tiDjcp1J5hzzghJO8YaRpCzGCveEMBNeKJkyP2dw7Sk7sC712XVVySqrT T79m57Z95Sb/6lKPwHPB5KSIgPbyCkm3+1kYY61giYIdZe0X9E1XIAWTA81b9S8= =ybEo -----END PGP SIGNATURE----- --LFAb40EN68ugSX9xOETWQAMONhBAiEieQ--