btrfs-progs: Refactor parameter of BTRFS_MAX_DEVS() from root to fs_info
[platform/upstream/btrfs-progs.git] / configure.ac
index 56d17c3..7d80aa4 100644 (file)
@@ -56,8 +56,8 @@ dnl
 dnl Calls pkg-config --static
 dnl
 AC_DEFUN([PKG_STATIC], [
-  if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
-    $1=`pkg-config --libs --static "$2"`
+  if AC_RUN_LOG([${PKG_CONFIG} --exists --print-errors "$2"]); then
+    $1=`${PKG_CONFIG} --libs --static "$2"`
     AC_SUBST([$1])
   else
     AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
@@ -210,12 +210,25 @@ fi
 AS_IF([test "x$enable_zstd" = xyes], [BTRFSRESTORE_ZSTD=1], [BTRFSRESTORE_ZSTD=0])
 AC_SUBST(BTRFSRESTORE_ZSTD)
 
+AC_ARG_ENABLE([python],
+       AS_HELP_STRING([--disable-python], [do not build libbtrfsutil Python bindings]),
+       [], [enable_python=yes]
+)
+
+if test "x$enable_python" = xyes; then
+       AM_PATH_PYTHON([3.4])
+fi
+
+AS_IF([test "x$enable_python" = xyes], [PYTHON_BINDINGS=1], [PYTHON_BINDINGS=0])
+AC_SUBST(PYTHON_BINDINGS)
+AC_SUBST(PYTHON)
+
 # udev v190 introduced the btrfs builtin and a udev rule to use it.
 # Our udev rule gives us the friendly dm names but isn't required (or valid)
 # on earlier releases.
 UDEVDIR=
-if pkg-config udev --atleast-version 190; then
-       UDEVDIR="$(pkg-config udev --variable=udevdir)"
+if ${PKG_CONFIG} udev --atleast-version 190; then
+       UDEVDIR="$(${PKG_CONFIG} udev --variable=udevdir)"
 fi
 AC_SUBST(UDEVDIR)
 
@@ -265,6 +278,8 @@ AC_MSG_RESULT([
        backtrace support:  ${enable_backtrace}
        btrfs-convert:      ${enable_convert} ${convertfs:+($convertfs)}
        btrfs-restore zstd: ${enable_zstd}
+       Python bindings:    ${enable_python}
+       Python interpreter: ${PYTHON}
 
        Type 'make' to compile.
 ])