Robert Buchholz
2008-Aug-26 23:06 UTC
[Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
Hi all, the xen/Makefile calls $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version" to get a human-readable representation of the GCC being used. However, this poses a problem at least in Gentoo, where as of gcc 4.3, "gcc -v" reads: ====================================================================Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-cld --enable-java-awt=gtk --enable-languages=c,c++,java,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion=''Gentoo 4.3.1-r1 p1.1'' Thread model: posix gcc version 4.3.1 (Gentoo 4.3.1-r1 p1.1) ====================================================================(Notice the line starting ''with'' matches "gcc.*version") I propose to change the statement to: $(CC) $(CFLAGS) --version | head -n1 See the attached patch. This is Gentoo bug #217151 [ https://bugs.gentoo.org/217151 ] Regards, Robert _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Aug-27 08:56 UTC
Re: [Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
On 27/8/08 00:06, "Robert Buchholz" <rbu@gentoo.org> wrote:> I propose to change the statement to: > $(CC) $(CFLAGS) --version | head -n1I think we can just tighten up the grep regexp a little. "gcc .*version " should do it. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Robert Buchholz
2008-Aug-27 10:12 UTC
Re: [Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
On Wednesday 27 August 2008, Keir Fraser wrote:> On 27/8/08 00:06, "Robert Buchholz" <rbu@gentoo.org> wrote: > > I propose to change the statement to: > > $(CC) $(CFLAGS) --version | head -n1 > > I think we can just tighten up the grep regexp a little. > > "gcc .*version " should do it.That is not guaranteed to filter only the desired lines (if a configure parameter would end in "gcc", or there is "gcc " in the path GCC was compiled in). The reason I proposed "gcc --version | head -n1" was that the output is only dependent on the GCC source, whereas "gcc -v | grep" also depends on the system configuration. Btw, what is the reason for ".*" in the first place? Regards, Robert _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Aug-27 10:33 UTC
Re: [Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
On 27/8/08 11:12, "Robert Buchholz" <rbu@gentoo.org> wrote:> Btw, what is the reason for ".*" in the first place?Lost somewhat in the mists of time, but I think some vendor packages (possibly Red Hat iirc) stuck something in between ''gcc'' and ''version''. Another tactic might be ''tail -n1''. I can''t remember if the version is always the last line of ''gcc -v'' output though. Hmmm... actually that is what Linux does (tail -n 1). So let''s go with that. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Aug-27 11:00 UTC
Re: [Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
On 27/8/08 11:33, "Keir Fraser" <keir.fraser@eu.citrix.com> wrote:> On 27/8/08 11:12, "Robert Buchholz" <rbu@gentoo.org> wrote: > >> Btw, what is the reason for ".*" in the first place? > > Lost somewhat in the mists of time, but I think some vendor packages > (possibly Red Hat iirc) stuck something in between ''gcc'' and ''version''. > > Another tactic might be ''tail -n1''. I can''t remember if the version is > always the last line of ''gcc -v'' output though. > > Hmmm... actually that is what Linux does (tail -n 1). So let''s go with that.I''ve checked in ''tail -1'' which I think is more portable. If that is agreeable to everyone then I''ll backport to 3.3 and 3.2 branches. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Robert Buchholz
2008-Aug-27 11:06 UTC
Re: [Xen-devel] [PATCH] xen/Makefile: use CC --version instead of -v
On Wednesday 27 August 2008, Keir Fraser wrote:> On 27/8/08 11:33, "Keir Fraser" <keir.fraser@eu.citrix.com> wrote: > > On 27/8/08 11:12, "Robert Buchholz" <rbu@gentoo.org> wrote: > >> Btw, what is the reason for ".*" in the first place? > > > > Lost somewhat in the mists of time, but I think some vendor > > packages (possibly Red Hat iirc) stuck something in between ''gcc'' > > and ''version''. > > > > Another tactic might be ''tail -n1''. I can''t remember if the version > > is always the last line of ''gcc -v'' output though. > > > > Hmmm... actually that is what Linux does (tail -n 1). So let''s go > > with that. > > I''ve checked in ''tail -1'' which I think is more portable. If that is > agreeable to everyone then I''ll backport to 3.3 and 3.2 branches.Thanks, backports are appreciated (and trivial). Robert _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel