[Top][All Lists]

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

Re: Trying to be fancy with feature testing

From: Eric Blake
Subject: Re: Trying to be fancy with feature testing
Date: Sat, 06 Mar 2010 10:49:09 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090812 Thunderbird/ Mnenhy/

According to NightStrike on 3/6/2010 10:23 AM:
> It comes up often that we want to test to see whether a feature of GCC
> works.  For instance, we want to see if -m64 is a valid gcc option to
> know if we should build the 64-bit libraries by default.  Other things
> include checking for unicode support, and the -municode option.  To do
> this, we usually do something like the following:
> _save_CFLAGS="$CFLAGS"

Overkill.  Shell assignments are NOT subject to word splitting, so it
_does not matter_ whether $CFLAGS contains spaces.  It is perfectly safe
to use:


> CFLAGS="$CFLAGS option"

This line does indeed need double quotes, but that is in order to include
literal whitespace as part of the word that will later be interpreted as a
shell assignment.  It is also possible (although less common) to write
this as:


with no change in semantics.

> CFLAGS="$_save_CFLAGS"
> I was trying to improve upon that using AS_VAR_COPY for the
> save/restore, but I can't figure out how to handle variables
> containing spaces.

They are handled like any other variable.


Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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