Autoconf 配置脚本生成
autoconf 根据 configure.ac 生成可移植的 configure 脚本,检测系统头文件、库和编译器能力。它常与 automake/libtool 一起使用。
autoconf
autoreconf -fi
./configure --prefix=/usr/local
./configure --help
./configure CFLAGS='-O2 -g'
make -j8
make install
cat config.log
| 文件/变量 | 含义 |
|---|---|
configure.ac |
Autoconf 输入 |
configure |
生成的配置脚本 |
config.status |
记录配置结果 |
config.log |
配置过程日志 |
AC_CHECK_* |
检测宏 |
--prefix |
安装前缀 |
configure 失败先看 config.log,不要只看最后一行。configure.ac 后要重新 autoreconf;不要手改生成的 configure。autoreconf -fi 生成缺失的辅助脚本。--host 和工具链环境变量。config.cache)可能导致检测结果过期;必要时删除。automake — 生成 Makefile.inlibtool — 库构建make — 执行构建