autoconf 简单demo试用

1. 安装工具

yum install  -y automake
 
2. 基本项目
a. 项目参考结构

├── AUTHORS
├── COPYING
├── ChangeLog
├── Makefile.am
├── NEWS
├── README
├── README.md
├── a.out
├── configure.ac
├── main
└── main.c

b.  configure.ac  Makefile.am  main.c

configure.ac  Makefile.am

configure.ac

AC_INIT([main],[0.0.1])
AC_CONFIG_SRCDIR("main.c")
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror])
AC_CONFIG_FILES([Makefile])
AC_PROG_CC
AC_OUTPUT

Makefile.am

bin_PROGRAMS = main
main_SOURCES =main.c


main.c

#include <stdio.h>

int main (){

 printf("%s","appdemo");
 return 0;

}


c. 生成文档

autoreconf  -i  提示的错误信息如下:

Makefile.am: error: required file './NEWS' not found
Makefile.am: error: required file './README' not found
Makefile.am: error: required file './ChangeLog' not found
Makefile.am: installing './COPYING' using GNU General Public License v3 file
Makefile.am:     Consider adding the COPYING file to the version control system
Makefile.am:     for your code, to avoid questions about which license your project uses
autoreconf: automake failed with exit status: 1


解决方法
list="INSTALL NEWS README AUTHORS ChangeLog COPYING"
touch  $list

重新生成之后  ./configure

d. make && install 

make install 

备注:或者使用autoscan 帮助生成部分代码,也是一个不错的选择
3. 一张参考图
4. 参考资料
https://github.com/rongfengliang/autoconf-demo
https://www.gnu.org/software/autoconf/autoconf.html
https://github.com/rongfengliang/autoconf-project

posted on   荣锋亮  阅读(303)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2014-05-08 oracle 、sql server 、mysql 复制表数据
2014-05-08 C# 使用oledb 方式连接本地或者远程oracel 数据库的方式

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示