Skip to content

Commit

Permalink
Split include and lib directory variables
Browse files Browse the repository at this point in the history
Solves phpv8#522
Solves phpv8#529
  • Loading branch information
JoshuaBehrens committed Sep 7, 2024
1 parent ccf94d8 commit c01f24f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ PHP_ARG_WITH(v8js, for V8 Javascript Engine,

if test "$PHP_V8JS" != "no"; then
SEARCH_PATH="/usr/local /usr"
SEARCH_FOR="$PHP_LIBDIR/libv8.$SHLIB_SUFFIX_NAME"
SEARCH_FOR="libv8.$SHLIB_SUFFIX_NAME"

if test -r $PHP_V8JS/$SEARCH_FOR; then
case $host_os in
darwin* )
Expand All @@ -14,26 +14,28 @@ if test "$PHP_V8JS" != "no"; then
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;;
esac
V8_DIR=$PHP_V8JS
V8_INCLUDE_DIR=$PHP_V8JS/include/v8
V8_LIBRARY_DIR=$PHP_V8JS/$PHP_LIBDIR
else
AC_MSG_CHECKING([for V8 files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
V8_DIR=$i
if test -r $i/$PHP_LIBDIR/$SEARCH_FOR; then
V8_INCLUDE_DIR=$i/include/v8
V8_LIBRARY_DIR=$i/$PHP_LIBDIR
AC_MSG_RESULT(found in $i)
fi
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_ERROR([Please reinstall the v8 distribution])
fi

PHP_ADD_INCLUDE($V8_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_DIR/$PHP_LIBDIR, V8JS_SHARED_LIBADD)
PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_LIBRARY_DIR, V8JS_SHARED_LIBADD)
PHP_SUBST(V8JS_SHARED_LIBADD)
PHP_REQUIRE_CXX()

Expand Down Expand Up @@ -89,8 +91,8 @@ if test "$PHP_V8JS" != "no"; then

AC_LANG_PUSH([C++])

CPPFLAGS="$CPPFLAGS -I$V8_DIR/include -std=$ac_cv_v8_cstd"
LDFLAGS="$LDFLAGS -L$V8_DIR/$PHP_LIBDIR"
CPPFLAGS="$CPPFLAGS -I$V8_INCLUDE_DIR -std=$ac_cv_v8_cstd"
LDFLAGS="$LDFLAGS -L$V8_LIBRARY_DIR"

AC_MSG_CHECKING([for libv8_libplatform])
AC_DEFUN([V8_CHECK_LINK], [
Expand Down Expand Up @@ -161,7 +163,7 @@ int main ()
AC_MSG_CHECKING([for $1])
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
AC_MSG_RESULT([found ($i/$1)])
AC_DEFINE_UNQUOTED([$2], "$i/$1", [Full path to $1 file])
Expand Down Expand Up @@ -219,7 +221,7 @@ int main ()

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, [ \
v8js_array_access.cc \
v8js_class.cc \
Expand Down

0 comments on commit c01f24f

Please sign in to comment.