首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Linux > HelloWorld in autoconf & automake
【标  题】:HelloWorld in autoconf & automake
【关键字】:HelloWorld,in,autoconf,amp,automake
【来  源】:http://blog.chinaunix.net/article.php?articleId=52942&blogId=4565

HelloWorld in autoconf & automake

写个autoconf和automake的HelloWorld先,以后再慢慢添加些常用宏的含义。


ok,让我们从hello.c开始
#include <stdio.h>
main()
{
printf("Howdy world!\n");
}

当然你可以像下面这样简单的编译这个程序

% gcc hello.c -o hello
% hello
让我们看看使用autoconf和automake的编译方法,首先创建下面两个文件
`Makefile.am'
bin_PROGRAMS = hello
hello_SOURCES = hello.c
`configure.in'
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello,0.1)
AC_PROG_CC
AC_PROG_INSTALL
AC_OUTPUT(Makefile)

运行 `autoconf':

% aclocal
% autoconf

上面这一步将产生我们熟悉的`configure'脚本。接下来运行 `automake':

% automake -a
required file "./install-sh" not found; installing
required file "./mkinstalldirs" not found; installing
required file "./missing" not found; installing
required file "./INSTALL" not found; installing
required file "./NEWS" not found
required file "./README" not found
required file "./COPYING" not found; installing
required file "./AUTHORS" not found
required file "./ChangeLog" not found

'-a' 的意思是'add missing standard files to package',第一次运行automake它会帮我们产生一些标准的文件,这些文件都是为了符合GNU编码标准,但也会出现一些文件找不到的错误,这些文件需要我们自己创建:

% touch NEWS README AUTHORS ChangeLog

再跑一下automake:

% automake -a

这时就会产生`Makefile.in'

现在所有的任务都完成,可以打包分发了,使用方法地球人都知道:

% ./configure
% make
% ./hello

要买惠普R607:【上一篇】
实践RHEL4中文环境:【下一篇】
【相关文章】
  • ]linux目录讲解
  • 从硬盘安装linux
  • Linux系统的常用命令
  • linux一些显示中文问题解决方法
  • 自己定制软盘上的Linux系统
  • 提高linux上网速度
  • linux安全与优化
  • 什么是linux
  • Linux网络应用问答
  • 学习Linux的七点忠告
  • 【随机文章】
  • 关于jsp保存文件到服务器
  • 雕虫小计—颜色渐变的进度条
  • URL包含中文,得到的是亂碼,Microsoft NewsGroup,新聞組
  • 制作个性化界面以及实现制作多国语言切换
  • 如何正确的计算文件收发进度
  • 6.3. Red Hat Enterprise Linux 的特定資訊
  • ADSL的原理【提到不少技术参数】
  • php+ajax动态生成下拉菜单
  • 一个跨平台的 C++ 内存泄漏检测器
  • JFS 概述:日志文件系统如何缩短系统重启时间
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.