root / autotools / ac_python_module.m4 @ 936f3c59
History | View | Annotate | Download (1000 Bytes)
1 | 6e06b36c | Iustin Pop | ##### http://autoconf-archive.cryp.to/ac_python_module.html |
---|---|---|---|
2 | 6e06b36c | Iustin Pop | # |
3 | 6e06b36c | Iustin Pop | # SYNOPSIS |
4 | 6e06b36c | Iustin Pop | # |
5 | 6e06b36c | Iustin Pop | # AC_PYTHON_MODULE(modname[, fatal]) |
6 | 6e06b36c | Iustin Pop | # |
7 | 6e06b36c | Iustin Pop | # DESCRIPTION |
8 | 6e06b36c | Iustin Pop | # |
9 | 6e06b36c | Iustin Pop | # Checks for Python module. |
10 | 6e06b36c | Iustin Pop | # |
11 | 6e06b36c | Iustin Pop | # If fatal is non-empty then absence of a module will trigger an |
12 | 6e06b36c | Iustin Pop | # error. |
13 | 6e06b36c | Iustin Pop | # |
14 | 6e06b36c | Iustin Pop | # LAST MODIFICATION |
15 | 6e06b36c | Iustin Pop | # |
16 | 6e06b36c | Iustin Pop | # 2007-01-09 |
17 | 6e06b36c | Iustin Pop | # |
18 | 6e06b36c | Iustin Pop | # COPYLEFT |
19 | 6e06b36c | Iustin Pop | # |
20 | 6e06b36c | Iustin Pop | # Copyright (c) 2007 Andrew Collier <colliera@ukzn.ac.za> |
21 | 6e06b36c | Iustin Pop | # |
22 | 6e06b36c | Iustin Pop | # Copying and distribution of this file, with or without |
23 | 6e06b36c | Iustin Pop | # modification, are permitted in any medium without royalty provided |
24 | 6e06b36c | Iustin Pop | # the copyright notice and this notice are preserved. |
25 | 6e06b36c | Iustin Pop | |
26 | 6e06b36c | Iustin Pop | AC_DEFUN([AC_PYTHON_MODULE],[ |
27 | 6e06b36c | Iustin Pop | if test -z $PYTHON; |
28 | 6e06b36c | Iustin Pop | then |
29 | 6e06b36c | Iustin Pop | PYTHON="python" |
30 | 6e06b36c | Iustin Pop | fi |
31 | 6e06b36c | Iustin Pop | PYTHON_NAME=`basename $PYTHON` |
32 | 6e06b36c | Iustin Pop | AC_MSG_CHECKING($PYTHON_NAME module: $1) |
33 | 6e06b36c | Iustin Pop | $PYTHON -c "import $1" 2>/dev/null |
34 | 6e06b36c | Iustin Pop | if test $? -eq 0; |
35 | 6e06b36c | Iustin Pop | then |
36 | 6e06b36c | Iustin Pop | AC_MSG_RESULT(yes) |
37 | 6e06b36c | Iustin Pop | eval AS_TR_CPP(HAVE_PYMOD_$1)=yes |
38 | 6e06b36c | Iustin Pop | else |
39 | 6e06b36c | Iustin Pop | AC_MSG_RESULT(no) |
40 | 6e06b36c | Iustin Pop | eval AS_TR_CPP(HAVE_PYMOD_$1)=no |
41 | 6e06b36c | Iustin Pop | # |
42 | 6e06b36c | Iustin Pop | if test -n "$2" |
43 | 6e06b36c | Iustin Pop | then |
44 | 6e06b36c | Iustin Pop | AC_MSG_ERROR(failed to find required module $1) |
45 | 6e06b36c | Iustin Pop | exit 1 |
46 | 6e06b36c | Iustin Pop | fi |
47 | 6e06b36c | Iustin Pop | fi |
48 | 6e06b36c | Iustin Pop | ]) |