summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorDaniel Elstner <daniel.kitta@gmail.com>2009-08-15 00:05:08 +0200
committerDaniel Elstner <daniel.kitta@gmail.com>2009-08-15 00:05:08 +0200
commitc9f22e1c767efaa916e82de5b0dbea7b18fe0670 (patch)
tree1a8c3359d2f411df22fdc8ad9cf4f162e6dea85e /macros
parent80b1e4bd59bdb5aed594fc92afb2eb2eb6439186 (diff)
downloadmm-common-c9f22e1c767efaa916e82de5b0dbea7b18fe0670.tar.gz
Implement MM_PREREQ() Autoconf macro
* macros/mm-common.m4.in: New configure input file. (_MM_PRE_INIT): Move macro from mm-module.m4 to mm-common.m4. (MM_PREREQ): Implement a version check macro akin to AC_PREREQ() and similar macros. This may be used to ensure the presence of a minimum version of the mm-common package at the time the configure script is generated, should the need ever arise. * configure.ac (AC_CONFIG_FILES): Add output file macros/mm-common.m4. * Makefile.am (aclocal_macro_DATA): Install macros/mm-common.m4.
Diffstat (limited to 'macros')
-rw-r--r--macros/mm-common.m4.in47
1 files changed, 47 insertions, 0 deletions
diff --git a/macros/mm-common.m4.in b/macros/mm-common.m4.in
new file mode 100644
index 0000000..b616327
--- /dev/null
+++ b/macros/mm-common.m4.in
@@ -0,0 +1,47 @@
+## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/>
+##
+## @configure_input@
+##
+## mm-common is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation, either version 2 of the License,
+## or (at your option) any later version.
+##
+## mm-common is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with mm-common. If not, see <http://www.gnu.org/licenses/>.
+
+#serial 20090814
+
+## _MM_PRE_INIT
+##
+## Private pre-initialization macro for use with AC_REQUIRE(). For now,
+## all it does is register a forbidden token pattern with autom4te, so
+## that unexpanded macro calls in the output can be caught.
+##
+AC_DEFUN([_MM_PRE_INIT], [m4_pattern_forbid([^_?MM_])])
+
+## _MM_PREREQ(this-package, this-version, min-version, user-package)
+##
+m4_define([_MM_PREREQ],
+[dnl
+m4_if(m4_quote(m4_version_compare([$2], [$3])), [-1],
+ [m4_fatal([$4 requires $1 $3 (version $2 is installed)])])[]dnl
+])
+
+## MM_PREREQ(min-version)
+##
+## Require at least mm-common <min-version> to be installed, otherwise
+## abort with a fatal error message. The version is checked statically
+## at the time the configure script is generated.
+##
+AC_DEFUN([MM_PREREQ],
+[dnl
+m4_assert([$# >= 1])[]dnl
+AC_REQUIRE([_MM_PRE_INIT])[]dnl
+_MM_PREREQ([@PACKAGE_NAME@], [@PACKAGE_VERSION@], [$1], m4_defn([AC_PACKAGE_NAME]))[]dnl
+])