]>
Commit | Line | Data |
---|---|---|
85ce3f4f | 1 | dnl # |
6e72a5b9 | 2 | dnl # Determines if pyzfs can be built, requires Python 2.7 or latter. |
85ce3f4f | 3 | dnl # |
85ce3f4f | 4 | AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [ |
85ce3f4f | 5 | AC_ARG_ENABLE([pyzfs], |
6 | AC_HELP_STRING([--enable-pyzfs], | |
7 | [install libzfs_core python bindings @<:@default=check@:>@]), | |
8 | [enable_pyzfs=$enableval], | |
9 | [enable_pyzfs=check]) | |
10 | ||
6e72a5b9 BB |
11 | dnl # |
12 | dnl # Packages for pyzfs specifically enabled/disabled. | |
13 | dnl # | |
14 | AS_IF([test "x$enable_pyzfs" != xcheck], [ | |
609b2425 | 15 | AS_IF([test "x$enable_pyzfs" = xyes], [ |
6e72a5b9 BB |
16 | DEFINE_PYZFS='--with pyzfs' |
17 | ], [ | |
18 | DEFINE_PYZFS='--without pyzfs' | |
85ce3f4f | 19 | ]) |
6e72a5b9 BB |
20 | ], [ |
21 | DEFINE_PYZFS='' | |
85ce3f4f | 22 | ]) |
6e72a5b9 | 23 | AC_SUBST(DEFINE_PYZFS) |
85ce3f4f | 24 | |
25 | dnl # | |
6e72a5b9 | 26 | dnl # Require python-devel libraries |
85ce3f4f | 27 | dnl # |
6e72a5b9 BB |
28 | AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [ |
29 | AS_IF([test "${PYTHON_VERSION:0:2}" = "2."], [ | |
30 | PYTHON_REQUIRED_VERSION=">= '2.7.0'" | |
31 | ], [ | |
32 | AS_IF([test "${PYTHON_VERSION:0:2}" = "3."], [ | |
33 | PYTHON_REQUIRED_VERSION=">= '3.4.0'" | |
34 | ], [ | |
35 | AC_MSG_ERROR("Python $PYTHON_VERSION unknown") | |
85ce3f4f | 36 | ]) |
37 | ]) | |
85ce3f4f | 38 | |
85ce3f4f | 39 | AX_PYTHON_DEVEL([$PYTHON_REQUIRED_VERSION], [ |
40 | AS_IF([test "x$enable_pyzfs" = xyes], [ | |
6e72a5b9 | 41 | AC_MSG_ERROR("Python $PYTHON_REQUIRED_VERSION development library is not installed") |
85ce3f4f | 42 | ], [test ! "x$enable_pyzfs" = xno], [ |
43 | enable_pyzfs=no | |
44 | ]) | |
45 | ]) | |
46 | ]) | |
47 | ||
48 | dnl # | |
49 | dnl # Python "setuptools" module is required to build and install pyzfs | |
50 | dnl # | |
6e72a5b9 | 51 | AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [ |
85ce3f4f | 52 | ZFS_AC_PYTHON_MODULE([setuptools], [], [ |
53 | AS_IF([test "x$enable_pyzfs" = xyes], [ | |
6e72a5b9 | 54 | AC_MSG_ERROR("Python $PYTHON_VERSION setuptools is not installed") |
85ce3f4f | 55 | ], [test ! "x$enable_pyzfs" = xno], [ |
56 | enable_pyzfs=no | |
57 | ]) | |
58 | ]) | |
59 | ]) | |
60 | ||
61 | dnl # | |
62 | dnl # Python "cffi" module is required to run pyzfs | |
63 | dnl # | |
6e72a5b9 | 64 | AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [ |
85ce3f4f | 65 | ZFS_AC_PYTHON_MODULE([cffi], [], [ |
66 | AS_IF([test "x$enable_pyzfs" = xyes], [ | |
6e72a5b9 | 67 | AC_MSG_ERROR("Python $PYTHON_VERSION cffi is not installed") |
85ce3f4f | 68 | ], [test ! "x$enable_pyzfs" = xno], [ |
69 | enable_pyzfs=no | |
70 | ]) | |
71 | ]) | |
72 | ]) | |
73 | ||
74 | dnl # | |
75 | dnl # Set enable_pyzfs to 'yes' if every check passed | |
76 | dnl # | |
77 | AS_IF([test "x$enable_pyzfs" = xcheck], [enable_pyzfs=yes]) | |
78 | ||
79 | AM_CONDITIONAL([PYZFS_ENABLED], [test x$enable_pyzfs = xyes]) | |
80 | AC_SUBST([PYZFS_ENABLED], [$enable_pyzfs]) | |
85ce3f4f | 81 | AC_SUBST(pythonsitedir, [$PYTHON_SITE_PKG]) |
6e72a5b9 BB |
82 | |
83 | AC_MSG_CHECKING([whether to enable pyzfs: ]) | |
84 | AC_MSG_RESULT($enable_pyzfs) | |
85ce3f4f | 85 | ]) |