]> git.proxmox.com Git - mirror_zfs.git/blame - config/always-pyzfs.m4
Use boot_ncpus in place of max_ncpus in taskq_create
[mirror_zfs.git] / config / always-pyzfs.m4
CommitLineData
85ce3f4f 1dnl #
b1b4ac27
RM
2dnl # ZFS_AC_PYTHON_MODULE(module_name, [action-if-true], [action-if-false])
3dnl #
4dnl # Checks for Python module. Freely inspired by AX_PYTHON_MODULE
5dnl # https://www.gnu.org/software/autoconf-archive/ax_python_module.html
6dnl # Required by ZFS_AC_CONFIG_ALWAYS_PYZFS.
7dnl #
8AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
9 PYTHON_NAME=$(basename $PYTHON)
10 AC_MSG_CHECKING([for $PYTHON_NAME module: $1])
11 AS_IF([$PYTHON -c "import $1" 2>/dev/null], [
12 AC_MSG_RESULT(yes)
13 m4_ifvaln([$2], [$2])
14 ], [
15 AC_MSG_RESULT(no)
16 m4_ifvaln([$3], [$3])
17 ])
18])
19
20dnl #
21dnl # Determines if pyzfs can be built, requires Python 2.7 or later.
85ce3f4f 22dnl #
85ce3f4f 23AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
85ce3f4f 24 AC_ARG_ENABLE([pyzfs],
25 AC_HELP_STRING([--enable-pyzfs],
26 [install libzfs_core python bindings @<:@default=check@:>@]),
27 [enable_pyzfs=$enableval],
28 [enable_pyzfs=check])
29
6e72a5b9
BB
30 dnl #
31 dnl # Packages for pyzfs specifically enabled/disabled.
32 dnl #
33 AS_IF([test "x$enable_pyzfs" != xcheck], [
609b2425 34 AS_IF([test "x$enable_pyzfs" = xyes], [
6e72a5b9
BB
35 DEFINE_PYZFS='--with pyzfs'
36 ], [
37 DEFINE_PYZFS='--without pyzfs'
85ce3f4f 38 ])
6e72a5b9 39 ], [
b1b4ac27 40 AS_IF([test "$PYTHON" != :], [
1a132f06
RM
41 DEFINE_PYZFS=''
42 ], [
43 enable_pyzfs=no
44 DEFINE_PYZFS='--without pyzfs'
45 ])
85ce3f4f 46 ])
6e72a5b9 47 AC_SUBST(DEFINE_PYZFS)
85ce3f4f 48
49 dnl #
6e72a5b9 50 dnl # Require python-devel libraries
85ce3f4f 51 dnl #
6e72a5b9 52 AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
b1b4ac27
RM
53 AS_CASE([$PYTHON_VERSION],
54 [3.*], [PYTHON_REQUIRED_VERSION=">= '3.4.0'"],
55 [2.*], [PYTHON_REQUIRED_VERSION=">= '2.7.0'"],
56 [AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
57 )
85ce3f4f 58
85ce3f4f 59 AX_PYTHON_DEVEL([$PYTHON_REQUIRED_VERSION], [
60 AS_IF([test "x$enable_pyzfs" = xyes], [
6e72a5b9 61 AC_MSG_ERROR("Python $PYTHON_REQUIRED_VERSION development library is not installed")
b1b4ac27 62 ], [test "x$enable_pyzfs" != xno], [
85ce3f4f 63 enable_pyzfs=no
64 ])
65 ])
66 ])
67
68 dnl #
69 dnl # Python "setuptools" module is required to build and install pyzfs
70 dnl #
6e72a5b9 71 AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
85ce3f4f 72 ZFS_AC_PYTHON_MODULE([setuptools], [], [
73 AS_IF([test "x$enable_pyzfs" = xyes], [
6e72a5b9 74 AC_MSG_ERROR("Python $PYTHON_VERSION setuptools is not installed")
b1b4ac27 75 ], [test "x$enable_pyzfs" != xno], [
85ce3f4f 76 enable_pyzfs=no
77 ])
78 ])
79 ])
80
81 dnl #
82 dnl # Python "cffi" module is required to run pyzfs
83 dnl #
6e72a5b9 84 AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
85ce3f4f 85 ZFS_AC_PYTHON_MODULE([cffi], [], [
86 AS_IF([test "x$enable_pyzfs" = xyes], [
6e72a5b9 87 AC_MSG_ERROR("Python $PYTHON_VERSION cffi is not installed")
b1b4ac27 88 ], [test "x$enable_pyzfs" != xno], [
85ce3f4f 89 enable_pyzfs=no
90 ])
91 ])
92 ])
93
94 dnl #
95 dnl # Set enable_pyzfs to 'yes' if every check passed
96 dnl #
97 AS_IF([test "x$enable_pyzfs" = xcheck], [enable_pyzfs=yes])
98
b1b4ac27 99 AM_CONDITIONAL([PYZFS_ENABLED], [test "x$enable_pyzfs" = xyes])
85ce3f4f 100 AC_SUBST([PYZFS_ENABLED], [$enable_pyzfs])
85ce3f4f 101 AC_SUBST(pythonsitedir, [$PYTHON_SITE_PKG])
6e72a5b9
BB
102
103 AC_MSG_CHECKING([whether to enable pyzfs: ])
104 AC_MSG_RESULT($enable_pyzfs)
85ce3f4f 105])