Ruby の configure スクリプトが実行可能ファイルとヘッダー ファイルを検出しないのはなぜですか?

Ruby の configure スクリプトが実行可能ファイルとヘッダー ファイルを検出しないのはなぜですか?

私は Ruby をコンパイルしようとしており、その際に何が起こっているのかを本当に理解しようとしています。 はMakefiles以前に使用したり書いたりしたことがありますが、autoconfconfigure.inファイルについては使用したことがありません。そのため、私が得た結果は意図的なものなのかもしれません。

$ git clone https://github.com/ruby/ruby.git
...
$ cd ruby
$ git clean -fdx
$ autoconf 
$ ./configure
...
checking for dot... no
checking for doxygen... no
checking for pkg-config... no
...
checking direct.h usability... no
checking direct.h presence... no
checking for direct.h... no
...
checking for daemon... (cached) no

ただし、少なくとも次のものはすべてインストールされています。

$ dot -V
dot - graphviz version 2.26.3 (20100126.1600)
$ doxygen --version
1.7.4
$ pkg-config --version
0.26
$ sudo updatedb
$ locate /direct.h
/usr/src/linux-headers-3.0.0-16-generic/include/config/pci/direct.h
/usr/src/linux-headers-3.0.0-17-generic/include/config/pci/direct.h
$ daemon --version
daemon-0.6.4

それぞれに原因があるかもしれないとは思いますが、なぜスクリプトによって検出されないのでしょうかconfigure?

最新のパッチを適用した Ubuntu 11.10 を実行しています。

$ uname -a
Linux username 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

別のホストで試しました。 差出人config.log:

configure:6408: checking for dot
configure:6424: found /usr/bin/dot
configure:6438: result: no
configure:6445: checking for doxygen
configure:6461: found /usr/bin/doxygen
configure:6475: result: no
configure:6483: checking for pkg-config
configure:6504: found /usr/bin/pkg-config
configure:6530: result: no

何?見つかったけど、まだダメなの?

configure:11880: checking direct.h usability
configure:11880: gcc -c  -O3 -ggdb    conftest.c >&5
conftest.c:135:20: fatal error: direct.h: No such file or directory
compilation terminated.
configure:11880: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
...
| #endif
| #include <direct.h>
configure:11880: result: no
configure:11880: checking direct.h presence
configure:11880: gcc -E  conftest.c
conftest.c:102:20: fatal error: direct.h: No such file or directory
compilation terminated.
configure:11880: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| /* end confdefs.h.  */
| #include <direct.h>
configure:11880: result: no
configure:11880: checking for direct.h
configure:11880: result: no

ファンキーなテスト スクリプト - おそらく、何らかのデフォルト パスに配置する必要があるのでしょうか?

configure:15175: checking for daemon
configure:15175: result: no

これは実行可能ファイルをチェックしているのではなく、C関数をチェックしていることがわかりました。AC_CHECK_FUNCS

答え1

私はRubyについてほとんど何も知りません。しかし、ビルドシステムについてはかなり知っています。ここで大胆な提案をしたいと思います。Rubyビルドシステムに本物のバグを発見した

私の考えは次のとおりです。

  1. まったく異なるシステム(Cygwin/Windows 7でも)で、指定したgitリポジトリとRuby 1.9のソースコード

  2. 表示される理由は、 パス上で実際に見つかったためです。これは、生成されたスクリプトで簡単に確認できます。found: /usr/bin/dot特に、シェルのデバッグ出力を取得するために最初の行を変更すると、次のようになります。configure.logconfigure#!/bin/sh -x

    + test -z /bin
    + for ac_exec_ext in ''\'''\''' '$ac_executable_extensions'
    + test -f /bin/dot
    + test -x /bin/dot
    + ac_cv_prog_DOT=
    + printf '%s\n' 'configure:6424: found /bin/dot'
    + break 2
    + IFS='     
    
  3. 理由はresult: no、上記のスニペットからわかるように、ac_cv_prog_DOTが空の文字列に設定されており、configure 内の次の行は単にその欠落した値を反映しているためです。

    + DOT=
    + test -n ''
    + printf '%s\n' 'configure:6438: result: no'
    + printf '%s\n' no
    no
    
  4. 空の文字列に設定された理由は (そしてこれが問題の核心ですが) configure.in、371 行目に空の文字列が指定されたためです。

    AC_CHECK_PROG(DOT, dot)
    AC_CHECK_PROG(DOXYGEN, doxygen)
    

    これはAC_CHECK_PROGマクロのバグのある呼び出しだと思われます。GNU Autoconf ドキュメントテイクを指定する三つ必須の引数は 2 つではありません。

    ― Macro: AC_CHECK_PROG (variable, prog-to-check-for, value-if-found, [value-if-not-found], [path = ‘$PATH’], [reject])
    
    Check whether program prog-to-check-for exists in path. If it
    is found, set variable to value-if-found, otherwise to
    value-if-not-found, if given. Always pass over reject (an
    absolute file name) even if it is the first found in the search
    path; in that case, set variable using the absolute file name
    of the prog-to-check-for found that is not reject. If variable
    was already set, do nothing. Calls AC_SUBST for variable. The
    result of this test can be overridden by setting the variable
    variable or the cache variable ac_cv_prog_variable.
    

    デフォルト値はありません。これを省略すると、実質的に「ドットが見つかった場合は、DOT を空の文字列に設定する」という意味になります。

  5. この間違いが起こった理由は、その行の元の定義で、 AC_CHECK_TOOL引数を 2 つだけ取る別のマクロ が使用されていたためだと考えています。

    から 2010 年 11 月 11 日に svn.ruby-lang.org にチェックイン

    AC_CHECK_TOOLはAC_CHECK_PROGになります

  6. これはしばらく前から問題になっていた可能性があり、いくつかの ChangeLog コメントは、DOXYGEN次のような問題があったことを示しているようです。

    Fri Mar 26 19:55:41 2010  Akinori MUSHA  <[email protected]>
    
        * Makefile.in (DOXYGEN): Define a missing variable DOXYGEN.  Build
          has been failing when doxygen(1) is found by configure but the
          variable is not defined by the system and make(1) does not allow
          an empty command. ("@$(DOXYGEN)" was the cause)
    

最後に、これはすべて間違っている可能性があります。しかし、私はそれが configureそれらのツールを見つけることであり、対応する Makefile 変数を空の文字列に設定するように指示されていると確信しています。

この分析について他の人がどう思うか聞いてみたい。

関連情報