1 # gcj.m4 serial 2 (gettext-0.17)
2 dnl Copyright (C) 2002, 2006, 2015 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 # Check for a Java compiler that creates executables.
8 # Assigns the variables GCJ and GCJFLAGS, and set HAVE_GCJ to nonempty,
9 # if found. Otherwise sets HAVE_GCJ to empty.
13 AC_ARG_VAR([GCJ], [Java native code compiler command])
14 AC_ARG_VAR([GCJFLAGS], [Java native code compiler flags])
16 AC_MSG_CHECKING([for Java to native code compiler])
17 # Search for the gcj command or use the one provided by the user.
18 if test -z "$GCJ"; then
19 pushdef([AC_MSG_CHECKING],[:])dnl
20 pushdef([AC_CHECKING],[:])dnl
21 pushdef([AC_MSG_RESULT],[:])dnl
22 AC_CHECK_TOOL([GCJ], [gcj], [none])
23 popdef([AC_MSG_RESULT])dnl
24 popdef([AC_CHECKING])dnl
25 popdef([AC_MSG_CHECKING])dnl
27 # Choose GCJFLAGS or use the one provided by the user.
28 if test "$GCJ" != none; then
29 test "${GCJFLAGS+set}" != set || GCJFLAGS="-O2 -g"
31 # Check whether the version is ok and it can create executables.
32 ac_gcj_link="$GCJ $GCJFLAGS conftest.java --main=conftest -o conftest$ac_exeext"
34 if test "$GCJ" != none \
35 && $GCJ --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | grep '^[3-9]' >/dev/null \
37 # See if libgcj.so is well installed and if exception handling works.
38 cat > conftest.java <<EOF
39 public class conftest {
40 public static void main (String[] args) {
42 java.util.ResourceBundle.getBundle("foobar");
43 } catch (Exception e) {
50 AC_TRY_EVAL([ac_gcj_link])
52 if test $error = 0 && test "$cross_compiling" != yes; then
53 # Run conftest and catch its exit status, but silently.
54 error=`./conftest >/dev/null 2>&1; echo $?`
55 test $error = 0 || error=1
56 rm -f core conftest.core
58 rm -f conftest.java conftest$ac_exeext
66 if test "$GCJ" != none; then