This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: ifeq/else/endif problem
- To: Patrick Guio <patrick dot guio at fys dot uio dot no>
- Subject: Re: ifeq/else/endif problem
- From: Raja R Harinath <harinath at cs dot umn dot edu>
- Date: 27 Oct 2000 14:52:20 -0500
- Cc: automake at gnu dot org
- List-Id: Discussion list for automake <automake.gnu.org>
- References: <Pine.LNX.4.21.0010271127260.30064-100000@fyspc-rp18.uio.no>
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