On Sun, 2005-09-11 at 17:53 -0400, Andrew Pinski wrote:
> > What do you think of the following patch to implement it as autoconf
> > macro?
> 
> This looks good and seems like it is simplifies the current
> code and comments too because it is much simpler in general.

Thanks. Committed as follows:

2005-09-11  Mark Wielaard  <[EMAIL PROTECTED]>

    * m4/acinclude.m4 (CLASSPATH_CHECK_GCJ): Check for gcj 4 with
    #if __GNUC__ <= 3.

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 
 ])
 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to