From patchwork Fri May 11 22:30:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 1764 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id 0FE1760993 for ; Fri, 11 May 2018 14:30:40 +0200 (CEST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id C59411109F49; Fri, 11 May 2018 13:30:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1526041839; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:list-id:list-unsubscribe:list-subscribe:list-post; bh=iMr4wCo4pjdIdCTFyoPX9tt80Fmm24ihvzH2Yz42iR4=; b=K7PpsrtUXkkCWA6ZYaldBztL8cgQ8PyvL6NevrntBtvazlitjQBg/0Ss2zPFbSeQ7FVkAg D9wzq8xZvjjdvihhihSA6JQPVnAgFxV8VsSP+su9Rr6g4OYXhhzn1IsTZo8whtgMGyAB+T 3Xr05QgN/5gsAf49NoGwN/eUaom7v7/uw/8tmpUecCsPwdTV417h8i/9GNQTRLDap/qLt7 nwN18oLfuiFjY3niA4orxAV5Sy2JB1jHZ0i4BqOvKY7ORGghj8o83GHk2v+cTqyNDg+vm0 yUFIkp/OkOxsrHUtg4b5Zee/djezIh6srFCF0lndJ2wDUV0xiCudOme6Phdsbw== Authentication-Results: mail01.i.ipfire.org; auth=pass smtp.auth=ms smtp.mailfrom=michael.tremer@ipfire.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1526041830; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=iMr4wCo4pjdIdCTFyoPX9tt80Fmm24ihvzH2Yz42iR4=; b=D1rKPuGvgc7CoyLlp+uMLBg9I9HY1IoaAwguEtuY39um2ipUnuYy8OcjnD7XSNtBeNgUFR PzlCKGJZkbZy6r/j2P0TufvuhaamUjPKDvbKNibRUpXgXSWtV9vDyyMuupZRjTvdnmS9jn 9KCyhV0l6IRohyxZQdRMOWVE9WBW3OXNaFo5pVwJ+qIRau9+FUVy0TZS3fm7fOht/D7q7C U3x3YtQPjNKhdtxXSG1Xb8QKIGKf7hupQFmoqPJUHqkAL2/K3P1ZuAkv0ut0M4aL2gjbKs QA06gEubRFB9pP4mq7vfWSwhA70lz8DROJovti6hl98rWwpP1pNx49eROR5cSQ== Received: from rice-oxley.tremer.co.uk (unknown [88.98.219.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id E8BD710F5E9A; Fri, 11 May 2018 13:30:29 +0100 (BST) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 2/5] m4: Ship AX_PYTHON_MODULE Date: Fri, 11 May 2018 13:30:09 +0100 Message-Id: <20180511123012.2138575-2-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511123012.2138575-1-michael.tremer@ipfire.org> References: <20180511123012.2138575-1-michael.tremer@ipfire.org> X-Spamd-Result: default: False [-4.10 / 11.00]; ASN(0.00)[asn:56478, ipnet:88.98.216.0/22, country:GB]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MIME_GOOD(-0.10)[text/plain]; REPLY(-2.00)[] X-Spam-Status: No, score=-4.10 X-Rspamd-Server: mail01.i.ipfire.org Cc: Michael Tremer X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- .gitignore | 3 +-- m4/ax_python_module.m4 | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 m4/ax_python_module.m4 diff --git a/.gitignore b/.gitignore index 9c34c9d6de67..8b229665e586 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -/m4 /Makefile /build-aux /libtool @@ -29,4 +28,4 @@ config.log config.status configure install-sh -stamp-* \ No newline at end of file +stamp-* diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4 new file mode 100644 index 000000000000..f0f873d199d5 --- /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 +])