Re: conditional += doesn't work as suggested by documentation

2006-05-13 Thread Ralf Wildenhues
Hi Richard,

* Richard Brooksby wrote on Fri, May 12, 2006 at 06:00:47PM CEST:
 At http://sources.redhat.com/automake/automake.html it says:
 7.1.3.2 Conditional compilation using Automake conditionals
*snip*

This documents Automake version 1.9.6.

 If your program uses a lot of files, you will probably prefer a  
 conditional +=.
 
  bin_PROGRAMS = hello
  hello_SOURCES = hello-common.c
  if LINUX
  hello_SOURCES += hello-linux.c
  else
  hello_SOURCES += hello-generic.c
  endif
 
 The former works, the latter does not.  I'm running automake 1.6.3 on  
 Mac OS X 10.4.  Try putting the attached minimal files in a directory  
 and running aclocal followed by automake.

Current is 1.9.6.  Use that instead of 1.6.3, which is several years
old.  I think the bug you report was fixed in 1.7, but I wasn't using
Automake back in those times.  Oodles of other bugs have been fixed
since.

Cheers,
Ralf




Re: conditional += doesn't work as suggested by documentation

2006-05-13 Thread Richard Brooksby

On 2006-05-13, at 09:06, Ralf Wildenhues wrote:


This documents Automake version 1.9.6.

...

Current is 1.9.6.  Use that instead of 1.6.3, which is several years
old.  I think the bug you report was fixed in 1.7, but I wasn't using
Automake back in those times.  Oodles of other bugs have been fixed
since.


Doh!

Thanks for pointing that out.

FWIW, it appears that automake 1.6.3 is installed by default on Mac  
OS X 10.4 as part of the BSD subsystem, so there are potentially a  
lot of automake 1.6.3 users out there, unfortunately.






Re: conditional += doesn't work as suggested by documentation

2006-05-13 Thread Ralf Wildenhues
Hi Richard,

* Richard Brooksby wrote on Sat, May 13, 2006 at 12:24:26PM CEST:
 
 FWIW, it appears that automake 1.6.3 is installed by default on Mac  
 OS X 10.4 as part of the BSD subsystem, so there are potentially a  
 lot of automake 1.6.3 users out there, unfortunately.

It'd be great if you could encourage them to ship with a newer version.
Other than that, you can always just download and install your own (but
then the usual caveats about paths where aclocal finds third-party macro
files apply).

Cheers,
Ralf




conditional += doesn't work as suggested by documentation

2006-05-12 Thread Richard Brooksby

At http://sources.redhat.com/automake/automake.html it says:

7.1.3.2 Conditional compilation using Automake conditionals

An often simpler way to compile source files conditionally is to  
use Automake conditionals. For instance, you could use this  
Makefile.am construct to build the same hello example:


 bin_PROGRAMS = hello
 if LINUX
 hello_SOURCES = hello-linux.c hello-common.c
 else
 hello_SOURCES = hello-generic.c hello-common.c
 endif
In this case, configure.ac should setup the LINUX conditional using  
AM_CONDITIONAL (see Conditionals).


When using conditionals like this you don't need to use the EXTRA_  
variable, because Automake will examine the contents of each  
variable to construct the complete list of source files.


If your program uses a lot of files, you will probably prefer a  
conditional +=.


 bin_PROGRAMS = hello
 hello_SOURCES = hello-common.c
 if LINUX
 hello_SOURCES += hello-linux.c
 else
 hello_SOURCES += hello-generic.c
 endif


The former works, the latter does not.  I'm running automake 1.6.3 on  
Mac OS X 10.4.  Try putting the attached minimal files in a directory  
and running aclocal followed by automake.




configure.ac
Description: Binary data


Makefile.am
Description: Binary data


I get output like this:

[EMAIL PROTECTED] automake
Makefile.am:4: hello_SOURCES was already defined in condition TRUE,  
which implies condition LINUX_TRUE

  hello_SOURCES (User, where = Makefile.am:4) +=
  {
TRUE = hello-common.c
  }
Makefile.am:4: hello_SOURCES was already defined in condition TRUE,  
which implies condition LINUX_FALSE

  hello_SOURCES (User, where = Makefile.am:4) +=
  {
TRUE = hello-common.c
LINUX_TRUE = hello-linux.c
  }
Makefile.am:4: warning: automake does not support conditional  
definition of hello_SOURCES in hello_SOURCES
Makefile.am:4: warning: automake does not support conditional  
definition of hello_SOURCES in hello_SOURCES
Use of uninitialized value in concatenation (.) or string at /usr/bin/ 
automake line 8449.
: am_hello_OBJECTS was already defined in condition LINUX_TRUE, which  
is implied by condition TRUE

  am_hello_OBJECTS (Automake, where = undefined) =
  {
LINUX_TRUE = hello-common.$(OBJEXT) hello-linux.$(OBJEXT)
  }
Use of uninitialized value in concatenation (.) or string at /usr/bin/ 
automake line 8449.
: am_hello_OBJECTS was already defined in condition TRUE, which  
implies condition LINUX_FALSE

  am_hello_OBJECTS (Automake, where = undefined) =
  {
TRUE = hello-common.$(OBJEXT)
LINUX_TRUE = hello-common.$(OBJEXT) hello-linux.$(OBJEXT)
  }
[EMAIL PROTECTED]