automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditionally compiling Java


From: Braden McDaniel
Subject: Re: Conditionally compiling Java
Date: Tue, 11 Jun 2002 10:53:14 -0400

On Tue, 2002-06-11 at 04:04, Alexandre Duret-Lutz wrote:
> >>> "Braden" == Braden McDaniel <address@hidden> writes:
> 
>  Braden> I'm trying to conditionally compile some Java sources
>  Braden> (with javac) using an Automake conditional:
> 
>  Braden> JAVAROOT = $(top_builddir)/java
>     
>  Braden> JAVA_FILES = MyClass1.java MyClass2.java
>     
>  Braden> if WITH_JDK
>  Braden> noinst_JAVA = $(JAVA_FILES)
>  Braden> endif
>     
>  Braden> EXTRA_DIST = $(JAVA_FILES)
> 
>  Braden> I am having trouble when the condition is false. If
>  Braden> JAVAROOT is defined outside the conditional (as above),
>  Braden> I get this error:
> 
>  Braden> 
> CLASSPATH=../../../java:../../../../java/vrml/field/../../../java:$CLASSPATH  
> -d ../../../java \        
>  Braden> /bin/sh: -d: command not found
> 
> I can't reproduce this.  Have you overridden $(JAVAC) somewhere?  

Er, yes. I have this in configure.ac:

  AC_PATH_PROG(JAVAC, javac)

> Here is the test case I've used:
> 
> #! /bin/sh
> 
> # Make sure conditional Java works.
> # Report from Braden McDaniel.
> 
> required=gcj
> . $srcdir/defs || exit 1

Sorry I wasn't clear; I'm trying to use javac from the Sun JDK, not gcj.

I tried changing to

  AC_PATH_PROG(JDK_JAVAC, javac)

I never use $(JDK_JAVAC) other than to test that the variable is
non-empty. And this in my Makefile.am:

  JAVAROOT = $(top_builddir)/java
  
  if WITH_JDK
  noinst_JAVA = MyClass1.java MyClass2.java
  endif

Works if WITH_JDK is true; but if WITH_JDK is false, javac still gets
called, but with no source file arguments. I don't want this to happen
since someone may have configured --without-jdk because they don't have
it on their system.

-- 
Braden McDaniel                           e-mail: <address@hidden>
<http://endoframe.com>                    Jabber: <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]