关于autotools的最好的入门教程,出自这里:http://blog.dccmx.com/2011/01/autotools-1/
转载一下,以备查看。
--------------------------------------------
Autotools上手指南1——autoconf基本思想
dccmx 于 2011年 一月 7日 发表 | 最后修改于 2011年 一月 10日
要想弄懂Autotools并使用它,必须先要了解一下M4这个怪物。
那么何为M4呢,M4的名称取自Macro(M后面跟4个字母…)。它和C预处理器里的宏是一个概念(其实,M4和C预处理器都K&R操刀设计的!!),用来处理文本替换。也就是说,M4是bash里的预处理器。
取自维基的例子:1
divert(-1) This `divert' discards this text. Note that I had to quote the `divert' in the comment so it wouldn't get undiverted. This starts the count at ONE as the incr is a preincrement. define(`H2_COUNT', 0) The define H2_COUNT is redefined every time the H2 macro is used. The dnl deletes everything on the line after it in the output (ie this bit) define(`H2', `define(`H2_COUNT', incr(H2_COUNT))'dnl `<h2>H2_COUNT. $1</h2>') divert(0)dnl diversion to 0 means back to normal dnl removes this line. H2(First Section) H2(Second Section) H2(Conclusion)
<h2>1. First Section</h2> <h2>2. Second Section</h2> <h2>3. Conclusion</h2>
AC_INIT([test], [1.0]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT
all: @PACKAGE_NAME@_bin @PACKAGE_NAME@_bin: test.c gcc -o @PACKAGE_NAME@_bin test.c
$ autoconf $ ./configure
all: test_bin test_bin: test.c gcc -o test_bin test.c