Xarch.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef _XARCH_H_
  2. # define _XARCH_H_
  3. /*
  4. * Copyright 1997 Metro Link Incorporated
  5. *
  6. * All Rights Reserved
  7. *
  8. * Permission to use, copy, modify, distribute, and sell this software and its
  9. * documentation for any purpose is hereby granted without fee, provided that
  10. * the above copyright notice appear in all copies and that both that
  11. * copyright notice and this permission notice appear in supporting
  12. * documentation, and that the names of the above listed copyright holder(s)
  13. * not be used in advertising or publicity pertaining to distribution of
  14. * the software without specific, written prior permission. The above listed
  15. * copyright holder(s) make(s) no representations about the suitability of
  16. * this software for any purpose. It is provided "as is" without express or
  17. * implied warranty.
  18. *
  19. * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
  20. * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  21. * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
  22. * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  23. * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  24. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  25. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  26. */
  27. /*
  28. * Determine the machine's byte order.
  29. */
  30. /* See if it is set in the imake config first */
  31. # ifdef X_BYTE_ORDER
  32. # define X_BIG_ENDIAN 4321
  33. # define X_LITTLE_ENDIAN 1234
  34. # else
  35. # if defined(SVR4) || defined(__SVR4)
  36. # include <sys/types.h>
  37. # include <sys/byteorder.h>
  38. # elif defined(CSRG_BASED)
  39. # if defined(__NetBSD__) || defined(__OpenBSD__)
  40. # include <sys/types.h>
  41. # endif
  42. # include <machine/endian.h>
  43. # elif defined(linux)
  44. # if defined __STRICT_ANSI__
  45. # undef __STRICT_ANSI__
  46. # include <endian.h>
  47. # define __STRICT_ANSI__
  48. # else
  49. # include <endian.h>
  50. # endif
  51. /* 'endian.h' might have been included before 'Xarch.h' */
  52. # if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
  53. # define LITTLE_ENDIAN __LITTLE_ENDIAN
  54. # endif
  55. # if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
  56. # define BIG_ENDIAN __BIG_ENDIAN
  57. # endif
  58. # if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN)
  59. # define PDP_ENDIAN __PDP_ENDIAN
  60. # endif
  61. # if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
  62. # define BYTE_ORDER __BYTE_ORDER
  63. # endif
  64. # endif
  65. # ifndef BYTE_ORDER
  66. # define LITTLE_ENDIAN 1234
  67. # define BIG_ENDIAN 4321
  68. # if defined(__sun) && defined(__SVR4)
  69. # include <sys/isa_defs.h>
  70. # ifdef _LITTLE_ENDIAN
  71. # define BYTE_ORDER LITTLE_ENDIAN
  72. # endif
  73. # ifdef _BIG_ENDIAN
  74. # define BYTE_ORDER BIG_ENDIAN
  75. # endif
  76. # endif /* sun */
  77. # endif /* BYTE_ORDER */
  78. # define X_BYTE_ORDER BYTE_ORDER
  79. # define X_BIG_ENDIAN BIG_ENDIAN
  80. # define X_LITTLE_ENDIAN LITTLE_ENDIAN
  81. # endif /* not in imake config */
  82. #endif /* _XARCH_H_ */