[libvirt] [libvirt-php][PATCH] m4: Check for php modules more wisely

Michal Privoznik mprivozn at redhat.com
Thu Sep 1 11:30:33 UTC 2016


I've got two version of PHP installed on my system, however one
of them has imagick the other one doesn't. During configure I've
noticed that wrong assumption has been made. Configure script
wrongly assumed the plugin missing. This is because for detecting
php plugins we use plain 'php -m | grep $module'. On my system,
php is a symlink and it defaults to the version without the
plugin. However, I am explicitly supplying 'php-config' from the
version that has the plugin installed:

  ./configure --with-php-config=/usr/lib64/php5.6/bin/php-config

The trick is to query provided php-config for path to php binary.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

Pushed under php-auto-push rule.

 m4/virt-php-extension.m4 | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/m4/virt-php-extension.m4 b/m4/virt-php-extension.m4
index 9040eb1..5aa3cb7 100644
--- a/m4/virt-php-extension.m4
+++ b/m4/virt-php-extension.m4
@@ -25,7 +25,18 @@ dnl
 AC_DEFUN([LIBVIRT_CHECK_PHP_EXTENSION],[
   AC_MSG_CHECKING([for php module $1])
 
-  module="$(php -m | grep $1)"
+  phpbinary="$($PHPCONFIG --php-binary)"
+  if test "x$phpbinary" = "x"; then
+    phpbinary="$($PHPCONFIG --prefix)/bin/php"
+  fi
+
+  if test ! -x "$phpbinary"; then
+    AC_MSG_ERROR([php binary not found])
+  fi
+
+  AC_SUBST([phpbinary])
+
+  module="$($phpbinary -m | grep $1)"
 
   if test "x$module" = "x"; then
     AC_MSG_ERROR([php module $1 not found])
-- 
2.8.4




More information about the libvir-list mailing list