cmake file for kolabformat.so

Mihai Badici mihai at badici.ro
Tue Apr 20 14:35:17 CEST 2021


Hello,

Since php7 I always had problems to compile php kolabformat module on 
Debian but always managed to sort out somehow.

Now I had some time to found the root causes.

The main problem is on Debian the include path is versioned to support 
multiple php releases.

On a recent installed buster i have for example:

/usr/include/php/20180731


that make this directive in  src/php/CmakeLists.txt:

find_path(PHP_INCLUDE_DIR NAMES main/php.h PATH_SUFFIXES php php5)

to fail. This will make the autogen to fail with message "php not found" 
in the end.


My idea is to remove that directive and use the php-config utility instead:

I have added some lines like :


execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --vernum
                     OUTPUT_VARIABLE PHP_VERSION_ID
        )
   message("version a: ${PHP_VERSION_ID}")

execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --include-dir
                     OUTPUT_VARIABLE PHP_INCLUDE_DIR
         )

   message("version: ${PHP_INCLUDE_DIR}")


string(REGEX REPLACE "\n" "" PHP_INCLUDE_DIR "${PHP_INCLUDE_DIR}")
string(REGEX REPLACE "\n" "" PHP_VERSION_ID "${PHP_VERSION_ID}")


right after the similar lines for --extension-dir


I think using php-config is pretty universal and more accurate so it 
will not have side effects for other distributions.

Mihai






More information about the users mailing list