Follow this tutorial to get started with autotools.

configure.ac 文件

使用 autoscan 工具生成 configure.scan 文件,将它重命名为 configure.ac ,默认的文件内容如下:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])

# Checks for programs.

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT

然后创建如下的项目目录结构:

src/main.c
README
configure.ac
Makefile.am
src/Makefile.am

Command autoreconf --install parse configure.ac into configure file. Command automake generate Makefile.in files. Command ./configure generate Makefie and src/Makefile from Makefile.in files.

我这里有一个基础的使用 autotools 工具的项目,展示了其中最基本的用法。

An Introduction to the Autotools

Resources