PHP detection in autotools is semi-broken

As I documented in !3944 (comment 2890681675), the autotools detection code for building PHP bindings is broken, depending on the presence of the PHP interpreter (e.g. /usr/bin/php) rather than the presence of the php-config tool and the development libraries/headers actually necessary to compile the bindings.

The problem, specifically, is when the php interpreter binary is installed, but a corresponding php-dev / php-devel package is NOT.

In those cases, after successfully detecting $PHP="/usr/bin/php" or whatever, the script will attempt to detect $PHPCONFIG. If it fails it sets use_php="No ...", if it succeeds it sets PHP_INCLUDES, PHP_LIBS, etc.

After that code is run, the code then inexplicably overrides the use_php determinations previously made based on the value of $PHP, not any of the development variables:

       if test "$PHP" != ""; then
 	    use_php="Yes"
         AC_SUBST([PHP_INCLUDES])
         AC_SUBST([PHP_INSTALL_DIR])
         AC_SUBST([PHP_INSTALL_DATADIR])
         AC_SUBST([PHP_LIBS])
         AC_SUBST([SWIG_PHP_OPT])
       fi

The scenario where php is installed, but php-config is not, causes the script to go into the last conditional block with $PHP set non-empty, and the use_php="Yes" override will still configure unbuildable PHP bindings.

To properly configure the bindings, the php interpreter binary is actually meaningless — I don't see any point in even detecting it. The php-config tool that provides the library and include paths is the key requirement, and in fact the only requirement, to compile the SWIG bindings for PHP.