5 履行aclocal和autoconf
我们应用automake,根据configure.in和Makefile.am来产生Makefile.in。
然后履行敕令aclocal和autoconf,分别会产生aclocal.m4及configure两个文件:
- $ aclocal
- $ls
- aclocal.m4 configure.in helloworld.c
- $ autoconf
- $ ls
- aclocal.m4 autom4te.cache configure configure.in helloworld.c
大年夜家可以看到configure.in内容是一些宏定义,这些宏经autoconf处理后会变成检查体系特点、情况变量、软件必须的参数的shell脚本。
autoconf 是用来生成主动设备软件源代码脚本(configure)的对象。configure脚本能自力于autoconf运行,且在运行的过程中,不须要用户的干涉。
1、建目次
要生成configure文件,你必须告诉autoconf若何找到你所用的宏。方法是应用aclocal法度榜样来生成你的aclocal.m4。
aclocal根据configure.in文件的内容,主动生成aclocal.m4文件。aclocal是一个perl 脚本法度榜样,它的定义是:“aclocal - create aclocal.m4 by scanning configure.ac”。
autoconf大年夜configure.in这个列举编译软件时所须要各类参数的模板文件中创建configure。
autoconf须要GNU m4宏处理器来处理aclocal.m4,生成configure脚本。
3、 aclocal
m4是一个宏处理器。将输入拷贝到输出,同时将宏展开〖?松所以内嵌的,也可所以用户定义的。除了可以展开宏,m4还有一些内建的函数,用来引用文件,履行敕令,整数运算,文本操作,轮回等。m4既可以作为编译器的前端,也可以零丁作为一个宏处理器.
6、新建Makefile.am
内容如下:
Code:
- AUTOMAKE_OPTIONS=foreign
- bin_PROGRAMS=helloworld
- helloworld_SOURCES=helloworld.c
7、运行automake
敕令:
Code:
- $ automake --add-missing
- configure.in: installing `./install-sh'
- configure.in: installing `./mkinstalldirs'
- configure.in: installing `./missing'
- Makefile.am: installing `./depcomp'
automake会根据Makefile.am文件产生一些文件,包含最重要的Makefile.in。
8、履行configure生成Makefile
Code:
- $ ./configure
- checking for a BSD-compatible install /usr/bin/install -c
- checking whether build environment is sane yes
推荐阅读
51CTO诚邀您9月23号和秒拍/国美/美团元专家一路聊智能CDN的优化之路,抓紧时光哦! 一、媒介关于mysql主大年夜同步,信赖大年夜家都不陌生,跟着体系应用拜访量逐渐增大年夜,单台数据库读>>>详细阅读
本文标题:Linux下使用autoconf和automake生成Makefile
地址:http://www.17bianji.com/lsqh/37331.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示