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

📄 autoconf.texi

📁 这是一个自动生成MAKEFILE的工具。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
The Autoconf macros are defined in several files.  Some of the files aredistributed with Autoconf; @code{autoconf} reads them first.  Then itlooks for the optional file @file{acsite.m4} in the directory thatcontains the distributed Autoconf macro files, and for the optional file@file{aclocal.m4} in the current directory.  Those files can containyour site's or the package's own Autoconf macro definitions(@pxref{Writing Macros}, for more information).  If a macro is definedin more than one of the files that @code{autoconf} reads, the lastdefinition it reads overrides the earlier ones.@code{autoconf} accepts the following options:@table @code@item --help@itemx -hPrint a summary of the command line options and exit.@item --localdir=@var{dir}@itemx -l @var{dir}Look for the package file @file{aclocal.m4} in directory @var{dir}instead of in the current directory.@item --macrodir=@var{dir}@itemx -m @var{dir}@evindex AC_MACRODIRLook for the installed macro files in directory @var{dir}.  You can alsoset the @code{AC_MACRODIR} environment variable to a directory; thisoption overrides the environment variable.@item --versionPrint the version number of Autoconf and exit.@end table@node Invoking autoreconf,  , Invoking autoconf, Making configure Scripts@section Using @code{autoreconf} to Update @code{configure} ScriptsIf you have a lot of Autoconf-generated @code{configure} scripts, the@code{autoreconf} program can save you some work.  It runs@code{autoconf} (and @code{autoheader}, where appropriate) repeatedly toremake the Autoconf @code{configure} scripts and configuration headertemplates in the directory tree rooted at the current directory.  Bydefault, it only remakes those files that are older than their@file{configure.in} or (if present) @file{aclocal.m4}.  Since@code{autoheader} does not change the timestamp of its output file ifthe file wouldn't be changing, this is not necessarily the minimumamount of work.  If you install a new version of Autoconf, you can make@code{autoreconf} remake @emph{all} of the files by giving it the@samp{--force} option.If you give @code{autoreconf} the @samp{--macrodir=@var{dir}} or@samp{--localdir=@var{dir}} options, it passes them down to@code{autoconf} and @code{autoheader} (with relative paths adjustedproperly).@code{autoreconf} does not support having, in the same directory tree,both directories that are parts of a larger package (sharing@file{aclocal.m4} and @file{acconfig.h}), and directories that areindependent packages (each with their own @file{aclocal.m4} and@file{acconfig.h}).  It assumes that they are all part of the samepackage, if you use @samp{--localdir}, or that each directory is aseparate package, if you don't use it.  This restriction may be removedin the future.@xref{Automatic Remaking}, for @file{Makefile} rules to automaticallyremake @code{configure} scripts when their source files change.  Thatmethod handles the timestamps of configuration header templatesproperly, but does not pass @samp{--macrodir=@var{dir}} or@samp{--localdir=@var{dir}}.@noindent@code{autoreconf} accepts the following options:@table @code@item --help@itemx -hPrint a summary of the command line options and exit.@item --force@itemx -fRemake even @file{configure} scripts and configuration headers that arenewer than their input files (@file{configure.in} and, if present,@file{aclocal.m4}).@item --localdir=@var{dir}@itemx -l @var{dir}Have @code{autoconf} and @code{autoheader} look for the package files@file{aclocal.m4} and (@code{autoheader} only) @file{acconfig.h} (butnot @file{@var{file}.top} and @file{@var{file}.bot}) in directory@var{dir} instead of in the directory containing each @file{configure.in}.@item --macrodir=@var{dir}@itemx -m @var{dir}@evindex AC_MACRODIRLook for the Autoconf macro files in directory @var{dir} instead of thedefault installation directory.You can also set the @code{AC_MACRODIR}environment variable to a directory; this option overrides theenvironment variable.@item --verbosePrint the name of each directory where @code{autoreconf} runs@code{autoconf} (and @code{autoheader}, if appropriate).@item --versionPrint the version number of Autoconf and exit.@end table@node Setup, Existing Tests, Making configure Scripts, Top@chapter Initialization and Output FilesAutoconf-generated @code{configure} scripts need some information abouthow to initialize, such as how to find the package's source files; andabout the output files to produce.  The following sections describeinitialization and creating output files.@menu* Input::                       Where Autoconf should find files.* Output::                      Creating output files.* Makefile Substitutions::      Using output variables in @file{Makefile}s.* Configuration Headers::       Creating a configuration header file.* Subdirectories::              Configuring independent packages together.* Default Prefix::              Changing the default installation prefix.* Versions::                    Version numbers in @code{configure}.@end menu@node Input, Output, Setup, Setup@section Finding @code{configure} InputEvery @code{configure} script must call @code{AC_INIT} before doinganything else.  The only other required macro is @code{AC_OUTPUT}(@pxref{Output}).@defmac AC_INIT (@var{unique-file-in-source-dir})@maindex INITProcess any command-line arguments and find the source code directory.@var{unique-file-in-source-dir} is some file that is in the package'ssource directory; @code{configure} checks for this file's existence tomake sure that the directory that it is told contains the source code infact does.  Occasionally people accidentally specify the wrong directorywith @samp{--srcdir}; this is a safety check.  @xref{Invoking configure},for more information.@end defmacPackages that do manual configuration or use the @code{install} programmight need to tell @code{configure} where to find some other shellscripts by calling @code{AC_CONFIG_AUX_DIR}, though the default placesit looks are correct for most cases.@defmac AC_CONFIG_AUX_DIR(@var{dir})@maindex CONFIG_AUX_DIRUse the @file{install-sh}, @file{config.sub}, @file{config.guess}, andCygnus @code{configure} scripts that are in directory @var{dir}.  Theseare auxiliary files used in configuration.  @var{dir} can be eitherabsolute or relative to @file{@var{srcdir}}.  The default is@file{@var{srcdir}} or @file{@var{srcdir}/..} or@file{@var{srcdir}/../..}, whichever is the first that contains@file{install-sh}.  The other files are not checked for, so that using@code{AC_PROG_INSTALL} does not automatically require distributing theother auxiliary files.  It checks for @file{install.sh} also, but thatname is obsolete because some @code{make} programs have a rule thatcreates @file{install} from it if there is no @file{Makefile}.@end defmac@node Output, Makefile Substitutions, Input, Setup@section Creating Output FilesEvery Autoconf-generated @code{configure} script must finish by calling@code{AC_OUTPUT}.  It is the macro that creates the @file{Makefile}s andoptional other files resulting from configuration.  The only otherrequired macro is @code{AC_INIT} (@pxref{Input}).@defmac AC_OUTPUT (@r{[}@var{file}@dots{} @r{[}, @var{extra-cmds} @r{[}, @var{init-cmds}@r{]]]})@maindex OUTPUTCreate output files.  Call this macro once, at the end of @file{configure.in}.The @var{file}@dots{} argument is awhitespace-separated list of output files; it may be empty.  This macrocreates each file @file{@var{file}} by copying an input file (by defaultnamed @file{@var{file}.in}), substituting the output variable values.@c If the file would be unchanged, it is left untouched, to preserve its timestamp.@xref{Makefile Substitutions}, for more information on using output variables.@xref{Setting Output Variables}, for more information on creating them.  Thismacro creates the directory that the file is in if it doesn't exist (butnot the parents of that directory).  Usually, @file{Makefile}s arecreated this way, but other files, such as @file{.gdbinit}, can bespecified as well.If @code{AC_CONFIG_HEADER}, @code{AC_LINK_FILES}, or@code{AC_CONFIG_SUBDIRS} has been called, this macro also creates thefiles named as their arguments.A typical call to @code{AC_OUTPUT} looks like this:@exampleAC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile)@end exampleYou can override an input file name by appending to @var{file} acolon-separated list of input files.  Examples:@exampleAC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk)@end exampleDoing this allows you to keep your file names acceptable to MS-DOS, orto prepend and/or append boilerplate to the file.If you pass @var{extra-cmds}, those commands will be inserted into@file{config.status} to be run after all its other processing.  If@var{init-cmds} are given, they are inserted just before@var{extra-cmds}, with shell variable, command, and backslashsubstitutions performed on them in @code{configure}.  You can use@var{init-cmds} to pass variables from @code{configure} to the@var{extra-cmds}.  If @code{AC_OUTPUT_COMMANDS} has been called, thecommands given to it are run just before the commands passed to this macro.@end defmac@defmac AC_OUTPUT_COMMANDS (@var{extra-cmds} @r{[}, @var{init-cmds}@r{]})Specify additional shell commands to run at the end of@file{config.status}, and shell commands to initialize any variablesfrom @code{configure}.  This macro may be called multiple times.Here is an unrealistic example:@examplefubar=27AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.], fubar=$fubar)AC_OUTPUT_COMMANDS([echo this is another, extra, bit], [echo init bit])@end example@end defmacIf you run @code{make} on subdirectories, you should run it using the@code{make} variable @code{MAKE}.  Most versions of @code{make} set@code{MAKE} to the name of the @code{make} program plus any options itwas given.  (But many do not include in it the values of any variablesset on the command line, so those are not passed on automatically.)Some old versions of @code{make} do not set this variable.  Thefollowing macro allows you to use it even with those versions.@defmac AC_PROG_MAKE_SET@maindex PROG_MAKE_SET@ovindex SET_MAKEIf @code{make} predefines the variable @code{MAKE}, define outputvariable @code{SET_MAKE} to be empty.  Otherwise, define @code{SET_MAKE}to contain @samp{MAKE=make}.  Calls @code{AC_SUBST} for @code{SET_MAKE}.@end defmacTo use this macro, place a line like this in each @file{Makefile.in}that runs @code{MAKE} on other directories:@example@@SET_MAKE@@@end example@node Makefile Substitutions, Configuration Headers, Output, Setup@section Substitutions in MakefilesEach subdirectory in a distribution that contains something to becompiled or installed should come with a file @file{Makefile.in}, fromwhich @code{configure} will create a @file{Makefile} in that directory.To create a @file{Makefile}, @code{configure} performs a simple variablesubstitution, replacing occurrences of @samp{@@@var{variable}@@} in@file{Makefile.in} with the value that @code{configure} has determinedfor that variable.  Variables that are substituted into output files inthis way are called @dfn{output variables}.  They are ordinary shellvariables that are set in @code{configure}.  To make @code{configure}substitute a particular variable into the output files, the macro@code{AC_SUBST} must be called with that variable name as an argument.Any occurrences of @samp{@@@var{variable}@@} for other variables areleft unchanged.  @xref{Setting Output Variables}, for more information oncreating output variables with @code{AC_SUBST}.A software package that uses a @code{configure} script should bedistributed with a file @file{Makefile.in}, but no @file{Makefile}; thatway, the user has to properly configure the package for the local systembefore compiling it.@xref{Makefile Conventions, , Makefile Conventions, standards, TheGNU Coding Standards}, for more information on what to put in@file{Makefile}s.@menu* Preset Output Variables::     Output variables that are always set.* Build Directories::           Supporting multiple concurrent compiles.* Automatic Remaking::          Makefile rules for configuring.@end menu@node Preset Output Variables, Build Directories, Makefile Substitutions, Makefile Substitutions@subsection Preset Output VariablesSome output variables are preset by the Autoconf macros.  Some of theAutoconf macros set additional output variables, which are mentioned inthe descriptions for those macros.  @xref{Output Variable Index}, for acomplete list of output variables.  Here is what each of the preset onescontains.  @xref{Directory Variables, , Variables for Installation Directories,standards, The GNU Coding Standards}, for more information aboutthe variables with names that end in @samp{dir}.@defvar bindir@ovindex bindirThe directory for installing executables that users run.@end defvar@defvar configure_input@ovindex configure_inputA comment saying that the file was generated automatically by@code{configure} and giving the name of the input file.@code{AC_OUTPUT} adds a comment line containing this variable to the topof every @file{Makefile} it creates.  For other files, you shouldreference this variable in a comment at the top of each input file.  Forexample, an input shell script should begin like this:@example#! /bin/sh# @@configure_input@@@end example@noindentThe presence of that line also reminds people editing the file that it

⌨️ 快捷键说明

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