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