Skip to content

Fix php detection logic in autotools

FeRD (Frank Dana) requested to merge ferdnyc/graphviz:php-detection into main

The code for detecting PHP in configure.ac was misusing AC_CHECK_PROGS, which has a signature of:

AC_CHECK_PROGS (variable, progs-to-check-for, [value-if-not-found], [path = ‘$PATH’])

progs-to-check-for is a space-separated list, not a comma-separated list. So this:

AC_CHECK_PROGS(PHP,php7.2,php7,php)

...was setting ${PHP} to php7.2 if that was found, or php7 if it wasn't. Then this:

AC_CHECK_PROGS(PHPCONFIG,${PHP}-config,php-config)

...set ${PHPCONFIG} to php-config if php7-config wasn't found.

Resulting in errors during configure:

checking for php7.2... no
checking for php7-config... no
../configure: line 23704: php-config: command not found
../configure: line 23705: php-config: command not found
../configure: line 23707: php-config: command not found
../configure: line 23707: php-config: command not found
checking for php.h... no

Merge request reports