前言:autoscan命令的作用是生成一个初步的 configure.in,此命令将检查以 SRCDIR 为根的目录树中的源文件,如果没有给出,则检查当前目录。它还搜索源文件以查找常见的可移植性问题,检查“ configure.ac ”的不完整性,并创建一个名为“ configure.scan ”的文件,用作该特定包的初步“ configure.ac ”文件。
#在线文档
https://www.gnu.org/software/autoconf/
http://man.he.net/man1/autoscan
一,安装
本文环境
[root@localhost ~]# cat /etc/os-release
NAME="openEuler"
VERSION="22.03 LTS"
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 LTS"
ANSI_COLOR="0;31
autoscan 是属于autotools系列工具,工具集包括aclocal,autoscan,autoconf,autoheader,automake
dnf install autoconf
二,参数
autoscan -h
Usage: /usr/bin/autoscan [OPTION]... [SRCDIR]
-h,--帮助
打印此帮助,然后退出
-V,--版本
打印版本号,然后退出
-v,--详细
详细报告处理
-d,--调试
不要删除临时文件
库目录:
-B, --prepend-include=DIR
将目录 DIR 添加到搜索路径
-I, --include=DIR
将目录 DIR 附加到搜索路径
三,实际使用
准备工作
#1.新建一个.c文件
[root@localhost test]# cat 1.c
int main(int argc, char** argv)
{
printf("Hello, Linux World! ");
return 0;
}
#2,生成configure
[root@localhost test]# autoscan
[root@localhost test]# ls
1.c autoscan.log configure.scan
[root@localhost test]# cat configure.scan
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.71])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([1.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT
如上,生成的configure.scan,可以拿它作为configure.ac的蓝本,而configure.ac是最后生成Makefile的基础。
四,总结
好了,本期只介绍autoscan,它的作用就是生成configure.ac的模板,这个模板可以修改后直接使用,下期再接着介绍下生成Makefile的整个过程。