]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: fix with_python usage, improve logic
authorKarel Zak <kzak@redhat.com>
Wed, 4 Jun 2014 11:43:15 +0000 (13:43 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 4 Jun 2014 11:43:15 +0000 (13:43 +0200)
We have to set the default withval= on the default with_python=check
otherwise uninitialized value is used.

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac

index 71a7568a3a47d21c2d298f28693be1cbcf310cfb..e7c6a144d70be57db84fb52db33fadcbb10936cc 100644 (file)
@@ -1648,8 +1648,8 @@ AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes]
 
 
 AC_ARG_WITH([python],
-           AS_HELP_STRING([--without-python], [do not build python bindings, use --with-python={2,3} to force version]),
-  [], [with_python=check]
+  AS_HELP_STRING([--without-python], [do not build python bindings, use --with-python={2,3} to force version]),
+  [], [with_python=check withval=check]
 )
 
 have_python=no
@@ -1658,14 +1658,17 @@ AS_IF([test "x$with_python" != xno], [
   # (minimal version is 2) but if major version is explicitly specified by
   # --with-python=2 or --with-python=3 then we look for PKG module "python2" or
   # "python3".
-  AS_IF([test "x$withval" != xno -a "x$withval" != xyes],
+  AS_IF([test "x$withval" != xno -a "x$withval" != xyes -a "x$withval" != xcheck],
        [pymajor="$withval"; PYTHON=python${pymajor}], [pymajor="2"])
   AM_PATH_PYTHON([$pymajor], [have_python=yes], [have_python=no])
   AS_CASE([$with_python:$have_python],
     [yes:no],
-      [AC_MSG_ERROR([python selected but libpython not found])]
+      [AC_MSG_ERROR([python selected but libpython not found])],
+    [check:no],
+       [AC_MSG_WARN([libpython not found, do not build python bindings])],
+    [*:yes],
+       [PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION])]
   )
-  PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION])
 ])