configure.texi

来自「基于4个mips核的noc设计」· TEXI 代码 · 共 1,744 行 · 第 1/5 页

TEXI
1,744
字号
@table @var@item cpuThe type of processor.  This is typically something like @samp{i386} or@samp{sparc}.  More specific variants are used as well, such as@samp{mipsel} to indicate a little endian MIPS processor.@item manufacturerA somewhat freeform field which indicates the manufacturer of thesystem.  This is often simply @samp{unknown}.  Other common strings are@samp{pc} for an IBM PC compatible system, or the name of a workstationvendor, such as @samp{sun}.@item operating_systemThe name of the operating system which is run on the system.  This willbe something like @samp{solaris2.5} or @samp{irix6.3}.  There is noparticular restriction on the version number, and strings like@samp{aix4.1.4.0} are seen.  For an embedded system, which has nooperating system, this field normally indicates the type of object fileformat, such as @samp{elf} or @samp{coff}.@item kernelThis is used mainly for GNU/Linux.  A typical GNU/Linux configurationname is @samp{i586-pc-linux-gnulibc1}.  In this case the kernel,@samp{linux}, is separated from the operating system, @samp{gnulibc1}.@end tableThe shell script @file{config.guess} will normally print the correctconfiguration name for the system on which it is run.  It does byrunning @samp{uname} and by examining other characteristics of thesystem.Because @file{config.guess} can normally determine the configurationname for a machine, it is normally only necessary to specify aconfiguration name when building a cross-compiler or when building usinga cross-compiler.@node Using Configuration Names@section Using Configuration NamesA configure script will sometimes have to make a decision based on aconfiguration name.  You will need to do this if you have to compilecode differently based on something which can not be tested using astandard autoconf feature test.It is normally better to test for particular features, rather than totest for a particular system.  This is because as Unix evolves,different systems copy features from one another.  Even if you need todetermine whether the feature is supported based on a configurationname, you should define a macro which describes the feature, rather thandefining a macro which describes the particular system you are on.Testing for a particular system is normally done using a case statementin @file{configure.in}.  The case statement might look something likethe following, assuming that @samp{host} is a shell variable holding acanonical configuration name (which will be the case if@file{configure.in} uses the @samp{AC_CANONICAL_HOST} or@samp{AC_CANONICAL_SYSTEM} macro).@smallexamplecase "$@{host@}" ini[3456]86-*-linux-gnu*) do something ;;sparc*-sun-solaris2.[56789]*) do something ;;sparc*-sun-solaris*) do something ;;mips*-*-elf*) do something ;;esac@end smallexampleIt is particularly important to use @samp{*} after the operating systemfield, in order to match the version number which will be generated by@file{config.guess}.In most cases you must be careful to match a range of processor types.For most processor families, a trailing @samp{*} suffices, as in@samp{mips*} above.  For the i386 family, something along the lines of@samp{i[3456]86} suffices at present.  For the m68k family, you willneed something like @samp{m68*}.  Of course, if you do not need to matchon the processor, it is simpler to just replace the entire field by a@samp{*}, as in @samp{*-*-irix*}.@node Cross Compilation Tools@chapter Cross Compilation Tools@cindex cross toolsThe GNU configure and build system can be used to build @dfn{crosscompilation} tools.  A cross compilation tool is a tool which runs onone system and produces code which runs on another system.@menu* Cross Compilation Concepts::		Cross Compilation Concepts.* Host and Target::			Host and Target.* Using the Host Type::			Using the Host Type.* Specifying the Target::       	Specifying the Target.* Using the Target Type::		Using the Target Type.* Cross Tools in the Cygnus Tree::	Cross Tools in the Cygnus Tree@end menu@node Cross Compilation Concepts@section Cross Compilation Concepts@cindex cross compilerA compiler which produces programs which run on a different system is across compilation compiler, or simply a @dfn{cross compiler}.Similarly, we speak of cross assemblers, cross linkers, etc.In the normal case, a compiler produces code which runs on the samesystem as the one on which the compiler runs.  When it is necessary todistinguish this case from the cross compilation case, such a compileris called a @dfn{native compiler}.  Similarly, we speak of nativeassemblers, etc.Although the debugger is not strictly speaking a compilation tool, it isnevertheless meaningful to speak of a cross debugger: a debugger whichis used to debug code which runs on another system.  Everything that issaid below about configuring cross compilation tools applies to thedebugger as well.@node Host and Target@section Host and Target@cindex host system@cindex target systemWhen building cross compilation tools, there are two different systemsinvolved: the system on which the tools will run, and the system forwhich the tools generate code.The system on which the tools will run is called the @dfn{host} system.The system for which the tools generate code is called the @dfn{target}system.For example, suppose you have a compiler which runs on a GNU/Linuxsystem and generates ELF programs for a MIPS embedded system.  In thiscase the GNU/Linux system is the host, and the MIPS ELF system is thetarget.  Such a compiler could be called a GNU/Linux cross MIPS ELFcompiler, or, equivalently, a @samp{i386-linux-gnu} cross@samp{mips-elf} compiler.Naturally, most programs are not cross compilation tools.  For thoseprograms, it does not make sense to speak of a target.  It only makessense to speak of a target for tools like @samp{gcc} or the@samp{binutils} which actually produce running code.  For example, itdoes not make sense to speak of the target of a tool like @samp{bison}or @samp{make}.Most cross compilation tools can also serve as native tools.  For anative compilation tool, it is still meaningful to speak of a target.For a native tool, the target is the same as the host.  For example, fora GNU/Linux native compiler, the host is GNU/Linux, and the target isalso GNU/Linux.@node Using the Host Type@section Using the Host TypeIn almost all cases the host system is the system on which you run the@samp{configure} script, and on which you build the tools (for the casewhen they differ, @pxref{Canadian Cross}).@cindex @samp{AC_CANONICAL_HOST}If your configure script needs to know the configuration name of thehost system, and the package is not a cross compilation tool andtherefore does not have a target, put @samp{AC_CANONICAL_HOST} in@file{configure.in}.  This macro will arrange to define a few shellvariables when the @samp{configure} script is run.@table @samp@item hostThe canonical configuration name of the host.  This will normally bedetermined by running the @file{config.guess} shell script, although theuser is permitted to override this by using an explicit @samp{--host}option.@item host_aliasIn the unusual case that the user used an explicit @samp{--host} option,this will be the argument to @samp{--host}.  In the normal case, thiswill be the same as the @samp{host} variable.@item host_cpu@itemx host_vendor@itemx host_osThe first three parts of the canonical configuration name.@end tableThe shell variables may be used by putting shell code in@file{configure.in}.  For an example, see @ref{Using ConfigurationNames}.@node Specifying the Target@section Specifying the TargetBy default, the @samp{configure} script will assume that the target isthe same as the host.  This is the more common case; for example, itleads to a native compiler rather than a cross compiler.@cindex @samp{--target} option@cindex target option@cindex configure targetIf you want to build a cross compilation tool, you must specify thetarget explicitly by using the @samp{--target} option when you run@samp{configure}.  The argument to @samp{--target} is the configurationname of the system for which you wish to generate code.@xref{Configuration Names}.For example, to build tools which generate code for a MIPS ELF embeddedsystem, you would use @samp{--target mips-elf}.@node Using the Target Type@section Using the Target Type@cindex @samp{AC_CANONICAL_SYSTEM}When writing @file{configure.in} for a cross compilation tool, you willneed to use information about the target.  To do this, put@samp{AC_CANONICAL_SYSTEM} in @file{configure.in}.@samp{AC_CANONICAL_SYSTEM} will look for a @samp{--target} option andcanonicalize it using the @file{config.sub} shell script.  It will alsorun @samp{AC_CANONICAL_HOST} (@pxref{Using the Host Type}).The target type will be recorded in the following shell variables.  Notethat the host versions of these variables will also be defined by@samp{AC_CANONICAL_HOST}.@table @samp@item targetThe canonical configuration name of the target.@item target_aliasThe argument to the @samp{--target} option.  If the user did not specifya @samp{--target} option, this will be the same as @samp{host_alias}.@item target_cpu@itemx target_vendor@itemx target_osThe first three parts of the canonical target configuration name.@end tableNote that if @samp{host} and @samp{target} are the same string, you canassume a native configuration.  If they are different, you can assume across configuration.It is arguably possible for @samp{host} and @samp{target} to representthe same system, but for the strings to not be identical.  For example,if @samp{config.guess} returns @samp{sparc-sun-sunos4.1.4}, and somebodyconfigures with @samp{--target sparc-sun-sunos4.1}, then the slightdifferences between the two versions of SunOS may be unimportant foryour tool.  However, in the general case it can be quite difficult todetermine whether the differences between two configuration names aresignificant or not.  Therefore, by convention, if the user specifies a@samp{--target} option without specifying a @samp{--host} option, it isassumed that the user wants to configure a cross compilation tool.The variables @samp{target} and @samp{target_alias} should be handleddifferently.In general, whenever the user may actually see a string,@samp{target_alias} should be used.  This includes anything which mayappear in the file system, such as a directory name or part of a toolname.  It also includes any tool output, unless it is clearly labelledas the canonical target configuration name.  This permits the user touse the @samp{--target} option to specify how the tool will appear tothe outside world.On the other hand, when checking for characteristics of the targetsystem, @samp{target} should be used.  This is because a wide variety of@samp{--target} options may map into the same canonical configurationname.  You should not attempt to duplicate the canonicalization done by@samp{config.sub} in your own code.By convention, cross tools are installed with a prefix of the argumentused with the @samp{--target} option, also known as @samp{target_alias}(@pxref{Using the Target Type}).  If the user does not use the@samp{--target} option, and thus is building a native tool, no prefix isused.For example, if gcc is configured with @samp{--target mips-elf}, thenthe installed binary will be named @samp{mips-elf-gcc}.  If gcc isconfigured without a @samp{--target} option, then the installed binarywill be named @samp{gcc}.The autoconf macro @samp{AC_ARG_PROGRAM} will handle this for you.  Ifyou are using automake, no more need be done; the programs willautomatically be installed with the correct prefixes.  Otherwise, seethe autoconf documentation for @samp{AC_ARG_PROGRAM}.@node Cross Tools in the Cygnus Tree@section Cross Tools in the Cygnus TreeThe Cygnus tree is used for various packages including gdb, the GNUbinutils, and egcs.  It is also, of course, used for Cygnus releases.In the Cygnus tree, the top level @file{configure} script uses the oldCygnus configure system, not autoconf.  The top level @file{Makefile.in}is written to build packages based on what is in the source tree, andsupports building a large number of tools in a single@samp{configure}/@samp{make} step.The Cygnus tree may be configured with a @samp{--target} option.  The@samp{--target} option applies recursively to every subdirectory, andpermits building an entire set of cross tools at once.@menu* Host and Target Libraries::		Host and Target Libraries.* Target Library Configure Scripts::	Target Library Configure Scripts.* Make Targets in Cygnus Tree::         Make Targets in Cygnus Tree.* Target libiberty::			Target libiberty@end menu@node Host and Target Libraries@subsection Host and Target LibrariesThe Cygnus tree distinguishes host libraries from target libraries.Host libraries are built with the compiler used to build the programswhich run on the host, which is called the host compiler.  This includeslibraries such as @samp{bfd} and @samp{tcl}.  These libraries are builtwith the host compiler, and are linked into programs like the binutilsor gcc which run on the host.Target libraries are built with the target compiler.  If gcc is presentin the source tree, then the target compiler is the gcc that is builtusing the host compiler.  Target libraries are libraries such as@samp{newlib} and @samp{libstdc++}.  These libraries are not linked intothe host programs, but are instead made available for use with programsbuilt with the target compiler.For the rest of this section, assume that gcc is present in the sourcetree, so that it will be used to build the target libraries.There is a complication here.  The configure process needs to know whichcompiler you are going to use to build a tool; otherwise, the featuretests will not work correctly.  The Cygnus tree handles this by notconfiguring the target libraries until the target compiler is built.  Inorder to permit everything to build using a single@samp{configure}/@samp{make}, the configuration of the target librariesis actually triggered during the make step.When the target libraries are configured, the @samp{--target} option isnot used.  Instead, the @samp{--host} option is used with the argumentof the @samp{--target} option for the overall configuration.  If no@samp{--target} option was used for the overall configuration, the@samp{--host} option will be passed with the output of the@file{config.guess} shell script.  Any @samp{--build} option is passeddown unchanged.This translation of configuration options is done because since thetarget libraries are compiled with the target compiler, they are beingbuilt in order to run on the target of the overall configuration.  Bythe definition of host, this means that their host system is the same asthe target system of the overall configuration.The same process is used for both a native configuration and a crossconfiguration.  Even when using a native configuration, the targetlibraries will be configured and built using the newly built compiler.This is particularly important for the C++ libraries, since there is noreason to assume that the C++ compiler used to build the host tools (ifthere even is one) uses the same ABI as the g++ comp

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?