This page was exported from phaq [ http://phaq.phunsites.net ] Export date:Sat Mar 15 16:55:12 2025 / +0000 GMT ___________________________________________________ Title: Fixing "Cannot find autoconf" error while building PHP extension from a FreeBSD port --------------------------------------------------- Today I had to add the PHP 'bcmath' extension to my FreeBSD host. Actually, that's a fairly easy one-liner: [root@localhost ~]# cd /usr/ports/math/php5-bcmath && make clean install However, I ended up with a crude error message: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. Bummer! So let's see how to fix this. Here's the complete output from the failed build: [root@localhost /usr/ports/math/php5-bcmath]# make ===> Vulnerability check disabled, database not found ===> License check disabled, port has not defined LICENSE ===> Extracting for php5-bcmath-5.3.3_2 => SHA256 Checksum OK for php-5.3.3.tar.bz2. ===> Patching for php5-bcmath-5.3.3_2 ===> php5-bcmath-5.3.3_2 depends on file: /usr/local/bin/phpize - found ===> php5-bcmath-5.3.3_2 depends on file: /usr/local/bin/autoconf-2.68 - found ===> PHPizing for php5-bcmath-5.3.3_2 Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. *** Error code 1 Stop in /usr/ports/math/php5-bcmath. From this we see, that error occurs during phpize, which tries to configure/build the extension matching up the currently installed PHP. Looking into phpize, which is actually a plain script, we find these lines: [root@noc2 /usr/ports/math/php5-bcmath]# grep -E -e 'PHP_AUTO(CONF|HEADER)' /usr/local/bin/phpize test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf-2.62 test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader-2.62 if test ! -x "$PHP_AUTOCONF" && test ! -x "`$php_shtool path $PHP_AUTOCONF`"; then $PHP_AUTOCONF environment variable. Then, rerun this script. if test ! -x "$PHP_AUTOHEADER" && test ! -x "`$php_shtool path $PHP_AUTOHEADER`"; then $PHP_AUTOHEADER environment variable. Then, rerun this script. $PHP_AUTOCONF || exit 1 $PHP_AUTOHEADER || exit 1 So phpize actually checks for existence of the PHP_AUTOCONF and PHP_AUTOHEADER environment variables. If these are missing, it will use some defaults for the autoconf/autoheader tools. The default were derived during the initial build which at that time were autoconf-2.62 and autoheader-2.62. Checking installed ports reveals that there's a newer version installed, which is why phpize fails so terribly. [root@noc2 /usr/ports/math/php5-bcmath]# pkg_info|grep autoconf autoconf-2.68 Automatically configure source code on many Un*x platforms autoconf-wrapper-20071109 Wrapper script for GNU autoconf To permanently fix this, you can do either of the following: simply change the PHP_AUTOCONF and PHP_AUTOHEADER variables in /usr/local/bin/phpize to reflect the currently installed version additionally install the old autoconf version besides the new one Invoke the build like this: PHP_AUTOCONF=autoconf PHP_AUTOHEADER=autoheader make configure --------------------------------------------------- Images: --------------------------------------------------- --------------------------------------------------- Post date: 2011-06-10 12:38:04 Post date GMT: 2011-06-10 11:38:04 Post modified date: 2011-06-10 12:38:04 Post modified date GMT: 2011-06-10 11:38:04 ____________________________________________________________________________________________ Export of Post and Page as text file has been powered by [ Universal Post Manager ] plugin from www.gconverters.com