<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Wed, 2010-12-29 at 15:51 -0500, Trevor Woerner wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
For this entire patch series I still can't understand why we need to
define an explicit _SET variable which defines whether or not the base
variable is defined, or not.

For every one of the new variables you have defined you have included
the following:

&gt; +# States if the user has exported BINDIR
&gt; +if [ X&quot;$BINDIR&quot; != X ]; then
&gt; +    BINDIR_SET=yes
&gt; +fi

And then you subsequently check to see if (using the specific
variables for this specific patch) BINDIR_SET is defined to decide
whether or not to use the value of BINDIR.

But why?

If BINDIR is not defined then BINDIR_SET will not be defined. So if
you want to check whether BINDIR is defined why not just check to see
if BINDIR is defined (instead of creating a new variable (BINDIR_SET)
and checking whether it is defined or not)?

Maybe there's something about what you're doing that I don't
understand. But if you're defining BINDIR_SET only if BINDIR is
defined and then using BINDIR_SET to indicate whether or not BINDIR is
defined then I think you're adding complexity for no reason.

PS. I have nothing against _what_ is being done, just the way in which
it is being done.
</PRE>
</BLOCKQUOTE>
<BR>
I think I found a way to expose the need for this _SET variable. Perhaps you can then help<BR>
me make it clearer as others will most likely have the same question, or risk breaking<BR>
it when maintaining the script.
<BLOCKQUOTE>
<PRE>

# States if the user has exported BINDIR
if [ X&quot;$BINDIR&quot; != X ]; then
&nbsp;&nbsp;&nbsp; BINDIR_SET=yes
fi
</PRE>
</BLOCKQUOTE>
The comment is important. This variable is to tell us if the user has exported an environment<BR>
variable called BINDIR, not to tell if it is empty or not.
<BLOCKQUOTE>
<PRE>

# Set the default value for BINDIR
if [ X&quot;$BINDIR_SET&quot; = X ]; then
&nbsp;&nbsp;&nbsp; BINDIR=$EPREFIX/bin
fi
</PRE>
</BLOCKQUOTE>
Th above part says: if the user has not exported the BINDIR variable, then assign it a default value.<BR>
So far, no need for BINDIR_SET, I agree. Note that from now on, BINDIR is always set, always.
<PRE>

&nbsp;&nbsp;&nbsp; # Set the path so that locally built apps will be found and used
&nbsp;&nbsp;&nbsp; PATH=${DESTDIR}${BINDIR}${PATH+:$PATH}
&nbsp;&nbsp;&nbsp; export PATH
</PRE>
The above line needs BINDIR to hold a value, always.
<PRE>

&nbsp;&nbsp;&nbsp; ${BINDIR_SET:+--bindir=&quot;$BINDIR&quot;}
</PRE>
This line above says: if the user has exported the BINDIR variable, add &quot;--bindir=$BINDIR&quot;<BR>
to the configure command line. It also says: do not add --bindir if the user has not exported<BR>
the BINDIR environment variable. Recall that BINDIR will always have a value, always.<BR>
<BR>
There may be a more elegant way of handling this situation. The variable should perhaps<BR>
be names BINDIR_USER_SET.<BR>
<BR>
In the case of PREFIX, it can bet set by the user as an env var or on the command line.<BR>
There are 2 places where PREFIX_SET is set.<BR>
<BR>
I appreciate you are not giving up, having code that works is good,<BR>
having maintainable code that works is even better.<BR>
<BR>
Gaetan<BR>
<BR>
</BODY>
</HTML>