Hi all, I have a upc program with *.upc source files. I have some macros that make UPC code look effectively like C code and so it is easy to compile this program as a C program as well. My Makefile.am has the following lines
bin_PROGRAMS = foo common_sources = file1.upc file2.upc if BUILD_UPC foo_LINK = $(UPCLINK) foo_SOURCES = $(common_sources) else foo_LINK = $(LINK) foo_SOURCES = $(common_sources:.upc=_c.c) fi I also have some code in my Makefile.am to tell make how to create (with links) the file1_c.c and file2_c.c files. The BUILD_UPC variable is set with AC_SUBST in my configure.ac based on a configure option (--disable-upc). If no option is given then BUILD_UPC is set to 1, but if --disable-upc is given BUILD_UPC is zero. automake is correctly automatically determining which compiler to use in both cases, but for some reason it wants to use the UPCLINK linker in both cases. I read section 8.13.3.1 How the Linker is Chosen, in the automake documentation and it says that automake determines which linker to use based on the foo_SOURCES variable, so I can't see why I need to include the two foo_LINK lines in my Makefile.am (I would like to avoid this). Does anyone know why this is happening? Am I forgetting something? Thank you, Jason