| 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 |
#ifdef SVR4 |
| 43 |
#if defined(NCR) || defined(Mips) |
| 44 |
#include <sys/endian.h> |
| 45 |
#else |
| 46 |
#if !defined(sun) |
| 47 |
#include <sys/byteorder.h> |
| 48 |
#endif |
| 49 |
#endif |
| 50 |
#elif defined(CSRG_BASED) |
| 51 |
#if defined(__NetBSD__) || defined(__OpenBSD__) |
| 52 |
#include <sys/types.h> |
| 53 |
#endif |
| 54 |
#include <machine/endian.h> |
| 55 |
#elif defined(linux) |
| 56 |
#if defined __STRICT_ANSI__ |
| 57 |
#undef __STRICT_ANSI__ |
| 58 |
#include <endian.h> |
| 59 |
#define __STRICT_ANSI__ |
| 60 |
#else |
| 61 |
#include <endian.h> |
| 62 |
#endif |
| 63 |
/* 'endian.h' might have been included before 'Xarch.h' */ |
| 64 |
#if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) |
| 65 |
#define LITTLE_ENDIAN __LITTLE_ENDIAN |
| 66 |
#endif |
| 67 |
#if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) |
| 68 |
#define BIG_ENDIAN __BIG_ENDIAN |
| 69 |
#endif |
| 70 |
#if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) |
| 71 |
#define PDP_ENDIAN __PDP_ENDIAN |
| 72 |
#endif |
| 73 |
#if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) |
| 74 |
#define BYTE_ORDER __BYTE_ORDER |
| 75 |
#endif |
| 76 |
#endif |
| 77 |
|
| 78 |
#ifndef BYTE_ORDER |
| 79 |
#define LITTLE_ENDIAN 1234 |
| 80 |
#define BIG_ENDIAN 4321 |
| 81 |
|
| 82 |
#if (defined(sun) && defined(SVR4)) |
| 83 |
#include <sys/isa_defs.h> |
| 84 |
#ifdef _LITTLE_ENDIAN |
| 85 |
#define BYTE_ORDER LITTLE_ENDIAN |
| 86 |
#endif |
| 87 |
#ifdef _BIG_ENDIAN |
| 88 |
#define BYTE_ORDER BIG_ENDIAN |
| 89 |
#endif |
| 90 |
#endif /* sun */ |
| 91 |
#endif /* BYTE_ORDER */ |
| 92 |
|
| 93 |
#define X_BYTE_ORDER BYTE_ORDER |
| 94 |
#define X_BIG_ENDIAN BIG_ENDIAN |
| 95 |
#define X_LITTLE_ENDIAN LITTLE_ENDIAN |
| 96 |
|
| 97 |
#endif /* not in imake config */ |
| 98 |
|
| 99 |
#endif /* _XARCH_H_ */ |