0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 08:11:52 +00:00

Check for libnode (additional/instead of libv8)

This commit is contained in:
Stefan Siegl 2024-09-29 10:05:47 +02:00
parent 9f854c5343
commit 56eb76bd9a

118
config.m4
View File

@ -3,46 +3,53 @@ PHP_ARG_WITH(v8js, for V8 Javascript Engine,
if test "$PHP_V8JS" != "no"; then if test "$PHP_V8JS" != "no"; then
SEARCH_PATH="/usr/local /usr" SEARCH_PATH="/usr/local /usr"
SEARCH_FOR="libv8.$SHLIB_SUFFIX_NAME"
if test -d "$PHP_V8JS"; then for libname in v8 node; do
SEARCH_PATH="$PHP_V8JS" SEARCH_FOR="lib$libname.$SHLIB_SUFFIX_NAME"
# set rpath, so library loader picks up libv8 even if it's not on the if test -d "$PHP_V8JS"; then
# system's library search path SEARCH_PATH="$PHP_V8JS"
case $host_os in
darwin* )
# MacOS does not support --rpath
;;
* )
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;;
esac
fi
AC_MSG_CHECKING([for V8 files in default path]) # set rpath, so library loader picks up libv8 even if it's not on the
ARCH=$(uname -m) # system's library search path
case $host_os in
for i in $SEARCH_PATH ; do darwin* )
if test -r "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/v8/v8.h"; then # MacOS does not support --rpath
V8_INCLUDE_DIR="$i/include/v8" ;;
V8_LIBRARY_DIR="$i/$PHP_LIBDIR" * )
AC_MSG_RESULT(found in $i) LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;;
esac
fi fi
# Debian installations AC_MSG_CHECKING([for V8 files in default path])
if test -r "$i/$PHP_LIBDIR/$ARCH-linux-gnu/$SEARCH_FOR"; then ARCH=$(uname -m)
V8_INCLUDE_DIR="$i/include/v8"
V8_LIBRARY_DIR="$i/$PHP_LIBDIR/$ARCH-linux-gnu"
AC_MSG_RESULT(found in $i)
fi
# Manual installations for i in $SEARCH_PATH ; do
if test -r "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/libplatform/libplatform.h"; then echo checking "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/$libname/v8.h"
V8_INCLUDE_DIR="$i/include" if test -r "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/$libname/v8.h"; then
V8_LIBRARY_DIR="$i/$PHP_LIBDIR" V8_INCLUDE_DIR="$i/include/$libname"
AC_MSG_RESULT(found in $i) V8_LIBRARY_DIR="$i/$PHP_LIBDIR"
fi AC_MSG_RESULT(found in $i)
break 2
fi
# Debian installations
if test -r "$i/$PHP_LIBDIR/$ARCH-linux-gnu/$SEARCH_FOR"; then
V8_INCLUDE_DIR="$i/include/$libname"
V8_LIBRARY_DIR="$i/$PHP_LIBDIR/$ARCH-linux-gnu"
AC_MSG_RESULT(found in $i)
break 2
fi
# Manual installations
if test -r "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/libplatform/libplatform.h"; then
V8_INCLUDE_DIR="$i/include"
V8_LIBRARY_DIR="$i/$PHP_LIBDIR"
AC_MSG_RESULT(found in $i)
break 2
fi
done
done done
AC_DEFINE_UNQUOTED([PHP_V8_EXEC_PATH], "$V8_LIBRARY_DIR/$SEARCH_FOR", [Full path to libv8 library file]) AC_DEFINE_UNQUOTED([PHP_V8_EXEC_PATH], "$V8_LIBRARY_DIR/$SEARCH_FOR", [Full path to libv8 library file])
@ -53,8 +60,9 @@ if test "$PHP_V8JS" != "no"; then
fi fi
PHP_ADD_INCLUDE($V8_INCLUDE_DIR) PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_LIBRARY_DIR, V8JS_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH($libname, $V8_LIBRARY_DIR, V8JS_SHARED_LIBADD)
PHP_SUBST(V8JS_SHARED_LIBADD) PHP_SUBST(V8JS_SHARED_LIBADD)
PHP_REQUIRE_CXX() PHP_REQUIRE_CXX()
@ -112,26 +120,28 @@ if test "$PHP_V8JS" != "no"; then
CPPFLAGS="$CPPFLAGS -I$V8_INCLUDE_DIR -std=$ac_cv_v8_cstd" CPPFLAGS="$CPPFLAGS -I$V8_INCLUDE_DIR -std=$ac_cv_v8_cstd"
LDFLAGS="$LDFLAGS -L$V8_LIBRARY_DIR" LDFLAGS="$LDFLAGS -L$V8_LIBRARY_DIR"
AC_MSG_CHECKING([for libv8_libplatform]) if test "$libname" = "v8"; then
AC_DEFUN([V8_CHECK_LINK], [ AC_MSG_CHECKING([for libv8_libplatform])
save_LIBS="$LIBS" AC_DEFUN([V8_CHECK_LINK], [
LIBS="$LIBS $1 -lv8_libplatform -lv8" save_LIBS="$LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([ LIBS="$LIBS $1 -lv8_libplatform -lv8"
#include <libplatform/libplatform.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([
], [ v8::platform::NewDefaultPlatform(); ])], [ #include <libplatform/libplatform.h>
dnl libv8_libplatform.so found ], [ v8::platform::NewDefaultPlatform(); ])], [
AC_MSG_RESULT(found) dnl libv8_libplatform.so found
V8JS_SHARED_LIBADD="$1 -lv8_libplatform $V8JS_SHARED_LIBADD" AC_MSG_RESULT(found)
$3 V8JS_SHARED_LIBADD="$1 -lv8_libplatform $V8JS_SHARED_LIBADD"
], [ $4 ]) $3
LIBS="$save_LIBS" ], [ $4 ])
]) LIBS="$save_LIBS"
V8_CHECK_LINK([], [], [], [
V8_CHECK_LINK([-lv8_libbase], [], [], [
AC_MSG_ERROR([could not find libv8_libplatform library])
]) ])
])
V8_CHECK_LINK([], [], [], [
V8_CHECK_LINK([-lv8_libbase], [], [], [
AC_MSG_ERROR([could not find libv8_libplatform library])
])
])
fi
dnl dnl