2.2 The First Configure Programs / 最初的 configure 程式
By 1992, four different systems had been developed to help with source code portability:
為了增進原始碼的可攜性,在 1992 年有四個不同的解決方案被開發出來:
-
The Metaconfig program, by Larry Wall, Harlan Stenn, and Raphael Manfredi.
Metaconfig ,由 Larry Wall 、 Harlan Stenn 以及 Raphael Manfredi 所發展。
-
The Cygnus `configure' script, by K. Richard Pixley, and the original GCC `configure' script, by Richard Stallman. These are quite similar, and the developers communicated regularly. GCC is the GNU Compiler Collection, formerly the GNU C compiler.
K. Richard Pixley 為 Cygnus 發展的 `configure' 指令稿;以及由 Richard Stallman 當初為 GCC 撰寫的 `configure' 指令稿, GCC 是 GNU Compiler Collection 的縮寫,其前身為 GNU C compiler 。這兩個指令稿非常相似,兩位發展者也經常交換意見。
-
The GNU Autoconf package, by David MacKenzie.
GNU Autoconf , David MacKenzie 所發展。
-
Imake, part of the X Window system.
Imake ,屬於 X Window 的一部份。
These systems all split building a program into two steps: a configuration step, and a build step. For all the systems, the build step used the standard Unix make program. The make program reads a set of rules in a `Makefile', and uses them to build a program. The configuration step would generate `Makefile's, and perhaps other files, which would then be used during the build step.
這些解決方案都把建置程式的過程分為兩個步驟: 組態,以及建置。在所有系統上,建置的程序會由 make 這個標準的 Unix 程式進行。 make 程式會由一個稱為 `Makefile' 的描述檔中讀取建置規則,並依據這些規則編譯程式。在建置作業前的組態階段,則會產生建置所需的 `Makefile' 以及其他建置時所需的檔案。
Metaconfig and Autoconf both use feature tests to determine the capabilities of the system. They use Bourne shell scripts (all variants of Unix support the Bourne shell in one form or another) to run various tests to see what the system can support.
Metaconfig 與 Autoconf 都透過執行一序列的測試程式來決定系統的功能與能提供的工具,這兩個工具的測試程式都是用 Bourne shell 指令稿所撰寫的。 (幾乎所有由 Unix 所衍生的作業系統都某種程度的支援 Bourne shell)
The Cygnus `configure' script and the original GCC `configure' script are also Bourne shell scripts. They rely on little configuration files for each system variant, both header files and `Makefile' fragments. In early versions, the user compiling the program had to tell the script which type of system the program should be built for; they were later enhanced with a shell script written by Per Bothner which determines the system type based on the standard Unix uname program and other information.
Cygnus 的 `configure' 指令稿以及 GCC 原始的 `configure' 指令稿也是使用 Bourne shell 指令稿所撰寫的, Cygnus 與 GCC 針對不同的系統平台分別提供了一組特定的系統組態檔、標頭檔、以及指引編譯流程的 `Makefile' 描述檔。在早期的版本,要建置軟體的使用者必須告訴 `configure' 指令稿建置出來的程式的目標執行平台是什麼;後來 Per Bothner 修改了 `configure' 指令稿,讓 `configure' 可以自己利用 uname 這個標準的 Unix 程式以及其他系統環境的資訊來決定目標執行平台。
Imake is a portable C program. Imake can be customized for a particular system, and run as part of building a package. However, it is more normally distributed with a package, including all the configuration information needed for supported systems.
Imake 是一個用 C 語言所撰寫的程式,他具有高度的可攜性。 Imake 可以針對特定作業系統客制化,並在爾後建置軟體套件時使用。不過,通常 Imake 會與軟體套件一起被散佈,套件檔案中會附上在套件所支援的系統上建置軟體所需的組態資訊。
Metaconfig and Autoconf are programs used by program authors. They produce a shell script which is distributed with the program's source code. A user who wants to build the program runs the shell script in order to configure the source code for the particular system on which it is to be built.
Metaconfig 與 Autoconf 是給程式設計師使用的工具,兩者都會產生出隨著軟體原始碼散佈用的 shell 指令稿。要建置軟體的使用者可以執行由 Metaconfig 或是 Autoconf 產生的 shell 指令稿,以將程式原始碼針對執行建置作業的系統環境作調整。
The Cygnus and GCC `configure' scripts, and imake, do not have this clear distinction between use by the developer and use by the user.
Cygnus 與 GCC 的 `configure' 指令稿,以及 Imake ,就比較沒有如此的清楚區分說哪部份要由程式設計師使用,哪個部份是給建置套件的使用者使用。
The Cygnus and GCC `configure' scripts included features to support cross development, both to support building a cross-compiler which compiles code to be run on another system, and to support building a program using a cross-compiler.
Cygnus 與 GCC 的 `configure' 指令稿支援了跨平台程式發展的功能,兩者都支援建置 cross-compiler ,或是利用 cross-compiler 建置程式。利用 cross-compiler ,可以編譯出執行在與編譯器執行平台相異的作業平台的機械碼。
Autoconf, Metaconfig and Imake did not have these features (they were later added to Autoconf); they only worked for building a program on the system on which it was to run.
Autoconf 、 Metaconfig 與 Imake 都不支援這些跨平台程式發展功能 (不過後來 Autoconf 有加入了這些功能) ;這些工具只能用來建置在建置環境中執行的程式。
The scripts generated by Metaconfig are interactive by default: they ask questions of the user as they go along. This permits them to determine certain characteristics of the system which it is difficult or impossible to test, such as the behavior of setuid programs.
由 Metaconfig 所產生出來的指令稿,在預設下是需要與使用者互動的: 在建置過程中,指令稿會問使用者一些問題。這個設計是為了取得一些比較難以自動偵測的系統組態與特性,比如說 setuid 程式的行為模式。
The Cygnus and GCC `configure' scripts, and the scripts generated by autoconf, and the imake program, are not interactive: they determine everything themselves. When using Autoconf, the package developer normally writes the script to accept command line options for features which can not be tested for, or sometimes requires the user to edit a header file after the `configure' script has run.
Cygnus 與 GCC 的 `configure' 指令稿、由 Autoconf 所產生的指令稿、以及 Imake 等這三者則相反,他們執行時不與使用者互動: 這些工具會自己做出所有關於環境特性的決定。如果要取得無法利用測試偵測出來的系統組態或特性,一般而言,套件發展者會撰寫額外的指令稿讓使用者可以利用指令列參數告知系統組態,或是,有時候可能會要求使用者在執行完 `configure' 指令稿後編輯一個特定的標頭檔,好指出系統的組態。