1 /**
2  * Copyright: Copyright (c) 2009 Jacob Carlborg.
3  * Authors: Jacob Carlborg
4  * Version: Initial created: Mar 28, 2009
5  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6  */
7 module mambo.util.Version;
8 
9 template Version (char[] V)
10 {
11 	mixin(
12 	"version(" ~ V ~ ")
13 	{
14 		enum bool Version = true;
15 	}
16 	else
17 	{
18 		enum bool Version = false;
19 	}");
20 }
21 
22 version (GNU)
23 {
24 	version (darwin)
25 		version = OSX;
26 
27 	static if ((void*).sizeof > int.sizeof)
28 		version = D_LP64;
29 }
30 
31 version (DigitalMars)
32 	version (OSX)
33 		version = darwin;
34 
35 //Compiler Vendors
36 version (DigitalMars) enum bool DigitalMars = true;
37 else enum bool DigitalMars = false;
38 
39 version (GNU) enum bool GNU = true;
40 else enum bool GNU = false;
41 
42 version (LDC) enum bool LDC = true;
43 else enum bool LDC = false;
44 
45 version (LLVM) enum bool LLVM = true;
46 else enum bool LLVM = false;
47 
48 version (D_Version2) enum bool D_Version2 = true;
49 else enum bool D_Version2 = false;
50 
51 
52 
53 //Processors
54 version (PPC) enum bool PPC = true;
55 else enum bool PPC = false;
56 
57 version (PPC64) enum bool PPC64 = true;
58 else enum bool PPC64 = false;
59 
60 version (SPARC) enum bool SPARC = true;
61 else enum bool SPARC = false;
62 
63 version (SPARC64) enum bool SPARC64 = true;
64 else enum bool SPARC64 = false;
65 
66 version (X86) enum bool X86 = true;
67 else enum bool X86 = false;
68 
69 version (X86_64) enum bool X86_64 = true;
70 else enum bool X86_64 = false;
71 
72 
73 
74 //Operating Systems
75 version (aix) enum bool aix = true;
76 else enum bool aix = false;
77 
78 version (cygwin) enum bool cygwin = true;
79 else enum bool cygwin = false;
80 
81 version (darwin) enum bool darwin = true;
82 else enum bool darwin = false;
83 
84 version (OSX) enum bool OSX = true;
85 else enum bool OSX = false;
86 
87 version (freebsd) enum bool freebsd = true;
88 else enum bool freebsd = false;
89 
90 version (linux) enum bool linux = true;
91 else enum bool linux = false;
92 
93 version (solaris) enum bool solaris = true;
94 else enum bool solaris = false;
95 
96 version (Unix) enum bool Unix = true;
97 else enum bool Unix = false;
98 
99 version (Win32) enum bool Win32 = true;
100 else enum bool Win32 = false;
101 
102 version (Win64) enum bool Win64 = true;
103 else enum bool Win64 = false;
104 
105 version (Windows) enum bool Windows = true;
106 else enum bool Windows = false;
107 
108 
109 
110 //Rest
111 version (BigEndian) enum bool BigEndian = true;
112 else enum bool BigEndian = false;
113 
114 version (LittleEndian) enum bool LittleEndian = true;
115 else enum bool LittleEndian = false;
116 
117 version (D_Coverage) enum bool D_Coverage = true;
118 else enum bool D_Coverage = false;
119 
120 version (D_Ddoc) enum bool D_Ddoc = true;
121 else enum bool D_Ddoc = false;
122 
123 version (D_InlineAsm_X86) enum bool D_InlineAsm_X86 = true;
124 else enum bool D_InlineAsm_X86 = false;
125 
126 version (D_InlineAsm_X86_64) enum bool D_InlineAsm_X86_64 = true;
127 else enum bool D_InlineAsm_X86_64 = false;
128 
129 version (D_LP64) enum bool D_LP64 = true;
130 else enum bool D_LP64 = false;
131 
132 version (D_PIC) enum bool D_PIC = true;
133 else enum bool D_PIC = false;
134 
135 version (GNU_BitsPerPointer32) enum bool GNU_BitsPerPointer32 = true;
136 else enum bool GNU_BitsPerPointer32 = false;
137 
138 version (GNU_BitsPerPointer64) enum bool GNU_BitsPerPointer64 = true;
139 else enum bool GNU_BitsPerPointer64 = false;
140 
141 version (all) enum bool all = true;
142 else enum bool D_InlineAsm_X86_64 = false;
143 
144 version (none) enum bool D_InlineAsm_X86_64 = true;
145 else enum bool none = false;
146 
147 version (Tango)
148 {
149 	enum bool Tango = true;
150 	enum bool Phobos = false;
151 
152 	version (PhobosCompatibility) enum bool PhobosCompatibility = true;
153 	else enum bool PhobosCompatibility = false;
154 }
155 
156 else
157 {
158 	enum bool Tango = false;
159 	enum bool Phobos = true;
160 	enum bool PhobosCompatibility = false;
161 }