Autoconf
| 開發者 | GNU |
|---|---|
| 穩定版本 | 2.68/ 2010年9月22日 |
| 作業系統 | 跨平台 |
| 類型 | 编程工具 |
| 許可協議 | GPL |
| 網站 | http://www.gnu.org/software/autoconf/ |
GNU Autoconf 是一个在Bourne shell下制作供编译、安装和打包软件的配置脚本的工具[1]。Autoconf并不受程式语言限制,常用于C、C++ 、Erlang和Objective-C。配置脚本控制了一个软件包在特定系统上的安装。在进行一系列测试后,配置脚本从模板中生成makefile与头文件进而调整软件包,使之适应某一种系统。Autoconf与Automake、Libtool等软件组成了GNU构建系统[2]。Autoconf 由 戴维·麦肯思于1991年夏天编写用于支持他在自由软件基金会的编程工作[3]。 此后,Autoconf包含了多人编写的改进代码并成为了使用最广泛的自由编译配置软件。[4][5]
目录 |
使用概要[编辑]
软件开发者通过使用GNU m4语言在configure.ac中写出限定配置脚本行为的列表。Autoconf将configure.ac中的命令 转化为对应特定平台的配置脚本。Autoconf本身并不具备编译能力,它仅仅用于产生通常附带在软件包中的配置脚本。
configure.ac 格式[编辑]
The GNU Autoconf手册建议configure.ac file使用如下格式:
- Autoconf requirements
- The AC_PREREQ(version) macro can be used to ensure that a recent enough version of the autoconf program is available to process the configure.ac file
- AC_INIT(package, version, bug-report-address)
- This macro is required in every configure.ac file. It specifies the name and version of the software package for which to generate a configure script and the email address of the developer.
- information on the package
- checks for programs
- checks for libraries
- checks for header files
- checks for types
- checks for structures
- checks for compiler characteristics
- checks for library functions
- checks for system services
- AC_CONFIG_FILES([file...])
- AC_OUTPUT
工作原理[编辑]
autoconf类似于perl使用的metaconfig包。先前X window系统所使用的imake系统与autoconf是密切相关,但有不同的理念。
autoconf通过检查特性而不是软件版本来确保可移植性。例如Sun OS 4的原生C编译器不支持ISO C,但是用户或管理员可以自行安装支持ISO C的编译器。基于软件特性的检查方法可以发现仅检查软件版本的方法检测不到的支持ISO C的编译器。因此配置脚本可以在未知的或者较新的系统中得到合理的结果,同样允许管理员按照他们的系统来配置脚本。
批评[编辑]
autoconf是一个古老和成熟的产品,如果使用得当,可以使用一个非常简单的接口进行复杂的交叉编译。但是有一些批评指出autoconf使用了过时的技术,因而遗留了很多限制。autoconf无法为Xcode与Visual Studio制作项目文件,其脚本通常大且复杂,因此增加了Debug的难度。Autoconf所使用的M4对于一些开发者来说是陌生的,因此他们需要专门学习[6]。一些开发者并不遵循配置脚本的一些习惯约定[7]。
因此一些自由软件开发者开始使用其他软件代替autoconf,KDE于KDE 4起开始使用CMake[8],Scribus 同样开始使用CMake[8]。
参见[编辑]
脚注[编辑]
- ^ Autoconf - GNU Project - Free Software Foundation (FSF). GNU Project. [2010-12-16].
- ^ The GNU Build System - Autoconf. GNU Project. [2010-12-16].
- ^ David Mackenzie. Genesis - Autoconf. GNU Project. [2010-12-16].
- ^ David Mackenzie. Leviticus - Autoconf. GNU Project. [2010-12-16].
- ^ David Mackenzie. Numbers - Autoconf. GNU Project. [2010-12-16].
- ^ McCall, Andrew. Stop the autoconf insanity! Why we need a new build system. 2003-06-21.
- ^ GNU Coding Standards.
- ^ 8.0 8.1 Neundorf, Alexander. Why the KDE project switched to CMake -- and how. 2006-06-21.
外部链接[编辑]
- GNU Autoconf home page
- GNU Autoconf macro archive
- The Goat Book homepage (aka the Autobook)
- Murray Cumming (of gtkmm fame) produced these succinct Autotool info pages:*one *two.
- Autotoolset home page
- http://www.freesoftwaremagazine.com/books/autotools_a_guide_to_autoconf_automake_libtool
教程[编辑]
- http://mi.eng.cam.ac.uk/~er258/code/autoconf/
- Learning Autoconf and Automake" by Eleftherios Gkioulekas
- Learning the GNU development tools @sourceforge
- Autotools Tutorial by Alexandre Duret-Lutz introduces Autoconf, Automake, Libtool,和 Gettext
- Using GNU auto{conf,make,header} by Felipe Bergo
|
|||||||||||||||||||