Re: Call for port reports

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter_e@gmx.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2003-10-31T16:20:57Z
Lists: pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > One other idea would be to set CFLAGS to "" before including template,
> > and just test to see if it is still "" after --- that might be cleaner
> > than saving the original value and comparing.
> 
> Yeah, that bothered me a bit too --- what if the template tries to set
> CFLAGS to its already-existing value?  I was thinking that unsetting
> CFLAGS before running the template would be the best answer.

I assume he did it that way so if you do:

	CFLAGS=

in the template file that it would be honored.  I see lots of this in
configure:

	ac_env_CFLAGS_set=${CFLAGS+set}

but that uses 'set' if the variable is null or unset:

       ${parameter:+word}
              Use Alternate  Value.   If  parameter  is  null  or
              unset, nothing is substituted, otherwise the expan-
              sion of word is substituted.

However, I thought null meant "", but I now think null basically means
the same as unset in this manual page.  Notice that '+' tests only for
unset, and knows when you have done VAR= and VAR="":
	
	$ echo ${Y+no}
	
	$ Y=
	$ echo ${Y+no}
	no
	$ Y=""
	$ echo ${Y+no}
	no
	$ unset Y
	$ echo ${Y+no}
	
	$

so the proper test would be to unset the variable, then use ${var+val}
to test CFLAGS after the template file is included.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073