1 #
   2 # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ###############################################################################
  27 #
  28 # Setup version numbers
  29 #
  30 
  31 # Verify that a given string represents a valid version number, and assign it
  32 # to a variable.
  33 
  34 # Argument 1: the variable to assign to
  35 # Argument 2: the value given by the user
  36 AC_DEFUN([JDKVER_CHECK_AND_SET_NUMBER],
  37 [
  38   # Additional [] needed to keep m4 from mangling shell constructs.
  39   if [ ! [[ "$2" =~ ^0*([1-9][0-9]*)|(0)$ ]] ] ; then
  40     AC_MSG_ERROR(["$2" is not a valid numerical value for $1])
  41   fi
  42   # Extract the version number without leading zeros.
  43   cleaned_value=${BASH_REMATCH[[1]]}
  44   if test "x$cleaned_value" = x; then
  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   # Source the version numbers file
  61   . $AUTOCONF_DIR/version-numbers
  62 
  63   # Some non-version number information is set in that file
  64   AC_SUBST(LAUNCHER_NAME)
  65   AC_SUBST(PRODUCT_NAME)
  66   AC_SUBST(PRODUCT_SUFFIX)
  67   AC_SUBST(JDK_RC_PLATFORM_NAME)
  68   AC_SUBST(HOTSPOT_VM_DISTRO)
  69 
  70   # Set the MACOSX Bundle Name base
  71   AC_ARG_WITH(macosx-bundle-name-base, [AS_HELP_STRING([--with-macosx-bundle-name-base],
  72       [Set the MacOSX Bundle Name base. This is the base name for calculating MacOSX Bundle Names.
  73       @<:@not specified@:>@])])
  74   if test "x$with_macosx_bundle_name_base" = xyes; then
  75     AC_MSG_ERROR([--with-macosx-bundle-name-base must have a value])
  76   elif [ ! [[ $with_macosx_bundle_name_base =~ ^[[:print:]]*$ ]] ]; then
  77     AC_MSG_ERROR([--with-macosx-bundle-name-base contains non-printing characters: $with_macosx_bundle_name_base])
  78   elif test "x$with_macosx_bundle_name_base" != x; then
  79     # Set MACOSX_BUNDLE_NAME_BASE to the configured value.
  80     MACOSX_BUNDLE_NAME_BASE="$with_macosx_bundle_name_base"
  81   fi
  82   AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
  83 
  84   # Set the MACOSX Bundle ID base
  85   AC_ARG_WITH(macosx-bundle-id-base, [AS_HELP_STRING([--with-macosx-bundle-id-base],
  86       [Set the MacOSX Bundle ID base. This is the base ID for calculating MacOSX Bundle IDs.
  87       @<:@not specified@:>@])])
  88   if test "x$with_macosx_bundle_id_base" = xyes; then
  89     AC_MSG_ERROR([--with-macosx-bundle-id-base must have a value])
  90   elif [ ! [[ $with_macosx_bundle_id_base =~ ^[[:print:]]*$ ]] ]; then
  91     AC_MSG_ERROR([--with-macosx-bundle-id-base contains non-printing characters: $with_macosx_bundle_id_base])
  92   elif test "x$with_macosx_bundle_id_base" != x; then
  93     # Set MACOSX_BUNDLE_ID_BASE to the configured value.
  94     MACOSX_BUNDLE_ID_BASE="$with_macosx_bundle_id_base"
  95   fi
  96   AC_SUBST(MACOSX_BUNDLE_ID_BASE)
  97 
  98   # Set the JDK RC name
  99   AC_ARG_WITH(jdk-rc-name, [AS_HELP_STRING([--with-jdk-rc-name],
 100       [Set JDK RC name. This is used for FileDescription and ProductName properties
 101        of MS Windows binaries. @<:@not specified@:>@])])
 102   if test "x$with_jdk_rc_name" = xyes; then
 103     AC_MSG_ERROR([--with-jdk-rc-name must have a value])
 104   elif [ ! [[ $with_jdk_rc_name =~ ^[[:print:]]*$ ]] ]; then
 105     AC_MSG_ERROR([--with-jdk-rc-name contains non-printing characters: $with_jdk_rc_name])
 106   elif test "x$with_jdk_rc_name" != x; then
 107     # Set JDK_RC_NAME to a custom value if '--with-jdk-rc-name' was used and is not empty.
 108     JDK_RC_NAME="$with_jdk_rc_name"
 109   else
 110     # Otherwise calculate from "version-numbers" included above.
 111     JDK_RC_NAME="$PRODUCT_NAME $JDK_RC_PLATFORM_NAME"
 112   fi
 113   AC_SUBST(JDK_RC_NAME)
 114 
 115   # The vendor name, if any
 116   AC_ARG_WITH(vendor-name, [AS_HELP_STRING([--with-vendor-name],
 117       [Set vendor name. Among others, used to set the 'java.vendor'
 118        and 'java.vm.vendor' system properties. @<:@not specified@:>@])])
 119   if test "x$with_vendor_name" = xyes; then
 120     AC_MSG_ERROR([--with-vendor-name must have a value])
 121   elif [ ! [[ $with_vendor_name =~ ^[[:print:]]*$ ]] ]; then
 122     AC_MSG_ERROR([--with-vendor-name contains non-printing characters: $with_vendor_name])
 123   elif test "x$with_vendor_name" != x; then
 124     # Only set COMPANY_NAME if '--with-vendor-name' was used and is not empty.
 125     # Otherwise we will use the value from "version-numbers" included above.
 126     COMPANY_NAME="$with_vendor_name"
 127   fi
 128   AC_SUBST(COMPANY_NAME)
 129 
 130   # The vendor URL, if any
 131   AC_ARG_WITH(vendor-url, [AS_HELP_STRING([--with-vendor-url],
 132       [Set the 'java.vendor.url' system property @<:@not specified@:>@])])
 133   if test "x$with_vendor_url" = xyes; then
 134     AC_MSG_ERROR([--with-vendor-url must have a value])
 135   elif [ ! [[ $with_vendor_url =~ ^[[:print:]]*$ ]] ]; then
 136     AC_MSG_ERROR([--with-vendor-url contains non-printing characters: $with_vendor_url])
 137   elif test "x$with_vendor_url" != x; then
 138     # Only set VENDOR_URL if '--with-vendor-url' was used and is not empty.
 139     # Otherwise we will use the value from "version-numbers" included above.
 140     VENDOR_URL="$with_vendor_url"
 141   fi
 142   AC_SUBST(VENDOR_URL)
 143 
 144   # The vendor bug URL, if any
 145   AC_ARG_WITH(vendor-bug-url, [AS_HELP_STRING([--with-vendor-bug-url],
 146       [Set the 'java.vendor.url.bug' system property @<:@not specified@:>@])])
 147   if test "x$with_vendor_bug_url" = xyes; then
 148     AC_MSG_ERROR([--with-vendor-bug-url must have a value])
 149   elif [ ! [[ $with_vendor_bug_url =~ ^[[:print:]]*$ ]] ]; then
 150     AC_MSG_ERROR([--with-vendor-bug-url contains non-printing characters: $with_vendor_bug_url])
 151   elif test "x$with_vendor_bug_url" != x; then
 152     # Only set VENDOR_URL_BUG if '--with-vendor-bug-url' was used and is not empty.
 153     # Otherwise we will use the value from "version-numbers" included above.
 154     VENDOR_URL_BUG="$with_vendor_bug_url"
 155   fi
 156   AC_SUBST(VENDOR_URL_BUG)
 157 
 158   # The vendor VM bug URL, if any
 159   AC_ARG_WITH(vendor-vm-bug-url, [AS_HELP_STRING([--with-vendor-vm-bug-url],
 160       [Sets the bug URL which will be displayed when the VM crashes @<:@not specified@:>@])])
 161   if test "x$with_vendor_vm_bug_url" = xyes; then
 162     AC_MSG_ERROR([--with-vendor-vm-bug-url must have a value])
 163   elif [ ! [[ $with_vendor_vm_bug_url =~ ^[[:print:]]*$ ]] ]; then
 164     AC_MSG_ERROR([--with-vendor-vm-bug-url contains non-printing characters: $with_vendor_vm_bug_url])
 165   else
 166     VENDOR_URL_VM_BUG="$with_vendor_vm_bug_url"
 167   fi
 168   AC_SUBST(VENDOR_URL_VM_BUG)
 169 
 170   # Override version from arguments
 171 
 172   # If --with-version-string is set, process it first. It is possible to
 173   # override parts with more specific flags, since these are processed later.
 174   AC_ARG_WITH(version-string, [AS_HELP_STRING([--with-version-string],
 175       [Set version string @<:@calculated@:>@])])
 176   if test "x$with_version_string" = xyes; then
 177     AC_MSG_ERROR([--with-version-string must have a value])
 178   elif test "x$with_version_string" != x; then
 179     # Additional [] needed to keep m4 from mangling shell constructs.
 180     if [ [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z]+))?((\+)([0-9]+)?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
 181       VERSION_FEATURE=${BASH_REMATCH[[1]]}
 182       VERSION_INTERIM=${BASH_REMATCH[[3]]}
 183       VERSION_UPDATE=${BASH_REMATCH[[5]]}
 184       VERSION_PATCH=${BASH_REMATCH[[7]]}
 185       VERSION_EXTRA1=${BASH_REMATCH[[9]]}
 186       VERSION_EXTRA2=${BASH_REMATCH[[11]]}
 187       VERSION_EXTRA3=${BASH_REMATCH[[13]]}
 188       VERSION_PRE=${BASH_REMATCH[[15]]}
 189       version_plus_separator=${BASH_REMATCH[[17]]}
 190       VERSION_BUILD=${BASH_REMATCH[[18]]}
 191       VERSION_OPT=${BASH_REMATCH[[20]]}
 192       # Unspecified numerical fields are interpreted as 0.
 193       if test "x$VERSION_INTERIM" = x; then
 194         VERSION_INTERIM=0
 195       fi
 196       if test "x$VERSION_UPDATE" = x; then
 197         VERSION_UPDATE=0
 198       fi
 199       if test "x$VERSION_PATCH" = x; then
 200         VERSION_PATCH=0
 201       fi
 202       if test "x$VERSION_EXTRA1" = x; then
 203         VERSION_EXTRA1=0
 204       fi
 205       if test "x$VERSION_EXTRA2" = x; then
 206         VERSION_EXTRA2=0
 207       fi
 208       if test "x$VERSION_EXTRA3" = x; then
 209         VERSION_EXTRA3=0
 210       fi
 211       if test "x$version_plus_separator" != x \
 212           && test "x$VERSION_BUILD$VERSION_OPT" = x; then
 213         AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
 214       fi
 215       # Stop the version part process from setting default values.
 216       # We still allow them to explicitly override though.
 217       NO_DEFAULT_VERSION_PARTS=true
 218     else
 219       AC_MSG_ERROR([--with-version-string fails to parse as a valid version string: $with_version_string])
 220     fi
 221   fi
 222 
 223   AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre],
 224       [Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])],
 225       [with_version_pre_present=true], [with_version_pre_present=false])
 226 
 227   if test "x$with_version_pre_present" = xtrue; then
 228     if test "x$with_version_pre" = xyes; then
 229       AC_MSG_ERROR([--with-version-pre must have a value])
 230     elif test "x$with_version_pre" = xno; then
 231       # Interpret --without-* as empty string instead of the literal "no"
 232       VERSION_PRE=
 233     else
 234       # Only [a-zA-Z] is allowed in the VERSION_PRE. Outer [ ] to quote m4.
 235       [ VERSION_PRE=`$ECHO "$with_version_pre" | $TR -c -d '[a-z][A-Z]'` ]
 236       if test "x$VERSION_PRE" != "x$with_version_pre"; then
 237         AC_MSG_WARN([--with-version-pre value has been sanitized from '$with_version_pre' to '$VERSION_PRE'])
 238       fi
 239     fi
 240   else
 241     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 242       # Default is to use "internal" as pre
 243       VERSION_PRE="internal"
 244     fi
 245   fi
 246 
 247   AC_ARG_WITH(version-opt, [AS_HELP_STRING([--with-version-opt],
 248       [Set version 'OPT' field (build metadata) @<:@<timestamp>.<user>.<dirname>@:>@])],
 249       [with_version_opt_present=true], [with_version_opt_present=false])
 250 
 251   if test "x$with_version_opt_present" = xtrue; then
 252     if test "x$with_version_opt" = xyes; then
 253       AC_MSG_ERROR([--with-version-opt must have a value])
 254     elif test "x$with_version_opt" = xno; then
 255       # Interpret --without-* as empty string instead of the literal "no"
 256       VERSION_OPT=
 257     else
 258       # Only [-.a-zA-Z0-9] is allowed in the VERSION_OPT. Outer [ ] to quote m4.
 259       [ VERSION_OPT=`$ECHO "$with_version_opt" | $TR -c -d '[a-z][A-Z][0-9].-'` ]
 260       if test "x$VERSION_OPT" != "x$with_version_opt"; then
 261         AC_MSG_WARN([--with-version-opt value has been sanitized from '$with_version_opt' to '$VERSION_OPT'])
 262       fi
 263     fi
 264   else
 265     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 266       # Default is to calculate a string like this 'adhoc.<username>.<base dir name>'
 267       # Outer [ ] to quote m4.
 268       [ basedirname=`$BASENAME "$TOPDIR" | $TR -d -c '[a-z][A-Z][0-9].-'` ]
 269       VERSION_OPT="adhoc.$USERNAME.$basedirname"
 270     fi
 271   fi
 272 
 273   AC_ARG_WITH(version-build, [AS_HELP_STRING([--with-version-build],
 274       [Set version 'BUILD' field (build number) @<:@not specified@:>@])],
 275       [with_version_build_present=true], [with_version_build_present=false])
 276 
 277   if test "x$with_version_build_present" = xtrue; then
 278     if test "x$with_version_build" = xyes; then
 279       AC_MSG_ERROR([--with-version-build must have a value])
 280     elif test "x$with_version_build" = xno; then
 281       # Interpret --without-* as empty string instead of the literal "no"
 282       VERSION_BUILD=
 283     elif test "x$with_version_build" = x; then
 284       VERSION_BUILD=
 285     else
 286       JDKVER_CHECK_AND_SET_NUMBER(VERSION_BUILD, $with_version_build)
 287     fi
 288   else
 289     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 290       # Default is to not have a build number.
 291       VERSION_BUILD=""
 292       # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0.
 293       VERSION_BUILD=0
 294     fi
 295   fi
 296 
 297   AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature],
 298       [Set version 'FEATURE' field (first number) @<:@current source value@:>@])],
 299       [with_version_feature_present=true], [with_version_feature_present=false])
 300 
 301   if test "x$with_version_feature_present" = xtrue; then
 302     if test "x$with_version_feature" = xyes; then
 303       AC_MSG_ERROR([--with-version-feature must have a value])
 304     else
 305       JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature)
 306     fi
 307   else
 308     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 309       # Default is to get value from version-numbers
 310       VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
 311     fi
 312   fi
 313 
 314   AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
 315       [Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
 316       [with_version_interim_present=true], [with_version_interim_present=false])
 317 
 318   if test "x$with_version_interim_present" = xtrue; then
 319     if test "x$with_version_interim" = xyes; then
 320       AC_MSG_ERROR([--with-version-interim must have a value])
 321     elif test "x$with_version_interim" = xno; then
 322       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 323       VERSION_INTERIM=0
 324     elif test "x$with_version_interim" = x; then
 325       VERSION_INTERIM=0
 326     else
 327       JDKVER_CHECK_AND_SET_NUMBER(VERSION_INTERIM, $with_version_interim)
 328     fi
 329   else
 330     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 331       # Default is 0, if unspecified
 332       VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
 333     fi
 334   fi
 335 
 336   AC_ARG_WITH(version-update, [AS_HELP_STRING([--with-version-update],
 337       [Set version 'UPDATE' field (third number) @<:@current source value@:>@])],
 338       [with_version_update_present=true], [with_version_update_present=false])
 339 
 340   if test "x$with_version_update_present" = xtrue; then
 341     if test "x$with_version_update" = xyes; then
 342       AC_MSG_ERROR([--with-version-update must have a value])
 343     elif test "x$with_version_update" = xno; then
 344       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 345       VERSION_UPDATE=0
 346     elif test "x$with_version_update" = x; then
 347       VERSION_UPDATE=0
 348     else
 349       JDKVER_CHECK_AND_SET_NUMBER(VERSION_UPDATE, $with_version_update)
 350     fi
 351   else
 352     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 353       # Default is 0, if unspecified
 354       VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
 355     fi
 356   fi
 357 
 358   AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
 359       [Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
 360       [with_version_patch_present=true], [with_version_patch_present=false])
 361 
 362   if test "x$with_version_patch_present" = xtrue; then
 363     if test "x$with_version_patch" = xyes; then
 364       AC_MSG_ERROR([--with-version-patch must have a value])
 365     elif test "x$with_version_patch" = xno; then
 366       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 367       VERSION_PATCH=0
 368     elif test "x$with_version_patch" = x; then
 369       VERSION_PATCH=0
 370     else
 371       JDKVER_CHECK_AND_SET_NUMBER(VERSION_PATCH, $with_version_patch)
 372     fi
 373   else
 374     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 375       # Default is 0, if unspecified
 376       VERSION_PATCH=$DEFAULT_VERSION_PATCH
 377     fi
 378   fi
 379 
 380   # The 1st version extra number, if any
 381   AC_ARG_WITH(version-extra1, [AS_HELP_STRING([--with-version-extra1],
 382       [Set 1st version extra number @<:@not specified@:>@])],
 383       [with_version_extra1_present=true], [with_version_extra1_present=false])
 384 
 385   if test "x$with_version_extra1_present" = xtrue; then
 386     if test "x$with_version_extra1" = xyes; then
 387       AC_MSG_ERROR([--with-version-extra1 must have a value])
 388     elif test "x$with_version_extra1" = xno; then
 389       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 390       VERSION_EXTRA1=0
 391     elif test "x$with_version_extra1" = x; then
 392       VERSION_EXTRA1=0
 393     else
 394       JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA1, $with_version_extra1)
 395     fi
 396   else
 397     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 398       VERSION_EXTRA1=$DEFAULT_VERSION_EXTRA1
 399     fi
 400   fi
 401 
 402   # The 2nd version extra number, if any
 403   AC_ARG_WITH(version-extra2, [AS_HELP_STRING([--with-version-extra2],
 404       [Set 2nd version extra number @<:@not specified@:>@])],
 405       [with_version_extra2_present=true], [with_version_extra2_present=false])
 406 
 407   if test "x$with_version_extra2_present" = xtrue; then
 408     if test "x$with_version_extra2" = xyes; then
 409       AC_MSG_ERROR([--with-version-extra2 must have a value])
 410     elif test "x$with_version_extra2" = xno; then
 411       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 412       VERSION_EXTRA2=0
 413     elif test "x$with_version_extra2" = x; then
 414       VERSION_EXTRA2=0
 415     else
 416       JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA2, $with_version_extra2)
 417     fi
 418   else
 419     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 420       VERSION_EXTRA2=$DEFAULT_VERSION_EXTRA2
 421     fi
 422   fi
 423 
 424   # The 3rd version extra number, if any
 425   AC_ARG_WITH(version-extra3, [AS_HELP_STRING([--with-version-extra3],
 426       [Set 3rd version extra number @<:@not specified@:>@])],
 427       [with_version_extra3_present=true], [with_version_extra3_present=false])
 428 
 429   if test "x$with_version_extra3_present" = xtrue; then
 430     if test "x$with_version_extra3" = xyes; then
 431       AC_MSG_ERROR([--with-version-extra3 must have a value])
 432     elif test "x$with_version_extra3" = xno; then
 433       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
 434       VERSION_EXTRA3=0
 435     elif test "x$with_version_extra3" = x; then
 436       VERSION_EXTRA3=0
 437     else
 438       JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA3, $with_version_extra3)
 439     fi
 440   else
 441     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
 442       VERSION_EXTRA3=$DEFAULT_VERSION_EXTRA3
 443     fi
 444   fi
 445 
 446   # Calculate derived version properties
 447 
 448   # Set VERSION_IS_GA based on if VERSION_PRE has a value
 449   if test "x$VERSION_PRE" = x; then
 450     VERSION_IS_GA=true
 451   else
 452     VERSION_IS_GA=false
 453   fi
 454 
 455   # VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
 456   VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
 457 
 458   # VERSION_NUMBER but always with all positions, with 0 for empty positions.
 459   VERSION_NUMBER_ALL_POSITIONS=$VERSION_NUMBER_FOUR_POSITIONS.$VERSION_EXTRA1.$VERSION_EXTRA2.$VERSION_EXTRA3
 460 
 461   stripped_version_number=$VERSION_NUMBER_ALL_POSITIONS
 462   # Strip trailing zeroes from stripped_version_number
 463   for i in 1 2 3 4 5 6 ; do stripped_version_number=${stripped_version_number%.0} ; done
 464   VERSION_NUMBER=$stripped_version_number
 465 
 466   # The complete version string, with additional build information
 467   if test "x$VERSION_BUILD$VERSION_OPT" = x; then
 468     VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
 469   else
 470     # If either build or opt is set, we need a + separator
 471     VERSION_STRING=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}+$VERSION_BUILD${VERSION_OPT:+-$VERSION_OPT}
 472   fi
 473 
 474   # The short version string, just VERSION_NUMBER and PRE, if present.
 475   VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
 476 
 477   # The version date
 478   AC_ARG_WITH(version-date, [AS_HELP_STRING([--with-version-date],
 479       [Set version date @<:@current source value@:>@])])
 480   if test "x$with_version_date" = xyes; then
 481     AC_MSG_ERROR([--with-version-date must have a value])
 482   elif test "x$with_version_date" != x; then
 483     if [ ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then
 484       AC_MSG_ERROR(["$with_version_date" is not a valid version date])
 485     else
 486       VERSION_DATE="$with_version_date"
 487     fi
 488   else
 489     VERSION_DATE="$DEFAULT_VERSION_DATE"
 490   fi
 491 
 492   # The vendor version string, if any
 493   AC_ARG_WITH(vendor-version-string, [AS_HELP_STRING([--with-vendor-version-string],
 494       [Set vendor version string @<:@not specified@:>@])])
 495   if test "x$with_vendor_version_string" = xyes; then
 496     AC_MSG_ERROR([--with-vendor-version-string must have a value])
 497   elif [ ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ]; then
 498     AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string])
 499   else
 500     VENDOR_VERSION_STRING="$with_vendor_version_string"
 501   fi
 502 
 503   # We could define --with flags for these, if really needed
 504   VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
 505   VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
 506   JDK_SOURCE_TARGET_VERSION="$DEFAULT_JDK_SOURCE_TARGET_VERSION"
 507 
 508   AC_MSG_CHECKING([for version string])
 509   AC_MSG_RESULT([$VERSION_STRING])
 510 
 511   AC_SUBST(VERSION_FEATURE)
 512   AC_SUBST(VERSION_INTERIM)
 513   AC_SUBST(VERSION_UPDATE)
 514   AC_SUBST(VERSION_PATCH)
 515   AC_SUBST(VERSION_EXTRA1)
 516   AC_SUBST(VERSION_EXTRA2)
 517   AC_SUBST(VERSION_EXTRA3)
 518   AC_SUBST(VERSION_PRE)
 519   AC_SUBST(VERSION_BUILD)
 520   AC_SUBST(VERSION_OPT)
 521   AC_SUBST(VERSION_NUMBER)
 522   AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
 523   AC_SUBST(VERSION_STRING)
 524   AC_SUBST(VERSION_SHORT)
 525   AC_SUBST(VERSION_IS_GA)
 526   AC_SUBST(VERSION_DATE)
 527   AC_SUBST(VENDOR_VERSION_STRING)
 528   AC_SUBST(VERSION_CLASSFILE_MAJOR)
 529   AC_SUBST(VERSION_CLASSFILE_MINOR)
 530   AC_SUBST(JDK_SOURCE_TARGET_VERSION)
 531 ])