1 /*=========================================================================
3 Program: KWSys - Kitware System Library
4 Module: $RCSfile: CPU.h.in,v $
6 Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
13 =========================================================================*/
14 #ifndef @KWSYS_NAMESPACE@_CPU_h
15 #define @KWSYS_NAMESPACE@_CPU_h
17 #include <@KWSYS_NAMESPACE@/Configure.h>
19 /* Identify possible endian cases. The macro
20 @KWSYS_NAMESPACE@_CPU_ENDIAN_ID will be defined to one of these, or
22 #define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG 4321
23 #define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE 1234
25 /* Apple always defines one of these. */
26 #if defined(__LITTLE_ENDIAN__)
27 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
28 #elif defined(__BIG_ENDIAN__)
29 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
32 #elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
33 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
36 #elif defined(__arm__)
37 # if !defined(__ARMEB__)
38 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
40 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
44 #elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
45 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
46 #elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
47 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
48 #elif defined(__MWERKS__) && defined(__INTEL__)
49 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
52 #elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
53 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
54 #elif defined(__amd64) || defined(__amd64__)
55 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
57 /* Intel Architecture-64 (Itanium) */
58 #elif defined(__ia64) || defined(__ia64__)
59 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
60 #elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
61 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE
64 #elif defined(__powerpc) || defined(__powerpc__)
65 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
66 #elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
67 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
70 #elif defined(__sparc) || defined(__sparc__)
71 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
74 #elif defined(__hppa) || defined(__hppa__)
75 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
78 #elif defined(__m68k__) || defined(M68000)
79 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
82 #elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
83 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
86 #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
87 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
88 #elif defined(_ARCH_PWR) || defined(_ARCH_PWR2)
89 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
92 #elif defined(__370__) || defined(__THW_370__)
93 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
96 #elif defined(__s390__) || defined(__s390x__)
97 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
100 #elif defined(__SYSC_ZARCH__)
101 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
105 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID 0
106 # if !defined(@KWSYS_NAMESPACE@_CPU_UNKNOWN_OKAY)
107 # error "The target CPU architecture is not known."
111 /* If building a C or C++ file in kwsys itself, give the source file
112 access to the macros without a configured namespace. */
113 #if defined(KWSYS_NAMESPACE)
114 # define KWSYS_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID
115 # define KWSYS_CPU_ENDIAN_ID_BIG @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
116 # define KWSYS_CPU_ENDIAN_ID_LITTLE @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE