📄 autobook_261.html
字号:
<HTML><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!-- Created on September, 12 2004 by texi2html 1.64 --><!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others.Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> --><HEAD><TITLE>Autoconf, Automake, and Libtool: Using the Target Type</TITLE><META NAME="description" CONTENT="Autoconf, Automake, and Libtool: Using the Target Type"><META NAME="keywords" CONTENT="Autoconf, Automake, and Libtool: Using the Target Type"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="texi2html 1.64"><script language="Javascript"><!-- // Check the browser version. function checkVersion() { if (navigator.appVersion.charAt(0)>=3) return true; if (navigator.appVersion.charAt(0)>=4) return true; else return false; } if (checkVersion()) { homeon = new Image(); homeon.src = "homeon.png"; homeoff = new Image(); homeoff.src = "home.png"; tocon = new Image(); tocon.src = "tocon.png"; tocoff = new Image(); tocoff.src = "toc.png"; indexon = new Image(); indexon.src = "indexon.png"; indexoff = new Image(); indexoff.src = "index.png"; helpon = new Image(); helpon.src = "helpon.png"; helpoff = new Image(); helpoff.src = "help.png"; backon = new Image(); backon.src = "backon.png"; backoff = new Image(); backoff.src = "back.png"; forwardon = new Image(); forwardon.src = "forwardon.png"; forwardoff = new Image(); forwardoff.src = "forward.png"; prevon = new Image(); prevon.src = "prevon.png"; prevoff = new Image(); prevoff.src = "prev.png"; nexton = new Image(); nexton.src = "nexton.png"; nextoff = new Image(); nextoff.src = "next.png"; upon = new Image(); upon.src = "upon.png"; upoff = new Image(); upoff.src = "up.png"; } function img_act(imgName) { if (checkVersion()) { imgOn = eval(imgName + "on.src"); document [imgName].src = imgOn; } } function img_inact(imgName) { if (checkVersion()) { imgOff = eval(imgName + "off.src"); document [imgName].src = imgOff; } }// --></SCRIPT></HEAD><BODY LANG="EN" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#6688AA" VLINK="#336688" ALINK="#808080"><A NAME="SEC261"></A><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=10><TR VALIGN="TOP"><TD ALIGN="MIDDLE" WIDTH=50 BGCOLOR="#e6e6e6"><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_260.html#SEC260" onMouseover="img_act('prev')" onMouseout="img_inact('prev')"><IMG SRC="prev.png" BORDER="0" ALT="Back: Specifying the Target" ALIGN="MIDDLE" NAME="prev"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_262.html#SEC262" onMouseover="img_act('next')" onMouseout="img_inact('next')"><IMG SRC="next.png" BORDER="0" ALT="Forward: Building with a Cross Compiler" ALIGN="MIDDLE" NAME="next"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_262.html#SEC262" onMouseover="img_act('back')" onMouseout="img_inact('back')"><IMG SRC="back.png" BORDER="0" ALT="FastBack: Building with a Cross Compiler" ALIGN="MIDDLE" NAME="back"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_258.html#SEC258" onMouseover="img_act('up')" onMouseout="img_inact('up')"><IMG SRC="up.png" BORDER="0" ALT="Up: Cross Compilation" ALIGN="MIDDLE" NAME="up"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_271.html#SEC271" onMouseover="img_act('forward')" onMouseout="img_inact('forward')"><IMG SRC="forward.png" BORDER="0" ALT="FastForward: Installing GNU Autotools" ALIGN="MIDDLE" NAME="forward"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook.html#SEC_Top" onMouseover="img_act('home')" onMouseout="img_inact('home')"><IMG SRC="home.png" BORDER="0" ALT="Top: Autoconf, Automake, and Libtool" ALIGN="MIDDLE" NAME="home"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_toc.html#SEC_Contents" onMouseover="img_act('toc')" onMouseout="img_inact('toc')"><IMG SRC="toc.png" BORDER="0" ALT="Contents: Table of Contents" ALIGN="MIDDLE" NAME="toc"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_285.html#SEC285" onMouseover="img_act('index')" onMouseout="img_inact('index')"><IMG SRC="index.png" BORDER="0" ALT="Index: Index" ALIGN="MIDDLE" NAME="index"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_abt.html#SEC_About" onMouseover="img_act('help')" onMouseout="img_inact('help')"><IMG SRC="help.png" BORDER="0" ALT="About: About this document" ALIGN="MIDDLE" NAME="help"></A></TD></TR></TABLE></TD><TD ALIGN="LEFT"><H2> 26.3 Using the Target Type </H2><!--docid::SEC261::--><P>A <TT>`configure'</TT> script for a cross compilation tool will use the<SAMP>`--target'</SAMP> option to control how it is built, so that theresulting program will produce programs which run on the appropriatesystem. In this section we explain how you can write your own configurescripts to support the <SAMP>`--target'</SAMP> option.</P><P><A NAME="IDX93"></A>You must start by putting <SAMP>`AC_CANONICAL_SYSTEM'</SAMP> in<TT>`configure.in'</TT>.<BR> <SAMP>`AC_CANONICAL_SYSTEM'</SAMP> will look for a<SAMP>`--target'</SAMP> option and canonicalize it using the <TT>`config.sub'</TT>shell script (for more information about configuration names,canonicalizing them, and <TT>`config.sub'</TT>, see section <A HREF="autobook_17.html#SEC17">3.4 Configuration Names</A>). <SAMP>`AC_CANONICAL_SYSTEM'</SAMP> will also run<SAMP>`AC_CANONICAL_HOST'</SAMP> to get the host information.</P><P>The host and target type will be recorded in the following shellvariables:</P><P><DL COMPACT><DT><SAMP>`host'</SAMP><DD>The canonical configuration name of the host. This will normally bedetermined by running the <TT>`config.guess'</TT> shell script, although theuser is permitted to override this by using an explicit <SAMP>`--host'</SAMP>option.<DT><SAMP>`target'</SAMP><DD>The canonical configuration name of the target.<DT><SAMP>`host_alias'</SAMP><DD>The argument to the <SAMP>`--host'</SAMP> option, if used. Otherwise, the sameas the <SAMP>`host'</SAMP> variable.<DT><SAMP>`target_alias'</SAMP><DD>The argument to the <SAMP>`--target'</SAMP> option. If the user did not specifya <SAMP>`--target'</SAMP> option, this will be the same as <SAMP>`host_alias'</SAMP>.<DT><SAMP>`host_cpu'</SAMP><DD><DT><SAMP>`host_vendor'</SAMP><DD><DT><SAMP>`host_os'</SAMP><DD>The first three parts of the canonical host configuration name.<DT><SAMP>`target_cpu'</SAMP><DD><DT><SAMP>`target_vendor'</SAMP><DD><DT><SAMP>`target_os'</SAMP><DD>The first three parts of the canonical target configuration name.</DL><P>Note that if <SAMP>`host'</SAMP> and <SAMP>`target'</SAMP> are the same string, you canassume a native configuration. If they are different, you can assume across configuration.</P><P>It is possible for <SAMP>`host'</SAMP> and <SAMP>`target'</SAMP> to represent the samesystem, but for the strings to not be identical. For example, if<SAMP>`config.guess'</SAMP> returns <SAMP>`sparc-sun-sunos4.1.4'</SAMP>, and somebodyconfigures with <SAMP>`--target sparc-sun-sunos4.1'</SAMP>, 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'</SAMP> option without specifying a <SAMP>`--host'</SAMP> option, it isassumed that the user wants to configure a cross compilation tool.</P><P>The <SAMP>`target'</SAMP> variable should not be handled in the same way as the<SAMP>`target_alias'</SAMP> variable. In general, whenever the user mayactually see a string, <SAMP>`target_alias'</SAMP> should be used. Thisincludes anything which may appear in the file system, such as adirectory name or part of a tool name. It also includes any tooloutput, unless it is clearly labelled as the canonical targetconfiguration name. This permits the user to use the <SAMP>`--target'</SAMP>option to specify how the tool will appear to the outside world. On theother hand, when checking for characteristics of the target system,<SAMP>`target'</SAMP> should be used. This is because a wide variety of<SAMP>`--target'</SAMP> options may map into the same canonical configurationname. You should not attempt to duplicate the canonicalization done by<SAMP>`config.sub'</SAMP> in your own code.</P><P>By convention, cross tools are installed with a prefix of the argumentused with the <SAMP>`--target'</SAMP> option, also known as<SAMP>`target_alias'</SAMP>. If the user does not use the <SAMP>`--target'</SAMP>option, and thus is building a native tool, no prefix is used. Forexample, if <CODE>gcc</CODE> is configured with <SAMP>`--target mips-elf'</SAMP>,then the installed binary will be named <TT>`mips-elf-gcc'</TT>. If<CODE>gcc</CODE> is configured without a <SAMP>`--target'</SAMP> option, then theinstalled binary will be named <TT>`gcc'</TT>.</P><P>The Autoconf macro <SAMP>`AC_ARG_PROGRAM'</SAMP> will handle the names ofbinaries for you. If you are using Automake, no more need be done; theprograms will automatically be installed with the correct prefixes.Otherwise, see the Autoconf documentation for <SAMP>`AC_ARG_PROGRAM'</SAMP>.</P><P><A NAME="Building with a Cross Compiler"></A></TR></TABLE><BR> <FONT SIZE="-1">This document was generatedby <I>Gary V. Vaughan</I> on <I>September, 12 2004</I>using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -