圖解autoscan、aclocal、autoheader、automake、autoconf...

1.autoscan (autoconf): 掃描源代碼以搜尋普通的可移植性問題,好比檢查編譯器,庫,頭文件等,生成文件configure.scan,它是configure.ac的一個雛形。 spa

    your source files --> [autoscan*] --> [configure.scan] --> configure.ac code

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 ci

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中定義的宏。 get

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

aclocal.m4 ,autoconfig.h.in - - - - - - -.
                                         V
                                     .--------,
configure.ac ----------------------->|autoconf|------> configure
 
6. ./configure的過程
.-------------> [config.cache]
     configure* --------------------------+-------------> config.log
                                          |
              [config.h.in] -.            v            .--> [autoconfig.h]
                             +-------> config.status* -+                   
              Makefile.in ---'                         `-->   Makefile
 
7. make過程
 
[autoconfig.h] -.
                     +--> make* --->  程序
       Makefile   ---'
 
.---------,
                   config.site - - ->|         |
                  config.cache - - ->|         | - - -> config.cache
                                     |         +-,
                                     `-+-------' |
                                       |         |----> config.status
                   config.h.in ------->|config-  |----> config.h
                   Makefile.in ------->|  .status|----> Makefile
                                       |         |----> stamp-h
                                       |         +--,
                                     .-+         |  |
                                     | `------+--'  |
                   ltmain.sh ------->|ltconfig|-------> libtool
                                     |        |     |
                                     `-+------'     |
                                       |config.guess|
                                       | config.sub |
                                       `------------'
                                   .--------,
                   Makefile ------>|        |
                   config.h ------>|  |
{project sources} ---------------->|        |--------> {project targets}
                                 .-+        +--,
                                 | `--------'  |
                                 |   libtool   |
                                 |   missing   |
                                 |  install-sh |
                                 |mkinstalldirs|
                                 `-------------'
相關文章
相關標籤/搜索