Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 55aa817

Browse files
committed
Use libv8 version string defined dufing configure step
1 parent 1f82103 commit 55aa817

File tree

4 files changed

+14
-57
lines changed

4 files changed

+14
-57
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ include_directories(/usr/local/include/php/sapi)
1212

1313
add_definitions(-DV8_DEPRECATION_WARNINGS)
1414

15+
if(EXISTS "${CMAKE_SOURCE_DIR}/config.h")
16+
add_definitions(-DHAVE_CONFIG_H)
17+
endif()
18+
1519
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
1620

1721
include_directories(./)

config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ if test "$PHP_V8" != "no"; then
132132
if test "$V8_API_VERSION" -lt 501000 ; then
133133
AC_MSG_ERROR([libv8 must be version 5.1.0 or greater])
134134
fi
135-
AC_DEFINE_UNQUOTED([PHP_LIBV8_API_VERSION], $V8_API_VERSION, [ ])
136-
AC_DEFINE_UNQUOTED([PHP_LIBV8_VERSION], "$ac_cv_v8_version", [ ])
135+
AC_DEFINE_UNQUOTED([PHP_V8_LIBV8_API_VERSION], $V8_API_VERSION, [ ])
136+
AC_DEFINE_UNQUOTED([PHP_V8_LIBV8_VERSION], "$ac_cv_v8_version", [ ])
137137
else
138138
AC_MSG_ERROR([could not determine libv8 version])
139139
fi

php_v8.h

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#ifndef PHP_V8_H
1616
#define PHP_V8_H
1717

18+
#ifdef HAVE_CONFIG_H
19+
#include "config.h"
20+
#endif
21+
1822
extern "C" {
1923
#include "php.h"
2024
#include <v8-version.h>
@@ -37,30 +41,10 @@ extern zend_module_entry php_v8_module_entry;
3741
#endif
3842

3943

44+
#define PHP_V8_NS "v8"
4045

41-
#define PHP_V8_NS "v8" // TODO: move to other header
42-
#define PHP_V8_EXCEPTIONS_NS PHP_V8_NS . "\\" . "Exceptions" // TODO: move to other header
43-
44-
45-
/* From v8 src/version.cc */
46-
47-
#if V8_IS_CANDIDATE_VERSION
48-
#define CANDIDATE_STRING " (candidate)"
49-
#else
50-
#define CANDIDATE_STRING ""
51-
#endif
52-
53-
#define SX(x) #x
54-
#define S(x) SX(x)
55-
56-
#if V8_PATCH_LEVEL > 0
57-
#define VERSION_STRING \
58-
S(V8_MAJOR_VERSION) "." S(V8_MINOR_VERSION) "." S(V8_BUILD_NUMBER) "." S( \
59-
V8_PATCH_LEVEL) CANDIDATE_STRING
60-
#else
61-
#define VERSION_STRING \
62-
S(V8_MAJOR_VERSION) "." S(V8_MINOR_VERSION) "." S(V8_BUILD_NUMBER) \
63-
CANDIDATE_STRING
46+
#ifndef PHP_V8_LIBV8_VERSION
47+
#define PHP_V8_LIBV8_VERSION "undefined"
6448
#endif
6549

6650

v8.cc

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,36 +91,6 @@ PHP_INI_END()
9191
*/
9292
/* }}} */
9393

94-
/* Remove the following function when you have successfully modified config.m4
95-
so that your module can be compiled into PHP, it exists only for testing
96-
purposes. */
97-
98-
// TODO: remove this function and other stub data
99-
/* Every user-visible function in PHP should document itself in the source */
100-
/* {{{ proto string confirm_v8_compiled(string arg)
101-
Return a string to confirm that the module is compiled in */
102-
PHP_FUNCTION(confirm_v8_compiled)
103-
{
104-
char *arg = NULL;
105-
size_t arg_len, len;
106-
char *strg;
107-
108-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
109-
return;
110-
}
111-
112-
len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "v8", arg);
113-
114-
RETVAL_STRINGL(strg, len);
115-
efree(strg);
116-
}
117-
/* }}} */
118-
/* The previous line is meant for vim and emacs, so it can correctly fold and
119-
unfold functions in source code. See the corresponding marks just before
120-
function definition, where the functions purpose is also documented. Please
121-
follow this convention for the convenience of others editing your code.
122-
*/
123-
12494

12595
/* {{{ PHP_MINIT_FUNCTION
12696
*/
@@ -233,7 +203,7 @@ PHP_MINFO_FUNCTION(v8)
233203
php_info_print_table_end();
234204

235205
php_info_print_table_start();
236-
php_info_print_table_row(2, "V8 Engine Compiled Version", VERSION_STRING);
206+
php_info_print_table_row(2, "V8 Engine Compiled Version", PHP_V8_LIBV8_VERSION);
237207
php_info_print_table_row(2, "V8 Engine Linked Version", v8::V8::GetVersion());
238208
php_info_print_table_end();
239209

@@ -269,7 +239,6 @@ static PHP_GSHUTDOWN_FUNCTION(v8)
269239
* Every user visible function must have an entry in php_v8_functions[].
270240
*/
271241
const zend_function_entry php_v8_functions[] = {
272-
PHP_FE(confirm_v8_compiled, NULL) /* For testing, remove later. */
273242
PHP_FE_END /* Must be the last line in php_v8_functions[] */
274243
};
275244
/* }}} */

0 commit comments

Comments
 (0)