From fd287abe1bfd239d956e3af05a9006f7e78f6ec3 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Sun, 17 Sep 2017 17:13:45 -0400 Subject: [PATCH 1/2] php: fix compiler warning for PHP >=7.1 --- src/plugins/php/weechat-php.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index d4f6311f1..8a734799e 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -1090,8 +1090,15 @@ php_weechat_sapi_error (int type, const char *format, ...) } void +#if PHP_MINOR_VERSION >= 1 +php_weechat_log_message (char *message, int syslog_type_int) +#else php_weechat_log_message (char *message) +#endif { +#if PHP_MINOR_VERSION >= 1 + (void)syslog_type_int; +#endif php_weechat_ub_write (message, strlen (message)); } From 25f79ff2f54c495c5648324dff6e0415d0d4e2d3 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Sun, 17 Sep 2017 18:19:35 -0400 Subject: [PATCH 2/2] php: use find_library to find libphp7.so --- cmake/FindPHP.cmake | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cmake/FindPHP.cmake b/cmake/FindPHP.cmake index 955862943..3e2e64a46 100644 --- a/cmake/FindPHP.cmake +++ b/cmake/FindPHP.cmake @@ -38,10 +38,22 @@ if(NOT PHP_FOUND) 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") - string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS}) - SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS) - set(PHP_LDFLAGS "-L${PHP_LIB_PREFIX}/lib/ ${PHP_LIBS} -lphp7") - set(PHP_FOUND 1) + find_library(PHP_LIB 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_FOUND 1) + endif() endif() endif() endif() + +if(NOT PHP_FOUND) + message(WARNING "Could not find libphp7. " + "Ensure PHP >=7.0.0 development libraries are installed and compiled with `--enable-embed`. " + "Ensure `php-config` is in `PATH`. " + "You may set `-DCMAKE_LIBRARY_PATH=...` to the directory containing libphp7." + ) +endif()