Statistics
| Branch: | Tag: | Revision:

root / autotools / ac_python_module.m4 @ e37f47d3

History | View | Annotate | Download (1000 Bytes)

1
##### http://autoconf-archive.cryp.to/ac_python_module.html
2
#
3
# SYNOPSIS
4
#
5
#   AC_PYTHON_MODULE(modname[, fatal])
6
#
7
# DESCRIPTION
8
#
9
#   Checks for Python module.
10
#
11
#   If fatal is non-empty then absence of a module will trigger an
12
#   error.
13
#
14
# LAST MODIFICATION
15
#
16
#   2007-01-09
17
#
18
# COPYLEFT
19
#
20
#   Copyright (c) 2007 Andrew Collier <colliera@ukzn.ac.za>
21
#
22
#   Copying and distribution of this file, with or without
23
#   modification, are permitted in any medium without royalty provided
24
#   the copyright notice and this notice are preserved.
25

    
26
AC_DEFUN([AC_PYTHON_MODULE],[
27
    if test -z $PYTHON;
28
    then
29
        PYTHON="python"
30
    fi
31
    PYTHON_NAME=`basename $PYTHON`
32
    AC_MSG_CHECKING($PYTHON_NAME module: $1)
33
	$PYTHON -c "import $1" 2>/dev/null
34
	if test $? -eq 0;
35
	then
36
		AC_MSG_RESULT(yes)
37
		eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
38
	else
39
		AC_MSG_RESULT(no)
40
		eval AS_TR_CPP(HAVE_PYMOD_$1)=no
41
		#
42
		if test -n "$2"
43
		then
44
			AC_MSG_ERROR(failed to find required module $1)
45
			exit 1
46
		fi
47
	fi
48
])