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
- # -*- Autoconf -*-
- # Process this file with autoconf to produce a configure script.
- AC_PREREQ(2.68)
- AC_INIT(hello,1.0)
- AM_INIT_AUTOMAKE(hello,1.0)
- AC_CONFIG_SRCDIR([hello.c])
- AC_CONFIG_HEADERS([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_CONFIG_FILES([makefile])
- AC_OUTPUT
第二部份:执行aclocal 执行autoconf
第三部份: 执行autoheader
第四部份: 新建makefile.am 执行automake -a
- AUTOMAKE_OPTIONS=foreign
- bin_PROGRAMS= hello
- hello_SOURCES= hello.c
最后:
。/configure make make install make clean
教程:
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",string);
return 0;
}
//interface of this program
int main(int argc , char **argv){
char str_read[1024];
printf("Please INPUT something end by [ENTER]\n");
scanf("%s",str_read);
return str(str_read );
}
第一部份:(执行一条命令+修改一个文件)
3、生成configure.in
include src
[root@localhost str]#autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1
[root@localhost str]# ls
autoscan.log configure.scan(上面的命令生成此文件) include src
[root@localhost str]# cp configure.scan configure.ac
修改 configure.scan 成 condigure.in:
1,修改AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)为
AC_INIT(str,0.0.1, [bug@sounos.org])
(注解:FULL-PACKAGE-NAME 为程序名称,VERSION为当前版本, BUG-REPORT-ADDRESS为bug汇报地址)
2,添加AM_INIT_AUTOMAKE
3,添加AC_CONFIG_FILES([Makefile])
修改后文件为:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(str, 0.0.1, [bug@sounos.org])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([include/str.h])
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_CONFIG_FILES([Makefile])
AC_OUTPUT
第二部份:(执行两条命令)
执行aclocal
[root@localhost str]# aclocal
/usr/share/aclocal/libfame.m4:6: warning: underquoted definition of AM_PATH_LIBFAME
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
执行autoconf
[root@localhost str]# autoconf
[root@localhost str]# ls
aclocal.m4 autoscan.log config.h.in configure.scan include Makefile.am NEWS
AUTHORS ChangeLog configure COPYING INSTALL Makefile.in README
autom4te.cache compile configure.ac depcomp install-sh missing src
第三部份(执行一条命令)
5、autoheader
root@localhost str]# autoheader
第四部份(新建文件+执行automake)
6、创建Makefile.am
[root@localhost str]# cat Makefile.am
#Makefile.am
bin_PROGRAMS = str
str_SOURCES = include/str.h src/str.c
str_CPPFLAGS = -I include/
7、automake必须文件(可略过此步):
* install-sh
* missing
* INSTALL
* NEWS
* README
* AUTHORS
* ChangeLog
* COPYING
* depcomp
其中
* install-sh
* missing
* INSTALL
* COPYING
* depcomp
可以通过automake -a选项自动生成,所以这里只需要建立如下文件
[root@localhost str]# touch NEWS README AUTHORS ChangeLog(也可不加这一步)
8、执行automake -a
[root@localhost str]# automake -a
configure.ac: installing `./install-sh'
configure.ac: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: installing `./COPYING'
Makefile.am: installing `./compile'
Makefile.am: installing `./depcomp'
最后一步:
10、执行测试:
执行./configure
执行 make 此时应该已经生成可执行文件,ls看一下
执行 make install
11、测试程序:#可执行文件
make clean 清除编译过程生成的文件
make uninstall 卸载
辅助知识
12. 添加测试包:make dist-gzip
13.添加一个支持子目录、静态库、自定义configure选项的包
支持子目录Makefile.am 选项 SUBDIR =
#Automake interface
SUBDIRS = src
支持静态库Makefile.am
EXTRA_DIST 用于添加除源码外的文件到dist包
#Automake interface
bin_PROGRAMS = hello
hello_SOURCES = hello.c lib/sbase.h
hello_CPPFLAGS = -I lib
hello_LDFLAGS = -static lib/libsbase.a
EXTRA_DIST = lib/libsbase.a
configure.ac:
AC_PREREQ(2.59)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(hello, 0.0.1, [SounOS@gmail.com])
#AM 声明
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/hello.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h stdlib.h sys/socket.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
#用于自定义configure 选项,见acinclude.am
AC_CHECK_EXTRA_OPTIONS
# Checks for library functions.
AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
automake 安装及使用相关推荐
- automake linux,在Linux中Automake – 安装版本’automake-1.14.1’有困难
我在Rapbian(2014-09-09-wheezy-raspbian)发行版上安装automake 1.14.1时遇到问题.我写了sh ./configure然后我写了make然后终端写了我: $ ...
- Redis6安装配置集群cluster以及集群宕机注意事项
Redis6的cluster模型推荐3主3从 先准备3台服务器,每个上面部署2个redis,服务器配置2核2G: 下面在每台服务器安装redis6,每台机器只要安装一次即可,然后分别配置2个端口的co ...
- CentOS 7.7 安装cmake3
安装gcc的软件依赖 yum install -y gcc gcc-c++ make automake 安装wget yum install -y wget 下载cmake源代码包 wget http ...
- CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境
什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/Perl/Python组合成的动态Web应用程序和服务器,它是一组Web应用程序的基础 ...
- 转:openTSDB 2.0 安装
OpenTSDB-2.0.0安装布署 2014-02-27 11:07:49| 分类: 大数据 | 标签:hadoop |举报|字号 订阅 1.介绍 OpenTSDB是一个架构在Hbase系统之 ...
- Linux的cmake3的安装 cmake3编译安装成功了的 yum对于cmake3表示成功但实际没成功
3.10.0 安装gcc的软件依赖 yum install -y gcc gcc-c++ make automake安装wget yum install -y wget下载cmake源代码包 wget ...
- centos 安装 janus
参考 :GitHub - meetecho/janus-gateway: Janus WebRTC Server 1.执行依赖: yum install libmicrohttpd-devel jan ...
- 【ninja】macOS 下安装ninja
[ninja]macOS 下安装ninja 1.在安装ninja的过程中需要先安装re2c(github地址:https://github.com/skvadrik/re2c): git clone ...
- win10下基于wsl-Ubuntu 的LAMMPS超便捷安装
前言 本文为学习过程中第一次进行总结和编撰,诸多问题详略不当还望谅解.如此拙见,若有幸相助,那必是荣幸之至. 简介 本次安装是基于Manual,使用win10下Ubuntu子系统中,apt应用商店的扩 ...
- TPM零知识学习四 —— tpm2-tss源码安装
tpm2-tss包的的源码安装方法参考: tpm2-tss/INSTALL.md at master · tpm2-software/tpm2-tss · GitHub TPM模拟器和TPM2-TSS ...
最新文章
- Python之字符编码(Day10)
- jittor和pytorch 生成网络对比之clustergan
- 企业如何应对BT传输
- python 用户认证_Python使用LDAP做用户认证的方法
- 广汽研究院BMS软件工程师_感·创未来 2020广汽科技日有哪些干货?
- boost::mp11::mp_insert_c相关用法的测试程序
- 23V3有这种C语言表达式吗,数据结构(C语言版第2版_李云清)习题答案2012-12.doc
- 精妙SQL语句收集(转)
- 每日一题(53)—— 评价代码片段
- Linux 文件 IO
- 网络工程师为什么要学python_网络工程师学python
- 软件测试:面试屡屡碰壁,只因你身上少了这几个特征!
- 异常:java.lang.IllegalStateException: No instances found of configserver(里面是一个微服务名)
- maven+springmvc出现:java.sql.SQLException: Unknown system variable 'query_cache_size'
- 什么是IP防护等级,又该如何区分
- 双十二|Solidigm官方店铺 惊喜大放送 福利享不停
- isNaN、Number.isNaN、isFinite、Number.isFinite
- 中国电子学会2022年06月份青少年软件编程Python等级考试试卷二级真题(含答案)
- 教师资格证2023年报名时间来了!
- (石头、剪刀、布)shell脚本,随机对比,case的应用
热门文章
- WPF下通过附加属性实现单实例启动
- php异步表单,利用ajax实现表单的异步互动——2018年4月10日
- protocol buffer的使用
- 19.12添加自定义监控项目19.13/19.14 配置邮件告警19.15 测试告警19.16 不发邮件的问题处理...
- 设置Webdriver启动chrome为默认用户的配置信息
- 将u盘的文件复制到虚拟机上的linux系统上面—》文件挂载(转)
- 设置数据库CRM允许select into 创建表
- 互联网+传统硬件,乐视与酷派要构建全新生态链?
- 随笔 2016-1-4
- 【转】Nginx双机热备高可用解决方案【二】