Fixed checks for libpython features
[libguestfs.git] / configure.ac
index ae4b401..40f67aa 100644 (file)
@@ -20,7 +20,7 @@
 # freeform string.
 m4_define([libguestfs_major],   [1])
 m4_define([libguestfs_minor],   [15])
-m4_define([libguestfs_release], [6])
+m4_define([libguestfs_release], [12])
 
 AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
 AC_CONFIG_AUX_DIR([build-aux])
@@ -315,22 +315,19 @@ AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
         AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl])
         ])
 
-dnl Check for Augeas (now optional).
-AC_CHECK_LIB([augeas],[aug_match],[
-        have_augeas=yes
-        AUGEAS_LIB="-laugeas"
-
-        old_LIBS="$LIBS"
-        LIBS="$LIBS $AUGEAS_LIB"
-        dnl Check for functions not available in earlier versions of Augeas.
-        AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode])
-        LIBS="$old_LIBS"
-
-        ],[have_augeas=no])
-if test "x$have_augeas" = "xyes"; then
-        AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas])
-fi
-AC_SUBST([AUGEAS_LIB])
+dnl Check for Augeas (optional).
+PKG_CHECK_MODULES([AUGEAS], [augeas],
+        [AC_SUBST([AUGEAS_CFLAGS])
+         AC_SUBST([AUGEAS_LIBS])
+         AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas])
+
+         old_LIBS="$LIBS"
+         LIBS="$LIBS $AUGEAS_LIBS"
+         dnl Check for functions not available in earlier versions of Augeas.
+         AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode])
+         LIBS="$old_LIBS"
+        ],
+        [AC_MSG_WARN([augeas not found, some core features will be disabled])])
 
 dnl Check for libselinux (optional).
 AC_CHECK_HEADERS([selinux/selinux.h])
@@ -741,19 +738,20 @@ AS_IF([test "x$enable_python" != "xno"],
                 AC_MSG_RESULT([$PYTHON_INSTALLDIR])
             fi
 
-            dnl Look for libpython and some optional symbols in it.
+            dnl Look for some optional symbols in libpython.
             old_LIBS="$LIBS"
-            if test "x$PYTHON_VERSION_MAJOR" = "x3"; then
-                dnl libpython3 is called "libpython3.Xmu.so"
-                LIBPYTHON="python${PYTHON_VERSION}mu"
-            else
-                LIBPYTHON="python$PYTHON_VERSION"
-            fi
-            AC_CHECK_LIB([$LIBPYTHON], [PyList_Size], [],
-                         [AC_MSG_FAILURE([$LIBPYTHON is not installed])])
 
-            AC_CHECK_FUNCS([PyCapsule_New \
-                            PyString_AsString])
+            PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig; \
+                                           print (distutils.sysconfig.get_config_var('BLDLIBRARY'))"`
+            AC_CHECK_LIB([c],[PyCapsule_New],
+                         [AC_DEFINE([HAVE_PYCAPSULE_NEW],1,
+                                    [Found PyCapsule_New in libpython])],
+                         [],[$PYTHON_BLDLIBRARY])
+            AC_CHECK_LIB([c],[PyString_AsString],
+                         [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
+                                    [Found PyString_AsString in libpython])],
+                         [],[$PYTHON_BLDLIBRARY])
+
             LIBS="$old_LIBS"
         fi
 
@@ -772,8 +770,10 @@ AC_ARG_ENABLE([ruby],
         [enable_ruby=yes])
 AS_IF([test "x$enable_ruby" != "xno"],
         [
-        AC_CHECK_LIB([ruby],[ruby_init],[HAVE_LIBRUBY=1],[HAVE_LIBRUBY=0])
+        AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
         AC_CHECK_PROG([RAKE],[rake],[rake],[no])
+        AC_CHECK_LIB([ruby],[ruby_init],[HAVE_LIBRUBY=1],[HAVE_LIBRUBY=0])
+        AC_SUBST([RAKE])
         ])
 AM_CONDITIONAL([HAVE_RUBY],
     [test "x$RAKE" != "xno" && test -n "$HAVE_LIBRUBY"])
@@ -1007,9 +1007,7 @@ AC_CONFIG_FILES([run],
 AC_CONFIG_FILES([Makefile
                  align/Makefile
                  appliance/Makefile
-                 capitests/Makefile
                  cat/Makefile
-                 caution/Makefile
                  clone/Makefile
                  csharp/Makefile
                  daemon/Makefile
@@ -1019,14 +1017,12 @@ AC_CONFIG_FILES([Makefile
                  erlang/Makefile
                  erlang/examples/Makefile
                  examples/Makefile
-                 extratests/Makefile
                  fish/Makefile
                  fuse/Makefile
                  generator/Makefile
                  gnulib/lib/Makefile
                  gnulib/tests/Makefile
                  haskell/Makefile
-                 images/Makefile
                  inspector/Makefile
                  java/Makefile
                  java/examples/Makefile
@@ -1044,7 +1040,6 @@ AC_CONFIG_FILES([Makefile
                  po/Makefile.in
                  python/Makefile
                  python/examples/Makefile
-                 regressions/Makefile
                  rescue/Makefile
                  resize/Makefile
                  ruby/Makefile
@@ -1053,6 +1048,16 @@ AC_CONFIG_FILES([Makefile
                  sparsify/Makefile
                  src/Makefile
                  test-tool/Makefile
+                 tests/c-api/Makefile
+                 tests/data/Makefile
+                 tests/extra/Makefile
+                 tests/guests/Makefile
+                 tests/luks/Makefile
+                 tests/lvm/Makefile
+                 tests/md/Makefile
+                 tests/protocol/Makefile
+                 tests/qemu/Makefile
+                 tests/regressions/Makefile
                  tools/Makefile])
 AC_OUTPUT