autoconf 2.66 にハマる。というか使っちゃいけない。

事の発端は ruby の 1.9.2 を rc1 ではなくブランチリポジトリから直接持ってきて configure && make してインストールしようとしたら configure スクリプトがなかったので autoconf を走らせた時。
開発機が CentOS5 でデフォルトパッケージの Autoconf は 2.59、この状態で ruby のソースディレクトリにおいて autoconf を走らせるとバージョン 2.60 以上が必要というエラーメッセージが出たので GNU のサイトから autoconf の 2.66 をダウンロードしてインストール。で、autoconf実行。

$ autoconf
configure.in:497: error: AC_CHECK_SIZEOF: requires literal arguments
autoconf/types.m4:783: AC_CHECK_SIZEOF is expanded from...
configure.in:489: RUBY_CHECK_SIZEOF is expanded from...
configure.in:497: the top level
autom4te: /usr/bin/m4 failed with exit status: 1

というエラーが発生してしまい、先に進めなくなってしまった。
autoconf のサイトに行ってみると m4 の 1.4.6 以降が最低限必要って書いてある。

$ m4 --version
GNU M4 1.4.5
Written by Rene' Seindal.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

このせいかなーと思って m4 もソースからインストールしなおし。

$ m4 --version
m4 (GNU M4) 1.4.14
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

さらに autoconf ももう一回 configure &コンパイル&インストール。
もう大丈夫だろうと autoconf を再び走らせると

$ autoconf
configure.in:497: error: AC_CHECK_SIZEOF: requires literal arguments
../../lib/autoconf/types.m4:765: AC_CHECK_SIZEOF is expanded from...
configure.in:408: RUBY_CHECK_SIZEOF is expanded from...
configure.in:497: the top level
autom4te: /usr/local/bin/m4 failed with exit status: 1

またも同様な結果になってしまったのでググってみたらすぐに原因が見つかった・・・。
Don't try autoconf 2.66 at home just yet!
こちらに書かれていることを ruby の configure.in に当てはめて調べてみると、

RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])

の部分で void* を渡していて RUBY_CHECK_SIZEOF 定義内の AC_CHECK_SIZEOF([$1], 0, [$4]) でコケてしまうって寸法。
結果的には autoconf 2.66 のリグレッションバグのようで、
http://osdir.com/ml/autoconf-gnu/2010-07/msg00007.html
こちらに修正パッチがあがってる。

これを適用した autoconf でようやく configure スクリプトの作成が可能になり、喜び勇んで configure スクリプトを走らせ、make。
でもそうは問屋が卸さない。

# make
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o main.o -c main.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o dln.o -c dln.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o dmydln.o -c dmydln.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o dmyencoding.o -c dmyencoding.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o version.o -c version.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT   -o dmyversion.o -c dmyversion.c
/usr/local/ruby_1_9_1/bin/ruby -I. ./tool/compile_prelude.rb ./prelude.rb miniprelude.c
bison -d  -o y.tab.c parse.y
make: *** [parse.c] パイプが切断されました

ぐばー。
bisonよ、お前もか・・・。

# bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

# rpm -e bison --nodeps

再び GNU のサイトから bison の 2.4.2 を引っ張ってきてインストール。

# bison --version
bison (GNU Bison) 2.4.2
Written by Robert Corbett and Richard Stallman.

これでようやく make が通った。

# /usr/local/ruby_1_9_2/bin/ruby --version
ruby 1.9.2dev (2010-07-06 revision 28549) [i686-linux]

ちなみに 1.9.2 の RC1 だったり、もしくは OS が新しめの ubuntu なんかであれば苦労レスで configure && make がするりと通る。

で、結論。
新しいものを試すって場合、CentOS5 の賞味期限はもう切れているってこと。RHEL6 がすでに beta2 に入り、それほど遠くない時期に正式版がリリースされることを考えると新規プロジェクト向けのサーバ構築で CentOS5 にこだわる理由はないし、そもそも何でそれ使うんだって話になるんだろう。ちなみに現在個人的に契約している VPS は CentOS5 なのだけれども、利用しているソフトウェアは殆どソースからコンパイルしたもので、パッケージは uninstall されゆく一方。ディストリビューションの恩恵を受けることがほぼ出来ない状態になってしまっている。
枯れたパッケージを乗っけて運用するのであれば CentOS5 でぜーんぜん問題ないんだけどなー。