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

Merge pull request #532 from JoshuaBehrens/feature/hassle-free-installation

Improve configureless installation on debian and redhat machines
This commit is contained in:
Stefan Siegl 2024-09-20 21:25:35 +02:00 committed by GitHub
commit b4471849c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,9 +3,12 @@ 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="$PHP_LIBDIR/libv8.$SHLIB_SUFFIX_NAME" SEARCH_FOR="libv8.$SHLIB_SUFFIX_NAME"
if test -d "$PHP_V8JS"; then
SEARCH_PATH="$PHP_V8JS $SEARCH_PATH"
fi
if test -r $PHP_V8JS/$SEARCH_FOR; then
case $host_os in case $host_os in
darwin* ) darwin* )
# MacOS does not support --rpath # MacOS does not support --rpath
@ -14,26 +17,41 @@ if test "$PHP_V8JS" != "no"; then
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR" LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;; ;;
esac esac
V8_DIR=$PHP_V8JS
else
AC_MSG_CHECKING([for V8 files in default path]) AC_MSG_CHECKING([for V8 files in default path])
ARCH=$(uname -m)
for i in $SEARCH_PATH ; do for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then if test -r $i/$PHP_LIBDIR/$SEARCH_FOR; then
V8_DIR=$i V8_INCLUDE_DIR=$i/include/v8
V8_LIBRARY_DIR=$i/$PHP_LIBDIR
AC_MSG_RESULT(found in $i)
fi
# Debian installations
if test -r $i/$PHP_LIBDIR/$ARCH-linux-gnu/$SEARCH_FOR; then
V8_INCLUDE_DIR=$i/include/v8
V8_LIBRARY_DIR=$i/$PHP_LIBDIR/$ARCH-linux-gnu
AC_MSG_RESULT(found in $i)
fi
# Manual installations
if test -r $i/$PHP_LIBDIR/$SEARCH_FOR && test -r $i/include/libplatform/libplatform.h; then
V8_INCLUDE_DIR=$i/include
V8_LIBRARY_DIR=$i/$PHP_LIBDIR
AC_MSG_RESULT(found in $i) AC_MSG_RESULT(found in $i)
fi fi
done done
fi
AC_DEFINE_UNQUOTED([PHP_V8_EXEC_PATH], "$V8_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])
if test -z "$V8_DIR"; then if test -z "$V8_INCLUDE_DIR" || test -z "$V8_LIBRARY_DIR"; then
AC_MSG_RESULT([not found]) AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the v8 distribution]) AC_MSG_ERROR([Please reinstall the v8 distribution])
fi fi
PHP_ADD_INCLUDE($V8_DIR/include) PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_DIR/$PHP_LIBDIR, V8JS_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_LIBRARY_DIR, V8JS_SHARED_LIBADD)
PHP_SUBST(V8JS_SHARED_LIBADD) PHP_SUBST(V8JS_SHARED_LIBADD)
PHP_REQUIRE_CXX() PHP_REQUIRE_CXX()
@ -89,8 +107,8 @@ if test "$PHP_V8JS" != "no"; then
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
CPPFLAGS="$CPPFLAGS -I$V8_DIR/include -std=$ac_cv_v8_cstd" CPPFLAGS="$CPPFLAGS -I$V8_INCLUDE_DIR -std=$ac_cv_v8_cstd"
LDFLAGS="$LDFLAGS -L$V8_DIR/$PHP_LIBDIR" LDFLAGS="$LDFLAGS -L$V8_LIBRARY_DIR"
AC_MSG_CHECKING([for libv8_libplatform]) AC_MSG_CHECKING([for libv8_libplatform])
AC_DEFUN([V8_CHECK_LINK], [ AC_DEFUN([V8_CHECK_LINK], [
@ -161,7 +179,7 @@ int main ()
AC_MSG_CHECKING([for $1]) AC_MSG_CHECKING([for $1])
blob_found=0 blob_found=0
for i in "$V8_DIR/$PHP_LIBDIR" "$V8_DIR/share/v8"; do for i in "$V8_LIBRARY_DIR" "$V8_INCLUDE_DIR/../share/v8"; do
if test -r "$i/$1"; then if test -r "$i/$1"; then
AC_MSG_RESULT([found ($i/$1)]) AC_MSG_RESULT([found ($i/$1)])
AC_DEFINE_UNQUOTED([$2], "$i/$1", [Full path to $1 file]) AC_DEFINE_UNQUOTED([$2], "$i/$1", [Full path to $1 file])
@ -219,7 +237,7 @@ int main ()
AC_DEFINE([V8_DEPRECATION_WARNINGS], [1], [Enable compiler warnings when using V8_DEPRECATED apis.]) AC_DEFINE([V8_DEPRECATION_WARNINGS], [1], [Enable compiler warnings when using V8_DEPRECATED apis.])
PHP_ADD_INCLUDE($V8_DIR) PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
PHP_NEW_EXTENSION(v8js, [ \ PHP_NEW_EXTENSION(v8js, [ \
v8js_array_access.cc \ v8js_array_access.cc \
v8js_class.cc \ v8js_class.cc \