autotools#01#基础知识

众所周知,我们在Linux系统上采用源码编译安装软件,一般就是 ./configure & make & make install 这三步。而 configure 是做什么用途?是怎么生成的?简单来说通过Autotools工具包以及辅助文件生成congfigure,然后该脚本文件生成定制化的Makefile。本系列文章,来探究Autotools的使用方法和实现原理。

Autotools由autoconf、automake、libtool等三部分组成,其中采用m4sh支持不同环境的shell脚本宏定义。

GNU Autoconf is a tool for producing configure scripts for building, installing, and packaging software on computer systems where a Bourne shell is available.
Autoconf is agnostic about the programming languages used, but it is often used for projects using C, C++, Fortran, Fortran 77, Erlang, or Objective-C.

In software development, GNU Automake is a programming tool to automate parts of the compilation process. It eases usual compilation problems. For example, it points to needed dependencies.
It automatically generates one or more Makefile.in from files called Makefile.am. Each Makefile.am contains, among other things, useful variable definitions for the compiled software, such as compiler and linker flags, dependencies and their versions, etc. The generated “Makefile.in”s are portable and compliant with the Makefile conventions in the GNU Coding Standards, and may be used by configure scripts to generate a working Makefile.

autotools的安装

1
2
3
4
5
$ sudo apt install autoconf

$ sudo apt install automake

$ sudo apt install libtool libtool-bin

autoconf命令列表

命令类型说明
/usr/bin/autoconfPOSIX shell script, ASCII text executable
/usr/bin/autoreconfPerl script text executable
/usr/bin/autoheaderPerl script text executable
/usr/bin/autoscanPerl script text executable
/usr/bin/autoupdatePerl script text executable
/usr/bin/autom4tePerl script text executable
/usr/bin/ifnamesPerl script text executable

automake命令列表

命令类型说明
/usr/bin/aclocalPerl script text executable
/usr/bin/automakePerl script text executable

libtool命令列表

命令类型说明
/usr/bin/libtoolBourne-Again shell script, ASCII text executable所处包:libtool-bin
/usr/bin/libtoolizePOSIX shell script, ASCII text executable所处包:libtool

官方网站

  • autoconf
名称链接
官方网站 https://www.gnu.org/software/autoconf
官方源码 https://github.com/autotools-mirror/autoconf

官网文档 https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/index.html

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.pdf

官网下载 https://ftp.gnu.org/gnu/autoconf

https://mirrors.aliyun.com/gnu/autoconf

https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.gz

  • automake
名称链接
官方网站 https://www.gnu.org/software/automake
官方源码 https://github.com/autotools-mirror/automake
官方文档 https://www.gnu.org/savannah-checkouts/gnu/automake/manual

https://www.gnu.org/savannah-checkouts/gnu/automake/manual/index-full.html

https://www.gnu.org/savannah-checkouts/gnu/automake/manual/1.16.5/automake.html

https://www.gnu.org/savannah-checkouts/gnu/automake/manual/1.16.5/automake.pdf

官网下载 https://ftp.gnu.org/gnu/automake

https://mirrors.aliyun.com/gnu/automake

https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.gz

  • libtool
名称链接
官方网站 https://www.gnu.org/software/libtool
官方源码 https://github.com/autotools-mirror/libtool
官方文档 https://www.gnu.org/software/libtool/manual

https://www.gnu.org/software/libtool/manual/libtool.html

https://www.gnu.org/software/libtool/manual/libtool.pdf

官网下载 https://ftp.gnu.org/gnu/libtool

https://mirrors.aliyun.com/gnu/libtool

https://ftp.gnu.org/gnu/libtool/libtool-2.4.7.tar.gz

  • m4
名称链接
官方网站 https://www.gnu.org/software/m4
官方源码 https://github.com/autotools-mirror/m4
官方文档 https://www.gnu.org/software/m4/manual

https://www.gnu.org/software/m4/manual/m4.html

https://www.gnu.org/software/m4/manual/m4.pdf

官网下载 https://ftp.gnu.org/gnu/m4

https://mirrors.aliyun.com/gnu/m4

https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz

参考资料