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 ebb9@xxxxxxx
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf