45 # Special case for zero
46 cleaned_value=${BASH_REMATCH[[2]]}
47 fi
48
49 if test $cleaned_value -gt 255; then
50 AC_MSG_ERROR([$1 is given as $2. This is greater than 255 which is not allowed.])
51 fi
52 if test "x$cleaned_value" != "x$2"; then
53 AC_MSG_WARN([Value for $1 has been sanitized from '$2' to '$cleaned_value'])
54 fi
55 $1=$cleaned_value
56 ])
57
58 AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
59 [
60 # Warn user that old version arguments are deprecated.
61 BASIC_DEPRECATED_ARG_WITH([milestone])
62 BASIC_DEPRECATED_ARG_WITH([update-version])
63 BASIC_DEPRECATED_ARG_WITH([user-release-suffix])
64 BASIC_DEPRECATED_ARG_WITH([build-number])
65
66 # Source the version numbers file
67 . $AUTOCONF_DIR/version-numbers
68
69 # Some non-version number information is set in that file
70 AC_SUBST(LAUNCHER_NAME)
71 AC_SUBST(PRODUCT_NAME)
72 AC_SUBST(PRODUCT_SUFFIX)
73 AC_SUBST(JDK_RC_PLATFORM_NAME)
74 AC_SUBST(COMPANY_NAME)
75 AC_SUBST(HOTSPOT_VM_DISTRO)
76 AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
77 AC_SUBST(MACOSX_BUNDLE_ID_BASE)
78
79 # Override version from arguments
80
81 # If --with-version-string is set, process it first. It is possible to
82 # override parts with more specific flags, since these are processed later.
83 AC_ARG_WITH(version-string, [AS_HELP_STRING([--with-version-string],
84 [Set version string @<:@calculated@:>@])])
85 if test "x$with_version_string" = xyes; then
86 AC_MSG_ERROR([--with-version-string must have a value])
87 elif test "x$with_version_string" != x; then
88 # Additional [] needed to keep m4 from mangling shell constructs.
89 if [ [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z]+))?((\+)([0-9]+)?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
90 VERSION_MAJOR=${BASH_REMATCH[[1]]}
91 VERSION_MINOR=${BASH_REMATCH[[3]]}
92 VERSION_SECURITY=${BASH_REMATCH[[5]]}
93 VERSION_PATCH=${BASH_REMATCH[[7]]}
94 VERSION_PRE=${BASH_REMATCH[[9]]}
95 version_plus_separator=${BASH_REMATCH[[11]]}
96 VERSION_BUILD=${BASH_REMATCH[[12]]}
97 VERSION_OPT=${BASH_REMATCH[[14]]}
98 # Unspecified numerical fields are interpreted as 0.
99 if test "x$VERSION_MINOR" = x; then
100 VERSION_MINOR=0
101 fi
102 if test "x$VERSION_SECURITY" = x; then
103 VERSION_SECURITY=0
104 fi
105 if test "x$VERSION_PATCH" = x; then
106 VERSION_PATCH=0
107 fi
108 if test "x$version_plus_separator" != x \
109 && test "x$VERSION_BUILD$VERSION_OPT" = x; then
110 AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
111 fi
112 # Stop the version part process from setting default values.
113 # We still allow them to explicitly override though.
114 NO_DEFAULT_VERSION_PARTS=true
115 else
116 AC_MSG_ERROR([--with-version-string fails to parse as a valid version string: $with_version_string])
117 fi
118 fi
119
120 AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre],
121 [Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])],
122 [with_version_pre_present=true], [with_version_pre_present=false])
123
174 if test "x$with_version_build_present" = xtrue; then
175 if test "x$with_version_build" = xyes; then
176 AC_MSG_ERROR([--with-version-build must have a value])
177 elif test "x$with_version_build" = xno; then
178 # Interpret --without-* as empty string instead of the literal "no"
179 VERSION_BUILD=
180 elif test "x$with_version_build" = x; then
181 VERSION_BUILD=
182 else
183 JDKVER_CHECK_AND_SET_NUMBER(VERSION_BUILD, $with_version_build)
184 fi
185 else
186 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
187 # Default is to not have a build number.
188 VERSION_BUILD=""
189 # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0.
190 VERSION_BUILD=0
191 fi
192 fi
193
194 AC_ARG_WITH(version-major, [AS_HELP_STRING([--with-version-major],
195 [Set version 'MAJOR' field (first number) @<:@current source value@:>@])],
196 [with_version_major_present=true], [with_version_major_present=false])
197
198 if test "x$with_version_major_present" = xtrue; then
199 if test "x$with_version_major" = xyes; then
200 AC_MSG_ERROR([--with-version-major must have a value])
201 else
202 JDKVER_CHECK_AND_SET_NUMBER(VERSION_MAJOR, $with_version_major)
203 fi
204 else
205 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
206 # Default is to get value from version-numbers
207 VERSION_MAJOR="$DEFAULT_VERSION_MAJOR"
208 fi
209 fi
210
211 AC_ARG_WITH(version-minor, [AS_HELP_STRING([--with-version-minor],
212 [Set version 'MINOR' field (second number) @<:@current source value@:>@])],
213 [with_version_minor_present=true], [with_version_minor_present=false])
214
215 if test "x$with_version_minor_present" = xtrue; then
216 if test "x$with_version_minor" = xyes; then
217 AC_MSG_ERROR([--with-version-minor must have a value])
218 elif test "x$with_version_minor" = xno; then
219 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
220 VERSION_MINOR=0
221 elif test "x$with_version_minor" = x; then
222 VERSION_MINOR=0
223 else
224 JDKVER_CHECK_AND_SET_NUMBER(VERSION_MINOR, $with_version_minor)
225 fi
226 else
227 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
228 # Default is 0, if unspecified
229 VERSION_MINOR=$DEFAULT_VERSION_MINOR
230 fi
231 fi
232
233 AC_ARG_WITH(version-security, [AS_HELP_STRING([--with-version-security],
234 [Set version 'SECURITY' field (third number) @<:@current source value@:>@])],
235 [with_version_security_present=true], [with_version_security_present=false])
236
237 if test "x$with_version_security_present" = xtrue; then
238 if test "x$with_version_security" = xyes; then
239 AC_MSG_ERROR([--with-version-security must have a value])
240 elif test "x$with_version_security" = xno; then
241 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
242 VERSION_SECURITY=0
243 elif test "x$with_version_security" = x; then
244 VERSION_SECURITY=0
245 else
246 JDKVER_CHECK_AND_SET_NUMBER(VERSION_SECURITY, $with_version_security)
247 fi
248 else
249 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
250 # Default is 0, if unspecified
251 VERSION_SECURITY=$DEFAULT_VERSION_SECURITY
252 fi
253 fi
254
255 AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
256 [Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
257 [with_version_patch_present=true], [with_version_patch_present=false])
258
259 if test "x$with_version_patch_present" = xtrue; then
260 if test "x$with_version_patch" = xyes; then
261 AC_MSG_ERROR([--with-version-patch must have a value])
262 elif test "x$with_version_patch" = xno; then
263 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
264 VERSION_PATCH=0
265 elif test "x$with_version_patch" = x; then
266 VERSION_PATCH=0
267 else
268 JDKVER_CHECK_AND_SET_NUMBER(VERSION_PATCH, $with_version_patch)
269 fi
270 else
271 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
272 # Default is 0, if unspecified
273 VERSION_PATCH=$DEFAULT_VERSION_PATCH
274 fi
275 fi
276
277 # Calculate derived version properties
278
279 # Set VERSION_IS_GA based on if VERSION_PRE has a value
280 if test "x$VERSION_PRE" = x; then
281 VERSION_IS_GA=true
282 else
283 VERSION_IS_GA=false
284 fi
285
286 # VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
287 VERSION_NUMBER_FOUR_POSITIONS=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_SECURITY.$VERSION_PATCH
288
289 stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
290 # Strip trailing zeroes from stripped_version_number
291 for i in 1 2 3 ; do stripped_version_number=${stripped_version_number%.0} ; done
292 VERSION_NUMBER=$stripped_version_number
293
294 # The complete version string, with additional build information
295 if test "x$VERSION_BUILD$VERSION_OPT" = x; then
296 VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
297 else
298 # If either build or opt is set, we need a + separator
299 VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}+$VERSION_BUILD${VERSION_OPT:+-$VERSION_OPT}
300 fi
301
302 # The short version string, just VERSION_NUMBER and PRE, if present.
303 VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
304
305 AC_MSG_CHECKING([for version string])
306 AC_MSG_RESULT([$VERSION_STRING])
307
308 AC_SUBST(VERSION_MAJOR)
309 AC_SUBST(VERSION_MINOR)
310 AC_SUBST(VERSION_SECURITY)
311 AC_SUBST(VERSION_PATCH)
312 AC_SUBST(VERSION_PRE)
313 AC_SUBST(VERSION_BUILD)
314 AC_SUBST(VERSION_OPT)
315 AC_SUBST(VERSION_NUMBER)
316 AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
317 AC_SUBST(VERSION_STRING)
318 AC_SUBST(VERSION_SHORT)
319 AC_SUBST(VERSION_IS_GA)
320 ])
|
45 # Special case for zero
46 cleaned_value=${BASH_REMATCH[[2]]}
47 fi
48
49 if test $cleaned_value -gt 255; then
50 AC_MSG_ERROR([$1 is given as $2. This is greater than 255 which is not allowed.])
51 fi
52 if test "x$cleaned_value" != "x$2"; then
53 AC_MSG_WARN([Value for $1 has been sanitized from '$2' to '$cleaned_value'])
54 fi
55 $1=$cleaned_value
56 ])
57
58 AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
59 [
60 # Warn user that old version arguments are deprecated.
61 BASIC_DEPRECATED_ARG_WITH([milestone])
62 BASIC_DEPRECATED_ARG_WITH([update-version])
63 BASIC_DEPRECATED_ARG_WITH([user-release-suffix])
64 BASIC_DEPRECATED_ARG_WITH([build-number])
65 BASIC_DEPRECATED_ARG_WITH([version-major])
66 BASIC_DEPRECATED_ARG_WITH([version-minor])
67 BASIC_DEPRECATED_ARG_WITH([version-security])
68
69 # Source the version numbers file
70 . $AUTOCONF_DIR/version-numbers
71
72 # Some non-version number information is set in that file
73 AC_SUBST(LAUNCHER_NAME)
74 AC_SUBST(PRODUCT_NAME)
75 AC_SUBST(PRODUCT_SUFFIX)
76 AC_SUBST(JDK_RC_PLATFORM_NAME)
77 AC_SUBST(COMPANY_NAME)
78 AC_SUBST(HOTSPOT_VM_DISTRO)
79 AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
80 AC_SUBST(MACOSX_BUNDLE_ID_BASE)
81
82 # Override version from arguments
83
84 # If --with-version-string is set, process it first. It is possible to
85 # override parts with more specific flags, since these are processed later.
86 AC_ARG_WITH(version-string, [AS_HELP_STRING([--with-version-string],
87 [Set version string @<:@calculated@:>@])])
88 if test "x$with_version_string" = xyes; then
89 AC_MSG_ERROR([--with-version-string must have a value])
90 elif test "x$with_version_string" != x; then
91 # Additional [] needed to keep m4 from mangling shell constructs.
92 if [ [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z]+))?((\+)([0-9]+)?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
93 VERSION_FEATURE=${BASH_REMATCH[[1]]}
94 VERSION_INTERIM=${BASH_REMATCH[[3]]}
95 VERSION_UPDATE=${BASH_REMATCH[[5]]}
96 VERSION_PATCH=${BASH_REMATCH[[7]]}
97 VERSION_PRE=${BASH_REMATCH[[9]]}
98 version_plus_separator=${BASH_REMATCH[[11]]}
99 VERSION_BUILD=${BASH_REMATCH[[12]]}
100 VERSION_OPT=${BASH_REMATCH[[14]]}
101 # Unspecified numerical fields are interpreted as 0.
102 if test "x$VERSION_INTERIM" = x; then
103 VERSION_INTERIM=0
104 fi
105 if test "x$VERSION_UPDATE" = x; then
106 VERSION_UPDATE=0
107 fi
108 if test "x$VERSION_PATCH" = x; then
109 VERSION_PATCH=0
110 fi
111 if test "x$version_plus_separator" != x \
112 && test "x$VERSION_BUILD$VERSION_OPT" = x; then
113 AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
114 fi
115 # Stop the version part process from setting default values.
116 # We still allow them to explicitly override though.
117 NO_DEFAULT_VERSION_PARTS=true
118 else
119 AC_MSG_ERROR([--with-version-string fails to parse as a valid version string: $with_version_string])
120 fi
121 fi
122
123 AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre],
124 [Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])],
125 [with_version_pre_present=true], [with_version_pre_present=false])
126
177 if test "x$with_version_build_present" = xtrue; then
178 if test "x$with_version_build" = xyes; then
179 AC_MSG_ERROR([--with-version-build must have a value])
180 elif test "x$with_version_build" = xno; then
181 # Interpret --without-* as empty string instead of the literal "no"
182 VERSION_BUILD=
183 elif test "x$with_version_build" = x; then
184 VERSION_BUILD=
185 else
186 JDKVER_CHECK_AND_SET_NUMBER(VERSION_BUILD, $with_version_build)
187 fi
188 else
189 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
190 # Default is to not have a build number.
191 VERSION_BUILD=""
192 # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0.
193 VERSION_BUILD=0
194 fi
195 fi
196
197 AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature],
198 [Set version 'FEATURE' field (first number) @<:@current source value@:>@])],
199 [with_version_feature_present=true], [with_version_feature_present=false])
200
201 if test "x$with_version_feature_present" = xtrue; then
202 if test "x$with_version_feature" = xyes; then
203 AC_MSG_ERROR([--with-version-feature must have a value])
204 else
205 JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature)
206 fi
207 else
208 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
209 # Default is to get value from version-numbers
210 VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
211 fi
212 fi
213
214 AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
215 [Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
216 [with_version_interim_present=true], [with_version_interim_present=false])
217
218 if test "x$with_version_interim_present" = xtrue; then
219 if test "x$with_version_interim" = xyes; then
220 AC_MSG_ERROR([--with-version-interim must have a value])
221 elif test "x$with_version_interim" = xno; then
222 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
223 VERSION_INTERIM=0
224 elif test "x$with_version_interim" = x; then
225 VERSION_INTERIM=0
226 else
227 JDKVER_CHECK_AND_SET_NUMBER(VERSION_INTERIM, $with_version_interim)
228 fi
229 else
230 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
231 # Default is 0, if unspecified
232 VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
233 fi
234 fi
235
236 AC_ARG_WITH(version-update, [AS_HELP_STRING([--with-version-update],
237 [Set version 'UPDATE' field (third number) @<:@current source value@:>@])],
238 [with_version_update_present=true], [with_version_update_present=false])
239
240 if test "x$with_version_update_present" = xtrue; then
241 if test "x$with_version_update" = xyes; then
242 AC_MSG_ERROR([--with-version-update must have a value])
243 elif test "x$with_version_update" = xno; then
244 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
245 VERSION_UPDATE=0
246 elif test "x$with_version_update" = x; then
247 VERSION_UPDATE=0
248 else
249 JDKVER_CHECK_AND_SET_NUMBER(VERSION_UPDATE, $with_version_update)
250 fi
251 else
252 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
253 # Default is 0, if unspecified
254 VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
255 fi
256 fi
257
258 AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
259 [Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
260 [with_version_patch_present=true], [with_version_patch_present=false])
261
262 if test "x$with_version_patch_present" = xtrue; then
263 if test "x$with_version_patch" = xyes; then
264 AC_MSG_ERROR([--with-version-patch must have a value])
265 elif test "x$with_version_patch" = xno; then
266 # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
267 VERSION_PATCH=0
268 elif test "x$with_version_patch" = x; then
269 VERSION_PATCH=0
270 else
271 JDKVER_CHECK_AND_SET_NUMBER(VERSION_PATCH, $with_version_patch)
272 fi
273 else
274 if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
275 # Default is 0, if unspecified
276 VERSION_PATCH=$DEFAULT_VERSION_PATCH
277 fi
278 fi
279
280 # Calculate derived version properties
281
282 # Set VERSION_IS_GA based on if VERSION_PRE has a value
283 if test "x$VERSION_PRE" = x; then
284 VERSION_IS_GA=true
285 else
286 VERSION_IS_GA=false
287 fi
288
289 # VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
290 VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
291
292 stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
293 # Strip trailing zeroes from stripped_version_number
294 for i in 1 2 3 ; do stripped_version_number=${stripped_version_number%.0} ; done
295 VERSION_NUMBER=$stripped_version_number
296
297 # The complete version string, with additional build information
298 if test "x$VERSION_BUILD$VERSION_OPT" = x; then
299 VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
300 else
301 # If either build or opt is set, we need a + separator
302 VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}+$VERSION_BUILD${VERSION_OPT:+-$VERSION_OPT}
303 fi
304
305 # The short version string, just VERSION_NUMBER and PRE, if present.
306 VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
307
308 # The version date
309 AC_ARG_WITH(version-date, [AS_HELP_STRING([--with-version-date],
310 [Set version date @<:@current source value@:>@])])
311 if test "x$with_version_date" = xyes; then
312 AC_MSG_ERROR([--with-version-date must have a value])
313 elif test "x$with_version_date" != x; then
314 if [ ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then
315 AC_MSG_ERROR(["$with_version_date" is not a valid version date])
316 else
317 VERSION_DATE="$with_version_date"
318 fi
319 else
320 VERSION_DATE="$DEFAULT_VERSION_DATE"
321 fi
322
323 # The vendor version string, if any
324 AC_ARG_WITH(vendor-version-string, [AS_HELP_STRING([--with-vendor-version-string],
325 [Set vendor version string @<:@not specified@:>@])])
326 if test "x$with_vendor_version_string" = xyes; then
327 AC_MSG_ERROR([--with-vendor-version-string must have a value])
328 elif [ ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ]; then
329 AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string])
330 else
331 VENDOR_VERSION_STRING="$with_vendor_version_string"
332 fi
333
334 AC_MSG_CHECKING([for version string])
335 AC_MSG_RESULT([$VERSION_STRING])
336
337 AC_SUBST(VERSION_FEATURE)
338 AC_SUBST(VERSION_INTERIM)
339 AC_SUBST(VERSION_UPDATE)
340 AC_SUBST(VERSION_PATCH)
341 AC_SUBST(VERSION_PRE)
342 AC_SUBST(VERSION_BUILD)
343 AC_SUBST(VERSION_OPT)
344 AC_SUBST(VERSION_NUMBER)
345 AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
346 AC_SUBST(VERSION_STRING)
347 AC_SUBST(VERSION_SHORT)
348 AC_SUBST(VERSION_IS_GA)
349 AC_SUBST(VERSION_DATE)
350 AC_SUBST(VENDOR_VERSION_STRING)
351 ])
|