8296478: Rework 8282948 and 8282700 to use the new autoconf UTIL_ARG_WITH

Reviewed-by: erikj, ihse
This commit is contained in:
Julian Waters 2023-01-12 15:01:59 +00:00
parent cf00d09c8c
commit 26890d1909
3 changed files with 187 additions and 209 deletions

@ -781,7 +781,7 @@ AC_DEFUN([JDKOPT_SETUP_MACOSX_SIGNING],
# Check for user provided code signing identity. # Check for user provided code signing identity.
UTIL_ARG_WITH(NAME: macosx-codesign-identity, TYPE: string, UTIL_ARG_WITH(NAME: macosx-codesign-identity, TYPE: string,
DEFAULT: openjdk_codesign, CHECK_VALUE: UTIL_CHECK_STRING_NON_EMPTY, DEFAULT: openjdk_codesign, CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY],
DESC: [specify the macosx code signing identity], DESC: [specify the macosx code signing identity],
CHECKING_MSG: [for macosx code signing identity] CHECKING_MSG: [for macosx code signing identity]
) )

@ -69,149 +69,132 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
AC_SUBST(JDK_RC_PLATFORM_NAME) AC_SUBST(JDK_RC_PLATFORM_NAME)
AC_SUBST(HOTSPOT_VM_DISTRO) AC_SUBST(HOTSPOT_VM_DISTRO)
# Note: UTIL_ARG_WITH treats empty strings as valid values when OPTIONAL is false!
# Outer [ ] to quote m4.
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
# Setup username (for use in adhoc version strings etc) # Setup username (for use in adhoc version strings etc)
AC_ARG_WITH([build-user], [AS_HELP_STRING([--with-build-user], UTIL_ARG_WITH(NAME: build-user, TYPE: string,
[build username to use in version strings])]) RESULT: USERNAME,
if test "x$with_build_user" = xyes || test "x$with_build_user" = xno; then DEFAULT: $USERNAME,
AC_MSG_ERROR([--with-build-user must have a value]) DESC: [build username to use in version strings],
elif test "x$with_build_user" != x; then DEFAULT_DESC: [current username, sanitized],
USERNAME="$with_build_user" CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY])
else
# Outer [ ] to quote m4.
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
fi
AC_SUBST(USERNAME) AC_SUBST(USERNAME)
# Set the JDK RC name # Set the JDK RC name
AC_ARG_WITH(jdk-rc-name, [AS_HELP_STRING([--with-jdk-rc-name], # Otherwise calculate from "branding.conf" included above.
[Set JDK RC name. This is used for FileDescription and ProductName properties UTIL_ARG_WITH(NAME: jdk-rc-name, TYPE: string,
of MS Windows binaries. @<:@not specified@:>@])]) DEFAULT: $PRODUCT_NAME $JDK_RC_PLATFORM_NAME,
if test "x$with_jdk_rc_name" = xyes || test "x$with_jdk_rc_name" = xno; then DESC: [Set JDK RC name. This is used for FileDescription and ProductName
AC_MSG_ERROR([--with-jdk-rc-name must have a value]) properties of MS Windows binaries.],
elif [ ! [[ $with_jdk_rc_name =~ ^[[:print:]]*$ ]] ]; then DEFAULT_DESC: [from branding.conf],
AC_MSG_ERROR([--with-jdk-rc-name contains non-printing characters: $with_jdk_rc_name]) CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
elif test "x$with_jdk_rc_name" != x; then
# Set JDK_RC_NAME to a custom value if '--with-jdk-rc-name' was used and is not empty.
JDK_RC_NAME="$with_jdk_rc_name"
else
# Otherwise calculate from "branding.conf" included above.
JDK_RC_NAME="$PRODUCT_NAME $JDK_RC_PLATFORM_NAME"
fi
AC_SUBST(JDK_RC_NAME) AC_SUBST(JDK_RC_NAME)
# The vendor name, if any # The vendor name, if any
AC_ARG_WITH(vendor-name, [AS_HELP_STRING([--with-vendor-name], # Only set COMPANY_NAME if '--with-vendor-name' was used and is not empty.
[Set vendor name. Among others, used to set the 'java.vendor' # Otherwise we will use the value from "branding.conf" included above.
and 'java.vm.vendor' system properties. @<:@not specified@:>@])]) UTIL_ARG_WITH(NAME: vendor-name, TYPE: string,
if test "x$with_vendor_name" = xyes || test "x$with_vendor_name" = xno; then RESULT: COMPANY_NAME,
AC_MSG_ERROR([--with-vendor-name must have a value]) DEFAULT: $COMPANY_NAME,
elif [ ! [[ $with_vendor_name =~ ^[[:print:]]*$ ]] ]; then DESC: [Set vendor name. Among others, used to set the 'java.vendor'
AC_MSG_ERROR([--with-vendor-name contains non-printing characters: $with_vendor_name]) and 'java.vm.vendor' system properties.],
elif test "x$with_vendor_name" != x; then DEFAULT_DESC: [from branding.conf],
# Only set COMPANY_NAME if '--with-vendor-name' was used and is not empty. CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
# Otherwise we will use the value from "branding.conf" included above.
COMPANY_NAME="$with_vendor_name"
fi
AC_SUBST(COMPANY_NAME) AC_SUBST(COMPANY_NAME)
# The vendor URL, if any # The vendor URL, if any
AC_ARG_WITH(vendor-url, [AS_HELP_STRING([--with-vendor-url], # Only set VENDOR_URL if '--with-vendor-url' was used and is not empty.
[Set the 'java.vendor.url' system property @<:@not specified@:>@])]) # Otherwise we will use the value from "branding.conf" included above.
if test "x$with_vendor_url" = xyes || test "x$with_vendor_url" = xno; then UTIL_ARG_WITH(NAME: vendor-url, TYPE: string,
AC_MSG_ERROR([--with-vendor-url must have a value]) DEFAULT: $VENDOR_URL,
elif [ ! [[ $with_vendor_url =~ ^[[:print:]]*$ ]] ]; then DESC: [Set the 'java.vendor.url' system property],
AC_MSG_ERROR([--with-vendor-url contains non-printing characters: $with_vendor_url]) DEFAULT_DESC: [from branding.conf],
elif test "x$with_vendor_url" != x; then CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
# Only set VENDOR_URL if '--with-vendor-url' was used and is not empty.
# Otherwise we will use the value from "branding.conf" included above.
VENDOR_URL="$with_vendor_url"
fi
AC_SUBST(VENDOR_URL) AC_SUBST(VENDOR_URL)
# The vendor bug URL, if any # The vendor bug URL, if any
AC_ARG_WITH(vendor-bug-url, [AS_HELP_STRING([--with-vendor-bug-url], # Only set VENDOR_URL_BUG if '--with-vendor-bug-url' was used and is not empty.
[Set the 'java.vendor.url.bug' system property @<:@not specified@:>@])]) # Otherwise we will use the value from "branding.conf" included above.
if test "x$with_vendor_bug_url" = xyes || test "x$with_vendor_bug_url" = xno; then UTIL_ARG_WITH(NAME: vendor-bug-url, TYPE: string,
AC_MSG_ERROR([--with-vendor-bug-url must have a value]) RESULT: VENDOR_URL_BUG,
elif [ ! [[ $with_vendor_bug_url =~ ^[[:print:]]*$ ]] ]; then DEFAULT: $VENDOR_URL_BUG,
AC_MSG_ERROR([--with-vendor-bug-url contains non-printing characters: $with_vendor_bug_url]) DESC: [Set the 'java.vendor.url.bug' system property],
elif test "x$with_vendor_bug_url" != x; then DEFAULT_DESC: [from branding.conf],
# Only set VENDOR_URL_BUG if '--with-vendor-bug-url' was used and is not empty. CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
# Otherwise we will use the value from "branding.conf" included above.
VENDOR_URL_BUG="$with_vendor_bug_url"
fi
AC_SUBST(VENDOR_URL_BUG) AC_SUBST(VENDOR_URL_BUG)
# The vendor VM bug URL, if any # The vendor VM bug URL, if any
AC_ARG_WITH(vendor-vm-bug-url, [AS_HELP_STRING([--with-vendor-vm-bug-url], # Only set VENDOR_URL_VM_BUG if '--with-vendor-vm-bug-url' was used and is not empty.
[Sets the bug URL which will be displayed when the VM crashes @<:@not specified@:>@])]) # Otherwise we will use the value from "branding.conf" included above.
if test "x$with_vendor_vm_bug_url" = xyes || test "x$with_vendor_vm_bug_url" = xno; then UTIL_ARG_WITH(NAME: vendor-vm-bug-url, TYPE: string,
AC_MSG_ERROR([--with-vendor-vm-bug-url must have a value]) RESULT: VENDOR_URL_VM_BUG,
elif [ ! [[ $with_vendor_vm_bug_url =~ ^[[:print:]]*$ ]] ]; then DEFAULT: $VENDOR_URL_VM_BUG,
AC_MSG_ERROR([--with-vendor-vm-bug-url contains non-printing characters: $with_vendor_vm_bug_url]) DESC: [Sets the bug URL which will be displayed when the VM crashes],
elif test "x$with_vendor_vm_bug_url" != x; then DEFAULT_DESC: [from branding.conf],
# Only set VENDOR_URL_VM_BUG if '--with-vendor-vm-bug-url' was used and is not empty. CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
# Otherwise we will use the value from "branding.conf" included above.
VENDOR_URL_VM_BUG="$with_vendor_vm_bug_url"
fi
AC_SUBST(VENDOR_URL_VM_BUG) AC_SUBST(VENDOR_URL_VM_BUG)
# Override version from arguments # Override version from arguments
# If --with-version-string is set, process it first. It is possible to # If --with-version-string is set, process it first. It is possible to
# override parts with more specific flags, since these are processed later. # override parts with more specific flags, since these are processed later.
AC_ARG_WITH(version-string, [AS_HELP_STRING([--with-version-string], UTIL_ARG_WITH(NAME: version-string, TYPE: string,
[Set version string @<:@calculated@:>@])]) DEFAULT: [],
if test "x$with_version_string" = xyes || test "x$with_version_string" = xno; then DESC: [Set version string],
AC_MSG_ERROR([--with-version-string must have a value]) DEFAULT_DESC: [calculated],
elif test "x$with_version_string" != x; then CHECK_VALUE: [
# Additional [] needed to keep m4 from mangling shell constructs. if test "x$RESULT" != x; then
if [ [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z0-9]+))?(((\+)([0-9]*))?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then # Additional [] needed to keep m4 from mangling shell constructs.
VERSION_FEATURE=${BASH_REMATCH[[1]]} if [ [[ $RESULT =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z0-9]+))?(((\+)([0-9]*))?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
VERSION_INTERIM=${BASH_REMATCH[[3]]} VERSION_FEATURE=${BASH_REMATCH[[1]]}
VERSION_UPDATE=${BASH_REMATCH[[5]]} VERSION_INTERIM=${BASH_REMATCH[[3]]}
VERSION_PATCH=${BASH_REMATCH[[7]]} VERSION_UPDATE=${BASH_REMATCH[[5]]}
VERSION_EXTRA1=${BASH_REMATCH[[9]]} VERSION_PATCH=${BASH_REMATCH[[7]]}
VERSION_EXTRA2=${BASH_REMATCH[[11]]} VERSION_EXTRA1=${BASH_REMATCH[[9]]}
VERSION_EXTRA3=${BASH_REMATCH[[13]]} VERSION_EXTRA2=${BASH_REMATCH[[11]]}
VERSION_PRE=${BASH_REMATCH[[15]]} VERSION_EXTRA3=${BASH_REMATCH[[13]]}
version_plus_separator=${BASH_REMATCH[[18]]} VERSION_PRE=${BASH_REMATCH[[15]]}
VERSION_BUILD=${BASH_REMATCH[[19]]} version_plus_separator=${BASH_REMATCH[[18]]}
VERSION_OPT=${BASH_REMATCH[[21]]} VERSION_BUILD=${BASH_REMATCH[[19]]}
# Unspecified numerical fields are interpreted as 0. VERSION_OPT=${BASH_REMATCH[[21]]}
if test "x$VERSION_INTERIM" = x; then # Unspecified numerical fields are interpreted as 0.
VERSION_INTERIM=0 if test "x$VERSION_INTERIM" = x; then
VERSION_INTERIM=0
fi
if test "x$VERSION_UPDATE" = x; then
VERSION_UPDATE=0
fi
if test "x$VERSION_PATCH" = x; then
VERSION_PATCH=0
fi
if test "x$VERSION_EXTRA1" = x; then
VERSION_EXTRA1=0
fi
if test "x$VERSION_EXTRA2" = x; then
VERSION_EXTRA2=0
fi
if test "x$VERSION_EXTRA3" = x; then
VERSION_EXTRA3=0
fi
if test "x$version_plus_separator" != x \
&& test "x$VERSION_BUILD$VERSION_OPT" = x; then
AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
fi
if test "x$VERSION_BUILD" = x0; then
AC_MSG_WARN([Version build 0 is interpreted as no build number])
VERSION_BUILD=
fi
# Stop the version part process from setting default values.
# We still allow them to explicitly override though.
NO_DEFAULT_VERSION_PARTS=true
else
FAILURE="--with-version-string fails to parse as a valid version string: $RESULT"
fi
fi fi
if test "x$VERSION_UPDATE" = x; then ])
VERSION_UPDATE=0
fi
if test "x$VERSION_PATCH" = x; then
VERSION_PATCH=0
fi
if test "x$VERSION_EXTRA1" = x; then
VERSION_EXTRA1=0
fi
if test "x$VERSION_EXTRA2" = x; then
VERSION_EXTRA2=0
fi
if test "x$VERSION_EXTRA3" = x; then
VERSION_EXTRA3=0
fi
if test "x$version_plus_separator" != x \
&& test "x$VERSION_BUILD$VERSION_OPT" = x; then
AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
fi
if test "x$VERSION_BUILD" = x0; then
AC_MSG_WARN([Version build 0 is interpreted as no build number])
VERSION_BUILD=
fi
# Stop the version part process from setting default values.
# We still allow them to explicitly override though.
NO_DEFAULT_VERSION_PARTS=true
else
AC_MSG_ERROR([--with-version-string fails to parse as a valid version string: $with_version_string])
fi
fi
AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre], AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre],
[Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])], [Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])],
@ -290,23 +273,19 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
fi fi
fi fi
AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature], # Default is to get value from version-numbers.conf
[Set version 'FEATURE' field (first number) @<:@current source value@:>@])], if test "x$NO_DEFAULT_VERSION_PARTS" = xtrue; then
[with_version_feature_present=true], [with_version_feature_present=false]) DEFAULT_VERSION_FEATURE="$VERSION_FEATURE"
if test "x$with_version_feature_present" = xtrue; then
if test "x$with_version_feature" = xyes || test "x$with_version_feature" = xno; then
AC_MSG_ERROR([--with-version-feature must have a value])
else
JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature)
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is to get value from version-numbers.conf
VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
fi
fi fi
UTIL_ARG_WITH(NAME: version-feature, TYPE: string,
DEFAULT: $DEFAULT_VERSION_FEATURE,
DESC: [Set version 'FEATURE' field (first number)],
DEFAULT_DESC: [current source value],
CHECK_VALUE: [
JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $RESULT)
])
AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim], AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
[Set version 'INTERIM' field (second number) @<:@current source value@:>@])], [Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
[with_version_interim_present=true], [with_version_interim_present=false]) [with_version_interim_present=true], [with_version_interim_present=false])
@ -480,91 +459,81 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE} VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
# The version date # The version date
AC_ARG_WITH(version-date, [AS_HELP_STRING([--with-version-date], UTIL_ARG_WITH(NAME: version-date, TYPE: string,
[Set version date @<:@current source value@:>@])]) DEFAULT: $DEFAULT_VERSION_DATE,
if test "x$with_version_date" = xyes || test "x$with_version_date" = xno; then DESC: [Set version date],
AC_MSG_ERROR([--with-version-date must have a value]) DEFAULT_DESC: [current source value],
elif test "x$with_version_date" != x; then CHECK_VALUE: [
if [ ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then if test "x$RESULT" = x; then
AC_MSG_ERROR(["$with_version_date" is not a valid version date]) FAILURE="--with-version-date cannot be empty"
else elif [ ! [[ $RESULT =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then
VERSION_DATE="$with_version_date" FAILURE="\"$RESULT\" is not a valid version date"
fi fi
else ])
VERSION_DATE="$DEFAULT_VERSION_DATE"
fi
# The vendor version string, if any # The vendor version string, if any
AC_ARG_WITH(vendor-version-string, [AS_HELP_STRING([--with-vendor-version-string], # DEFAULT is set to an empty string in the case of --with-vendor-version-string without
[Set vendor version string @<:@not specified@:>@])]) # any value, which would set VENDOR_VERSION_STRING_ENABLED to true and ultimately also
if test "x$with_vendor_version_string" = xyes; then # cause VENDOR_VERSION_STRING to fall back to the value in DEFAULT
AC_MSG_ERROR([--with-vendor-version-string must have a value]) UTIL_ARG_WITH(NAME: vendor-version-string, TYPE: string,
elif [ ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ]; then DEFAULT: [],
AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string]) OPTIONAL: true,
elif test "x$with_vendor_version_string" != xno; then DESC: [Set vendor version string],
# Set vendor version string if --without is not passed DEFAULT_DESC: [not specified])
# Check not required if an empty value is passed, since VENDOR_VERSION_STRING
# would then be set to "" if test "x$VENDOR_VERSION_STRING_ENABLED" = xtrue; then
VENDOR_VERSION_STRING="$with_vendor_version_string" if [ ! [[ $VENDOR_VERSION_STRING =~ ^[[:graph:]]*$ ]] ]; then
AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $VENDOR_VERSION_STRING])
fi
fi fi
# Set the MACOSX Bundle Name base # Set the MACOSX Bundle Name base
AC_ARG_WITH(macosx-bundle-name-base, [AS_HELP_STRING([--with-macosx-bundle-name-base], UTIL_ARG_WITH(NAME: macosx-bundle-name-base, TYPE: string,
[Set the MacOSX Bundle Name base. This is the base name for calculating MacOSX Bundle Names. DEFAULT: $MACOSX_BUNDLE_NAME_BASE,
@<:@not specified@:>@])]) DESC: [Set the MacOSX Bundle Name base. This is the base name for calculating MacOSX Bundle Names.],
if test "x$with_macosx_bundle_name_base" = xyes || test "x$with_macosx_bundle_name_base" = xno; then DEFAULT_DESC: [from branding.conf],
AC_MSG_ERROR([--with-macosx-bundle-name-base must have a value]) CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
elif [ ! [[ $with_macosx_bundle_name_base =~ ^[[:print:]]*$ ]] ]; then
AC_MSG_ERROR([--with-macosx-bundle-name-base contains non-printing characters: $with_macosx_bundle_name_base])
elif test "x$with_macosx_bundle_name_base" != x; then
# Set MACOSX_BUNDLE_NAME_BASE to the configured value.
MACOSX_BUNDLE_NAME_BASE="$with_macosx_bundle_name_base"
fi
AC_SUBST(MACOSX_BUNDLE_NAME_BASE) AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
# Set the MACOSX Bundle ID base # If using the default value, append the VERSION_PRE if there is one
AC_ARG_WITH(macosx-bundle-id-base, [AS_HELP_STRING([--with-macosx-bundle-id-base], # to make it possible to tell official builds apart from developer builds
[Set the MacOSX Bundle ID base. This is the base ID for calculating MacOSX Bundle IDs. if test "x$VERSION_PRE" != x; then
@<:@not specified@:>@])]) MACOSX_BUNDLE_ID_BASE="$MACOSX_BUNDLE_ID_BASE-$VERSION_PRE"
if test "x$with_macosx_bundle_id_base" = xyes || test "x$with_macosx_bundle_id_base" = xno; then
AC_MSG_ERROR([--with-macosx-bundle-id-base must have a value])
elif [ ! [[ $with_macosx_bundle_id_base =~ ^[[:print:]]*$ ]] ]; then
AC_MSG_ERROR([--with-macosx-bundle-id-base contains non-printing characters: $with_macosx_bundle_id_base])
elif test "x$with_macosx_bundle_id_base" != x; then
# Set MACOSX_BUNDLE_ID_BASE to the configured value.
MACOSX_BUNDLE_ID_BASE="$with_macosx_bundle_id_base"
else
# If using the default value, append the VERSION_PRE if there is one
# to make it possible to tell official builds apart from developer builds
if test "x$VERSION_PRE" != x; then
MACOSX_BUNDLE_ID_BASE="$MACOSX_BUNDLE_ID_BASE-$VERSION_PRE"
fi
fi fi
# Set the MACOSX Bundle ID base
UTIL_ARG_WITH(NAME: macosx-bundle-id-base, TYPE: string,
DEFAULT: $MACOSX_BUNDLE_ID_BASE,
DESC: [Set the MacOSX Bundle ID base. This is the base ID for calculating MacOSX Bundle IDs.],
DEFAULT_DESC: [based on branding.conf and VERSION_PRE],
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
AC_SUBST(MACOSX_BUNDLE_ID_BASE) AC_SUBST(MACOSX_BUNDLE_ID_BASE)
# Set the MACOSX CFBundleVersion field if test "x$VERSION_BUILD" != x; then
AC_ARG_WITH(macosx-bundle-build-version, [AS_HELP_STRING([--with-macosx-bundle-build-version], MACOSX_BUNDLE_BUILD_VERSION="$VERSION_BUILD"
[Set the MacOSX Bundle CFBundleVersion field. This key is a machine-readable
string composed of one to three period-separated integers and should represent the
build version. Defaults to the build number.])])
if test "x$with_macosx_bundle_build_version" = xyes || test "x$with_macosx_bundle_build_version" = xno; then
AC_MSG_ERROR([--with-macosx-bundle-build-version must have a value])
elif [ ! [[ $with_macosx_bundle_build_version =~ ^[0-9\.]*$ ]] ]; then
AC_MSG_ERROR([--with-macosx-bundle-build-version contains non numbers and periods: $with_macosx_bundle_build_version])
elif test "x$with_macosx_bundle_build_version" != x; then
MACOSX_BUNDLE_BUILD_VERSION="$with_macosx_bundle_build_version"
else else
if test "x$VERSION_BUILD" != x; then MACOSX_BUNDLE_BUILD_VERSION=0
MACOSX_BUNDLE_BUILD_VERSION="$VERSION_BUILD"
else
MACOSX_BUNDLE_BUILD_VERSION=0
fi
# If VERSION_OPT consists of only numbers and periods, add it.
if [ [[ $VERSION_OPT =~ ^[0-9\.]+$ ]] ]; then
MACOSX_BUNDLE_BUILD_VERSION="$MACOSX_BUNDLE_BUILD_VERSION.$VERSION_OPT"
fi
fi fi
# If VERSION_OPT consists of only numbers and periods, add it.
if [ [[ $VERSION_OPT =~ ^[0-9\.]+$ ]] ]; then
MACOSX_BUNDLE_BUILD_VERSION="$MACOSX_BUNDLE_BUILD_VERSION.$VERSION_OPT"
fi
# Set the MACOSX CFBundleVersion field
UTIL_ARG_WITH(NAME: macosx-bundle-build-version, TYPE: string,
DEFAULT: $MACOSX_BUNDLE_BUILD_VERSION,
DESC: [Set the MacOSX Bundle CFBundleVersion field. This key is a machine-readable
string composed of one to three period-separated integers and should represent the
build version.],
DEFAULT_DESC: [the build number],
CHECK_VALUE: [
if test "x$RESULT" = x; then
FAILURE="--with-macosx-bundle-build-version must have a value"
elif [ ! [[ $RESULT =~ ^[0-9\.]*$ ]] ]; then
FAILURE="--with-macosx-bundle-build-version contains non numbers and periods: $RESULT"
fi
])
AC_SUBST(MACOSX_BUNDLE_BUILD_VERSION) AC_SUBST(MACOSX_BUNDLE_BUILD_VERSION)
# We could define --with flags for these, if really needed # We could define --with flags for these, if really needed

@ -818,3 +818,12 @@ AC_DEFUN([UTIL_CHECK_STRING_NON_EMPTY],
FAILURE="Value cannot be empty" FAILURE="Value cannot be empty"
fi fi
]) ])
AC_DEFUN([UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE],
[
if test "x$RESULT" = x; then
FAILURE="Value cannot be empty"
elif [ ! [[ $RESULT =~ ^[[:print:]]*$ ]] ]; then
FAILURE="Value contains non-printing characters: $RESULT"
fi
])