linux下软件安装配置时几个命令的用法.docx
《linux下软件安装配置时几个命令的用法.docx》由会员分享,可在线阅读,更多相关《linux下软件安装配置时几个命令的用法.docx(9页珍藏版)》请在冰豆网上搜索。
linux下软件安装配置时几个命令的用法
linux下软件安装配置时几个命令的用法
收藏到手机 转发 评论
2010-09-1521:
57
有时候在linux下面安装软件时,有部分命令是干什么的其实自己也不是很清楚,都是按照网上的资料一步一步安装的,今天来系统的总结一下,加深一些印象。
1.hello.c
debian:
/home/server/helloword#vihello.c
intmain(intargc,char**argv){
print("HelloWorld!
\n");
return0;
}
2.autoscan
执行autoscan前
debian:
/home/server/helloword#ls
hello.c
debian:
/home/server/helloword#autoscan
执行autoscan后
debian:
/home/server/helloword#ls
autoscan.log configure.scan hello.c
3.编辑文件configure.in
cpconfigure.scanconfigure.in
文件configure.in的内容如下:
# -*-Autoconf-*-
#Processthisfilewithautoconftoproduceaconfigurescript.
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello,1.0)
#Checksforprograms.
AC_PROG_CC
#Checksforlibraries.
#Checksforheaderfiles.
#Checksfortypedefs,structures,andcompilercharacteristics.
#Checksforlibraryfunctions.
AC_OUTPUT(Makefile)
4.生成aclocal.m4及configure
可以看到configure.in内容是一些宏定义,这些宏经autoconf处理后会变成检查系统特性、环境变量、软件必须的参数的shell脚本。
执行aclocal,根据文件configure.in的内容,生成aclocal.m4文件
debian:
/home/server/helloword#ls
autoscan.log configure.in configure.scan hello.c
debian:
/home/server/helloword#aclocal
debian:
/home/server/helloword#ls
aclocal.m4 autom4te.cache autoscan.log configure.in configure.scan hello.c
执行autoconf,根据文件configure.in及aclocal.m4的内容,生成configure文件,configure是一个shell脚本
debian:
/home/server/helloword#ls
aclocal.m4 autoscan.log configure.in hello.c
autom4te.cache configure configure.scan
5.新建Makefile.am
输入如下的内容:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
automake会根据你写的Makefile.am来自动生成Makefile.in。
Makefile.am中定义的宏和目标,会指导automake生成指定的代码。
例如,宏bin_PROGRAMS将导致编译和连接的目标被生成。
6.运行automake
debian:
/home/server/helloword#automake--add-missing
debian:
/home/server/helloword#ls
aclocal.m4 autoscan.log configure.in depcomp install-sh Makefile.in
autom4te.cache configure configure.scan hello.c Makefile.am missing
7.执行configure生成Makefile
debian:
/home/server/helloword#./configure
checkingforaBSD-compatibleinstall.../usr/bin/install-c
checkingwhetherbuildenvironmentissane...yes
checkingforathread-safemkdir-p.../bin/mkdir-p
checkingforgawk...no
checkingformawk...mawk
checkingwhethermakesets$(MAKE)...yes
checkingforgcc...gcc
checkingforCcompilerdefaultoutputfilename...a.out
checkingwhethertheCcompilerworks...yes
checkingwhetherwearecrosscompiling...no
checkingforsuffixofexecutables...
checkingforsuffixofobjectfiles...o
checkingwhetherweareusingtheGNUCcompiler...yes
checkingwhethergccaccepts-g...yes
checkingforgccoptiontoacceptISOC89...noneneeded
checkingforstyleofincludeusedbymake...GNU
checkingdependencystyleofgcc...gcc3
configure:
creating./config.status
config.status:
creatingMakefile
config.status:
executingdepfilescommands
已经生成文件Makefile了
debian:
/home/server/helloword#ls
aclocal.m4 config.log configure.in hello.c Makefile.am
autom4te.cache config.status configure.scan install-sh Makefile.in
autoscan.log configure depcomp Makefile missing
8.使用make命令通过Makefile文件编译代码
debian:
/home/server/helloword#make
gcc-DPACKAGE_NAME=\"\"-DPACKAGE_TARNAME=\"\"-DPACKAGE_VERSION=\"\"-DPACKAGE_STRING=\"\"-DPACKAGE_BUGREPORT=\"\"-DPACKAGE=\"hello\"-DVERSION=\"1.0\"-I. -g-O2-MThello.o-MD-MP-MF.deps/hello.Tpo-c-ohello.ohello.c
mv-f.deps/hello.Tpo.deps/hello.Po
gcc -g-O2 -ohellohello.o
9.执行
debian:
/home/server/helloword#./hello
HelloWorld!
至此,大功告成。
附各个命令在linux下面的原始说明
1.autoscan
生成configure.scan文件
debian:
~#manautoscan
AUTOSCAN
(1) UserCommands AUTOSCAN
(1)
NAME
autoscan-Generateapreliminaryconfigure.in
SYNOPSIS
autoscan[OPTION]...[SRCDIR]
DESCRIPTION
Examine source files in thedirectorytreerootedatSRCDIR,orthecurrent
directoryifnoneisgiven. Searchthesource files for common portability
problems, check forincompletenessof`configure.ac',andcreateafile`con-
figure.scan'whichisapreliminary`configure.ac'forthatpackage.
2.autoconf
debian:
/data/wwwroot/app#autoconf--help
Usage:
/usr/bin/autoconf[OPTION]...[TEMPLATE-FILE]
GenerateaconfigurationscriptfromaTEMPLATE-FILEifgiven,or
`configure.ac'ifpresent,orelse`configure.in'. Outputissent
tothestandardoutputifTEMPLATE-FILEisgiven,elseinto
`configure'.
3.automake
debian:
~#manautomake
AUTOMAKE
(1) AUTOMAKE
(1)
NAME
automake-automaticallycreateMakefile.in'sfromMakefile.am's
4.aclocal
debian:
~#manaclocal
ACLOCAL
(1) ACLOCAL
(1)
NAME
aclocal-automaticallygenerateaclocal.m4fromconfigure.in
5.libtoolize
debian:
~#manlibtoolize
LIBTOOLIZE
(1) UserManuals LIBTOOLIZE
(1)
NAME
libtoolize-addlibtoolsupporttoyourpackage
SYNOPSIS
libtoolize[OPTION]...
DESCRIPTION
The`libtoolize'programprovidesastandardwaytoaddlibtoolsupporttoyour
package. Inthefuture,itmayimplementbetterusagechecking,orother fea-
turestomakelibtooleveneasiertouse.
6.autoheader
debian:
~#manautoheader
AUTOHEADER
(1) UserCommands AUTOHEADER
(1)
NAME
autoheader-Createatemplateheaderforconfigure
SYNOPSIS
autoheader[OPTION]...[TEMPLATE-FILE]
DESCRIPTION
Create a template fileofC`#define'statementsfor`configure'touse. To
thisend,scanTEMPLATE-FILE,or`configure.ac'ifpresent, or else `config-
ure.in'.
7.autoupdate
debian:
~#manautoupdate
AUTOUPDATE
(1) UserCommands AUTOUPDATE
(1)
NAME
autoupdate-Updateaconfigure.intoanewerAutoconf
SYNOPSIS
autoupdate[OPTION]... [TEMPLATE-FILE...]
DESCRIPTION
Update the TEMPLATE-FILE... if given,or`configure.ac'ifpresent,orelse
`configure.in',tothesyntaxofthecurrentversionofAutoconf. Theoriginal
filesarebackedup.
8.autoreconf
debian:
~#manautoreconf
AUTORECONF
(1) UserCommands AUTORECONF
(1)
NAME
autoreconf-Updategeneratedconfigurationfiles
SYNOPSIS
autoreconf[OPTION]...[CONFIGURE-ACorDIRECTORY]...
DESCRIPTION
Run `autoconf'(and`autoheader',`aclocal',`automake',`autopoint'(formerly
`gettextize'),and`libtoolize'whereappropriate)repeatedlytoremaketheGNU
Build SystemfilesintheDIRECTORIESorthedirectorytreesdrivenbyCONFIG-
URE-AC(defaultingto`.').
Bydefault,itonlyremakesthosefilesthatareolderthantheirpredecessors.
If you install new versions of theGNUBuildSystem,running`autoreconf'
remakesallofthefilesbygivingitthe`--force'option.
延伸阅读: