File: ax_python_module.m4

package info (click to toggle)
libncl 2.1.21%2Bgit20210811.b1213a7-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,860 kB
  • sloc: cpp: 33,500; sh: 10,676; python: 533; makefile: 228
file content (49 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
dnl @synopsis AC_PYTHON_MODULE(modname[, fatal[, msg]])
dnl
dnl Checks for Python module.
dnl
dnl If fatal is non-empty then absence of a module will trigger an
dnl error, if fatal is empty then PYTHON will be set to an empty string
dnl
dnl If errormsg is non-empty, the message will be printed
dnl instead of a generic error message.
dnl
dnl @category InstalledPackages
dnl @author Andrew Collier <colliera@nu.ac.za>.
dnl @version 2004-07-14
dnl @license AllPermissive

AC_DEFUN([AC_PYTHON_MODULE],[
	if test -z "PYTHON"
	then
		AC_PATH_PROG([PYTHON], [python3], [], [$PATH])
	fi
	AC_MSG_CHECKING(python3 module: $1)
	if test -z "$PYTHON"
	then
		false
	else
		"$PYTHON" -c "import $1" 2>/dev/null
	fi
	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
			if test -n "$3"
			then
				AC_MSG_ERROR($3)
			else
				AC_MSG_ERROR(failed to find required module $1)
			fi
			exit 1
		else
			PYTHON=""
		fi
	fi
])