@@ -121,138 +121,124 @@ int main ()
121
121
set $ac_cv_v8_version
122
122
IFS=$ac_IFS
123
123
V8_API_VERSION=`expr [ $] 1 \* 1000000 + [ $] 2 \* 1000 + [ $] 3`
124
- if test "$V8_API_VERSION" -lt 3024006 ; then
125
- AC_MSG_ERROR ( [ libv8 must be version 3.24.6 or greater] )
124
+ if test "$V8_API_VERSION" -lt 4006076 ; then
125
+ AC_MSG_ERROR ( [ libv8 must be version 4.6.76 or greater] )
126
126
fi
127
127
AC_DEFINE_UNQUOTED ( [ PHP_V8_API_VERSION] , $V8_API_VERSION , [ ] )
128
128
AC_DEFINE_UNQUOTED ( [ PHP_V8_VERSION] , "$ac_cv_v8_version" , [ ] )
129
129
else
130
130
AC_MSG_ERROR ( [ could not determine libv8 version] )
131
131
fi
132
132
133
- if test "$V8_API_VERSION" -ge 3029036 ; then
134
- dnl building for v8 3.29.36 or later, which requires us to
135
- dnl initialize and provide a platform; hence we need to
136
- dnl link in libplatform to make our life easier.
137
- PHP_ADD_INCLUDE($V8_DIR)
133
+ PHP_ADD_INCLUDE($V8_DIR)
138
134
139
- case $host_os in
140
- darwin* )
141
- static_link_extra="libv8_libplatform.a libv8_libbase.a"
142
- ;;
143
- * )
144
- static_link_extra="libv8_libplatform.a"
145
- ;;
146
- esac
147
-
148
- LDFLAGS_libplatform=""
149
- for static_link_extra_file in $static_link_extra; do
150
- AC_MSG_CHECKING ( [ for $static_link_extra_file] )
151
-
152
- for i in $PHP_V8JS $SEARCH_PATH ; do
153
- if test -r $i/lib64/$static_link_extra_file; then
154
- static_link_dir=$i/lib64
155
- AC_MSG_RESULT ( found in $i )
156
- fi
157
- if test -r $i/lib/$static_link_extra_file; then
158
- static_link_dir=$i/lib
159
- AC_MSG_RESULT ( found in $i )
160
- fi
161
- done
162
-
163
- if test -z "$static_link_dir"; then
164
- AC_MSG_RESULT ( [ not found] )
165
- AC_MSG_ERROR ( [ Please provide $static_link_extra_file next to the libv8.so, see README.md for details] )
166
- fi
167
-
168
- LDFLAGS_libplatform="$LDFLAGS_libplatform $static_link_dir/$static_link_extra_file"
169
- done
135
+ case $host_os in
136
+ darwin* )
137
+ static_link_extra="libv8_libplatform.a libv8_libbase.a"
138
+ ;;
139
+ * )
140
+ static_link_extra="libv8_libplatform.a"
141
+ ;;
142
+ esac
170
143
171
- # modify flags for (possibly) succeeding V8 startup check
172
- CPPFLAGS="$CPPFLAGS -I$V8_DIR"
173
- LIBS="$LIBS $LDFLAGS_libplatform"
174
- fi
144
+ LDFLAGS_libplatform=""
145
+ for static_link_extra_file in $static_link_extra; do
146
+ AC_MSG_CHECKING ( [ for $static_link_extra_file] )
147
+
148
+ if test -r $V8_DIR/lib64/$static_link_extra_file; then
149
+ static_link_dir=$V8_DIR/lib64
150
+ AC_MSG_RESULT ( found in $V8_DIR/lib64 )
151
+ fi
152
+
153
+ if test -r $V8_DIR/lib/$static_link_extra_file; then
154
+ static_link_dir=$V8_DIR/lib
155
+ AC_MSG_RESULT ( found in $V8_DIR/lib )
156
+ fi
157
+
158
+ if test -z "$static_link_dir"; then
159
+ AC_MSG_RESULT ( [ not found] )
160
+ AC_MSG_ERROR ( [ Please provide $static_link_extra_file next to the libv8.so, see README.md for details] )
161
+ fi
162
+
163
+ LDFLAGS_libplatform="$LDFLAGS_libplatform $static_link_dir/$static_link_extra_file"
164
+ done
165
+
166
+ # modify flags for (possibly) succeeding V8 startup check
167
+ CPPFLAGS="$CPPFLAGS -I$V8_DIR"
168
+ LIBS="$LIBS $LDFLAGS_libplatform"
169
+
170
+ dnl building for v8 4.4.10 or later, which requires us to
171
+ dnl provide startup data, if V8 wasn't compiled with snapshot=off.
172
+ AC_MSG_CHECKING ( [ whether V8 requires startup data] )
173
+ AC_TRY_RUN ( [
174
+ #include <v8.h>
175
+ #include <libplatform/libplatform.h>
176
+ #include <stdlib.h>
177
+ #include <string.h>
175
178
176
- if test "$V8_API_VERSION" -ge 4004010 ; then
177
- dnl building for v8 4.4.10 or later, which requires us to
178
- dnl provide startup data, if V8 wasn't compiled with snapshot=off.
179
- AC_MSG_CHECKING ( [ whether V8 requires startup data] )
180
- AC_TRY_RUN ( [
181
- #include <v8.h>
182
- #include <libplatform/libplatform.h>
183
- #include <stdlib.h>
184
- #include <string.h>
185
-
186
- #if PHP_V8_API_VERSION >= 4004010
187
179
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
188
180
public:
189
- virtual void* Allocate(size_t length) {
190
- void* data = AllocateUninitialized(length);
191
- return data == NULL ? data : memset(data, 0, length);
192
- }
193
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
194
- virtual void Free(void* data, size_t) { free(data); }
181
+ virtual void* Allocate(size_t length) {
182
+ void* data = AllocateUninitialized(length);
183
+ return data == NULL ? data : memset(data, 0, length);
184
+ }
185
+ virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
186
+ virtual void Free(void* data, size_t) { free(data); }
195
187
};
196
- #endif
197
-
198
- int main ()
199
- {
200
- v8::Platform *v8_platform = v8::platform::CreateDefaultPlatform();
201
- v8::V8::InitializePlatform(v8_platform);
202
- v8::V8::Initialize();
203
-
204
- #if PHP_V8_API_VERSION >= 4004044
205
- static ArrayBufferAllocator array_buffer_allocator;
206
- v8::Isolate::CreateParams create_params;
207
- create_params.array_buffer_allocator = &array_buffer_allocator;
208
-
209
- v8::Isolate::New(create_params);
210
- #else /* PHP_V8_API_VERSION < 4004044 */
211
- v8::Isolate::New();
212
- #endif
213
- return 0;
214
- }
215
- ] , [
216
- AC_MSG_RESULT ( [ no] )
217
- ] , [
218
- AC_MSG_RESULT ( [ yes] )
219
- AC_DEFINE ( [ PHP_V8_USE_EXTERNAL_STARTUP_DATA] , [ 1] , [ Whether V8 requires (and can be provided with custom versions of) external startup data] )
220
-
221
- SEARCH_PATH="$V8_DIR/lib $V8_DIR/share/v8"
222
-
223
- AC_MSG_CHECKING ( [ for natives_blob.bin] )
224
- SEARCH_FOR="natives_blob.bin"
225
-
226
- for i in $SEARCH_PATH ; do
227
- if test -r $i/$SEARCH_FOR; then
228
- AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
229
- AC_DEFINE_UNQUOTED ( [ PHP_V8_NATIVES_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to natives_blob.bin file] )
230
- native_blob_found=1
231
- fi
232
- done
233
-
234
- if test -z "$native_blob_found"; then
235
- AC_MSG_RESULT ( [ not found] )
236
- AC_MSG_ERROR ( [ Please provide V8 native blob as needed] )
237
- fi
238
-
239
- AC_MSG_CHECKING ( [ for snapshot_blob.bin] )
240
- SEARCH_FOR="snapshot_blob.bin"
241
-
242
- for i in $SEARCH_PATH ; do
243
- if test -r $i/$SEARCH_FOR; then
244
- AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
245
- AC_DEFINE_UNQUOTED ( [ PHP_V8_SNAPSHOT_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to snapshot_blob.bin file] )
246
- snapshot_blob_found=1
247
- fi
248
- done
249
-
250
- if test -z "$snapshot_blob_found"; then
251
- AC_MSG_RESULT ( [ not found] )
252
- AC_MSG_ERROR ( [ Please provide V8 snapshot blob as needed] )
253
- fi
254
- ] )
255
- fi
188
+
189
+ int main ()
190
+ {
191
+ v8::Platform *v8_platform = v8::platform::CreateDefaultPlatform();
192
+ v8::V8::InitializePlatform(v8_platform);
193
+ v8::V8::Initialize();
194
+
195
+ static ArrayBufferAllocator array_buffer_allocator;
196
+ v8::Isolate::CreateParams create_params;
197
+ create_params.array_buffer_allocator = &array_buffer_allocator;
198
+
199
+ v8::Isolate::New(create_params);
200
+ return 0;
201
+ }
202
+ ] , [
203
+ AC_MSG_RESULT ( [ no] )
204
+ ] , [
205
+ AC_MSG_RESULT ( [ yes] )
206
+ AC_DEFINE ( [ PHP_V8_USE_EXTERNAL_STARTUP_DATA] , [ 1] , [ Whether V8 requires (and can be provided with custom versions of) external startup data] )
207
+
208
+ SEARCH_PATH="$V8_DIR/lib $V8_DIR/share/v8"
209
+
210
+ AC_MSG_CHECKING ( [ for natives_blob.bin] )
211
+ SEARCH_FOR="natives_blob.bin"
212
+
213
+ for i in $SEARCH_PATH ; do
214
+ if test -r $i/$SEARCH_FOR; then
215
+ AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
216
+ AC_DEFINE_UNQUOTED ( [ PHP_V8_NATIVES_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to natives_blob.bin file] )
217
+ native_blob_found=1
218
+ fi
219
+ done
220
+
221
+ if test -z "$native_blob_found"; then
222
+ AC_MSG_RESULT ( [ not found] )
223
+ AC_MSG_ERROR ( [ Please provide V8 native blob as needed] )
224
+ fi
225
+
226
+ AC_MSG_CHECKING ( [ for snapshot_blob.bin] )
227
+ SEARCH_FOR="snapshot_blob.bin"
228
+
229
+ for i in $SEARCH_PATH ; do
230
+ if test -r $i/$SEARCH_FOR; then
231
+ AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
232
+ AC_DEFINE_UNQUOTED ( [ PHP_V8_SNAPSHOT_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to snapshot_blob.bin file] )
233
+ snapshot_blob_found=1
234
+ fi
235
+ done
236
+
237
+ if test -z "$snapshot_blob_found"; then
238
+ AC_MSG_RESULT ( [ not found] )
239
+ AC_MSG_ERROR ( [ Please provide V8 snapshot blob as needed] )
240
+ fi
241
+ ] )
256
242
257
243
AC_LANG_RESTORE
258
244
LIBS=$old_LIBS
0 commit comments