@@ -121,137 +121,124 @@ int main ()
121121 set $ac_cv_v8_version
122122 IFS=$ac_IFS
123123 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] )
126126 fi
127127 AC_DEFINE_UNQUOTED ( [ PHP_V8_API_VERSION] , $V8_API_VERSION , [ ] )
128128 AC_DEFINE_UNQUOTED ( [ PHP_V8_VERSION] , "$ac_cv_v8_version" , [ ] )
129129 else
130130 AC_MSG_ERROR ( [ could not determine libv8 version] )
131131 fi
132132
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)
138134
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- for static_link_extra_file in $static_link_extra; do
149- AC_MSG_CHECKING ( [ for $static_link_extra_file] )
150-
151- for i in $PHP_V8JS $SEARCH_PATH ; do
152- if test -r $i/lib64/$static_link_extra_file; then
153- static_link_dir=$i/lib64
154- AC_MSG_RESULT ( found in $i )
155- fi
156- if test -r $i/lib/$static_link_extra_file; then
157- static_link_dir=$i/lib
158- AC_MSG_RESULT ( found in $i )
159- fi
160- done
161-
162- if test -z "$static_link_dir"; then
163- AC_MSG_RESULT ( [ not found] )
164- AC_MSG_ERROR ( [ Please provide $static_link_extra_file next to the libv8.so, see README.md for details] )
165- fi
166-
167- LDFLAGS_libplatform="$static_link_dir/$static_link_extra_file"
168- 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
169143
170- # modify flags for (possibly) succeeding V8 startup check
171- CPPFLAGS="$CPPFLAGS -I$V8_DIR"
172- LIBS="$LIBS $LDFLAGS_libplatform"
173- 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>
174178
175- if test "$V8_API_VERSION" -ge 4004010 ; then
176- dnl building for v8 4.4.10 or later, which requires us to
177- dnl provide startup data, if V8 wasn't compiled with snapshot=off.
178- AC_MSG_CHECKING ( [ whether V8 requires startup data] )
179- AC_TRY_RUN ( [
180- #include <v8.h>
181- #include <libplatform/libplatform.h>
182- #include <stdlib.h>
183- #include <string.h>
184-
185- #if PHP_V8_API_VERSION >= 4004010
186179class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
187180public:
188- virtual void* Allocate(size_t length) {
189- void* data = AllocateUninitialized(length);
190- return data == NULL ? data : memset(data, 0, length);
191- }
192- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
193- 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); }
194187};
195- #endif
196-
197- int main ()
198- {
199- v8::Platform *v8_platform = v8::platform::CreateDefaultPlatform();
200- v8::V8::InitializePlatform(v8_platform);
201- v8::V8::Initialize();
202-
203- #if PHP_V8_API_VERSION >= 4004044
204- static ArrayBufferAllocator array_buffer_allocator;
205- v8::Isolate::CreateParams create_params;
206- create_params.array_buffer_allocator = &array_buffer_allocator;
207-
208- v8::Isolate::New(create_params);
209- #else /* PHP_V8_API_VERSION < 4004044 */
210- v8::Isolate::New();
211- #endif
212- return 0;
213- }
214- ] , [
215- AC_MSG_RESULT ( [ no] )
216- ] , [
217- AC_MSG_RESULT ( [ yes] )
218- AC_DEFINE ( [ PHP_V8_USE_EXTERNAL_STARTUP_DATA] , [ 1] , [ Whether V8 requires (and can be provided with custom versions of) external startup data] )
219-
220- SEARCH_PATH="$V8_DIR/lib $V8_DIR/share/v8"
221-
222- AC_MSG_CHECKING ( [ for natives_blob.bin] )
223- SEARCH_FOR="natives_blob.bin"
224-
225- for i in $SEARCH_PATH ; do
226- if test -r $i/$SEARCH_FOR; then
227- AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
228- AC_DEFINE_UNQUOTED ( [ PHP_V8_NATIVES_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to natives_blob.bin file] )
229- native_blob_found=1
230- fi
231- done
232-
233- if test -z "$native_blob_found"; then
234- AC_MSG_RESULT ( [ not found] )
235- AC_MSG_ERROR ( [ Please provide V8 native blob as needed] )
236- fi
237-
238- AC_MSG_CHECKING ( [ for snapshot_blob.bin] )
239- SEARCH_FOR="snapshot_blob.bin"
240-
241- for i in $SEARCH_PATH ; do
242- if test -r $i/$SEARCH_FOR; then
243- AC_MSG_RESULT ( [ found ($i/$SEARCH_FOR)] )
244- AC_DEFINE_UNQUOTED ( [ PHP_V8_SNAPSHOT_BLOB_PATH] , "$i/$SEARCH_FOR" , [ Full path to snapshot_blob.bin file] )
245- snapshot_blob_found=1
246- fi
247- done
248-
249- if test -z "$snapshot_blob_found"; then
250- AC_MSG_RESULT ( [ not found] )
251- AC_MSG_ERROR ( [ Please provide V8 snapshot blob as needed] )
252- fi
253- ] )
254- 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+ ] )
255242
256243 AC_LANG_RESTORE
257244 LIBS=$old_LIBS
0 commit comments