mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-08 14:48:40 +00:00
Use linker to detect libv8_libplatform & libv8_libbase
Conflicts: config.m4 Backport from php7 branch.
This commit is contained in:
parent
15cdc3e7df
commit
ea8ac66762
78
config.m4
78
config.m4
@ -81,21 +81,43 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
old_LDFLAGS=$LDFLAGS
|
old_LDFLAGS=$LDFLAGS
|
||||||
old_CPPFLAGS=$CPPFLAGS
|
old_CPPFLAGS=$CPPFLAGS
|
||||||
|
|
||||||
case $host_os in
|
|
||||||
darwin* )
|
|
||||||
# MacOS does not support --rpath
|
|
||||||
LDFLAGS="-L$V8_DIR/$PHP_LIBDIR"
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
LDFLAGS="-Wl,--rpath=$V8_DIR/$PHP_LIBDIR -L$V8_DIR/$PHP_LIBDIR"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
LIBS=-lv8
|
|
||||||
CPPFLAGS="-I$V8_DIR/include -std=$ac_cv_v8_cstd"
|
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
|
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$V8_DIR/include -std=$ac_cv_v8_cstd"
|
||||||
|
LDFLAGS="$LDFLAGS -L$V8_DIR/$PHP_LIBDIR"
|
||||||
|
|
||||||
|
AC_DEFUN([V8_CHECK_LINK], [
|
||||||
|
AC_MSG_CHECKING([for libv8_libplatform])
|
||||||
|
save_LIBS="$LIBS"
|
||||||
|
LIBS="$LIBS $1 -lv8_libplatform -lv8"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
|
namespace v8 {
|
||||||
|
namespace platform {
|
||||||
|
void* CreateDefaultPlatform(int thread_pool_size = 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
], [ v8::platform::CreateDefaultPlatform(); ])], [
|
||||||
|
dnl libv8_libplatform.so found
|
||||||
|
AC_MSG_RESULT(found)
|
||||||
|
V8JS_SHARED_LIBADD="$1 -lv8_libplatform $V8JS_SHARED_LIBADD"
|
||||||
|
$2
|
||||||
|
], [ $3 ])
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
])
|
||||||
|
|
||||||
|
V8_CHECK_LINK([], [], [
|
||||||
|
V8_CHECK_LINK([-lv8_libbase], [], [ AC_MSG_ERROR([could not find libv8_libplatform library]) ])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl Check for V8 version
|
||||||
|
dnl (basic support for library linking assumed to be achieved above)
|
||||||
|
dnl
|
||||||
|
|
||||||
|
|
||||||
|
LIBS="$LIBS $V8JS_SHARED_LIBADD"
|
||||||
AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
|
AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
|
||||||
AC_TRY_RUN([#include <v8.h>
|
AC_TRY_RUN([#include <v8.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -132,40 +154,8 @@ int main ()
|
|||||||
|
|
||||||
PHP_ADD_INCLUDE($V8_DIR)
|
PHP_ADD_INCLUDE($V8_DIR)
|
||||||
|
|
||||||
case $host_os in
|
|
||||||
darwin* )
|
|
||||||
static_link_extra="libv8_libplatform.a libv8_libbase.a"
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
static_link_extra="libv8_libplatform.a"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
LDFLAGS_libplatform=""
|
|
||||||
for static_link_extra_file in $static_link_extra; do
|
|
||||||
AC_MSG_CHECKING([for $static_link_extra_file])
|
|
||||||
|
|
||||||
if test -r $V8_DIR/lib64/$static_link_extra_file; then
|
|
||||||
static_link_dir=$V8_DIR/lib64
|
|
||||||
AC_MSG_RESULT(found in $V8_DIR/lib64)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -r $V8_DIR/lib/$static_link_extra_file; then
|
|
||||||
static_link_dir=$V8_DIR/lib
|
|
||||||
AC_MSG_RESULT(found in $V8_DIR/lib)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$static_link_dir"; then
|
|
||||||
AC_MSG_RESULT([not found])
|
|
||||||
AC_MSG_ERROR([Please provide $static_link_extra_file next to the libv8.so, see README.md for details])
|
|
||||||
fi
|
|
||||||
|
|
||||||
LDFLAGS_libplatform="$LDFLAGS_libplatform $static_link_dir/$static_link_extra_file"
|
|
||||||
done
|
|
||||||
|
|
||||||
# modify flags for (possibly) succeeding V8 startup check
|
# modify flags for (possibly) succeeding V8 startup check
|
||||||
CPPFLAGS="$CPPFLAGS -I$V8_DIR"
|
CPPFLAGS="$CPPFLAGS -I$V8_DIR"
|
||||||
LIBS="$LIBS $LDFLAGS_libplatform"
|
|
||||||
|
|
||||||
dnl building for v8 4.4.10 or later, which requires us to
|
dnl building for v8 4.4.10 or later, which requires us to
|
||||||
dnl provide startup data, if V8 wasn't compiled with snapshot=off.
|
dnl provide startup data, if V8 wasn't compiled with snapshot=off.
|
||||||
|
Loading…
Reference in New Issue
Block a user