当我们在linux下利用源码安装开源软件时,通常采用 ./configure -> make -> make install 的方式。打开其中的makefile,组件相当复杂,有些还是多目录结构。
在网上搜索了相关的方法,发现了几个好用的开源工具:autoconf 与 automake。
确保已安装如下命令: autoscan, aclocal, autoconf, automake 否则sudo apt-get install之。
执行如下命令即可完成配置:aclocal; autoconf; automake --add-missing; ./configure; make; ./helloworld
一切还是从HelloWorld开始:
1. 新建helloworld目录以及三个文件 helloworld.c, configure.in, Makefile.am
2. 编写简单的hello world示例程序:
3. 执行autoscan
4. 执行mv configure.in configure.ac
5. 执行aclocal; autoconf
6. touch NEWS README AUTHORS ChangeLog
7. automake –add-missing
8. ./configure; make; ./helloworld
搞定!