Home | History | Annotate | Download | only in X11
      1 #ifndef _XARCH_H_
      2 #define _XARCH_H_
      3 
      4 /*
      5  * Copyright 1997 Metro Link Incorporated
      6  *
      7  *                           All Rights Reserved
      8  *
      9  * Permission to use, copy, modify, distribute, and sell this software and its
     10  * documentation for any purpose is hereby granted without fee, provided that
     11  * the above copyright notice appear in all copies and that both that
     12  * copyright notice and this permission notice appear in supporting
     13  * documentation, and that the names of the above listed copyright holder(s)
     14  * not be used in advertising or publicity pertaining to distribution of
     15  * the software without specific, written prior permission.  The above listed
     16  * copyright holder(s) make(s) no representations about the suitability of
     17  * this software for any purpose.  It is provided "as is" without express or
     18  * implied warranty.
     19  *
     20  * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
     21  * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     22  * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
     23  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
     24  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
     25  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     26  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     27  */
     28 /* $XFree86: xc/include/Xarch.h,v 1.10tsi Exp $ */
     29 
     30 
     31 /*
     32  * Determine the machine's byte order.
     33  */
     34 
     35 /* See if it is set in the imake config first */
     36 #ifdef X_BYTE_ORDER
     37 
     38 #define X_BIG_ENDIAN 4321
     39 #define X_LITTLE_ENDIAN 1234
     40 
     41 #else
     42 
     43 #ifdef SVR4
     44 #if defined(NCR) || defined(Mips) || defined(__sgi)
     45 #include <sys/endian.h>
     46 #else
     47 #if !defined(sun)
     48 #include <sys/byteorder.h>
     49 #endif
     50 #endif
     51 #elif defined(CSRG_BASED)
     52 #if defined(__NetBSD__) || defined(__OpenBSD__)
     53 #include <sys/types.h>
     54 #endif
     55 #include <machine/endian.h>
     56 #elif defined(linux)
     57 #if defined __STRICT_ANSI__
     58 #undef __STRICT_ANSI__
     59 #include <endian.h>
     60 #define __STRICT_ANSI__
     61 #else
     62 #include <endian.h>
     63 #endif
     64 /* 'endian.h' might have been included before 'Xarch.h' */
     65 #if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
     66 #define LITTLE_ENDIAN __LITTLE_ENDIAN
     67 #endif
     68 #if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
     69 #define BIG_ENDIAN __BIG_ENDIAN
     70 #endif
     71 #if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN)
     72 #define PDP_ENDIAN __PDP_ENDIAN
     73 #endif
     74 #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
     75 #define BYTE_ORDER __BYTE_ORDER
     76 #endif
     77 #elif defined(Lynx)
     78 #if 0
     79 /* LynxOS 2.4.0 has wrong defines in bsd/ip.h */
     80 #include <bsd/in.h>
     81 #include <bsd/in_systm.h>
     82 #include <bsd/ip.h>
     83 #endif
     84 #endif
     85 
     86 #ifndef BYTE_ORDER
     87 #define LITTLE_ENDIAN 1234
     88 #define BIG_ENDIAN    4321
     89 
     90 #if defined(__QNX__) && !defined(__QNXNTO__)
     91 #define BYTE_ORDER LITTLE_ENDIAN
     92 #endif
     93 
     94 #if defined(__QNXNTO__)
     95 #if defined(i386) || defined(__i386__) || defined(__x86__)
     96 #define BYTE_ORDER LITTLE_ENDIAN
     97 #else
     98 #define BYTE_ORDER BIG_ENDIAN
     99 #endif
    100 #endif
    101 
    102 #ifdef Lynx
    103 #if defined(i386) || defined(__i386__) || defined(__x86__)
    104 #define BYTE_ORDER LITTLE_ENDIAN
    105 #else
    106 #define BYTE_ORDER BIG_ENDIAN
    107 #endif
    108 #endif
    109 #if (defined(sun) && defined(SVR4)) && !defined(Lynx)
    110 #include <sys/isa_defs.h>
    111 #ifdef _LITTLE_ENDIAN
    112 #define BYTE_ORDER LITTLE_ENDIAN
    113 #endif
    114 #ifdef _BIG_ENDIAN
    115 #define BYTE_ORDER BIG_ENDIAN
    116 #endif
    117 #endif /* sun */
    118 #endif /* BYTE_ORDER */
    119 
    120 #define X_BYTE_ORDER BYTE_ORDER
    121 #define X_BIG_ENDIAN BIG_ENDIAN
    122 #define X_LITTLE_ENDIAN LITTLE_ENDIAN
    123 
    124 #endif /* not in imake config */
    125 
    126 #endif /* _XARCH_H_ */
    127