summaryrefslogtreecommitdiff
path: root/m4/library_version.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/library_version.m4')
-rw-r--r--m4/library_version.m410
1 files changed, 10 insertions, 0 deletions
diff --git a/m4/library_version.m4 b/m4/library_version.m4
new file mode 100644
index 0000000000..f0a9e8219c
--- /dev/null
+++ b/m4/library_version.m4
@@ -0,0 +1,10 @@
+# LIBRARY_VERSION(lib, [cabal_file])
+# --------------------------------
+# Gets the version number of a library.
+# If $1 is ghc-prim, then we define LIBRARY_ghc_prim_VERSION as 1.2.3
+# $2 points to the directory under libraries/
+AC_DEFUN([LIBRARY_VERSION],[
+cabal_file=m4_default([$2],[$1/$1.cabal])
+LIBRARY_[]translit([$1], [-], [_])[]_VERSION=`grep -i "^version:" libraries/${cabal_file} | sed "s/.* //"`
+AC_SUBST(LIBRARY_[]translit([$1], [-], [_])[]_VERSION)
+])