|
Packit |
130fc8 |
# ===========================================================================
|
|
Packit |
130fc8 |
# http://www.gnu.org/software/autoconf-archive/ax_is_release.html
|
|
Packit |
130fc8 |
# ===========================================================================
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# SYNOPSIS
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# AX_IS_RELEASE(POLICY)
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# DESCRIPTION
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# Determine whether the code is being configured as a release, or from
|
|
Packit |
130fc8 |
# git. Set the ax_is_release variable to 'yes' or 'no'.
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# If building a release version, it is recommended that the configure
|
|
Packit |
130fc8 |
# script disable compiler errors and debug features, by conditionalising
|
|
Packit |
130fc8 |
# them on the ax_is_release variable. If building from git, these
|
|
Packit |
130fc8 |
# features should be enabled.
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# The POLICY parameter specifies how ax_is_release is determined. It can
|
|
Packit |
130fc8 |
# take the following values:
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# * git-directory: ax_is_release will be 'no' if a '.git' directory exists
|
|
Packit |
130fc8 |
# * minor-version: ax_is_release will be 'no' if the minor version number
|
|
Packit |
130fc8 |
# in $PACKAGE_VERSION is odd; this assumes
|
|
Packit |
130fc8 |
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
|
Packit |
130fc8 |
# * micro-version: ax_is_release will be 'no' if the micro version number
|
|
Packit |
130fc8 |
# in $PACKAGE_VERSION is odd; this assumes
|
|
Packit |
130fc8 |
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
|
Packit |
130fc8 |
# * always: ax_is_release will always be 'yes'
|
|
Packit |
130fc8 |
# * never: ax_is_release will always be 'no'
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# Other policies may be added in future.
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# LICENSE
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# Copying and distribution of this file, with or without modification, are
|
|
Packit |
130fc8 |
# permitted in any medium without royalty provided the copyright notice
|
|
Packit |
130fc8 |
# and this notice are preserved.
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
#serial 3
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
AC_DEFUN([AX_IS_RELEASE],[
|
|
Packit |
130fc8 |
AC_BEFORE([AC_INIT],[$0])
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
m4_case([$1],
|
|
Packit |
130fc8 |
[git-directory],[
|
|
Packit |
130fc8 |
# $is_release = (.git directory does not exist)
|
|
Packit |
130fc8 |
AS_IF([test -d .git],[ax_is_release=no],[ax_is_release=yes])
|
|
Packit |
130fc8 |
],
|
|
Packit |
130fc8 |
[minor-version],[
|
|
Packit |
130fc8 |
# $is_release = ($minor_version is even)
|
|
Packit |
130fc8 |
minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
|
|
Packit |
130fc8 |
AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
|
|
Packit |
130fc8 |
[ax_is_release=no],[ax_is_release=yes])
|
|
Packit |
130fc8 |
],
|
|
Packit |
130fc8 |
[micro-version],[
|
|
Packit |
130fc8 |
# $is_release = ($micro_version is even)
|
|
Packit |
130fc8 |
micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
|
|
Packit |
130fc8 |
AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
|
|
Packit |
130fc8 |
[ax_is_release=no],[ax_is_release=yes])
|
|
Packit |
130fc8 |
],
|
|
Packit |
130fc8 |
[always],[ax_is_release=yes],
|
|
Packit |
130fc8 |
[never],[ax_is_release=no],
|
|
Packit |
130fc8 |
[
|
|
Packit |
130fc8 |
AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.])
|
|
Packit |
130fc8 |
])
|
|
Packit |
130fc8 |
])
|