File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libiconv / m4 / endian.m4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:57:49 2012 UTC (12 years, 4 months ago) by misho
Branches: libiconv, MAIN
CVS tags: v1_16p0, v1_14p0, v1_14, v1_13_1, HEAD
libiconv

    1: dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
    2: dnl This file is free software, distributed under the terms of the GNU
    3: dnl General Public License.  As a special exception to the GNU General
    4: dnl Public License, this file may be distributed as part of a program
    5: dnl that contains a configuration script generated by Autoconf, under
    6: dnl the same distribution terms as the rest of that program.
    7: 
    8: dnl From Bruno Haible, Marcus Daniels.
    9: 
   10: AC_PREREQ(2.13)
   11: 
   12: AC_DEFUN([CL_WORDS_LITTLEENDIAN],
   13: [AC_CACHE_CHECK(byte ordering, cl_cv_sys_endian, [
   14: AC_TRY_RUN([int main () {
   15:   /* Are we little or big endian?  From Harbison&Steele.  */
   16:   union
   17:   {
   18:     long l;
   19:     char c[sizeof (long)];
   20:   } u;
   21:   u.l = 1;
   22:   exit (u.c[0] == 1);
   23: }],
   24: cl_cv_sys_endian="big endian",
   25: cl_cv_sys_endian="little endian",
   26: : # must guess the endianness
   27: )
   28: if test -z "$cl_cv_sys_endian"; then
   29: AC_EGREP_CPP(yes,[#if defined(m68k) || defined(__m68k__) || defined(mc68000) || defined(mc68020) || defined(__mc68020__) || defined(sparc) || defined(__sparc__) || defined(MIPSEB) || defined(__MIPSEB__) || defined(hppa) || defined(__hppa) || defined(m88000) || defined(__m88k__)
   30:   yes
   31: #endif
   32: ], cl_cv_sys_endian="big endian")
   33: fi
   34: if test -z "$cl_cv_sys_endian"; then
   35: AC_EGREP_CPP(yes,[#if defined(i386) || defined(__i386) || defined(__i386__) || defined(_I386) || defined(MIPSEL) || defined(__MIPSEL__) || defined(__alpha)
   36:   yes
   37: #endif
   38: ], cl_cv_sys_endian="little endian")
   39: fi
   40: if test -z "$cl_cv_sys_endian"; then
   41: cl_cv_sys_endian="guessing little endian"
   42: fi
   43: ])
   44: case "$cl_cv_sys_endian" in
   45:   *little*)
   46:     AC_DEFINE(WORDS_LITTLEENDIAN, 1,
   47:       [Define if the machine's byte ordering is little endian.]) ;;
   48:   *big*) ;;
   49: esac
   50: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>