📄 autobook_32.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: Ordering Tests</TITLE><META NAME="description" CONTENT="Autoconf, Automake, and Libtool: Ordering Tests"><META NAME="keywords" CONTENT="Autoconf, Automake, and Libtool: Ordering Tests"><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="SEC32"></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_31.html#SEC31" onMouseover="img_act('prev')" onMouseout="img_inact('prev')"><IMG SRC="prev.png" BORDER="0" ALT="Back: Brief introduction to portable sh" ALIGN="MIDDLE" NAME="prev"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_33.html#SEC33" onMouseover="img_act('next')" onMouseout="img_inact('next')"><IMG SRC="next.png" BORDER="0" ALT="Forward: What to check for" 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_33.html#SEC33" onMouseover="img_act('back')" onMouseout="img_inact('back')"><IMG SRC="back.png" BORDER="0" ALT="FastBack: What to check for" ALIGN="MIDDLE" NAME="back"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_29.html#SEC29" onMouseover="img_act('up')" onMouseout="img_inact('up')"><IMG SRC="up.png" BORDER="0" ALT="Up: Writing configure.in" ALIGN="MIDDLE" NAME="up"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_35.html#SEC35" onMouseover="img_act('forward')" onMouseout="img_inact('forward')"><IMG SRC="forward.png" BORDER="0" ALT="FastForward: Introducing GNU Automake" 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> 6.3 Ordering Tests </H2><!--docid::SEC32::--><P>In addition to the problem of writing portable <CODE>sh</CODE> code, anotherproblem which confronts first-time <TT>`configure.in'</TT> writers isdetermining the order in which to run the various tests. Autoconfindirectly (via the <CODE>autoscan</CODE> program, which we cover in<A HREF="autobook_237.html#SEC237">24. Migrating an Existing Package to GNU Autotools</A>) suggests a standard ordering, whichis what we describe here.</P><P>The standard ordering is:</P><P><OL><LI>Boilerplate. This section should include standard boilerplate code,such as the call to <CODE>AC_INIT</CODE> (which must be first),<CODE>AM_INIT_AUTOMAKE</CODE>, <CODE>AC_CONFIG_HEADER</CODE>, and perhaps<CODE>AC_REVISION</CODE>.<P><LI>Options. The next section should include macros which add command-lineoptions to <CODE>configure</CODE>, such as <CODE>AC_ARG_ENABLE</CODE>. It istypical to put support code for the option in this section as well, ifit is short enough, like this example from <CODE>libgcj</CODE>:<P><TABLE width=100%><tr><td> </td><td class=example bgcolor=#6688aa><br><pre>AC_ARG_ENABLE(getenv-properties,[ --disable-getenv-properties don't set system properties from GCJ_PROPERTIES])dnl Whether GCJ_PROPERTIES is used depends on the target.if test -n "$enable_getenv_properties"; then enable_getenv_properties=${enable_getenv_properties_default-yes}fiif test "$enable_getenv_properties" = no; then AC_DEFINE(DISABLE_GETENV_PROPERTIES)fi</pre></td></tr></table></P><P><LI>Programs. Next it is traditional to check for programs that are eitherneeded by the configure process, the build process, or by one of theprograms being built. This usually involves calls to macros like<CODE>AC_CHECK_PROG</CODE> and <CODE>AC_PATH_TOOL</CODE>.<P><LI>Libraries. Checks for libraries come before checks for other objectsvisible to C (or C++, or anything else). This is necessary because someother checks work by trying to link or run a program; by checking forlibraries first you ensure that the resulting programs can be linked.<P><LI>Headers. Next come checks for existence of headers.<P><LI>Typedefs and structures. We do checks for typedefs after checking forheaders for the simple reason that typedefs appear in headers, and weneed to know which headers we can use before we look inside them.<P><LI>Functions. Finally we check for functions. These come last becausefunctions have dependencies on the preceding items: when searching forfunctions, libraries are needed in order to correctly link, headers areneeded in order to find prototypes (this is especially important forC++, which has stricter prototyping rules than C), and typedefs areneeded for those functions which use or return types which are not builtin.<P><LI>Output. This is done by invoking <CODE>AC_OUTPUT</CODE>.</OL><P>This ordering should be considered a rough guideline, and not a list ofhard-and-fast rules. Sometimes it is necessary to interleave tests,either to make <TT>`configure.in'</TT> easier to maintain, or because thetests themselves do need to be in a different order. For instance, ifyour project uses both C and C++ you might choose to do all the C++checks after all the C checks are done, in order to make<TT>`configure.in'</TT> a bit easier to read.</P><P><A NAME="What to check for"></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 + -