autoconf-patches
[Top][All Lists]
Advanced

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

Re: unreliable detection of universal builds in AC_C_BIGENDIAN


From: Eric Blake
Subject: Re: unreliable detection of universal builds in AC_C_BIGENDIAN
Date: Fri, 26 Dec 2008 11:13:19 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.666

-----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             address@hidden
-----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

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