Subject: java: cannot use JAVA with both dist_ and nodist_ prefixes

From: Stefano Lattarini <[email-masked]>
Date: Wed, 6 Apr 2011 21:00:32 +0200

Hello autoconfers.

Currently, limitations in the Automake support for java enforce the
restriction that only one `_JAVA' primary can be used in a given
Makefile.am.

Unfortunately, this (quite acceptable) limitation has the side effect
that one cannot have both distributed and not distributed *.java files
in a the same Makefile.am:

 $ cat Makefile.am
 dist_java_JAVA = a.java
 nodist_java_JAVA = b.java
 $ automake -a
 /usr/share/automake-1.11/am/java.am: JAVAC multiply defined in condition TRUE ...
 Makefile.am:2:   while processing `nodist_java_JAVA'
 /usr/share/automake-1.11/am/java.am: ... `JAVAC' previously defined here
 Makefile.am:1:   while processing `dist_java_JAVA'
 /usr/share/automake-1.11/am/java.am: CLASSPATH_ENV multiply defined in condition TRUE ...
 Makefile.am:2:   while processing `nodist_java_JAVA'
 /usr/share/automake-1.11/am/java.am: ... `CLASSPATH_ENV' previously defined here
 Makefile.am:1:   while processing `dist_java_JAVA'
 /usr/share/automake-1.11/am/java.am: JAVAROOT multiply defined in condition TRUE ...
 Makefile.am:2:   while processing `nodist_java_JAVA'
 /usr/share/automake-1.11/am/java.am: ... `JAVAROOT' previously defined here
 Makefile.am:1:   while processing `dist_java_JAVA'
 Makefile.am:2: multiple _JAVA primaries in use

See also the attached testcase (for maint, v1.11-329-gd4df619).

This bug is particularly annoying because *.java files listed with
the `JAVA' primary are not included by default in the distribution.

Ganted, one can always use EXTRA_DIST to work around this issue,
but it would be nice if things Just Worked.

Regards,
  Stefano