Fossil SCM

Expand version reporting support to all compilers with in-tree makefiles.

mistachkin 2014-02-15 03:49 trunk
Commit 43dbc41226a67166bd4596ebae04679daef6901f
2 files changed +43 -14 +12 -3
+43 -14
--- src/config.h
+++ src/config.h
@@ -75,41 +75,70 @@
7575
/*
7676
** Define the compiler variant, used to compile the project
7777
*/
7878
#if !defined(COMPILER_NAME)
7979
# if defined(__DMC__)
80
-# define COMPILER_NAME "dmc"
80
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
81
+# define COMPILER_NAME "dmc-" COMPILER_VERSION
82
+# else
83
+# define COMPILER_NAME "dmc"
84
+# endif
8185
# elif defined(__POCC__)
8286
# if defined(_M_X64)
83
-# define COMPILER_NAME "pellesc64"
87
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
88
+# define COMPILER_NAME "pellesc64-" COMPILER_VERSION
89
+# else
90
+# define COMPILER_NAME "pellesc64"
91
+# endif
8492
# else
85
-# define COMPILER_NAME "pellesc32"
93
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
94
+# define COMPILER_NAME "pellesc32-" COMPILER_VERSION
95
+# else
96
+# define COMPILER_NAME "pellesc32"
97
+# endif
8698
# endif
8799
# elif defined(_MSC_VER)
88100
# if !defined(COMPILER_VERSION)
89101
# define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER)
90102
# endif
91
-# define COMPILER_NAME "msc-" COMPILER_VERSION
103
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
104
+# define COMPILER_NAME "msc-" COMPILER_VERSION
105
+# else
106
+# define COMPILER_NAME "msc"
107
+# endif
92108
# elif defined(__MINGW32__)
93
-# if defined(__GNUC__) && defined(__VERSION__)
94
-# if !defined(COMPILER_VERSION)
95
-# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
109
+# if !defined(COMPILER_VERSION)
110
+# if defined(__MINGW32_VERSION)
111
+# if defined(__GNUC__)
112
+# if defined(__VERSION__)
113
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
114
+# else
115
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
116
+# endif
117
+# else
118
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
119
+# endif
96120
# endif
121
+# endif
122
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
97123
# define COMPILER_NAME "mingw32-" COMPILER_VERSION
98124
# else
99
-# if !defined(COMPILER_VERSION)
100
-# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
101
-# endif
102
-# define COMPILER_NAME "mingw32-" COMPILER_VERSION
125
+# define COMPILER_NAME "mingw32"
103126
# endif
104127
# elif defined(_WIN32)
105128
# define COMPILER_NAME "win32"
106129
# elif defined(__GNUC__)
107130
# if !defined(COMPILER_VERSION)
108
-# define COMPILER_VERSION __VERSION__
131
+# if defined(__VERSION__)
132
+# define COMPILER_VERSION __VERSION__
133
+# endif
109134
# endif
110
-# define COMPILER_NAME "gcc-" COMPILER_VERSION
135
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
136
+# define COMPILER_NAME "gcc-" COMPILER_VERSION
137
+# else
138
+# define COMPILER_NAME "gcc"
139
+# endif
111140
# else
112141
# define COMPILER_NAME "unknown"
113142
# endif
114143
#endif
115144
@@ -147,11 +176,11 @@
147176
** The following macros are used to cast pointers to integers and
148177
** integers to pointers. The way you do this varies from one compiler
149178
** to the next, so we have developed the following set of #if statements
150179
** to generate appropriate macros for a wide range of compilers.
151180
**
152
-** The correct "ANSI" way to do this is to use the intptr_t type.
181
+** The correct "ANSI" way to do this is to use the intptr_t type.
153182
** Unfortunately, that typedef is not available on all compilers, or
154183
** if it is available, it requires an #include of specific headers
155184
** that vary from one machine to the next.
156185
*/
157186
#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
158187
--- src/config.h
+++ src/config.h
@@ -75,41 +75,70 @@
75 /*
76 ** Define the compiler variant, used to compile the project
77 */
78 #if !defined(COMPILER_NAME)
79 # if defined(__DMC__)
80 # define COMPILER_NAME "dmc"
 
 
 
 
81 # elif defined(__POCC__)
82 # if defined(_M_X64)
83 # define COMPILER_NAME "pellesc64"
 
 
 
 
84 # else
85 # define COMPILER_NAME "pellesc32"
 
 
 
 
86 # endif
87 # elif defined(_MSC_VER)
88 # if !defined(COMPILER_VERSION)
89 # define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER)
90 # endif
91 # define COMPILER_NAME "msc-" COMPILER_VERSION
 
 
 
 
92 # elif defined(__MINGW32__)
93 # if defined(__GNUC__) && defined(__VERSION__)
94 # if !defined(COMPILER_VERSION)
95 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
 
 
 
 
 
 
 
 
96 # endif
 
 
97 # define COMPILER_NAME "mingw32-" COMPILER_VERSION
98 # else
99 # if !defined(COMPILER_VERSION)
100 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
101 # endif
102 # define COMPILER_NAME "mingw32-" COMPILER_VERSION
103 # endif
104 # elif defined(_WIN32)
105 # define COMPILER_NAME "win32"
106 # elif defined(__GNUC__)
107 # if !defined(COMPILER_VERSION)
108 # define COMPILER_VERSION __VERSION__
 
 
109 # endif
110 # define COMPILER_NAME "gcc-" COMPILER_VERSION
 
 
 
 
111 # else
112 # define COMPILER_NAME "unknown"
113 # endif
114 #endif
115
@@ -147,11 +176,11 @@
147 ** The following macros are used to cast pointers to integers and
148 ** integers to pointers. The way you do this varies from one compiler
149 ** to the next, so we have developed the following set of #if statements
150 ** to generate appropriate macros for a wide range of compilers.
151 **
152 ** The correct "ANSI" way to do this is to use the intptr_t type.
153 ** Unfortunately, that typedef is not available on all compilers, or
154 ** if it is available, it requires an #include of specific headers
155 ** that vary from one machine to the next.
156 */
157 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
158
--- src/config.h
+++ src/config.h
@@ -75,41 +75,70 @@
75 /*
76 ** Define the compiler variant, used to compile the project
77 */
78 #if !defined(COMPILER_NAME)
79 # if defined(__DMC__)
80 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
81 # define COMPILER_NAME "dmc-" COMPILER_VERSION
82 # else
83 # define COMPILER_NAME "dmc"
84 # endif
85 # elif defined(__POCC__)
86 # if defined(_M_X64)
87 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
88 # define COMPILER_NAME "pellesc64-" COMPILER_VERSION
89 # else
90 # define COMPILER_NAME "pellesc64"
91 # endif
92 # else
93 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
94 # define COMPILER_NAME "pellesc32-" COMPILER_VERSION
95 # else
96 # define COMPILER_NAME "pellesc32"
97 # endif
98 # endif
99 # elif defined(_MSC_VER)
100 # if !defined(COMPILER_VERSION)
101 # define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER)
102 # endif
103 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
104 # define COMPILER_NAME "msc-" COMPILER_VERSION
105 # else
106 # define COMPILER_NAME "msc"
107 # endif
108 # elif defined(__MINGW32__)
109 # if !defined(COMPILER_VERSION)
110 # if defined(__MINGW32_VERSION)
111 # if defined(__GNUC__)
112 # if defined(__VERSION__)
113 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
114 # else
115 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
116 # endif
117 # else
118 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
119 # endif
120 # endif
121 # endif
122 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
123 # define COMPILER_NAME "mingw32-" COMPILER_VERSION
124 # else
125 # define COMPILER_NAME "mingw32"
 
 
 
126 # endif
127 # elif defined(_WIN32)
128 # define COMPILER_NAME "win32"
129 # elif defined(__GNUC__)
130 # if !defined(COMPILER_VERSION)
131 # if defined(__VERSION__)
132 # define COMPILER_VERSION __VERSION__
133 # endif
134 # endif
135 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
136 # define COMPILER_NAME "gcc-" COMPILER_VERSION
137 # else
138 # define COMPILER_NAME "gcc"
139 # endif
140 # else
141 # define COMPILER_NAME "unknown"
142 # endif
143 #endif
144
@@ -147,11 +176,11 @@
176 ** The following macros are used to cast pointers to integers and
177 ** integers to pointers. The way you do this varies from one compiler
178 ** to the next, so we have developed the following set of #if statements
179 ** to generate appropriate macros for a wide range of compilers.
180 **
181 ** The correct "ANSI" way to do this is to use the intptr_t type.
182 ** Unfortunately, that typedef is not available on all compilers, or
183 ** if it is available, it requires an #include of specific headers
184 ** that vary from one machine to the next.
185 */
186 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
187
+12 -3
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,12 +69,21 @@
6969
}
7070
}
7171
printf("#define RELEASE_RESOURCE_VERSION %s", vx);
7272
while( d<3 ){ printf(",0"); d++; }
7373
printf("\n");
74
-#if defined(_MSC_VER)
75
- d = _MSC_VER / 100;
76
- x = _MSC_VER % 100;
74
+#if defined(__DMC__) /* e.g. 0x857 */
75
+ d = (__DMC__ & 0xF00) >> 8; /* major */
76
+ x = (__DMC__ & 0x0F0) >> 4; /* minor */
77
+ i = (__DMC__ & 0x00F); /* revision */
78
+ printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i);
79
+#elif defined(__POCC__) /* e.g. 700 */
80
+ d = (__POCC__ / 100); /* major */
81
+ x = (__POCC__ % 100); /* minor */
82
+ printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
83
+#elif defined(_MSC_VER) /* e.g. 1800 */
84
+ d = (_MSC_VER / 100); /* major */
85
+ x = (_MSC_VER % 100); /* minor */
7786
printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
7887
#endif
7988
return 0;
8089
}
8190
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,12 +69,21 @@
69 }
70 }
71 printf("#define RELEASE_RESOURCE_VERSION %s", vx);
72 while( d<3 ){ printf(",0"); d++; }
73 printf("\n");
74 #if defined(_MSC_VER)
75 d = _MSC_VER / 100;
76 x = _MSC_VER % 100;
 
 
 
 
 
 
 
 
 
77 printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
78 #endif
79 return 0;
80 }
81
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,12 +69,21 @@
69 }
70 }
71 printf("#define RELEASE_RESOURCE_VERSION %s", vx);
72 while( d<3 ){ printf(",0"); d++; }
73 printf("\n");
74 #if defined(__DMC__) /* e.g. 0x857 */
75 d = (__DMC__ & 0xF00) >> 8; /* major */
76 x = (__DMC__ & 0x0F0) >> 4; /* minor */
77 i = (__DMC__ & 0x00F); /* revision */
78 printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i);
79 #elif defined(__POCC__) /* e.g. 700 */
80 d = (__POCC__ / 100); /* major */
81 x = (__POCC__ % 100); /* minor */
82 printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
83 #elif defined(_MSC_VER) /* e.g. 1800 */
84 d = (_MSC_VER / 100); /* major */
85 x = (_MSC_VER % 100); /* minor */
86 printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
87 #endif
88 return 0;
89 }
90

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button