Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON extension dependency check #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ if test "$PHP_JSONNET" != "no"; then

# --with-jsonnet -> check for lib and symbol presence

PHP_ADD_INCLUDE($JSONNET_DIR)
PHP_EVAL_LIBLINE($JSONNET_DIR, JSONNET_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(jsonnet, $JSONNET_DIR, JSONNET_SHARED_LIBADD)

AC_JSONNET_EPOLL()
PHP_ADD_INCLUDE($JSONNET_DIR)
PHP_EVAL_LIBLINE($JSONNET_DIR, JSONNET_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(jsonnet, $JSONNET_DIR, JSONNET_SHARED_LIBADD)

PHP_SUBST(JSONNET_SHARED_LIBADD)
AC_JSONNET_EPOLL()

PHP_NEW_EXTENSION(jsonnet, jsonnet.c, $ext_shared)
PHP_SUBST(JSONNET_SHARED_LIBADD)
PHP_ADD_EXTENSION_DEP(jsonnet, json)
PHP_NEW_EXTENSION(jsonnet, jsonnet.c, $ext_shared)
fi
10 changes: 7 additions & 3 deletions jsonnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "php_jsonnet.h"
#include "libjsonnet.h"


ZEND_DECLARE_MODULE_GLOBALS(jsonnet)

static int le_jsonnet;
Expand Down Expand Up @@ -62,10 +61,16 @@ const zend_function_entry jsonnet_methods[] =
}
};

const zend_module_dep jsonnet_deps[] = {
ZEND_MOD_REQUIRED("json")
ZEND_MOD_END
};

zend_module_entry jsonnet_module_entry =
{
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
STANDARD_MODULE_HEADER_EX, NULL,
jsonnet_deps,
#endif
JSONNET_RES_NAME,
jsonnet_functions,
Expand Down Expand Up @@ -94,7 +99,6 @@ static void php_jsonnet_init_globals(zend_jsonnet_globals *jsonnet_globals)

}


PHP_MINIT_FUNCTION(jsonnet)
{
ZEND_INIT_MODULE_GLOBALS(jsonnet, php_jsonnet_init_globals, NULL);
Expand Down