Re: How do I make a dependency on the sockets extension?
| From: | Johannes Schlüter | Date: | Sun, 08 Sep 2013 12:26:13 +0000 |
| Subject: | Re: How do I make a dependency on the sockets extension? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-11032@lists.php.net to get a copy of this message | ||
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