1# =================================================================== 2# http://www.gnu.org/software/autoconf-archive/ax_is_release.html 3# =================================================================== 4# 5# SYNOPSIS 6# 7# AX_IS_RELEASE(POLICY) 8# 9# DESCRIPTION 10# 11# Determine whether the code is being configured as a release, or from git. 12# Set the ax_is_release variable to 'yes' or 'no'. 13# 14# If building a release version, it is recommended that the configure script 15# disable compiler errors and debug features, by conditionalising them on 16# the ax_is_release variable. If building from git, these features should 17# be enabled. 18# 19# The POLICY parameter specifies how ax_is_release is determined. It can 20# take the following values: 21# 22# * git-directory: ax_is_release will be 'no' if a '.git' directory exists 23# * minor-version: ax_is_release will be 'no' if the minor version number 24# in $PACKAGE_VERSION is odd; this assumes 25# $PACKAGE_VERSION follows the 'major.minor.micro' scheme 26# * always: ax_is_release will always be 'yes' 27# * never: ax_is_release will always be 'no' 28# 29# Other policies may be added in future. 30# 31# LICENSE 32# 33# Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk> 34# 35# Copying and distribution of this file, with or without modification, are 36# permitted in any medium without royalty provided the copyright notice 37# and this notice are preserved. 38 39#serial 1 40 41AC_DEFUN([AX_IS_RELEASE],[ 42 AC_BEFORE([AC_INIT],[$0]) 43 44 m4_case([$1], 45 [git-directory],[ 46 # $is_release = (.git directory does not exist) 47 AS_IF([test -d .git],[ax_is_release=no],[ax_is_release=yes]) 48 ], 49 [minor-version],[ 50 # $is_release = ($minor_version is even) 51 minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` 52 AS_IF([test "$(( $minor_version % 2 ))" -ne 0], 53 [ax_is_release=no],[ax_is_release=yes]) 54 ], 55 [always],[ax_is_release=yes], 56 [never],[ax_is_release=no], 57 [ 58 AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.]) 59 ]) 60]) 61