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