From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C7E3C07E99 for ; Mon, 5 Jul 2021 10:55:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF45F61416 for ; Mon, 5 Jul 2021 10:55:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF45F61416 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.150100.277621 (Exim 4.92) (envelope-from ) id 1m0MGG-0005Fp-50; Mon, 05 Jul 2021 10:55:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 150100.277621; Mon, 05 Jul 2021 10:55:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m0MGG-0005Fe-12; Mon, 05 Jul 2021 10:55:36 +0000 Received: by outflank-mailman (input) for mailman id 150100; Mon, 05 Jul 2021 10:55:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m0MGE-0003rB-Cc for xen-devel@lists.xenproject.org; Mon, 05 Jul 2021 10:55:34 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 74206765-7696-408d-bc0e-90cade312c02; Mon, 05 Jul 2021 10:55:24 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1629B12FC; Mon, 5 Jul 2021 03:55:24 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.197.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 304EA3F5A1; Mon, 5 Jul 2021 03:55:23 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 74206765-7696-408d-bc0e-90cade312c02 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Ian Jackson , Wei Liu , Stefano Stabellini Subject: [PATCH v7 4/9] m4/python: add function to docs_tool.m4 and new m4 module Date: Mon, 5 Jul 2021 11:50:58 +0100 Message-Id: <20210705105103.14509-5-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210705105103.14509-1-luca.fancellu@arm.com> References: <20210705105103.14509-1-luca.fancellu@arm.com> Add ax_python_module.m4 to have a way to check if a python module is installed in the system. Add a function to docs_tool.m4 to throw an error if the required docs tool is missing. Signed-off-by: Luca Fancellu Acked-by: Stefano Stabellini --- m4/ax_python_module.m4 | 56 ++++++++++++++++++++++++++++++++++++++++++ m4/docs_tool.m4 | 9 +++++++ 2 files changed, 65 insertions(+) create mode 100644 m4/ax_python_module.m4 diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4 new file mode 100644 index 0000000000..107d88264a --- /dev/null +++ b/m4/ax_python_module.m4 @@ -0,0 +1,56 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_python_module.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_MODULE(modname[, fatal, python]) +# +# DESCRIPTION +# +# Checks for Python module. +# +# If fatal is non-empty then absence of a module will trigger an error. +# The third parameter can either be "python" for Python 2 or "python3" for +# Python 3; defaults to Python 3. +# +# LICENSE +# +# Copyright (c) 2008 Andrew Collier +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) +AC_DEFUN([AX_PYTHON_MODULE],[ + if test -z $PYTHON; + then + if test -z "$3"; + then + PYTHON="python3" + else + PYTHON="$3" + fi + fi + PYTHON_NAME=`basename $PYTHON` + AC_MSG_CHECKING($PYTHON_NAME module: $1) + $PYTHON -c "import $1" 2>/dev/null + if test $? -eq 0; + then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PYMOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PYMOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi +]) \ No newline at end of file diff --git a/m4/docs_tool.m4 b/m4/docs_tool.m4 index 3e8814ac8d..39aa348026 100644 --- a/m4/docs_tool.m4 +++ b/m4/docs_tool.m4 @@ -15,3 +15,12 @@ dnl AC_MSG_WARN([$2 is not available so some documentation won't be built]) ]) ]) + +AC_DEFUN([AX_DOCS_TOOL_REQ_PROG], [ +dnl + AC_ARG_VAR([$1], [Path to $2 tool]) + AC_PATH_PROG([$1], [$2]) + AS_IF([! test -x "$ac_cv_path_$1"], [ + AC_MSG_ERROR([$2 is needed]) + ]) +]) \ No newline at end of file -- 2.17.1