On Sun, 2013-09-08 at 16:27 +0500, Ruslan Osmanov wrote:
> 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
> 
> 

Compile-time checks for other extensions are only relevant for static
builds. Once you go to shared extensions the availability at compile
time tells *nothing* about runtime. (An extension might be installed
only for one SAPI or PHP might run CLI with -n or ...)

You can check for the required headers in your m4 and prevent building
the extension if not available but aside from that any further check
gains nothing practical.

johannes



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

Reply via email to