1# =========================================================================== 2# http://www.gnu.org/software/autoconf-archive/ax_python_module.html 3# =========================================================================== 4# 5# SYNOPSIS 6# 7# AX_PYTHON_MODULE(modname[, fatal]) 8# 9# DESCRIPTION 10# 11# Checks for Python module. 12# 13# If fatal is non-empty then absence of a module will trigger an error. 14# 15# LICENSE 16# 17# Copyright (c) 2008 Andrew Collier 18# 19# Copying and distribution of this file, with or without modification, are 20# permitted in any medium without royalty provided the copyright notice 21# and this notice are preserved. This file is offered as-is, without any 22# warranty. 23 24#serial 6 25 26AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) 27AC_DEFUN([AX_PYTHON_MODULE],[ 28 if test -z $PYTHON2; 29 then 30 PYTHON2="python" 31 fi 32 PYTHON_NAME=`basename $PYTHON2` 33 AC_MSG_CHECKING($PYTHON_NAME module: $1) 34 $PYTHON2 -c "import $1" 2>/dev/null 35 if test $? -eq 0; 36 then 37 AC_MSG_RESULT(yes) 38 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes 39 else 40 AC_MSG_RESULT(no) 41 eval AS_TR_CPP(HAVE_PYMOD_$1)=no 42 # 43 if test -n "$2" 44 then 45 AC_MSG_ERROR(failed to find required module $1) 46 exit 1 47 fi 48 fi 49]) 50