aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/dists/autogen/m4/ax_extract_version.m4
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:16:07 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:16:07 +0000
commit5d69ab51fd28961fd43b7e7646768b5a6dcbcb25 (patch)
tree5323292fcb46269f7dbbafe5a15ee399ad74675e /Lua/dists/autogen/m4/ax_extract_version.m4
parent220ae11b40e104d09e2c1ac08203c2a631294d99 (diff)
downloadusdx-5d69ab51fd28961fd43b7e7646768b5a6dcbcb25.tar.gz
usdx-5d69ab51fd28961fd43b7e7646768b5a6dcbcb25.tar.xz
usdx-5d69ab51fd28961fd43b7e7646768b5a6dcbcb25.zip
lua stuff moved to experimental folder
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1642 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua/dists/autogen/m4/ax_extract_version.m4')
-rw-r--r--Lua/dists/autogen/m4/ax_extract_version.m458
1 files changed, 58 insertions, 0 deletions
diff --git a/Lua/dists/autogen/m4/ax_extract_version.m4 b/Lua/dists/autogen/m4/ax_extract_version.m4
new file mode 100644
index 00000000..c514e3c3
--- /dev/null
+++ b/Lua/dists/autogen/m4/ax_extract_version.m4
@@ -0,0 +1,58 @@
+# This file is part of UltraStar Deluxe
+# Created by the UltraStar Deluxe Team
+
+# SYNOPSIS
+#
+# AX_EXTRACT_VERSION(VARIABLE_PREFIX, VERSION)
+#
+# DESCRIPTION
+#
+# Splits a version number ("major.minor.release") into its components.
+# The resulting components of the version are guaranteed to be
+# numeric. All non-numeric chars are removed.
+#
+# Sets
+# [$VARIABLE_PREFIX]_VERSION_MAJOR
+# [$VARIABLE_PREFIX]_VERSION_MINOR
+# [$VARIABLE_PREFIX]_VERSION_RELEASE
+#
+# This function calls
+# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type
+
+AC_DEFUN([AX_EXTRACT_VERSION],
+[
+ version=[$2]
+
+ # strip leading non-numeric tokens
+ # (necessary for some ffmpeg-packages in ubuntu)
+ # example: 0d.51.1.0 -> 51.1.0
+ version=`echo $version | sed 's/^[[^.]]*[[^0-9.]][[^.]]*\.//'`
+
+ # replace "." and "-" with " " and ignore trailing tokens.
+ # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4].
+ # In addition we delete everything after the first character
+ # which is not 0-9.
+ # 1.3a4-r32 will be [maj=1, min=3, rel=0].
+ read major minor release ignore <<eof
+ `echo $version | tr '.-' ' ' | sed 's/[[^0-9\ ]].*//'`
+eof
+ # Note: Do NOT indent the eof-delimiter
+ # We use a here-document (<<< here-strings not POSIX compatible)
+
+ test -z $major && major=0
+ test -z $minor && minor=0
+ test -z $release && release=0
+
+ # strip preceding 0s and set unset version-parts to 0
+ [$1][_VERSION_MAJOR]=$(($major))
+ [$1][_VERSION_MINOR]=$(($minor))
+ [$1][_VERSION_RELEASE]=$(($release))
+ # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+ # can be used if pkg-config's comparison fails
+ [$1][_VERSION_INT]=$(($[$1][_VERSION_MAJOR]*1000000+$[$1][_VERSION_MINOR]*1000+$[$1][_VERSION_RELEASE]))
+
+ AC_SUBST([$1][_VERSION_MAJOR])
+ AC_SUBST([$1][_VERSION_MINOR])
+ AC_SUBST([$1][_VERSION_RELEASE])
+ AC_SUBST([$1][_VERSION_INT])
+])