目标:
生成makefile,可通过make生成静态库(.a)。
基本步骤:
# autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1
# mv configure.scan configure.in
# vim configure.in
//进行如下操作
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
改为
AC_INIT(libcomm.a, 1.0.0, shiluo.110@163.com)
AC_CONFIG_HEADER([config.h])
改为
AM_CONFIG_HEADER([config.h])
增加
AM_INIT_AUTOMAKE(test,1.0)
增加
AC_PROG_RANLIB
# aclocal
# autoconf
# autoheader
# automake --add-missing
# ./configure
# make
遇到的问题:
1、运行autoscan报错: [root
@localhost dust]# autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1
解决方法:无视。
2、
configure.ac:6: installing `./install-sh'; error while making link: 不允许的操作
configure.ac:6: installing `./missing'; error while making link: 不允许的操作
src/Makefile.am: installing `./depcomp'; error while making link: 不允许的操作
解决方法:因为把工程放在FAT32分区上了,而它不支持link。挪到ext3上就解决了。
3、
想通过自定义的install-sh脚本完成自定义的功能,却未找到相应的操作宏。
解决方法:将configure.in和Makefile.am放到一个build文件夹内,通过安装脚本调用autoconf/automake等命令生成静态库,并完成拷贝等操作。
(未完,待续)