summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-10-14 11:10:34 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-10-14 11:10:34 +0200
commit19c36cddc7023f2273dc13471371e6e0d44ca0a9 (patch)
tree74d64d4fa485bda5207cd8502946ae70dc940765
parent0db48c7291067ff3dd6b0f38664cc6867e0e87e5 (diff)
downloadweechat-19c36cddc7023f2273dc13471371e6e0d44ca0a9.zip
build: fix PHP library used to compile PHP plugin (closes #1078)
This was causing a dependency missing in debian packaging.
-rw-r--r--cmake/FindPHP.cmake10
-rw-r--r--configure.ac8
-rw-r--r--src/plugins/php/CMakeLists.txt3
3 files changed, 12 insertions, 9 deletions
diff --git a/cmake/FindPHP.cmake b/cmake/FindPHP.cmake
index 3e2e64a46..444184a13 100644
--- a/cmake/FindPHP.cmake
+++ b/cmake/FindPHP.cmake
@@ -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()
diff --git a/configure.ac b/configure.ac
index 6744a3a43..471271746 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/src/plugins/php/CMakeLists.txt b/src/plugins/php/CMakeLists.txt
index b23b40141..5931d2371 100644
--- a/src/plugins/php/CMakeLists.txt
+++ b/src/plugins/php/CMakeLists.txt
@@ -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)