[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:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
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:
_save_CFLAGS=$CFLAGS
> 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:
CFLAGS=$CFLAGS\ option
with no change in semantics.
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM.......
> 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.
AS_VAR_COPY([_save_CFLAGS], [CFLAGS])
--
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
signature.asc
Description: OpenPGP digital signature