⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autoconf.texi

📁 LINUX下的源码工具,可自己分析,或者直接装在系统上作为应用
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
* Redefined M4 Macros::         M4 builtins changed in M4sugar* Evaluation Macros::           More quotation and evaluation control* Forbidden Patterns::          Catching unexpanded macrosWriting Autoconf Macros* Macro Definitions::           Basic format of an Autoconf macro* Macro Names::                 What to call your new macros* Reporting Messages::          Notifying @command{autoconf} users* Dependencies Between Macros::  What to do when macros depend on other macros* Obsoleting Macros::           Warning about old ways of doing things* Coding Style::                Writing Autoconf macros @`a la AutoconfDependencies Between Macros* Prerequisite Macros::         Ensuring required information* Suggested Ordering::          Warning about possible ordering problemsPortable Shell Programming* Shellology::                  A zoology of shells* Here-Documents::              Quirks and tricks* File Descriptors::            FDs and redirections* File System Conventions::     File- and pathnames* Shell Substitutions::         Variable and command expansions* Assignments::                 Varying side effects of assignments* Special Shell Variables::     Variables you should not change* Limitations of Builtins::     Portable use of not so portable /bin/sh* Limitations of Usual Tools::  Portable use of portable tools* Limitations of Make::         Portable MakefilesManual Configuration* Specifying Names::            Specifying the system type* Canonicalizing::              Getting the canonical system type* Using System Type::           What to do with the system typeSite Configuration* External Software::           Working with other optional software* Package Options::             Selecting optional features* Pretty Help Strings::         Formatting help string* Site Details::                Configuring site details* Transforming Names::          Changing program names when installing* Site Defaults::               Giving @command{configure} local defaultsTransforming Program Names When Installing* Transformation Options::      @command{configure} options to transform names* Transformation Examples::     Sample uses of transforming names* Transformation Rules::        @file{Makefile} uses of transforming namesRunning @command{configure} Scripts* Basic Installation::          Instructions for typical cases* Compilers and Options::       Selecting compilers and optimization* Multiple Architectures::      Compiling for multiple architectures at once* Installation Names::          Installing in different directories* Optional Features::           Selecting optional features* System Type::                 Specifying the system type* Sharing Defaults::            Setting site-wide defaults for @command{configure}* Defining Variables::          Specifying the compiler etc.* configure Invocation::        Changing how @command{configure} runsObsolete Constructs* Obsolete config.status Use::  Different calling convention* acconfig.h::                  Additional entries in @file{config.h.in}* autoupdate Invocation::       Automatic update of @file{configure.ac}* Obsolete Macros::             Backward compatibility macros* Autoconf 1::                  Tips for upgrading your files* Autoconf 2.13::               Some fresher tipsUpgrading From Version 1* Changed File Names::          Files you might rename* Changed Makefiles::           New things to put in @file{Makefile.in}* Changed Macros::              Macro calls you might replace* Changed Results::             Changes in how to check test results* Changed Macro Writing::       Better ways to write your own macrosUpgrading From Version 2.13* Changed Quotation::           Broken code which used to work* New Macros::                  Interaction with foreign macros* Hosts and Cross-Compilation::  Bugward compatibility kludges* AC_LIBOBJ vs LIBOBJS::        LIBOBJS is a forbidden token* AC_FOO_IFELSE vs AC_TRY_FOO::  A more generic scheme for testing sourcesGenerating Test Suites with Autotest* Using an Autotest Test Suite::  Autotest and the user* Writing testsuite.at::        Autotest macros* testsuite Invocation::        Running @command{testsuite} scripts* Making testsuite Scripts::    Using autom4te to create @command{testsuite}Using an Autotest Test Suite* testsuite Scripts::           The concepts of Autotest* Autotest Logs::               Their contentsFrequent Autoconf Questions, with answers* Distributing::                Distributing @command{configure} scripts* Why GNU m4::                  Why not use the standard M4?* Bootstrapping::               Autoconf and @acronym{GNU} M4 require each other?* Why Not Imake::               Why @acronym{GNU} uses @command{configure} instead of Imake* Defining Directories::        Passing @code{datadir} to program* autom4te.cache::              What is it?  Can I remove it?History of Autoconf* Genesis::                     Prehistory and naming of @command{configure}* Exodus::                      The plagues of M4 and Perl* Leviticus::                   The priestly code of portability arrives* Numbers::                     Growth and contributors* Deuteronomy::                 Approaching the promises of easy configurationCopying This Manual* GNU Free Documentation License::  License for copying this manualIndices* Environment Variable Index::  Index of environment variables used* Output Variable Index::       Index of variables set in output files* Preprocessor Symbol Index::   Index of C preprocessor symbols defined* Autoconf Macro Index::        Index of Autoconf macros* M4 Macro Index::              Index of M4, M4sugar, and M4sh macros* Autotest Macro Index::        Index of Autotest macros* Program & Function Index::    Index of those with portability problems* Concept Index::               General index@end detailmenu@end menu@c ============================================================= Introduction.@node Introduction@chapter Introduction@flushrightA physicist, an engineer, and a computer scientist were discussing thenature of God.  ``Surely a Physicist,'' said the physicist, ``becauseearly in the Creation, God made Light; and you know, Maxwell'sequations, the dual nature of electromagnetic waves, the relativisticconsequences@dots{}'' ``An Engineer!,'' said the engineer, ``becausebefore making Light, God split the Chaos into Land and Water; it takes ahell of an engineer to handle that big amount of mud, and orderlyseparation of solids from liquids@dots{}'' The computer scientistshouted: ``And the Chaos, where do you think it was coming from, hmm?''---Anonymous@end flushright@c (via Franc,ois Pinard)Autoconf is a tool for producing shell scripts that automaticallyconfigure software source code packages to adapt to many kinds of@sc{unix}-like systems.  The configuration scripts produced by Autoconfare independent of Autoconf when they are run, so their users do notneed to have Autoconf.The configuration scripts produced by Autoconf require no manual userintervention when run; they do not normally even need an argumentspecifying the system type.  Instead, they individually test for thepresence of each feature that the software package they are for might need.(Before each check, they print a one-line message stating what they arechecking for, so the user doesn't get too bored while waiting for thescript to finish.)  As a result, they deal well with systems that arehybrids or customized from the more common @sc{unix} variants.  There isno need to maintain files that list the features supported by eachrelease of each variant of @sc{unix}.For each software package that Autoconf is used with, it creates aconfiguration script from a template file that lists the system featuresthat the package needs or can use.  After the shell code to recognizeand respond to a system feature has been written, Autoconf allows it tobe shared by many software packages that can use (or need) that feature.If it later turns out that the shell code needs adjustment for somereason, it needs to be changed in only one place; all of theconfiguration scripts can be regenerated automatically to take advantageof the updated code.The Metaconfig package is similar in purpose to Autoconf, but thescripts it produces require manual user intervention, which is quiteinconvenient when configuring large source trees.  Unlike Metaconfigscripts, Autoconf scripts can support cross-compiling, if some care istaken in writing them.Autoconf does not solve all problems related to making portablesoftware packages---for a more complete solution, it should be used inconcert with other @acronym{GNU} build tools like Automake andLibtool.  These other tools take on jobs like the creation of aportable, recursive @file{Makefile} with all of the standard targets,linking of shared libraries, and so on.  @xref{The GNU Build System},for more information.Autoconf imposes some restrictions on the names of macros used with@code{#if} in C programs (@pxref{Preprocessor Symbol Index}).Autoconf requires @acronym{GNU} M4 in order to generate the scripts.  It usesfeatures that some @sc{unix} versions of M4, including @acronym{GNU} M4 1.3,do not have.  You must use version 1.4 or later of @acronym{GNU} M4.@xref{Autoconf 1}, for information about upgrading from version 1.@xref{History}, for the story of Autoconf's development.  @xref{FAQ},for answers to some common questions about Autoconf.See the @href{http://www.gnu.org/software/autoconf/autoconf.html,Autoconf web page} for up-to-date information, details on the mailinglists, pointers to a list of known bugs, etc.Mail suggestions to @email{autoconf@@gnu.org, the Autoconf mailinglist}.Bug reports should be preferably submitted to the@href{http://bugs.gnu.org/cgi-bin/gnatsweb.pl?database=autoconf,Autoconf Gnats database}, or sent to @email{bug-autoconf@@gnu.org, theAutoconf Bugs mailing list}.  If possible, first check that your bug isnot already solved in current development versions, and that it has notbeen reported yet.  Be sure to include all the needed information and ashort @file{configure.ac} that demonstrates the problem.Autoconf's development tree is accessible via @acronym{CVS}; see the Autoconfweb page for details.  There is also a@href{http://subversions.gnu.org/cgi-bin/cvsweb/autoconf/, @acronym{CVS}webinterface to the Autoconf development tree}.  Patches relative to thecurrent @acronym{CVS} version can be sent for review to the@email{autoconf-patches@@gnu.org, Autoconf Patches mailing list}.Because of its mission, Autoconf includes only a set of often-usedmacros that have already demonstrated their usefulness.  Nevertheless,if you wish to share your macros, or find existing ones, see the@href{http://www.gnu.org/software/ac-archive/, Autoconf MacroArchive}, which is kindly run by @email{simons@@computer.org,Peter Simons}.@c ================================================= The GNU Build System@node The GNU Build System@chapter The @acronym{GNU} Build SystemAutoconf solves an important problem---reliable discovery ofsystem-specific build and run-time information---but this is only onepiece of the puzzle for the development of portable software.  To thisend, the @acronym{GNU} project has developed a suite of integratedutilities to finish the job Autoconf started: the @acronym{GNU} buildsystem, whose most important components are Autoconf, Automake, andLibtool.  In this chapter, we introduce you to those tools, point youto sources of more information, and try to convince you to use theentire @acronym{GNU} build system for your software.@menu* Automake::                    Escaping Makefile hell* Libtool::                     Building libraries portably* Pointers::                    More info on the @acronym{GNU} build system@end menu@node Automake@section AutomakeThe ubiquity of @command{make} means that a @file{Makefile} is almost theonly viable way to distribute automatic build rules for software, butone quickly runs into @command{make}'s numerous limitations.  Its lack ofsupport for automatic dependency tracking, recursive builds insubdirectories, reliable timestamps (e.g., for network filesystems), andso on, mean that developers must painfully (and often incorrectly)reinvent the wheel for each project.  Portability is non-trivial, thanksto the quirks of @command{make} on many systems.  On top of all this is themanual labor required to implement the many standard targets that usershave come to expect (@code{make install}, @code{make distclean},@code{make uninstall}, etc.).  Since you are, of course, using Autoconf,you also have to insert repetitive code in your @code{Makefile.in} torecognize @code{@@CC@@}, @code{@@CFLAGS@@}, and other substitutionsprovided by @command{configure}.  Into this mess steps @dfn{Automake}.@cindex AutomakeAutomake allows you to specify your build needs in a @code{Makefile.am}file with a vastly simpler and more powerful syntax than that of a plain@code{Makefile}, and then generates a portable @code{Makefile.in} foruse with Autoconf.  For example, the @code{Makefile.am} to build andinstall a simple ``Hello world'' program might look like:@examplebin_PROGRAMS = hellohello_SOURCES = hello.c@end example@noindentThe resulting @code{Makefile.in} (~400 lines) automatically supports allthe standard targets, the substitutions provided by Autoconf, automaticdependency tracking, @code{VPATH} building, and so on.  @command{make} willbuild the @code{hello} program, and @code{make install} will install itin @file{/usr/local/bin} (or whatever prefix was given to@command{configure}, if not @file{/usr/local}).Automake may require that additional tools be present on the@emph{developer's} machine.  For example, the @code{Makefile.in} thatthe developer works with may not be portable (e.g., it might use specialfeatures of your compiler to automatically generate dependencyinformation).  Running @code{make dist}, however, produces a@file{hello-1.0.tar.gz} package (or whatever the program/version is)with a @code{Makefile.in} that will work on any system.The benefits of Automake increase for larger packages (especially oneswith subdirectories), but even for small programs the added convenienceand portability can be substantial.  And that's not all@enddots{}@node Libtool@section LibtoolVery often, one wants to build not only programs, but libraries, so thatother programs can benefit from the fruits of your labor.  Ideally, onewould like to produce @emph{shared} (dynamically linked) libraries,which can be used by multiple programs without duplication on disk or inmemory and can be updated independently of the linked programs.Producing shared libraries portably, however, is the stuff ofnightmares---each system has its own incompatible tools, compiler flags,and magic incantations.  Fortunately, @acronym{GNU} provides a solution:@dfn{Libtool}.@cindex LibtoolLibtool handles all the requirements of building shared libraries foryou, and at this time seems to be the @emph{only} way to do so with anyportability.  It also handles many other headaches, such as: theinteraction of @code{Makefile} rules with the variable suffixes ofshared libraries, linking reliably with shared libraries before they areinstalled by the superuser, and supplying a consistent versioning system(so that different versions of a library can be installed or upgradedwithout breaking binary compatibility).  Although Libtool, likeAutoconf, can be used on its own, it is most simply utilized inconjunction with Automake---there, Libtool is used automaticallywhenever shared libraries are needed, and you need not know its syntax.

⌨️ 快捷键说明

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