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 
     29 
     30 /*
     31  * Determine the machine's byte order.
     32  */
     33 
     34 /* See if it is set in the imake config first */
     35 # ifdef X_BYTE_ORDER
     36 
     37 #  define X_BIG_ENDIAN 4321
     38 #  define X_LITTLE_ENDIAN 1234
     39 
     40 # else
     41 
     42 #  if defined(SVR4) || defined(__SVR4)
     43 #   include <sys/byteorder.h>
     44 #  elif defined(CSRG_BASED)
     45 #   if defined(__NetBSD__) || defined(__OpenBSD__)
     46 #    include <sys/types.h>
     47 #   endif
     48 #   include <machine/endian.h>
     49 #  elif defined(linux)
     50 #   if defined __STRICT_ANSI__
     51 #    undef __STRICT_ANSI__
     52 #    include <endian.h>
     53 #    define __STRICT_ANSI__
     54 #   else
     55 #    include <endian.h>
     56 #   endif
     57 /* 'endian.h' might have been included before 'Xarch.h' */
     58 #   if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
     59 #    define LITTLE_ENDIAN __LITTLE_ENDIAN
     60 #   endif
     61 #   if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
     62 #    define BIG_ENDIAN __BIG_ENDIAN
     63 #   endif
     64 #   if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN)
     65 #    define PDP_ENDIAN __PDP_ENDIAN
     66 #   endif
     67 #   if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
     68 #    define BYTE_ORDER __BYTE_ORDER
     69 #   endif
     70 #  endif
     71 
     72 #  ifndef BYTE_ORDER
     73 #   define LITTLE_ENDIAN 1234
     74 #   define BIG_ENDIAN    4321
     75 
     76 #   if defined(__sun) && defined(__SVR4)
     77 #    include <sys/isa_defs.h>
     78 #    ifdef _LITTLE_ENDIAN
     79 #     define BYTE_ORDER LITTLE_ENDIAN
     80 #    endif
     81 #    ifdef _BIG_ENDIAN
     82 #     define BYTE_ORDER BIG_ENDIAN
     83 #    endif
     84 #   endif /* sun */
     85 #  endif /* BYTE_ORDER */
     86 
     87 #  define X_BYTE_ORDER BYTE_ORDER
     88 #  define X_BIG_ENDIAN BIG_ENDIAN
     89 #  define X_LITTLE_ENDIAN LITTLE_ENDIAN
     90 
     91 # endif /* not in imake config */
     92 
     93 #endif /* _XARCH_H_ */
     94