[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 1-bigendian-grep.patch
From: |
Akim Demaille |
Subject: |
Re: 1-bigendian-grep.patch |
Date: |
13 Aug 2001 14:48:20 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor) |
| @@ -847,9 +846,8 @@
| ], [#if BYTE_ORDER != BIG_ENDIAN
| not big endian
| #endif
| -])], [ac_cv_c_bigendian=yes],
| - [ac_cv_c_bigendian=no])])
| -if test $ac_cv_c_bigendian = unknown; then
| +])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])],
| +[# It does not; compile a test program.
This is obfuscation to me :)
| + AC_COMPILE_IFELSE(
| +[short ascii_mm[[]] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
| +short ascii_ii[[]] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
| +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
| +short ebcdic_ii[[]] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
| +short ebcdic_mm[[]] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
| +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
| +int main () { _ascii (); _ebcdic (); return 0; }],
Ouch! Please, don't! Use AC_LANG_PROGRAM or whatever AC_LANG_* you
think is accurate, but not directly to AC_COMPILE_IFELSE. Also,
quoting the whole argument is preferred to just the [].
| +[if test `grep -l BIGenDianSyS conftest.$ac_objext` ; then
if fgrep BIGenDianSyS conftest.$ac_objext >/dev/null; then
| + ac_cv_c_bigendian=yes
| fi
| +if test `grep -l LiTTleEnDian conftest.$ac_objext` ; then
Likewise.
| + if test "$ac_cv_c_bigendian" = unknown; then
| + ac_cv_c_bigendian=no
| + else
| + # finding both strings is unlikely to happen, but who knows?
| + ac_cv_c_bigendian=unknown
| + fi
| +fi])])])])
Great work, thanks!