automake 安装及使用

http://blog.csdn.net/lusehu/article/details/6415213

autotools是个系列工具,首先确认你的Ubuntu系统是否安装了以下工具(可以通过which命令查看):

    aclocal
    autoscan
    autoconf
    autoheader
    automake

 

  安装方法:
       root@ubuntu:~# sudo apt-get install autoconf (
我只执行了这一条安装指令  下面的使用中没有出错

  显示如下:
         正在读取软件包列表… 完成
         正在分析软件包的依赖关系树       
         正在读取状态信息… 完成       
         E: 无法找到软件包 autoscan
        将会安装下列额外的软件包:
         automake autotools-dev m4
        建议安装的软件包:
        autoconf2.13 autobook autoconf-archive gnu-standards autoconf-doc libtool
        gettext
        下列【新】软件包将被安装:
         autoconf automake autotools-dev m4
        共升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 28 个软件未被升级。
         需要下载 1315kB 的软件包。
         解压缩后会消耗掉 4366kB 的额外空间。
         您希望继续执行吗Y/n] 
        输入y,安装

 

最好一起安装它建议安装的软件包,否则autotools工具使用可能出错。

root@ubuntu:~# sudo apt-get install autotools-dev m4 autoconf2.13 autobook autoconf-archive gnu-standards autoconf-doc libtool

使用:

官方文档http://www.gnu.org/software/automake/manual/index.html

流程

第一部份:执行autoscan  修改configure.scan  成   configure.in

[cpp] view plain copy print

  1. #                                               -*- Autoconf -*-  
  2. # Process this file with autoconf to produce a configure script.  
  3.   
  4. AC_PREREQ(2.68)  
  5. AC_INIT(hello,1.0)  
  6. AM_INIT_AUTOMAKE(hello,1.0)  
  7. AC_CONFIG_SRCDIR([hello.c])  
  8. AC_CONFIG_HEADERS([config.h])  
  9.   
  10. # Checks for programs.  
  11. AC_PROG_CC  
  12.   
  13. # Checks for libraries.  
  14.   
  15. # Checks for header files.  
  16.   
  17. # Checks for typedefs, structures, and compiler characteristics.  
  18.   
  19. # Checks for library functions.  
  20. AC_CONFIG_FILES([makefile])  
  21. AC_OUTPUT  

第二部份:执行aclocal   执行autoconf

第三部份: 执行autoheader

第四部份: 新建makefile.am  执行automake  -a

[cpp] view plain copy print

  1. AUTOMAKE_OPTIONS=foreign  
  2. bin_PROGRAMS= hello  
  3. hello_SOURCES= hello.c  

 最后:

。/configure   make    make install   make clean

automake 安装及使用

教程:

                             http://public0821.iteye.com/blog/665786

这片文章不错 : http://www.cnblogs.com/276815076/archive/2010/09/30/1839589.html

                          http://www.jcwcn.com/article-22327-1.html

文库教程: http://wenku.baidu.com/view/bcb0074669eae009581becbb.html

实例:(应注意观察每一步的执行结果是否正确,是否生成了想要的文件


实例1:精简实例很不错

(我测试过没问题 只是中间有个单词写错了

vim Makefile.am

文件内容为:

AUTOMAKE——OPTIONS=foreign

bin_PROGRAMS=hello

hello_SUORCES=hello.c  此处应为 hello_SOURCES=hello.c 

)

 http://www.cnblogs.com/276815076/archive/2010/09/30/1839589.html

实例2:(未测试,但流程正确)

http://blog.163.com/adam_mhl/blog/static/64278267200710291130488/

   建立目录:mkdir include src
    编写程序:include/str.h
        #include <stdio.h>
        int str(char *string);


    编写程序:src/str.c
       #include “str.h”
//print string
int str(char *string){
       printf(“n—-PRINT STRING—-n”%s””n””

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2015年1月10日
下一篇 2015年1月10日

相关推荐