OSX 10.6でPHPソースのbuildconfが実行できない

9月 18, 2010 Computer, Development
(Last Updated On: 2018年8月14日)

Mac OSX 10.6のPHPはPHP5.3なのでPHP5.2をビルドしてインストールしたい、と思っている方も多いと思います。Macportsが入っていれば、

sudo port install php52 php52-web

のような感じでPHP5.2をインストールできます。Portsじゃなくてソースから、そしてPECLなど他のモジュールもロードするのではなくスタティックに組み込みたい!という場合もあるでしょう。いちいちモジュールディレクトリを作ってphp.iniでロールするのは面倒ですから当然です。

しかし、PHP 5.2.14 のソースに付属するbuildconfを実行すると以下のようなエラーが発生します。

yohgaki@yohgaki-macbook-2$ rm configure && ./buildconf –force
Forcing buildconf
buildconf: checking installation…
buildconf: autoconf version 2.65 (ok)
buildconf: Your version of autoconf likely contains buggy cache code.
Running vcsclean for you.
To avoid this, install autoconf-2.13.
Can’t figure out your VCS, not cleaning.
rebuilding configure
ext/pdo_dblib/config.m4:55: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1998: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:2019: AC_CACHE_CHECK is expanded from…
aclocal.m4:2741: PHP_CHECK_PDO_INCLUDES is expanded from…
ext/pdo_firebird/config.m4:43: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_mysql/config.m4:135: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_oci/config.m4:231: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_odbc/config.m4:42: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:109: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_sqlite/config.m4:14: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/sqlite/config.m4:50: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
rebuilding main/php_config.h.in
autoheader: WARNING: Using auxiliary files such as `acconfig.h’, `config.h.bot’
autoheader: WARNING: and `config.h.top’, to define templates for `config.h.in’
autoheader: WARNING: is deprecated and discouraged.
autoheader:
autoheader: WARNING: Using the third argument of `AC_DEFINE’ and
autoheader: WARNING: `AC_DEFINE_UNQUOTED’ allows one to define a template without
autoheader: WARNING: `acconfig.h’:
autoheader:
autoheader: WARNING: AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader: [Define if a function `main’ is needed.])
autoheader:
autoheader: WARNING: More sophisticated templates can also be produced, see the
autoheader: WARNING: documentation.
ext/pdo_dblib/config.m4:55: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1998: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:2019: AC_CACHE_CHECK is expanded from…
aclocal.m4:2741: PHP_CHECK_PDO_INCLUDES is expanded from…
ext/pdo_firebird/config.m4:43: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_mysql/config.m4:135: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_oci/config.m4:231: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_odbc/config.m4:42: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:109: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_sqlite/config.m4:14: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/sqlite/config.m4:50: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached

エラーメッセージにめげずにconfigureスクリプトを実行すると

yohgaki@yohgaki-macbook-2$ ./configure
cat: confdefs.h: No such file or directory
./configure: line 387: ac_fn_c_try_run: command not found
./configure: line 403: 5: Bad file descriptor
./configure: line 404: 6: Bad file descriptor
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
cat: confdefs.h: No such file or directory
./configure: line 443: ac_fn_c_try_run: command not found
./configure: line 466: 5: Bad file descriptor
./configure: line 467: 6: Bad file descriptor
./configure: line 469: 5: Bad file descriptor
./configure: line 470: 6: Bad file descriptor
cat: confdefs.h: No such file or directory

全く動作しません。原因は明らかにautoconfが新しすぎる事にあるので古いautoconfが必要です。PHPではautoconf 2.13という古いバージョンが推奨されています。

yohgaki@yohgaki-macbook-2$ which autoconf213
/opt/local/bin/autoconf213

Macportsがautoconf 2.13を勝手にインストールしてくれているのでこれを使います。

yohgaki@yohgaki-macbook-2$ rm configure && PHP_AUTOCONF=autoconf213 ./buildconf –force
Forcing buildconf
rebuilding configure
rebuilding main/php_config.h.in
autoheader: WARNING: Using auxiliary files such as `acconfig.h’, `config.h.bot’
autoheader: WARNING: and `config.h.top’, to define templates for `config.h.in’
autoheader: WARNING: is deprecated and discouraged.
autoheader:
autoheader: WARNING: Using the third argument of `AC_DEFINE’ and
autoheader: WARNING: `AC_DEFINE_UNQUOTED’ allows one to define a template without
autoheader: WARNING: `acconfig.h’:
autoheader:
autoheader: WARNING: AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader: [Define if a function `main’ is needed.])
autoheader:
autoheader: WARNING: More sophisticated templates can also be produced, see the
autoheader: WARNING: documentation.
ext/pdo_dblib/config.m4:55: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1998: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:2019: AC_CACHE_CHECK is expanded from…
aclocal.m4:2741: PHP_CHECK_PDO_INCLUDES is expanded from…
ext/pdo_firebird/config.m4:43: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_mysql/config.m4:135: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_oci/config.m4:231: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_odbc/config.m4:42: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:109: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_sqlite/config.m4:14: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/sqlite/config.m4:50: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached

今度もエラーが起きていますが、./configureは動作します。私が必要とするモジュールではエラーは発生しないのですが、PDO周りでエラーが発生するかも知れないです。

投稿者: yohgaki