Okay, I've figured out that PHP_ADD_EXTENSION_DEP is supposed to be used at the configuration time only.

The HAVE_SOCKETS symbol is defined in <main/php_config.h>, if PHP is built with --enable-sockets option.

But if sockets is built as a separate package, then we have no HAVE_SOCKETS symbol at compilation time. I guess some OS distributions, having no support of per-package configuration, provide separate packages like "php-sockets".

Thus, making "sockets" required doesn't solve the issue at all.

Probably I can fix it by defining HAVE_SOCKETS manually in my config.m4:

 if test "$PHP_EVENT_SOCKETS" != "no"; then
    AC_CHECK_HEADERS([$phpincludedir/ext/sockets/php_sockets.h], ,
      [
AC_MSG_ERROR([Couldn't find $phpincludedir/sockets/php_sockets.h. Please check if sockets extension installed])
      ]
    )
    PHP_ADD_EXTENSION_DEP(event, sockets)
    AC_DEFINE(PHP_EVENT_SOCKETS, 1, [Whether sockets extension is
    dnl A hack for distros installing sockets ext. separately.
    AC_DEFINE(HAVE_SOCKETS, 1, [Whether sockets extension is enabled])
 fi



On 09/08/2013 02:06 PM, Ruslan Osmanov wrote:
On 09/08/2013 12:41 PM, Ruslan Osmanov wrote:
Even though I made sockets required by default, this guy still has
issues with building:

https://bugs.php.net/bug.php?id=65597

I suspect he has different versions of phpize and php or so. Have no
clue.


I've found a strange thing.

The PHP_ADD_EXTENSION_DEP macro implementation contains the following
check:

is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__)
...
if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then

In case if "sockets" disabled, it is written to configure as follows

is_it_enabled=$PHP_SOCKETS
..

if test "x$is_it_enabled" = "xno" && test "x" != "xtrue"; then
  as_fn_error $? "
You've configured extension event, which depends on extension sockets,
but you've either not enabled sockets, or have disabled it.
" "$LINENO" 5
fi

We can see that $PHP_SOCKETS is actually empty when PHP is built with
--disable-sockets, and the check will not be satisfied!

However, it works with a little hack in my config.m4:
   if test "x$PHP_SOCKETS" = "x"; then
     PHP_SOCKETS="no"
   fi

With this hack, it outputs the desired error.

Please help me to understand whether it is a bug in acinclude.m4,
or I'm just getting it wrong.

Thanks.

--
Ruslan Osmanov

--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to