From: Bruno Haible Date: Mon, 6 May 2002 11:03:30 +0000 (+0000) Subject: Make the gcj determination work with GCC 3.1 as well. X-Git-Tag: v0.11.3~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7861fd909a3a5590557c1829c89d6e821de06ddb;p=thirdparty%2Fgettext.git Make the gcj determination work with GCC 3.1 as well. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 502ef44cc..835e19be3 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2002-05-04 Bruno Haible + + * javacomp.c (compile_java_class): Ignore non-digits in the first + line of the output of "gcj --version". Needed for gcj 3.1. + 2002-04-30 Bruno Haible * stdbool.h.in (_Bool): Omit the definition if _Bool is already known diff --git a/lib/javacomp.c b/lib/javacomp.c index 858296bbd..3f03d18ab 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -1,5 +1,5 @@ /* Compile a Java program. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2002 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -55,7 +55,7 @@ Program from A C O g T $JAVAC unknown N n/a -O -g true - gcj -C GCC 3.0 Y --classpath=P -O -g gcj --version | grep '^[3-9]' >/dev/null + gcj -C GCC 3.0 Y --classpath=P -O -g gcj --version | sed -e 's,^[^0-9]*,,' -e 1q | grep '^[3-9]' >/dev/null javac JDK 1.1.8 Y -classpath P -O -g javac 2>/dev/null; test $? = 1 javac JDK 1.3.0 Y -classpath P -O -g javac 2>/dev/null; test $? -le 2 jikes Jikes 1.14 N -classpath P -O -g jikes 2>/dev/null; test $? = 1 @@ -193,7 +193,8 @@ compile_java_class (java_sources, java_sources_count, if (!gcj_tested) { /* Test for presence of gcj: - "gcj --version 2> /dev/null | grep '^[3-9]' > /dev/null" */ + "gcj --version 2> /dev/null | \ + sed -e 's,^[^0-9]*,,' -e 1q | grep '^[3-9]' > /dev/null" */ char *argv[3]; pid_t child; int fd[1]; @@ -207,12 +208,21 @@ compile_java_class (java_sources, java_sources_count, gcj_present = false; if (child != -1) { - /* Read the subprocess output, a single line, and test whether - it starts with a digit >= 3. */ + /* Read the subprocess output, drop all lines except the first, + and test whether the first digit found in the first line is + >= 3. */ char c; - if (safe_read (fd[0], &c, 1) > 0) - gcj_present = (c >= '3' && c <= '9'); + while (safe_read (fd[0], &c, 1) > 0) + { + if (c >= '0' && c <= '9') + { + gcj_present = (c >= '3' && c <= '9'); + break; + } + if (c == '\n') + break; + } while (safe_read (fd[0], &c, 1) > 0) ; diff --git a/m4/ChangeLog b/m4/ChangeLog index 0d72d0779..f233bf08b 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2002-05-04 Bruno Haible + + * javacomp.m4 (gt_JAVACOMP): Ignore non-digits in the first line of + the output of "gcj --version". Needed for gcj 3.1. + 2002-04-30 Bruno Haible * stdbool.m4 (gt_STDBOOL_H): If does not exist, check for diff --git a/m4/javacomp.m4 b/m4/javacomp.m4 index fd49b63fe..40b44edcb 100644 --- a/m4/javacomp.m4 +++ b/m4/javacomp.m4 @@ -1,4 +1,4 @@ -# javacomp.m4 serial 3 (gettext-0.11.2) +# javacomp.m4 serial 4 (gettext-0.11.3) dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -32,7 +32,7 @@ AC_DEFUN([gt_JAVACOMP], popdef([AC_MSG_CHECKING])dnl changequote(,)dnl if test -n "$HAVE_GCJ_IN_PATH" \ - && gcj --version 2>/dev/null | grep '^[3-9]' >/dev/null \ + && gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | grep '^[3-9]' >/dev/null \ && ( # See if libgcj.jar is well installed. cat > conftest.java <