Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4233008
  • 博文数量: 176
  • 博客积分: 10059
  • 博客等级: 上将
  • 技术积分: 4681
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-24 12:27
文章分类

全部博文(176)

文章存档

2012年(1)

2011年(4)

2010年(14)

2009年(71)

2008年(103)

分类: C/C++

2009-08-31 23:19:48

1.autoscan (autoconf): 扫描源代码以搜寻普通的可移植性问题,比如检查编译器,库,头文件等,生成文件configure.scan,它是configure.ac的一个雏形。

2.aclocal (automake):根据已经安装的宏,用户定义宏和acinclude.m4文件中的宏将configure.ac文件所需要的宏集中定义到文件 aclocal.m4中。aclocal是一个perl 脚本程序,它的定义是:“aclocal - create aclocal.m4 by scanning configure.ac”

user input files   optional input     process          output files
================   ==============     =======          ============

                    acinclude.m4 - - - - -.
                                          V
                                      .-------,
configure.ac ------------------------>|aclocal|
                 {user macro files} ->|       |------> aclocal.m4
                                      `-------'
3.autoheader(autoconf): 根据configure.ac中的某些宏,比如cpp宏定义,运行m4,声称config.h.in

user input files    optional input     process          output files
================    ==============     =======          ============

                    aclocal.m4 - - - - - - - .
                                             |
                                             V
                                     .----------,
configure.ac ----------------------->|autoheader|----> autoconfig.h.in
                                     `----------'
4.automake: automake将Makefile.am中定义的结构建立Makefile.in,然后configure脚本将生成的Makefile.in文件转换为Makefile。如果在configure.ac中定义了一些特殊的宏,比如AC_PROG_LIBTOOL,它会调用libtoolize,否则它会自己产生config.guess和config.sub

user input files   optional input   processes          output files
================   ==============   =========          ============

                                     .--------,
                                     |        | - - -> COPYING
                                     |        | - - -> INSTALL
                                     |        |------> install-sh
                                     |        |------> missing
                                     |automake|------> mkinstalldirs
configure.ac ----------------------->|        |
Makefile.am  ----------------------->|        |------> Makefile.in
                                     |        |------> stamp-h.in
                                 .---+        | - - -> config.guess
                                 |   |        | - - -> config.sub
                                 |   `------+-'
                                 |          | - - - -> config.guess
                                 |libtoolize| - - - -> config.sub
                                 |          |--------> ltmain.sh
                                 |          |--------> ltconfig
                                 `----------'
5.autoconf:将configure.ac中的宏展开,生成configure脚本。这个过程可能要用到aclocal.m4中定义的宏。

user input files   optional input   processes          output files
================   ==============   =========          ============

                   aclocal.m4 - - - - - -.
                                         V
                                     .--------,
configure.ac ----------------------->|autoconf|------> configure ----->autoconfig.h,Makefile







[root@zieckey autoconf]# mkdir hello
[root@zieckey autoconf]# cd hello/
[root@zieckey hello]# vi hello.c
[root@zieckey hello]# ls
hello.c
[root@zieckey hello]# autoscan
[root@zieckey hello]# ls
autoscan.log configure.scan hello.c
[root@zieckey hello]# mv configure.scan configure.in
[root@zieckey hello]# ls
autoscan.log configure.in hello.c
主要是修改 AC_INIT
添加 AM_INIT_AUTOMAKE(hello, 1.0)
如果不需要 config.h 就删除者一行 AC_CONFIG_HEADER([config.h])
[root@zieckey hello]# cat configure.in
AC_PREREQ(2.61)
AC_INIT(hello, 1.0, bug-318 )
AM_INIT_AUTOMAKE(hello, 1.0)
AC_CONFIG_SRCDIR(hello.c)
AC_PROG_CC
AC_OUTPUT(Makefile)
[root@zieckey hello]# ls
autoscan.log configure.in hello.c
[root@zieckey hello]# aclocal
[root@zieckey hello]# autoconf
[root@zieckey hello]# ls
aclocal.m4 autom4te.cache autoscan.log configure configure.in hello.c
[root@zieckey hello]# vi Makefile.am
[root@zieckey hello]# cat Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
[root@zieckey hello]# ls
Makefile.am aclocal.m4 autom4te.cache autoscan.log configure configure.in hello.c
[root@zieckey hello]# automake --add-missing
configure.in:3: installing `./missing'
configure.in:3: installing `./install-sh'

Makefile.am: installing `./depcomp

阅读(2596) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~