This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ifeq/else/endif problem


Patrick Guio <patrick.guio@fys.uio.no> writes:
> I am trying to insert a conditional part in a Makefile.am in the following
> way :
> 
> ## 2-dimensions library
> libmudfas2d_la_SOURCES = $(MUDSRC)
> ifeq ($(CXX),cxx)
>   libmudfas2d_la_CXXFLAGS = -ptr mudfas2d -DDIM=2
>   libmudfas2d_la_LDFLAGS = mudfas2d/*.o -version-info 0:0:0
> else
>   libmudfas2d_la_CXXFLAGS = -DDIM=2
>   libmudfas2d_la_LDFLAGS = -version-info 0:0:0
> endif
> 
> But when running automake I get
> 
> % automake -a -c --include-deps 
> src/Makefile.am:24: endif without if
> src/Makefile.am:31: else without if
> src/Makefile.am:34: endif without if
> src/Makefile.am:41: else without if
> src/Makefile.am:44: endif without if

Automake has its own conditional, which, unfortunately, share keywords
with GNU make conditionals.  If you can convert your checks above to
automake conditionals, that would be good.

In configure.in, do

   AM_CONDITIONAL(COMPILER_IS_COMPAQ_CXX, [test x"$CXX" = xcxx])

and in Makefile.am, do

   if COMPILER_IS_COMPAQ_CXX
     foo
   else
     bar
   endif

Otherwise, in case of extreme duress, try this (untested):

In configure.in, 

   MK=''; AC_SUBST(MK)

And in Makefile.am:

   @MK@ifeq ...
            foo
   @MK@else
            bar
   @MK@endif

However, you cannot put in automake magic variables (things like
foo_SOURCES, foo_LDFLAGS, etc) inside an ifeq/else/endif.  Rather, you
can, but automake will get extremely confused if you do ;-)

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]