make/autoconf/jdk-version.m4
changeset 48327 d2a837cf9ff1
parent 47216 71c04702a3d5
child 48355 4944950606ef
child 48378 e8e8db4f8194
equal deleted inserted replaced
48326:e1eb12343774 48327:d2a837cf9ff1
     1 #
     1 #
     2 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    60   # Warn user that old version arguments are deprecated.
    60   # Warn user that old version arguments are deprecated.
    61   BASIC_DEPRECATED_ARG_WITH([milestone])
    61   BASIC_DEPRECATED_ARG_WITH([milestone])
    62   BASIC_DEPRECATED_ARG_WITH([update-version])
    62   BASIC_DEPRECATED_ARG_WITH([update-version])
    63   BASIC_DEPRECATED_ARG_WITH([user-release-suffix])
    63   BASIC_DEPRECATED_ARG_WITH([user-release-suffix])
    64   BASIC_DEPRECATED_ARG_WITH([build-number])
    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])
    65 
    68 
    66   # Source the version numbers file
    69   # Source the version numbers file
    67   . $AUTOCONF_DIR/version-numbers
    70   . $AUTOCONF_DIR/version-numbers
    68 
    71 
    69   # Some non-version number information is set in that file
    72   # Some non-version number information is set in that file
    85   if test "x$with_version_string" = xyes; then
    88   if test "x$with_version_string" = xyes; then
    86     AC_MSG_ERROR([--with-version-string must have a value])
    89     AC_MSG_ERROR([--with-version-string must have a value])
    87   elif test "x$with_version_string" != x; then
    90   elif test "x$with_version_string" != x; then
    88     # Additional [] needed to keep m4 from mangling shell constructs.
    91     # 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
    92     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]]}
    93       VERSION_FEATURE=${BASH_REMATCH[[1]]}
    91       VERSION_MINOR=${BASH_REMATCH[[3]]}
    94       VERSION_INTERIM=${BASH_REMATCH[[3]]}
    92       VERSION_SECURITY=${BASH_REMATCH[[5]]}
    95       VERSION_UPDATE=${BASH_REMATCH[[5]]}
    93       VERSION_PATCH=${BASH_REMATCH[[7]]}
    96       VERSION_PATCH=${BASH_REMATCH[[7]]}
    94       VERSION_PRE=${BASH_REMATCH[[9]]}
    97       VERSION_PRE=${BASH_REMATCH[[9]]}
    95       version_plus_separator=${BASH_REMATCH[[11]]}
    98       version_plus_separator=${BASH_REMATCH[[11]]}
    96       VERSION_BUILD=${BASH_REMATCH[[12]]}
    99       VERSION_BUILD=${BASH_REMATCH[[12]]}
    97       VERSION_OPT=${BASH_REMATCH[[14]]}
   100       VERSION_OPT=${BASH_REMATCH[[14]]}
    98       # Unspecified numerical fields are interpreted as 0.
   101       # Unspecified numerical fields are interpreted as 0.
    99       if test "x$VERSION_MINOR" = x; then
   102       if test "x$VERSION_INTERIM" = x; then
   100         VERSION_MINOR=0
   103         VERSION_INTERIM=0
   101       fi
   104       fi
   102       if test "x$VERSION_SECURITY" = x; then
   105       if test "x$VERSION_UPDATE" = x; then
   103         VERSION_SECURITY=0
   106         VERSION_UPDATE=0
   104       fi
   107       fi
   105       if test "x$VERSION_PATCH" = x; then
   108       if test "x$VERSION_PATCH" = x; then
   106         VERSION_PATCH=0
   109         VERSION_PATCH=0
   107       fi
   110       fi
   108       if test "x$version_plus_separator" != x \
   111       if test "x$version_plus_separator" != x \
   189       # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0.
   192       # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0.
   190       VERSION_BUILD=0
   193       VERSION_BUILD=0
   191     fi
   194     fi
   192   fi
   195   fi
   193 
   196 
   194   AC_ARG_WITH(version-major, [AS_HELP_STRING([--with-version-major],
   197   AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature],
   195       [Set version 'MAJOR' field (first number) @<:@current source value@:>@])],
   198       [Set version 'FEATURE' field (first number) @<:@current source value@:>@])],
   196       [with_version_major_present=true], [with_version_major_present=false])
   199       [with_version_feature_present=true], [with_version_feature_present=false])
   197 
   200 
   198   if test "x$with_version_major_present" = xtrue; then
   201   if test "x$with_version_feature_present" = xtrue; then
   199     if test "x$with_version_major" = xyes; then
   202     if test "x$with_version_feature" = xyes; then
   200       AC_MSG_ERROR([--with-version-major must have a value])
   203       AC_MSG_ERROR([--with-version-feature must have a value])
   201     else
   204     else
   202       JDKVER_CHECK_AND_SET_NUMBER(VERSION_MAJOR, $with_version_major)
   205       JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature)
   203     fi
   206     fi
   204   else
   207   else
   205     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   208     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   206       # Default is to get value from version-numbers
   209       # Default is to get value from version-numbers
   207       VERSION_MAJOR="$DEFAULT_VERSION_MAJOR"
   210       VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
   208     fi
   211     fi
   209   fi
   212   fi
   210 
   213 
   211   AC_ARG_WITH(version-minor, [AS_HELP_STRING([--with-version-minor],
   214   AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
   212       [Set version 'MINOR' field (second number) @<:@current source value@:>@])],
   215       [Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
   213       [with_version_minor_present=true], [with_version_minor_present=false])
   216       [with_version_interim_present=true], [with_version_interim_present=false])
   214 
   217 
   215   if test "x$with_version_minor_present" = xtrue; then
   218   if test "x$with_version_interim_present" = xtrue; then
   216     if test "x$with_version_minor" = xyes; then
   219     if test "x$with_version_interim" = xyes; then
   217       AC_MSG_ERROR([--with-version-minor must have a value])
   220       AC_MSG_ERROR([--with-version-interim must have a value])
   218     elif test "x$with_version_minor" = xno; then
   221     elif test "x$with_version_interim" = xno; then
   219       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
   222       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
   220       VERSION_MINOR=0
   223       VERSION_INTERIM=0
   221     elif test "x$with_version_minor" = x; then
   224     elif test "x$with_version_interim" = x; then
   222       VERSION_MINOR=0
   225       VERSION_INTERIM=0
   223     else
   226     else
   224       JDKVER_CHECK_AND_SET_NUMBER(VERSION_MINOR, $with_version_minor)
   227       JDKVER_CHECK_AND_SET_NUMBER(VERSION_INTERIM, $with_version_interim)
   225     fi
   228     fi
   226   else
   229   else
   227     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   230     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   228       # Default is 0, if unspecified
   231       # Default is 0, if unspecified
   229       VERSION_MINOR=$DEFAULT_VERSION_MINOR
   232       VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
   230     fi
   233     fi
   231   fi
   234   fi
   232 
   235 
   233   AC_ARG_WITH(version-security, [AS_HELP_STRING([--with-version-security],
   236   AC_ARG_WITH(version-update, [AS_HELP_STRING([--with-version-update],
   234       [Set version 'SECURITY' field (third number) @<:@current source value@:>@])],
   237       [Set version 'UPDATE' field (third number) @<:@current source value@:>@])],
   235       [with_version_security_present=true], [with_version_security_present=false])
   238       [with_version_update_present=true], [with_version_update_present=false])
   236 
   239 
   237   if test "x$with_version_security_present" = xtrue; then
   240   if test "x$with_version_update_present" = xtrue; then
   238     if test "x$with_version_security" = xyes; then
   241     if test "x$with_version_update" = xyes; then
   239       AC_MSG_ERROR([--with-version-security must have a value])
   242       AC_MSG_ERROR([--with-version-update must have a value])
   240     elif test "x$with_version_security" = xno; then
   243     elif test "x$with_version_update" = xno; then
   241       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
   244       # Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
   242       VERSION_SECURITY=0
   245       VERSION_UPDATE=0
   243     elif test "x$with_version_security" = x; then
   246     elif test "x$with_version_update" = x; then
   244       VERSION_SECURITY=0
   247       VERSION_UPDATE=0
   245     else
   248     else
   246       JDKVER_CHECK_AND_SET_NUMBER(VERSION_SECURITY, $with_version_security)
   249       JDKVER_CHECK_AND_SET_NUMBER(VERSION_UPDATE, $with_version_update)
   247     fi
   250     fi
   248   else
   251   else
   249     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   252     if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
   250       # Default is 0, if unspecified
   253       # Default is 0, if unspecified
   251       VERSION_SECURITY=$DEFAULT_VERSION_SECURITY
   254       VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
   252     fi
   255     fi
   253   fi
   256   fi
   254 
   257 
   255   AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
   258   AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
   256       [Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
   259       [Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
   282   else
   285   else
   283     VERSION_IS_GA=false
   286     VERSION_IS_GA=false
   284   fi
   287   fi
   285 
   288 
   286   # VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
   289   # 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
   290   VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
   288 
   291 
   289   stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
   292   stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
   290   # Strip trailing zeroes from stripped_version_number
   293   # Strip trailing zeroes from stripped_version_number
   291   for i in 1 2 3 ; do stripped_version_number=${stripped_version_number%.0} ; done
   294   for i in 1 2 3 ; do stripped_version_number=${stripped_version_number%.0} ; done
   292   VERSION_NUMBER=$stripped_version_number
   295   VERSION_NUMBER=$stripped_version_number
   300   fi
   303   fi
   301 
   304 
   302   # The short version string, just VERSION_NUMBER and PRE, if present.
   305   # The short version string, just VERSION_NUMBER and PRE, if present.
   303   VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
   306   VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
   304 
   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 
   305   AC_MSG_CHECKING([for version string])
   334   AC_MSG_CHECKING([for version string])
   306   AC_MSG_RESULT([$VERSION_STRING])
   335   AC_MSG_RESULT([$VERSION_STRING])
   307 
   336 
   308   AC_SUBST(VERSION_MAJOR)
   337   AC_SUBST(VERSION_FEATURE)
   309   AC_SUBST(VERSION_MINOR)
   338   AC_SUBST(VERSION_INTERIM)
   310   AC_SUBST(VERSION_SECURITY)
   339   AC_SUBST(VERSION_UPDATE)
   311   AC_SUBST(VERSION_PATCH)
   340   AC_SUBST(VERSION_PATCH)
   312   AC_SUBST(VERSION_PRE)
   341   AC_SUBST(VERSION_PRE)
   313   AC_SUBST(VERSION_BUILD)
   342   AC_SUBST(VERSION_BUILD)
   314   AC_SUBST(VERSION_OPT)
   343   AC_SUBST(VERSION_OPT)
   315   AC_SUBST(VERSION_NUMBER)
   344   AC_SUBST(VERSION_NUMBER)
   316   AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
   345   AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
   317   AC_SUBST(VERSION_STRING)
   346   AC_SUBST(VERSION_STRING)
   318   AC_SUBST(VERSION_SHORT)
   347   AC_SUBST(VERSION_SHORT)
   319   AC_SUBST(VERSION_IS_GA)
   348   AC_SUBST(VERSION_IS_GA)
       
   349   AC_SUBST(VERSION_DATE)
       
   350   AC_SUBST(VENDOR_VERSION_STRING)
   320 ])
   351 ])