xen/Makefile: use CC --version instead of -v
PATCH 1/1 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/Makefile +1 -1
@@ -87,7 +87,7 @@ include/xen/compile.h: include/xen/compi -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ -e 's/@@domain@@/$(XEN_DOMAIN)/g' \ -e 's/@@hostname@@/$(shell hostname)/g' \ - -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \ + -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version | head -n1)!g' \ -e 's/@@version@@/$(XEN_VERSION)/g' \ -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Robert Buchholz
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.
-- Keir
Quoted 7 lines · Keir Fraser
Quoted 2 lines · Robert Buchholz
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.
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
[email protected]
http://lists.xensource.com/xen-devel
Quoted 1 line · Robert Buchholz
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
Quoted 11 lines · Keir Fraser
Quoted 1 line · Robert Buchholz
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
Quoted 8 lines · Keir Fraser
Quoted 7 lines · Keir Fraser
Quoted 1 line · Robert Buchholz
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'.
Quoted 8 lines
Quoted 5 lines
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
[email protected]
http://lists.xensource.com/xen-devel