GNU Autoconf Introduction

下載地址:https://www.gnu.org/software/autoconf/manual/autoconf.pdf


Autoconf is a tool for producing shell scripts that automatically configure software source code packages to adapt to many kinds of Posix-like systems.

Autoconf是一種用於生成shell腳本的工具,可自動配置軟件源代碼包,以適應多種類型的 Posix-like 系統。

The configuration scripts produced by Autoconf are independent of Autoconf when they are run, so their users do not need to have Autoconf.

Autoconf 生成的配置腳本在運行時獨立於Autoconf,因此用戶不需要安裝 Autoconf。


The configuration scripts produced by Autoconf require no manual user intervention when run;

Autoconf 生成的配置腳本在運行時並不需要用戶手動干預

they do not normally even need an argument specifying the system type.

通常它們也不需要通過參數指定系統的類型。

Instead, they individually test for the presence of each feature that the software package they are for might need.

取而代之的是,它們會單獨測試每個功能可能需要的軟件包是否存在

(Before each check, they print a one-line message stating what they are checking for, so the user doesn’t get too bored while waiting for the script to finish.)

(在每次檢查之前, 它們會打印一行消息, 說明它們正在檢查什麼, 所以用戶在等待腳本完成時也不會感到無聊)。

As a result, they deal well with systems that are hybrids or customized from the more common Posix variants.

這樣導致的結果就是它能夠很好的處理混血系統或常見的 Posix 變體定製系統.

There is no need to maintain files that list the features supported by each release of each variant of Posix.

並不需要維護 各個版本Posix 變體系統所支持的功能特性的文件列表


For each software package that Autoconf is used with, it creates a configuration script from a template file that lists the system features that the package needs or can use.

對於使用 Autoconf 的每個軟件包, 它將從模板文件創建一個配置腳本, 該模板文件列出了軟件包需要或可以使用的系統功能

After the shell code to recognize and respond to a system feature has been written, Autoconf allows it to be shared by many software packages that can use (or need) that feature.

在編寫了用於識別和響應系統功能的shell代碼之後,Autoconf允許它被許多可以使用(或需要)該功能的軟件包共享。

If it later turns out that the shell code needs adjustment for some reason, it needs to be changed in only one place;

如果後期由於某種原因需要調整shell代碼,那麼僅需要在一個地方進行更改即可;

all of the configuration scripts can be regenerated automatically to take advantage of the updated code.

所有配置腳本都可以自動重新生成,以利用更新的代碼。


Those who do not understand Autoconf are condemned to reinvent it, poorly.

一些不瞭解 Autoconf 的人譴責它是重複造輪子,這很糟糕。

The primary goal of Autoconf is making the user’s life easier; making the maintainer’s life easier is only a secondary goal.

Autoconf 的主要目標是使用戶的生活更輕鬆;使維護者的生活更輕鬆僅是次要目標。

Put another way, the primary goal is not to make the generation of ‘configure’ automatic for package maintainers
(although patches along that front are welcome, since package maintainers form the user base of Autoconf);

換句話說, Autoconf 的主要目標並不是爲軟件包維護者自動生成 ‘configure’
(儘管這個前端的補丁很受歡迎,因爲軟件包維護者成了Autoconf 的用戶羣)

rather, the goal is to make ‘configure’ painless, portable, and predictable for the end user of each auto confiscated package.

相反,它的目標是使最終用戶自動化 ‘配置’ 包的過程變得無痛,可移植 和 可預測

And to this degree, Autoconf is highly successful at its goal — most complaints to the Autoconf list are about difficulties in writing Autoconf input, and not in the behavior of the resulting ‘configure’.

在這種程度上可以說 Autoconf 的目標是非常成功的 —— 對 Autoconf 列出的大部分抱怨都是寫Autoconf 腳本難,
而不是其生成 ‘configure’ 的行爲難。

Even packages that don’t use Autoconf will generally provide a ‘configure’ script,

即使不使用 Autoconf 的包通常也會提供一個 ‘configure’ 腳本,

and the most common complaint about these alternative home-grown scripts is that they fail to meet one or more of the GNU Coding Standards (see Section ‘Configuration’ in The GNU Coding Standards) that users have come to expect from Autoconf-generated ‘configure’ scripts.

對於一些原生腳本最常見的抱怨是它們不符合一個或多個GNU編碼標準( 請參閱GNU編碼標準中的 ‘Configuration’ 一節 )
用戶已經期望使用 Autoconf 生成 ‘configure’ 腳本。


The Metaconfig package is similar in purpose to Autoconf, but the scripts it produces require manual user intervention, which is quite inconvenient when configuring large source trees.

Metaconfig 軟件包的目的與 Autoconf 類似, 但它生成的腳本需要用戶手動干預, 這在配置大型源代碼樹時相當不方便。

Unlike Metaconfig scripts, Autoconf scripts can support cross-compiling, if some care is taken in writing them.

與Metaconfig腳本不同,Autoconf腳本可以支持交叉編譯,如果需要編寫它們請注意。


Autoconf does not solve all problems related to making portable software packages—for a more complete solution, it should be used in concert with other GNU build tools like Automake and Libtool.

Autoconf並不能解決製作可移植軟件包相關的所有問題 —— 一個更完整的解決方案是,
應該與其他GNU構建工具 Automake 和 Libtool 協調使用

These other tools take on jobs like the creation of a portable, recursive makefile with all of the standard targets, linking of shared libraries, and so on.

這些其他工具承擔的工作有,爲所有標準目標平臺創建一個可移植的、能夠遞歸的 makefile,鏈接共享庫,等等

See Chapter 2 [The GNU Build System], page 3, for more information.

有關詳細信息,請參閱第2章 [ GNU構建系統 ],第3頁。


Autoconf imposes some restrictions on the names of macros used with #if in C programs
(see Section B.3 [Preprocessor Symbol Index], page 366).

Autoconf 對 C 程序中 #if 使用的宏名稱施加了一些限制
( 請參見第B.3節[ 預處理器符號索引 ],第366頁 )


Autoconf requires GNU M4 version 1.4.6 or later in order to generate the scripts.

Autoconf 需要 GNU M4 1.4.6 或更高版本才能生成腳本。

It uses features that some versions of M4, including GNU M4 1.3, do not have.

Autoconf 使用的功能在一些版本的 M4 上(包括GNU M4 1.3)沒有。

Autoconf works better with GNU M4 version 1.4.14 or later, though this is not required.

Autoconf 最好使用 GNU M4 1.4.14 或更高版本,儘管這不是必需的。


See Section 18.5 [Autoconf 1], page 318, for information about upgrading from version 1.

有關從版本1升級的信息,請參見第18.5節[Autoconf 1],第318頁。

See Chapter 21 [History], page 351, for the story of Autoconf’s development.

有關 Autoconf 開發的故事,請參見第21章[歷史],第351頁。

See Chapter 20 [FAQ], page 341, for answers to some common questions about Autoconf.

有關 Autoconf 的一些常見問題的答案,請參閱第20章[常見問題],第341頁。


See the Autoconf web page for up-to-date information, details on the mailing lists, pointers to a list of known bugs, etc.

請參閱 Autoconf 網頁瞭解最新信息,比如郵件列表的詳細信息、指向已知錯誤列表的詳細信息, 等等。

Mail suggestions to the Autoconf mailing list. Past suggestions are archived.

可以發送建議到 Autoconf 郵件列表。 過去的建議已被存檔。


Mail bug reports to the Autoconf Bugs mailing list. Past bug reports are archived.

也可以發送 錯誤報告到 Autoconf Bugs 郵件列表中. 過去的錯誤報告也已歸檔。

If possible, first check that your bug is not already solved in current development versions, and that it has not been reported yet.

如果可能的話,請先檢查您的錯誤是否還沒有在當前開發版本中解決,並且還沒有被報告。

Be sure to include all the needed information and a short ‘configure.ac’ that demonstrates the problem.

然後再確保包含所有需要的信息和一個簡短的 ‘configure.ac’ 來證明這個問題。


Autoconf’s development tree is accessible via git; see the Autoconf Summary for details, or view the actual repository.

Autoconf 的開發樹可以通過git訪問; 有關詳細信息,請參閱 Autoconf 摘要,或查看實際的代碼庫。

Anonymous CVS access is also available, see ‘README’ for more details.

匿名CVS訪問也可用,有關詳細信息,請參閱“README”。

Patches relative to the current git version can be sent for review to the Autoconf Patches mailing list, with discussion on prior patches archived;

可以將相對於當前git版本的補丁發送給 Autoconf Patches 郵件列表進行審閱,並對先前的修補程序進行了討論;

and all commits are posted in the read-only Autoconf Commit mailing list, which is also archived.

並且所有提交都被投遞到只讀的 Autoconf Commit 郵件列表中,該列表也已被歸檔。


Because of its mission, the Autoconf package itself includes only a set of often-used macros that have already demonstrated their usefulness.

由於它的使命,Autoconf 包本身只包含一組經常使用的宏,這些宏已經證明了它們的有效性。

Nevertheless, if you wish to share your macros, or find existing ones, see the Autoconf Macro Archive, which is kindly run by Peter Simons.

不過,如果您希望分享您的宏,或找到現有的宏,請參閱由 Peter Simons 所管理的 Autoconf 宏存檔。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章