【编译】GUN的autotools们的简要介绍

来源:互联网 发布:section软件使用方法 编辑:程序博客网 时间:2024/06/06 02:46

autoconf包里头有如下工具:

 z  autoconf
z autoheader
z autom4te
z autoreconf
z autoscan
z autoupdate
z ifnames



autoconf
是一个简单的bshell脚本,确保当前的 shell 含有运行 M4 macro processor所需的必要的功能. (I’ll discuss Autoconf’s use of M4 in detail in Chapter 3.) The remainder of the script parses command-line parameters and executes autom4te.


autoreconf
The autoreconf utility executes the configuration tools in theautoconf,
automake, andlibtoolpackages as required by each project.autoreconf
minimizes the amount of regeneration required to address changes in
timestamps, features, and project state. It was written as an attempt to
consolidate existing maintainer-written, script-based utilities that ran all
the required Autotools in the right order. You can think ofautoreconfas a
sort of smart Autotools bootstrap utility. If all you have is aconfigure.acfile,
you can run autoreconf to execute all the tools you need, in the correct
order, so that configure will be properly generated.



autoheader
The autoheaderutility 从configure.ac的各种不同的结构中,产生 C/C++兼容的头文件模板(config.h.in),
当终端用户执行configure时, 配置脚本从config.h.in生成config.h 。

 As maintainer, you’ll use autoheader to generate the template file that you will include in your distribution package. (We’ll examine
autoheader in greater detail in Chapter 3.)


autoscan
The autoscan program generates a defaultconfigure.acfile for a new project; it
can also examine an existing Autotools project for flaws and opportunities
for enhancement. (We’ll discuss autoscan in more detail in Chapters 3 and 8.)
autoscan is very useful as a starting point for a project that uses a non-Autotoolsbased build system, but it may also be useful for suggesting features that might
enhance an existing Autotools-based project.


autoupdate
The autoupdate utility is used to updateconfigure.acor the template (.in) files
to match the syntax supported by the current version of the Autotools.


ifnames
The ifnames program is a small and generally underused utility that accepts a list
of source file names on the command line and displays a list of C-preprocessor
definitions on the stdout device. This utility was designed to help maintainers
determine what to put into the configure.ac andMakefile.amfiles to make them
portable. If your project was written with some level of portability in mind,
ifnames can help you determine where those attempts at portability are located
in your source tree and give you the names of potential portability definitions.


autom4te
The autom4te utility 是对 M4的智能缓冲封装,大部分的其他 Autotools 都会用到它. Theautom4tecache decreases the time successive
tools spend accessing configure.ac constructs by as much as 30 percent.
I won’t spend a lot of time on autom4te (pronouncedautomate) because
it’s primarily used internally by the Autotools. The only sign that it’s working
is the autom4te.cache directory that will appear in your top-level project directory after you runautoconfor autoreconf.

以上工具的协同工作:




Automake

automake从高层次的build 标准文件Makefile.am 产生标准的Makefile模板(Makefile.in)
These Makefile.am input files are essentially just regular makefiles. If you were
to put only the few required Automake definitions in aMakefile.amfile, you’d
get a Makefile.in file containing several hundred lines of parameterizedmake
script.
If you add additional make syntax to a Makefile.am file, Automake will
move this code to the most functionally correct location in the resulting
Makefile.in file. In fact, you can write yourMakefile.amfiles so all they contain
is ordinary make script, and the resulting makefiles will work just fine. This
pass-through feature gives you the ability to extend Automake’s functionality
to suit your project’s specific requirements

修改Makefile.am,添加额外make 语言,这样Automake可以把这些代码移动到生成的Makefile.in文件的正确位置。



aclocal

aclocal.m4 含有很多自定义的宏。aclocal.m4与configure.ac 放在同一目录下,处理configure.ac的时候,会自动包含aclocal.m4。

aclocal.m4 文件包含所有用户自定义的宏,以及所有要求的 Automake 宏。

现在,用户不是直接给alocal.m4中加入配置宏,而是在文件acinclude.m4中加入。

当前,推荐在工程的根目录下创建一个m4的文件夹,里头是很多独立的 .m4 文件,包含了很多的宏,在 Autoconf 处理 configure.ac之时,会把这些文件集成到 aclocal.m4 中。






libtool 包提供以下程序、库和头文件:


z libtool (program)
z libtoolize (program)
z ltdl (静态和共享库)
z ltdl.h (头文件)


ltdl, the Libtool C API
libtool 包也提供了 ltdl库和相关的头文件
用于提供跨平台的一致的运行时的共享对象的管理。


Figure 1-3 演示了 集成了automakelibtool脚本、用来创造可使用输入文件配置和build工程的products

Automake and Libtool are both standard pluggable options that can be
added to configure.ac with just a few simple macro calls



我的ubuntu  14.04.1:

autoconf的版本号

root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# which autoconf
/usr/bin/autoconf
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# autoconf -version
autoconf: error: invalid option `-version'
Try `autoconf --help' for more information.
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Written by David J. MacKenzie and Akim Demaille.
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# 



root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# which automake
/usr/bin/automake
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# automake --version
automake (GNU automake) 1.14.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# 





root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# which libtool
/usr/bin/libtool
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# libtool --version
libtool (GNU libtool) 2.4.2
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996


Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@Ubuntu32:/home/zhangbin/zbhome/GL/LCUI# 


还有一位大牛翻译的,更全一些:

http://www.tuicool.com/articles/AbyMryR



0 0