AC_DEFUN([PECL_CHECK_LIBBROTLI], [
+ PECL_CHECK_LIBBROTLI_COMMON([$1], [$2])
+ PECL_CHECK_DONE(libbrotlicommon, [$PECL_VAR([HAVE_LIBBROTLI_COMMON])])
PECL_CHECK_LIBBROTLI_DEC([$1], [$2])
PECL_CHECK_DONE(libbrotlidec, [$PECL_VAR([HAVE_LIBBROTLI_DEC])])
PECL_CHECK_LIBBROTLI_ENC([$1], [$2])
PECL_CHECK_DONE(libbrotlienc, [$PECL_VAR([HAVE_LIBBROTLI_ENC])])
- if $PECL_VAR([HAVE_LIBBROTLI_DEC]) && $PECL_VAR([HAVE_LIBBROTLI_ENC]); then
+ if $PECL_VAR([HAVE_LIBBROTLI_COMMON]) \
+ && $PECL_VAR([HAVE_LIBBROTLI_DEC]) \
+ && $PECL_VAR([HAVE_LIBBROTLI_ENC]); then
PECL_VAR([HAVE_LIBBROTLI])=true
fi
])
+AC_DEFUN([PECL_CHECK_LIBBROTLI_COMMON], [
+ PECL_CHECK_PKGCONFIG(libbrotlicommon, [$1])
+
+ PECL_HAVE_VERSION(libbrotlicommon, ifelse($2,,1.0,$2), [
+ PECL_VAR([HAVE_LIBBROTLI_COMMON])=true
+ ], [
+ AC_MSG_WARN([skipping libbrotli])
+ PECL_VAR([HAVE_LIBBROTLI_COMMON])=false
+ ])
+])
+
AC_DEFUN([PECL_CHECK_LIBBROTLI_DEC], [
PECL_CHECK_PKGCONFIG(libbrotlidec, [$1])
EMPTY_FUNCTION_ENTRY
};
+/* POS */
+const void *BrotliGetDictionary();
+const void *(*php_http_brotli_get_dictionary)();
+
PHP_MINIT_FUNCTION(http_encoding_brotli)
{
zend_class_entry ce;
+ /* force link to libbrotlicommon, because their libraries don't */
+ php_http_brotli_get_dictionary = BrotliGetDictionary();
+
memset(&ce, 0, sizeof(ce));
INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Enbrotli", php_http_enbrotli_stream_methods);
php_http_enbrotli_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_get_encoding_stream_class_entry());