[mm-common] Implement check for GNU make features



commit 9254c7b716968c7ebd22c7c7b7eacb760f2bc8f4
Author: Daniel Elstner <daniel kitta gmail com>
Date:   Sun Aug 23 05:11:29 2009 +0200

    Implement check for GNU make features
    
    * macros/mm-pkg.m4 (MM_CHECK_GNU_MAKE): New Autoconf macro to ensure
    that the installed make program is compatible with GNU make.
    * macros/mm-module.m4 (MM_INIT_MODULE): Require MM_CHECK_GNU_MAKE.
    * macros/mm-doc.m4 (MM_CONFIG_DOCTOOL_DIR): ditto.

 macros/mm-doc.m4    |    1 +
 macros/mm-module.m4 |    3 ++-
 macros/mm-pkg.m4    |   39 ++++++++++++++++++++++++++++++++++++---
 3 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/macros/mm-doc.m4 b/macros/mm-doc.m4
index 92898bf..10e6f82 100644
--- a/macros/mm-doc.m4
+++ b/macros/mm-doc.m4
@@ -67,6 +67,7 @@ AC_MSG_RESULT([$MMDOCTOOLDIR])[]dnl
 AC_DEFUN([MM_CONFIG_DOCTOOL_DIR],
 [dnl
 AC_REQUIRE([_MM_PRE_INIT])[]dnl
+AC_REQUIRE([MM_CHECK_GNU_MAKE])[]dnl
 m4_ifval([$1], [MMDOCTOOLDIR='[$]{top_srcdir}/$1'], [AC_REQUIRE([_MM_CONFIG_DOCTOOL_DIR])])
 AC_SUBST([MMDOCTOOLDIR])[]dnl
 ])
diff --git a/macros/mm-module.m4 b/macros/mm-module.m4
index f21eab9..2193ded 100644
--- a/macros/mm-module.m4
+++ b/macros/mm-module.m4
@@ -15,7 +15,7 @@
 ## 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 20090820
+#serial 20090822
 
 ## _MM_INIT_MODULE_VERSION(basename, BASENAME, [major], [minor], [micro])
 ##
@@ -79,6 +79,7 @@ AC_DEFUN([MM_INIT_MODULE],
 [dnl
 m4_assert([$# >= 1])[]dnl
 AC_REQUIRE([_MM_PRE_INIT])[]dnl
+AC_REQUIRE([MM_CHECK_GNU_MAKE])[]dnl
 _MM_INIT_MODULE_BASENAME([$1],
                  m4_quote(m4_ifval([$2], [$2], m4_defn([AC_PACKAGE_VERSION]))),
                  m4_quote(m4_bpatsubst([$1], [-[.0123456789]+$])),
diff --git a/macros/mm-pkg.m4 b/macros/mm-pkg.m4
index 2618310..86f94d2 100644
--- a/macros/mm-pkg.m4
+++ b/macros/mm-pkg.m4
@@ -15,7 +15,40 @@
 ## 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 20090821
+#serial 20090822
+
+## _MM_CHECK_GNU_MAKE
+##
+## Implementation of MM_CHECK_GNU_MAKE.
+##
+m4_define([_MM_CHECK_GNU_MAKE],
+[dnl
+AC_PROVIDE([$0])[]dnl
+AC_MSG_CHECKING([whether [$]{MAKE-make} supports GNU make features])
+cat >conftest.make <<'_MMEOF'
+override reverse = [$](2)[$](subst ,, )[$](1)
+override result := [$](word 2,[$](call reverse,success,failure))
+all: ; test '[$](result)' = success
+.PHONY: all
+_MMEOF
+AS_IF([[$]{MAKE-make} -f conftest.make >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
+      [mm_gnu_make=yes], [mm_gnu_make=no])
+rm -f conftest.make
+AC_MSG_RESULT([$mm_gnu_make])
+AS_IF([test "x$mm_gnu_make" != xyes],
+      [AC_MSG_FAILURE([[The GNU make program is required to build $PACKAGE_NAME.]])])[]dnl
+])
+
+## MM_CHECK_GNU_MAKE
+##
+## Check whether the installed make program supports GNU make features.
+## If the test fails, display an error message and abort.
+##
+AC_DEFUN([MM_CHECK_GNU_MAKE],
+[dnl
+AC_REQUIRE([_MM_PRE_INIT])[]dnl
+AC_REQUIRE([_MM_CHECK_GNU_MAKE])[]dnl
+])
 
 ## _MM_PATH_PERL
 ##
@@ -46,9 +79,9 @@ AC_REQUIRE([_MM_PATH_PERL])[]dnl
 ##
 m4_define([_MM_CHECK_PERL],
 [dnl
-AS_IF([$PERL -e 'require v$1; exit 0;' >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
+AS_IF([$PERL -e "require v$1; exit 0;" >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
       [$2], m4_ifval([$2$3], [[$3]],
-            [[AC_MSG_FAILURE([[At least Perl ]$1[ is required to build $PACKAGE.]])]]))[]dnl
+            [[AC_MSG_FAILURE([[At least Perl ]$1[ is required to build $PACKAGE_NAME.]])]]))[]dnl
 ])
 
 ## MM_CHECK_PERL([min-version], [action-if-found], [action-if-not-found])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]