[libvirt] [libvirt-php][PATCH] m4: Check for php modules more wisely
Michal Privoznik
mprivozn at redhat.com
Fri Sep 2 11:02:10 UTC 2016
On 02.09.2016 12:27, Christophe Fergeau wrote:
> Hey,
>
> On Thu, Sep 01, 2016 at 01:30:33PM +0200, Michal Privoznik wrote:
>> 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])
>
> Is the AC_SUBST needed? Nothing outside of m4/virt-php-extension.m4
> seems to be using it.
Not really. I'm just using it as a debug. Next time somebody runs into a
problem, I can easily see what php binary was used just looking into
config.log. Unfortunately, there's no AC_DEBUG(). But I'm open to ideas :-)
Michal
More information about the libvir-list
mailing list