Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust scanning, override SEARCH_PATH by explicitly given dir #534

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
More robust scanning, override SEARCH_PATH by explicitly given dir
stesie committed Sep 20, 2024
commit 303ab95a90f4b0eb3fec2f6c4e9f3cdbf97fcacf
40 changes: 21 additions & 19 deletions config.m4
Original file line number Diff line number Diff line change
@@ -6,39 +6,41 @@ if test "$PHP_V8JS" != "no"; then
SEARCH_FOR="libv8.$SHLIB_SUFFIX_NAME"

if test -d "$PHP_V8JS"; then
SEARCH_PATH="$PHP_V8JS $SEARCH_PATH"
SEARCH_PATH="$PHP_V8JS"

# set rpath, so library loader picks up libv8 even if it's not on the
# system's library search path
case $host_os in
darwin* )
# MacOS does not support --rpath
;;
* )
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;;
esac
fi

case $host_os in
darwin* )
# MacOS does not support --rpath
;;
* )
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
;;
esac

AC_MSG_CHECKING([for V8 files in default path])
ARCH=$(uname -m)

for i in $SEARCH_PATH ; do
if test -r $i/$PHP_LIBDIR/$SEARCH_FOR; then
V8_INCLUDE_DIR=$i/include/v8
V8_LIBRARY_DIR=$i/$PHP_LIBDIR
if test -r "$i/$PHP_LIBDIR/$SEARCH_FOR" -a -r "$i/include/v8/v8.h"; then
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
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
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)
fi
done