(automake-1.16.info)Java Support with gcj


Next: Vala Support Prev: Fortran 9x Support Up: Programs
Enter node , (file) or (file)node

8.16 Compiling Java sources using gcj
=====================================

Automake includes support for natively compiled Java, using ‘gcj’, the
Java front end to the GNU Compiler Collection (rudimentary support for
compiling Java to bytecode using the ‘javac’ compiler is also present,
_albeit deprecated_; Note: Java).

   Any package including Java code to be compiled must define the output
variable ‘GCJ’ in ‘configure.ac’; the variable ‘GCJFLAGS’ must also be
defined somehow (either in ‘configure.ac’ or ‘Makefile.am’).  The
simplest way to do this is to use the ‘AM_PROG_GCJ’ macro.

   By default, programs including Java source files are linked with
‘gcj’.

   As always, the contents of ‘AM_GCJFLAGS’ are passed to every
compilation invoking ‘gcj’ (in its role as an ahead-of-time compiler,
when invoking it to create ‘.class’ files, ‘AM_JAVACFLAGS’ is used
instead).  If it is necessary to pass options to ‘gcj’ from
‘Makefile.am’, this variable, and not the user variable ‘GCJFLAGS’,
should be used.

   ‘gcj’ can be used to compile ‘.java’, ‘.class’, ‘.zip’, or ‘.jar’
files.

   When linking, ‘gcj’ requires that the main class be specified using
the ‘--main=’ option.  The easiest way to do this is to use the
‘_LDFLAGS’ variable for the program.


automatically generated by info2www version 1.2.2.9