-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 12/26/2008 4:51 AM:
>> Wouldn't this also do the trick, by narrowing the search to an argument
>> that starts with -arch, without resorting to an iteration over arguments?
>>
>> case " $CC $CFLAGS $CPPFLAGS $LDFLAGS" in  #(
>>   *\ -arch*ppc* | *\ -arch*i386* | *\ -arch*x86_64*)
>>     ac_cv_c_bigendian=universal;;
>> esac
> 
> No it wouldn't. $CC, $CFLAGS etc. can also use tabs instead of spaces as word
> separator. To iterate over the words of a command, the simplest way is really
> a 'for' loop.

That still seems quite verbose.  This is a more compact way to check for
two instances of the literal " -arch ", using set and $* to flatten tabs
into space:

set x $CC $CFLAGS $CPPFLAGS $LDFLAGS x
case $* in
  *\ -arch\ *\ -arch\ *) ac_cv_c_bigendian=universal;;
esac

How likely is it that -arch appears multiple times, but always with the
same argument (or asked another way, my compact version appears immune to
false negatives, but how likely is it to trigger false positives that only
your more verbose for loop would detect)?

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

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklVHr8ACgkQ84KuGfSFAYAx+gCg1+5g+GMcrs8Ka7OlVKimiIWD
HR4AoKyrYP6I2UbrgXQ6jNNqmMipYhYR
=RMmL
-----END PGP SIGNATURE-----


Reply via email to