[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: Re: [cp-patches] [RFC] require gcj 4 in build machinery]
From: |
Mark Wielaard |
Subject: |
Re: [Fwd: Re: [cp-patches] [RFC] require gcj 4 in build machinery] |
Date: |
Sun, 11 Sep 2005 23:32:42 +0200 |
Hi Andrew,
On Fri, 2005-09-09 at 21:47 -0400, Andrew Pinski wrote:
> Maybe a better way to make a small C file which tests the GCC version
> that way? You can compile it with the gcj driver so it should be no
> problems with having two different versions of GCC installed.
> And this will get away from using sed or regex fully.
That is a cute trick. I didn't know you could use gcj as C compiler.
What do you think of the following patch to implement it as autoconf
macro?
Cheers,
Mark
Index: m4/acinclude.m4
===================================================================
RCS file: /cvsroot/classpath/classpath/m4/acinclude.m4,v
retrieving revision 1.6
diff -u -r1.6 acinclude.m4
--- m4/acinclude.m4 27 Aug 2005 20:12:55 -0000 1.6
+++ m4/acinclude.m4 11 Sep 2005 21:29:43 -0000
@@ -63,48 +63,23 @@
else
AC_PATH_PROG(GCJ, "gcj")
fi
-
+ dnl Test the given GCJ, but use it as C (!) compiler to check version
if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 Free Software Foundation, Inc.
- ## This is free software; see the source for copying conditions. There
is NO
- ## warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
- AC_MSG_CHECKING(gcj version)
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^@<:@^0-9@:>@*//' -e
's/@<:@^.0-9@:>@@<:@^.0-9@:>@*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
- if test "x$GCJ" != x; then
- AC_MSG_RESULT($GCJ_VERSION)
+ AC_MSG_CHECKING([gcj version 4.0])
+ AC_LANG_PUSH([C])
+ AC_LANG_CONFTEST(
+ [[#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+ ]])
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ AC_MSG_RESULT([4.0 or higher found])
else
- AC_MSG_WARN($GCJ_VERSION: gcj 3.3 or higher required)
+ AC_MSG_WARN([4.0 or higher required])
fi
+ AC_LANG_POP
fi
])
signature.asc
Description: This is a digitally signed message part