mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 01:33:12 +02:00
build: fix PHP library used to compile PHP plugin (closes #1078)
This was causing a dependency missing in debian packaging.
This commit is contained in:
+6
-4
@@ -28,22 +28,24 @@ endif()
|
||||
|
||||
if(NOT PHP_FOUND)
|
||||
find_program(PHP_CONFIG_EXECUTABLE NAMES
|
||||
php-config php-config7
|
||||
php-config7.2 php-config72
|
||||
php-config7.1 php-config71
|
||||
php-config7.0 php-config70)
|
||||
php-config7.0 php-config70
|
||||
php-config php-config7)
|
||||
if (PHP_CONFIG_EXECUTABLE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE PHP_LIB_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --includes OUTPUT_VARIABLE PHP_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --libs OUTPUT_VARIABLE PHP_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE PHP_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(${PHP_VERSION} MATCHES "^7")
|
||||
find_library(PHP_LIB php7 HINTS ${PHP_LIB_PREFIX} ${PHP_LIB_PREFIX}/lib ${PHP_LIB_PREFIX}/lib64)
|
||||
find_library(PHP_LIB
|
||||
NAMES php7.2 php7.1 php7.0 php7
|
||||
HINTS ${PHP_LIB_PREFIX} ${PHP_LIB_PREFIX}/lib ${PHP_LIB_PREFIX}/lib64)
|
||||
if(PHP_LIB)
|
||||
get_filename_component(PHP_LIB_DIR ${PHP_LIB} DIRECTORY)
|
||||
string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS})
|
||||
SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS)
|
||||
set(PHP_LDFLAGS "-L${PHP_LIB_DIR} ${PHP_LIBS} -lphp7")
|
||||
set(PHP_LDFLAGS "-L${PHP_LIB_DIR} ${PHP_LIBS}")
|
||||
set(PHP_FOUND 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+4
-4
@@ -954,7 +954,7 @@ if test "x$enable_php" = "xyes" ; then
|
||||
if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
|
||||
AC_MSG_CHECKING(for PHP headers and libraries with pkg-config)
|
||||
echo
|
||||
for l in "$php_suffix" "7" "7.2" "72" "7.1" "71" "7.0" "70" "" ; do
|
||||
for l in "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
|
||||
pkgconfig_php_found=`$PKGCONFIG --exists php$l 2>/dev/null`
|
||||
if test "x$?" = "x0" ; then
|
||||
pkgconfig_php_found=`$PKGCONFIG --atleast-version=7 php$l 2>/dev/null`
|
||||
@@ -971,14 +971,14 @@ if test "x$enable_php" = "xyes" ; then
|
||||
if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
|
||||
PHPCONFIG=""
|
||||
AC_MSG_CHECKING(for PHP headers and libraries with php-config)
|
||||
for l in "$php_suffix" "7" "7.2" "72" "7.1" "71" "7.0" "70" "" ; do
|
||||
for l in "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
|
||||
AC_CHECK_PROG(PHPCONFIG, "php-config$l", "php-config$l")
|
||||
if test "x$PHPCONFIG" != "x" ; then
|
||||
php_config_version=`$PHPCONFIG --version`
|
||||
if test "x${php_config_version#7}" != "x${php_config_version}" ; then
|
||||
PHP_VERSION=$php_config_version
|
||||
PHP_CFLAGS=`$PHPCONFIG --includes`
|
||||
PHP_LFLAGS="-L$($PHPCONFIG --prefix)/lib/ $($PHPCONFIG --libs) -lphp7"
|
||||
PHP_LFLAGS="-L$($PHPCONFIG --prefix)/lib/ $($PHPCONFIG --libs) -lphp$l"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
@@ -992,7 +992,7 @@ if test "x$enable_php" = "xyes" ; then
|
||||
if test "x$ac_found_php_header" = "xyes" ; then
|
||||
PHP_CFLAGS="$CFLAGS"
|
||||
fi
|
||||
for l in "$php_suffix" "7" "7.2" "72" "7.1" "71" "7.0" "70" "" ; do
|
||||
for l in "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
|
||||
AC_CHECK_LIB(php$l,php_execute_script,ac_found_php_lib="yes",ac_found_php_lib="no")
|
||||
if test "x$ac_found_php_lib" = "xyes" ; then
|
||||
PHP_VERSION=">=7.0.0"
|
||||
|
||||
@@ -24,7 +24,8 @@ set_target_properties(php PROPERTIES PREFIX "")
|
||||
|
||||
if(PHP_FOUND)
|
||||
include_directories(${PHP_INCLUDE_DIRS})
|
||||
target_link_libraries(php ${PHP_LDFLAGS} weechat_plugins_scripts)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PHP_LDFLAGS}")
|
||||
target_link_libraries(php ${PHP_LIB} weechat_plugins_scripts)
|
||||
endif()
|
||||
|
||||
install(TARGETS php LIBRARY DESTINATION ${LIBDIR}/plugins)
|
||||
|
||||
Reference in New Issue
Block a user