Autoconf








body.skin-minerva .mw-parser-output table.infobox caption{text-align:center}





































Autoconf

Heckert GNU white.svg
開發者
GNU
穩定版本

穩定版本
2.69
(2012年4月24日,​6年前​(2012-04-24


操作系统
跨平台
类型
编程工具
许可协议
GPL
網站
http://www.gnu.org/software/autoconf/
源代码库
  • ftp.gnu.org/gnu/autoconf/
編輯維基數據鏈接



autoconf和automake的工作流程图。请注意"configure.ac"在Autoconf早期版本中名为"configure.in"


GNU Autoconf是一个在Bourne shell下制作供编译、安装和打包软件的配置脚本英语Configure_script (computing)的工具[1]。Autoconf并不受程式语言限制,常用于C、C++、Erlang和Objective-C。配置脚本控制了一个软件包在特定系统上的安装。在进行一系列测试后,配置脚本从模板中生成makefile与头文件进而调整软件包,使之适应某一种系统。Autoconf与Automake、Libtool等软件组成了GNU构建系统[2]。Autoconf由戴维·麦肯思英语David Mackenzie于1991年夏天编写用于支持他在自由软件基金会的编程工作[3]。此后,Autoconf包含了多人编写的改进代码并成为了使用最广泛的自由编译配置软件。[4][5]




目录






  • 1 使用概要


    • 1.1 configure.ac格式




  • 2 工作原理


  • 3 批评


  • 4 参见


  • 5 脚注


  • 6 外部链接


    • 6.1 教程







使用概要


软件开发者通过使用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]



参见




  • CMake

  • 配置脚本

  • GNU构建系统

  • pkg-config



脚注





  1. ^ Autoconf - GNU Project - Free Software Foundation (FSF). GNU Project. [2010-12-16]. 


  2. ^ The GNU Build System - Autoconf. GNU Project. [2010-12-16]. 


  3. ^ David Mackenzie. Genesis - Autoconf. GNU Project. [2010-12-16]. 


  4. ^ David Mackenzie. Leviticus - Autoconf. GNU Project. [2010-12-16]. 


  5. ^ David Mackenzie. Numbers - Autoconf. GNU Project. [2010-12-16]. 


  6. ^ McCall, Andrew. Stop the autoconf insanity! Why we need a new build system. 2003-06-21. 


  7. ^ GNU Coding Standards. 


  8. ^ 8.08.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



教程



  • https://web.archive.org/web/20100627142047/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





Popular posts from this blog

澳門輕軌系統

水泉澳邨

Indian Forest Service