automake: Java Support with gcj
1
1 8.16 Compiling Java sources using gcj
1 =====================================
1
1 Automake includes support for natively compiled Java, using ‘gcj’, the
1 Java front end to the GNU Compiler Collection (rudimentary support for
1 compiling Java to bytecode using the ‘javac’ compiler is also present,
1 _albeit deprecated_; ⇒Java).
1
1 Any package including Java code to be compiled must define the output
1 variable ‘GCJ’ in ‘configure.ac’; the variable ‘GCJFLAGS’ must also be
1 defined somehow (either in ‘configure.ac’ or ‘Makefile.am’). The
1 simplest way to do this is to use the ‘AM_PROG_GCJ’ macro.
1
1 By default, programs including Java source files are linked with
1 ‘gcj’.
1
1 As always, the contents of ‘AM_GCJFLAGS’ are passed to every
1 compilation invoking ‘gcj’ (in its role as an ahead-of-time compiler,
1 when invoking it to create ‘.class’ files, ‘AM_JAVACFLAGS’ is used
1 instead). If it is necessary to pass options to ‘gcj’ from
1 ‘Makefile.am’, this variable, and not the user variable ‘GCJFLAGS’,
1 should be used.
1
1 ‘gcj’ can be used to compile ‘.java’, ‘.class’, ‘.zip’, or ‘.jar’
1 files.
1
1 When linking, ‘gcj’ requires that the main class be specified using
1 the ‘--main=’ option. The easiest way to do this is to use the
1 ‘_LDFLAGS’ variable for the program.
1