fbpx
维基百科

Autoconf

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

Autoconf
開發者GNU
目前版本
  • 2.71 (2021年1月28日;穩定版本)[1]
源代码库
  • git.savannah.gnu.org/cgit/autoconf.git
操作系统跨平台
类型编程工具
许可协议GPL
网站http://www.gnu.org/software/autoconf/
autoconf和automake的工作流程图。请注意"configure.ac"在Autoconf早期版本中名为"configure.in"

使用概要

软件开发者通过使用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无法为XcodeVisual Studio制作项目文件,其脚本通常大且复杂,因此增加了Debug的难度。Autoconf所使用的M4对于一些开发者来说是陌生的,因此他们需要专门学习[7]。一些开发者并不遵循配置脚本的一些习惯约定[8]

因此一些自由软件开发者开始使用其他软件代替autoconf,KDE于KDE 4起开始使用CMake[9]Scribus同样开始使用CMake[9]

参见

脚注

  1. ^ autoconf-2.71 released [stable]. 2021年1月28日 [2021年1月29日] (英語). 
  2. ^ Autoconf - GNU Project - Free Software Foundation (FSF). GNU Project. [2010-12-16]. (原始内容于2010-12-23). 
  3. ^ The GNU Build System - Autoconf. GNU Project. [2010-12-16]. (原始内容于2010-12-25). 
  4. ^ David Mackenzie. Genesis - Autoconf. GNU Project. [2010-12-16]. (原始内容于2010-12-25). 
  5. ^ David Mackenzie. Leviticus - Autoconf. GNU Project. [2010-12-16]. (原始内容于2010-12-25). 
  6. ^ David Mackenzie. Numbers - Autoconf. GNU Project. [2010-12-16]. (原始内容于2010-12-25). 
  7. ^ McCall, Andrew. Stop the autoconf insanity! Why we need a new build system. 2003-06-21 [2010-12-14]. (原始内容于2010-12-27). 
  8. ^ GNU Coding Standards. [2010-12-14]. (原始内容于2010-12-23). 
  9. ^ 9.0 9.1 Neundorf, Alexander. Why the KDE project switched to CMake -- and how. 2006-06-21 [2010-12-14]. (原始内容于2011-05-07). 

外部链接

  • 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: .
  • Autotoolset home page(页面存档备份,存于互联网档案馆

教程

autoconf, 是一个在bourne, shell下制作供编译, 安装和打包软件的配置脚本, 英语, configure, script, computing, 的工具, 并不受程式语言限制, 常用于c, erlang和objective, 配置脚本控制了一个软件包在特定系统上的安装, 在进行一系列测试后, 配置脚本从模板中生成makefile与头文件进而调整软件包, 使之适应某一种系统, 与automake, libtool等软件组成了gnu构建系统, 由戴维, 麦肯思, 英语, david, mackenz. GNU Autoconf是一个在Bourne shell下制作供编译 安装和打包软件的配置脚本 英语 Configure script computing 的工具 2 Autoconf并不受程式语言限制 常用于C C Erlang和Objective C 配置脚本控制了一个软件包在特定系统上的安装 在进行一系列测试后 配置脚本从模板中生成makefile与头文件进而调整软件包 使之适应某一种系统 Autoconf与Automake Libtool等软件组成了GNU构建系统 3 Autoconf由戴维 麦肯思 英语 David Mackenzie 于1991年夏天编写用于支持他在自由软件基金会的编程工作 4 此后 Autoconf包含了多人编写的改进代码并成为了使用最广泛的自由编译配置软件 5 6 Autoconf開發者GNU目前版本2 71 2021年1月28日 穩定版本 1 源代码库git wbr savannah wbr gnu wbr org wbr cgit wbr autoconf wbr git操作系统跨平台类型编程工具许可协议GPL网站http www gnu org software autoconf autoconf和automake的工作流程图 请注意 configure ac 在Autoconf早期版本中名为 configure in 目录 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对于一些开发者来说是陌生的 因此他们需要专门学习 7 一些开发者并不遵循配置脚本的一些习惯约定 8 因此一些自由软件开发者开始使用其他软件代替autoconf KDE于KDE 4起开始使用CMake 9 Scribus同样开始使用CMake 9 参见 编辑 自由软件主题 CMake 配置脚本 GNU构建系统 pkg config脚注 编辑 autoconf 2 71 released stable 2021年1月28日 2021年1月29日 英語 引文格式1维护 未识别语文类型 link Autoconf GNU Project Free Software Foundation FSF GNU Project 2010 12 16 原始内容存档于2010 12 23 The GNU Build System Autoconf GNU Project 2010 12 16 原始内容存档于2010 12 25 David Mackenzie Genesis Autoconf GNU Project 2010 12 16 原始内容存档于2010 12 25 David Mackenzie Leviticus Autoconf GNU Project 2010 12 16 原始内容存档于2010 12 25 David Mackenzie Numbers Autoconf GNU Project 2010 12 16 原始内容存档于2010 12 25 McCall Andrew Stop the autoconf insanity Why we need a new build system 2003 06 21 2010 12 14 原始内容存档于2010 12 27 GNU Coding Standards 2010 12 14 原始内容存档于2010 12 23 9 0 9 1 Neundorf Alexander Why the KDE project switched to CMake and how 2006 06 21 2010 12 14 原始内容存档于2011 05 07 外部链接 编辑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 页面存档备份 存于互联网档案馆 https web archive org web 20140816060326 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 取自 https zh wikipedia org w index php title Autoconf amp oldid 64116981, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。