Bug 33278 - [4.3 Regression] libjava fails to compile if configure argument contains "version"
Summary: [4.3 Regression] libjava fails to compile if configure argument contains "ver...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.3.0
: P5 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2007-09-02 11:00 UTC by Serge Belyshev
Modified: 2007-09-05 05:10 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Belyshev 2007-09-02 11:00:16 UTC
When gcc is configured with, for example, "--without-pkgversion", this part of libjava configure script parses "gcj -v" output incorrectly, thus encoding garbage as preprocessor macro and failing:

gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`

An obvious fix would be:

Index: gcc43/libjava/configure.ac
===================================================================
--- gcc43.orig/libjava/configure.ac
+++ gcc43/libjava/configure.ac
@@ -1369,7 +1369,7 @@ AC_SUBST(toolexecmainlibdir)
 AC_SUBST(toolexeclibdir)
 
 # Determine gcj and libgcj version number.
-gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`
+gcjversion=`$GCJ -v 2>&1 | awk '/^gcc version/ { print $3 }'`
 libgcj_soversion=`awk -F: '/^[[^#]].*:/ { print $1 }' $srcdir/libtool-version`
 GCJVERSION=$gcjversion
 AC_SUBST(GCJVERSION)


Introduced by:

r127025 | doko | 2007-07-29 00:32:27 +0400 (Sun, 29 Jul 2007) | 6 lines
2007-07-28  Matthias Klose  <doko@ubuntu.com>

        * configure.ac: Encode the libgcj soversion in dbexecdir,
        pass --with-native-libdir to classpath configure.
        * configure: Regenerate.
Comment 1 Matthias Klose 2007-09-02 11:21:53 UTC
Subject: Re:   New: [4.3 Regression] libjava fails to compile
 if configure argument contains "version"

belyshev at depni dot sinp dot msu dot ru schrieb:
> When gcc is configured with, for example, "--without-pkgversion", this part of
> libjava configure script parses "gcj -v" output incorrectly, thus encoding
> garbage as preprocessor macro and failing:
> 
> gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`
> 
> An obvious fix would be:

> -gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`
> +gcjversion=`$GCJ -v 2>&1 | awk '/^gcc version/ { print $3 }'`

doesn't look robust either; what about

  gcjversion=`cat $srcdir/../gcc/BASE-VER`

Comment 2 Serge Belyshev 2007-09-02 12:28:45 UTC
(In reply to comment #1)
>> doesn't look robust either; what about
> 
>   gcjversion=`cat $srcdir/../gcc/BASE-VER`
> 

Agreed, that's much better. To be even more robust, add quotes:

gcjversion=`cat "$srcdir/../gcc/BASE-VER"`
Comment 3 Matthias Klose 2007-09-04 21:32:55 UTC
Subject: Bug 33278

Author: doko
Date: Tue Sep  4 21:32:41 2007
New Revision: 128104

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128104
Log:
2007-09-05  Matthias Klose  <doko@ubuntu.com>

	PR libgcj/33278
	* configure.ac: Robustify extraction of gcj version.
	* configure: Regenerate.

Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/configure
    trunk/libjava/configure.ac

Comment 4 Mark Mitchell 2007-09-05 02:24:18 UTC
Since a patch has been checked in, can this issue be closed?
Comment 5 Serge Belyshev 2007-09-05 05:10:57 UTC
Fixed.