1*63eb84d1Schristos# gcj.m4 serial 1 (gettext-0.11.3) 2*63eb84d1Schristosdnl Copyright (C) 2002 Free Software Foundation, Inc. 3*63eb84d1Schristosdnl This file is free software; the Free Software Foundation 4*63eb84d1Schristosdnl gives unlimited permission to copy and/or distribute it, 5*63eb84d1Schristosdnl with or without modifications, as long as this notice is preserved. 6*63eb84d1Schristos 7*63eb84d1Schristos# Check for a Java compiler that creates executables. 8*63eb84d1Schristos# Assigns the variables GCJ and GCJFLAGS, and set HAVE_GCJ to nonempty, 9*63eb84d1Schristos# if found. Otherwise sets HAVE_GCJ to empty. 10*63eb84d1Schristos 11*63eb84d1SchristosAC_DEFUN([gt_GCJ], 12*63eb84d1Schristos[ 13*63eb84d1Schristos AC_ARG_VAR([GCJ], [Java native code compiler command]) 14*63eb84d1Schristos AC_ARG_VAR([GCJFLAGS], [Java native code compiler flags]) 15*63eb84d1Schristos 16*63eb84d1Schristos AC_MSG_CHECKING([for Java to native code compiler]) 17*63eb84d1Schristos # Search for the gcj command or use the one provided by the user. 18*63eb84d1Schristos if test -z "$GCJ"; then 19*63eb84d1Schristos pushdef([AC_MSG_CHECKING],[:])dnl 20*63eb84d1Schristos pushdef([AC_CHECKING],[:])dnl 21*63eb84d1Schristos pushdef([AC_MSG_RESULT],[:])dnl 22*63eb84d1Schristos AC_CHECK_PROGS(GCJ, [gcj], [none]) 23*63eb84d1Schristos popdef([AC_MSG_RESULT])dnl 24*63eb84d1Schristos popdef([AC_CHECKING])dnl 25*63eb84d1Schristos popdef([AC_MSG_CHECKING])dnl 26*63eb84d1Schristos fi 27*63eb84d1Schristos # Choose GCJFLAGS or use the one provided by the user. 28*63eb84d1Schristos if test "$GCJ" != none; then 29*63eb84d1Schristos test "${GCJFLAGS+set}" != set || GCJFLAGS="-O2 -g" 30*63eb84d1Schristos fi 31*63eb84d1Schristos # Check whether the version is ok and it can create executables. 32*63eb84d1Schristos ac_gcj_link="$GCJ $GCJFLAGS conftest.java --main=conftest -o conftest$ac_exeext" 33*63eb84d1Schristoschangequote(,)dnl 34*63eb84d1Schristos if test "$GCJ" != none \ 35*63eb84d1Schristos && $GCJ --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | grep '^[3-9]' >/dev/null \ 36*63eb84d1Schristos && ( 37*63eb84d1Schristos # See if libgcj.so is well installed and if exception handling works. 38*63eb84d1Schristos cat > conftest.java <<EOF 39*63eb84d1Schristospublic class conftest { 40*63eb84d1Schristos public static void main (String[] args) { 41*63eb84d1Schristos try { 42*63eb84d1Schristos java.util.ResourceBundle.getBundle("foobar"); 43*63eb84d1Schristos } catch (Exception e) { 44*63eb84d1Schristos } 45*63eb84d1Schristos System.exit(0); 46*63eb84d1Schristos } 47*63eb84d1Schristos} 48*63eb84d1SchristosEOF 49*63eb84d1Schristoschangequote([,])dnl 50*63eb84d1Schristos AC_TRY_EVAL([ac_gcj_link]) 51*63eb84d1Schristos error=$? 52*63eb84d1Schristos if test $error = 0 && test "$cross_compiling" != yes; then 53*63eb84d1Schristos # Run conftest and catch its exit status, but silently. 54*63eb84d1Schristos error=`./conftest >/dev/null 2>&1; echo $?` 55*63eb84d1Schristos test $error = 0 || error=1 56*63eb84d1Schristos rm -f core conftest.core 57*63eb84d1Schristos fi 58*63eb84d1Schristos rm -f conftest.java conftest$ac_exeext 59*63eb84d1Schristos exit $error 60*63eb84d1Schristos ); then 61*63eb84d1Schristos : 62*63eb84d1Schristos else 63*63eb84d1Schristos GCJ=none 64*63eb84d1Schristos fi 65*63eb84d1Schristos AC_MSG_RESULT($GCJ) 66*63eb84d1Schristos if test "$GCJ" != none; then 67*63eb84d1Schristos HAVE_GCJ=1 68*63eb84d1Schristos else 69*63eb84d1Schristos HAVE_GCJ= 70*63eb84d1Schristos fi 71*63eb84d1Schristos AC_SUBST(GCJ) 72*63eb84d1Schristos AC_SUBST(GCJFLAGS) 73*63eb84d1Schristos AC_SUBST(HAVE_GCJ) 74*63eb84d1Schristos]) 75