免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 850 | 回复: 0
打印 上一主题 下一主题

自动编译工具AutoTools使用测试 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-04 19:55 |只看该作者 |倒序浏览
自动编译工具AutoTools使用测试
1.检查系统必装工具包(保证可用)automake,autoconf,aclocal,autoheader,libtool,m4,perl
2.mkdir test && vi test/test.c
输入测试代码:
#include
int main(int argc,char **argv)
{
printf("GNU AutoTools Test.The test works well if you see this
message.");
return 0;
}
3.$autoscan
生成如下文件:
autoscan.log configure.scan test.c
4.$mv configure.scan configure.in && vi configure.in
源文件如下:
#            -*-Autoconf-*-
#Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(FULL-PACKAGE-NAME,VERSION,BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([test.c])
AC_CONFIG_HEADER([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
修改如下:
#            -*-Autoconf-*-
#Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(test.c,1.0,creatory@mail.com)
AM_INIT_AUTOMAKE(test,1.0)
AC_CONFIG_SRCDIR([test.c])
AC_CONFIG_HEADER([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(Makefile)
5.$aclocal && autoheader && autoconf
生成文件如下:
aclocal.m4 autoscan.log configure test.c autom4te.cache config.h.in configure.in
6.$vi Makefile.am
新建文件内容如下:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=test
test_SOURCES=test.c
7.$automake --add-missing
至此配置完毕
先用./configure进行检测配置
再用make dist打包为test-1.0.tar.gz即可发行.
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/56374/showart_1851725.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP