autoconf
[Top][All Lists]
Advanced

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

Re: problem with ifelse


From: Vincent Torri
Subject: Re: problem with ifelse
Date: Fri, 6 Mar 2009 15:30:26 +0100 (CET)


Here is an example of use:

want_ecore_win32="no"
ECORE_CHECK_MODULE([Win32], [${want_ecore_win32}], [yes],
  [ecore_win32_libs="-lole32 -lgdi32"])

Bingo.  You are attempting to mix a shell variable ${want_ecore_win32}
(expanded at ./configure time) with an m4 argument $2 (expanded at
autoconf time).  That won't work.  You have to make a decision - either
the code is statically determined at autoconf time (in other words, you
pass a literal "yes" or "no" as the second argument), or you have to emit
both option choices and emit a shell conditional (AS_IF or even
if...then...fi) to choose the right code path at configure time.  The
reason your code is always selecting the false path is becase
"${want_ecore_win32}" is not identical to "no" during m4 expansion at
autoconf time, and m4 has no way to predict what value that shell variable
will later have at configure time.

haaa, i understand ! And indeed, i used if / then / else and it worked, but i wanted to understand why ifelse (or m4_if) does not work. Now i see the problem and it's actually obvious when we know it :p

As the value of want_ecore_win32 changes acoording to the host, i think I'll have to use AS_IF or if / then /else. Which one is better ?

Vincent Torri




reply via email to

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