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

📄 autoconf.texi

📁 autoconf 2.59版,可用于redhat系统.用于编译原码,编写makefile文件.
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
argument:@exampleecho "Hard rock was here!  --[AC_DC]"@end example@noindentwhich will result in@exampleecho "Hard rock was here!  --AC_DC"@end example@noindentWhen you use the same text in a macro argument, you must therefore havean extra quotation level (since one is stripped away by the macrosubstitution).  In general, then, it is a good idea to @emph{use doublequoting for all literal string arguments}:@exampleAC_MSG_WARN([[AC_DC stinks  --Iron Maiden]])@end exampleYou are now able to understand one of the constructs of Autoconf thathas been continually misunderstood@dots{}  The rule of thumb is that@emph{whenever you expect macro expansion, expect quote expansion};i.e., expect one level of quotes to be lost.  For instance:@exampleAC_COMPILE_IFELSE([char b[10];],, [AC_MSG_ERROR([you lose])])@end example@noindentis incorrect: here, the first argument of @code{AC_COMPILE_IFELSE} is@samp{char b[10];} and will be expanded once, which results in@samp{char b10;}.  (There was an idiom common in Autoconf's past toaddress this issue via the M4 @code{changequote} primitive, but do notuse it!)  Let's take a closer look: the author meant the first argumentto be understood as a literal, and therefore it must be quoted twice:@exampleAC_COMPILE_IFELSE([[char b[10];]],, [AC_MSG_ERROR([you lose])])@end example@noindentVoil@`a, you actually produce @samp{char b[10];} this time!The careful reader will notice that, according to these guidelines, the``properly'' quoted @code{AC_CHECK_HEADER} example above is actuallylacking three pairs of quotes!  Nevertheless, for the sake of readability,double quotation of literals is used only where needed in this manual.Some macros take optional arguments, which this documentation representsas @ovar{arg} (not to be confused with the quote characters).  You mayjust leave them empty, or use @samp{[]} to make the emptiness of theargument explicit, or you may simply omit the trailing commas.  Thethree lines below are equivalent:@exampleAC_CHECK_HEADERS(stdio.h, [], [], [])AC_CHECK_HEADERS(stdio.h,,,)AC_CHECK_HEADERS(stdio.h)@end exampleIt is best to put each macro call on its own line in@file{configure.ac}.  Most of the macros don't add extra newlines; theyrely on the newline after the macro call to terminate the commands.This approach makes the generated @command{configure} script a littleeasier to read by not inserting lots of blank lines.  It is generallysafe to set shell variables on the same line as a macro call, becausethe shell allows assignments without intervening newlines.You can include comments in @file{configure.ac} files by starting themwith the @samp{#}.  For example, it is helpful to begin@file{configure.ac} files with a line like this:@example# Process this file with autoconf to produce a configure script.@end example@node configure.ac Layout@subsection Standard @file{configure.ac} LayoutThe order in which @file{configure.ac} calls the Autoconf macros is notimportant, with a few exceptions.  Every @file{configure.ac} mustcontain a call to @code{AC_INIT} before the checks, and a call to@code{AC_OUTPUT} at the end (@pxref{Output}).  Additionally, some macrosrely on other macros having been called first, because they checkpreviously set values of some variables to decide what to do.  Thesemacros are noted in the individual descriptions (@pxref{ExistingTests}), and they also warn you when @command{configure} is created if theyare called out of order.To encourage consistency, here is a suggested order for calling theAutoconf macros.  Generally speaking, the things near the end of thislist are those that could depend on things earlier in it.  For example,library functions could be affected by types and libraries.@display@groupAutoconf requirements@code{AC_INIT(@var{package}, @var{version}, @var{bug-report-address})}information on the packagechecks for programschecks for librarieschecks for header fileschecks for typeschecks for structureschecks for compiler characteristicschecks for library functionschecks for system services@code{AC_CONFIG_FILES(@r{[}@var{file@dots{}}@r{]})}@code{AC_OUTPUT}@end group@end display@node autoscan Invocation@section Using @command{autoscan} to Create @file{configure.ac}@cindex @command{autoscan}The @command{autoscan} program can help you create and/or maintain a@file{configure.ac} file for a software package.  @command{autoscan}examines source files in the directory tree rooted at a directory givenas a command line argument, or the current directory if none is given.It searches the source files for common portability problems and createsa file @file{configure.scan} which is a preliminary @file{configure.ac}for that package, and checks a possibly existing @file{configure.ac} forcompleteness.When using @command{autoscan} to create a @file{configure.ac}, youshould manually examine @file{configure.scan} before renaming it to@file{configure.ac}; it will probably need some adjustments.Occasionally, @command{autoscan} outputs a macro in the wrong orderrelative to another macro, so that @command{autoconf} produces a warning;you need to move such macros manually.  Also, if you want the package touse a configuration header file, you must add a call to@code{AC_CONFIG_HEADERS} (@pxref{Configuration Headers}).  You mightalso have to change or add some @code{#if} directives to your program inorder to make it work with Autoconf (@pxref{ifnames Invocation}, forinformation about a program that can help with that job).When using @command{autoscan} to maintain a @file{configure.ac}, simplyconsider adding its suggestions.  The file @file{autoscan.log} willcontain detailed information on why a macro is requested.@command{autoscan} uses several data files (installed along with Autoconf)to determine which macros to output when it finds particular symbols ina package's source files.  These data files all have the same format:each line consists of a symbol, whitespace, and the Autoconf macro tooutput if that symbol is encountered.  Lines starting with @samp{#} arecomments.@command{autoscan} accepts the following options:@table @option@item --help@itemx -hPrint a summary of the command line options and exit.@item --version@itemx -VPrint the version number of Autoconf and exit.@item --verbose@itemx -vPrint the names of the files it examines and the potentially interestingsymbols it finds in them.  This output can be voluminous.@item --include=@var{dir}@itemx -I @var{dir}Append @var{dir} to the include path.  Multiple invocations accumulate.@item --prepend-include=@var{dir}@item -B @var{dir}Prepend @var{dir} to the include path.  Multiple invocations accumulate.@end table@node ifnames Invocation@section Using @command{ifnames} to List Conditionals@cindex @command{ifnames}@command{ifnames} can help you write @file{configure.ac} for a softwarepackage.  It prints the identifiers that the package already uses in Cpreprocessor conditionals.  If a package has already been set up to havesome portability, @command{ifnames} can thus help you figure out what its@command{configure} needs to check for.  It may help fill in some gaps in a@file{configure.ac} generated by @command{autoscan} (@pxref{autoscanInvocation}).@command{ifnames} scans all of the C source files named on the command line(or the standard input, if none are given) and writes to the standardoutput a sorted list of all the identifiers that appear in those filesin @code{#if}, @code{#elif}, @code{#ifdef}, or @code{#ifndef}directives.  It prints each identifier on a line, followed by aspace-separated list of the files in which that identifier occurs.@noindent@command{ifnames} accepts the following options:@table @option@item --help@itemx -hPrint a summary of the command line options and exit.@item --version@itemx -VPrint the version number of Autoconf and exit.@end table@node autoconf Invocation@section Using @command{autoconf} to Create @command{configure}@cindex @command{autoconf}To create @command{configure} from @file{configure.ac}, run the@command{autoconf} program with no arguments.  @command{autoconf} processes@file{configure.ac} with the M4 macro processor, using theAutoconf macros.  If you give @command{autoconf} an argument, it reads thatfile instead of @file{configure.ac} and writes the configuration scriptto the standard output instead of to @command{configure}.  If you give@command{autoconf} the argument @option{-}, it reads from the standardinput instead of @file{configure.ac} and writes the configuration scriptto the standard output.The Autoconf macros are defined in several files.  Some of the files aredistributed with Autoconf; @command{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 Autoconf Macros}, for more information).  If a macro isdefined in more than one of the files that @command{autoconf} reads, thelast definition it reads overrides the earlier ones.@command{autoconf} accepts the following options:@table @option@item --help@itemx -hPrint a summary of the command line options and exit.@item --version@itemx -VPrint the version number of Autoconf and exit.@item --verbose@itemx -vReport processing steps.@item --debug@itemx -dDon't remove the temporary files.@item --force@itemx -fRemake @file{configure} even if newer than its input files.@item --include=@var{dir}@itemx -I @var{dir}Append @var{dir} to the include path.  Multiple invocations accumulate.@item --prepend-include=@var{dir}@item -B @var{dir}Prepend @var{dir} to the include path.  Multiple invocations accumulate.@item --output=@var{file}@itemx -o @var{file}Save output (script or trace) to @var{file}.  The file @option{-} standsfor the standard output.@item --warnings=@var{category}@itemx -W @var{category}@evindex WARNINGSReport the warnings related to @var{category} (which can actually be acomma separated list).  @xref{Reporting Messages}, macro@code{AC_DIAGNOSE}, for a comprehensive list of categories.  Specialvalues include:@table @samp@item allreport all the warnings@item nonereport none@item errortreats warnings as errors@item no-@var{category}disable warnings falling into @var{category}@end tableWarnings about @samp{syntax} are enabled by default, and the environmentvariable @code{WARNINGS}, a comma separated list of categories, ishonored.  Passing @samp{-W @var{category}} will actually behave as ifyou had passed @samp{--warnings=syntax,$WARNINGS,@var{category}}.  Ifyou want to disable the defaults and @code{WARNINGS}, but (for example)enable the warnings about obsolete constructs, you would use @option{-Wnone,obsolete}.@cindex Back trace@cindex Macro invocation stackBecause @command{autoconf} uses @command{autom4te} behind the scenes, itdisplays a back trace for errors, but not for warnings; if you wantthem, just pass @option{-W error}.  @xref{autom4te Invocation}, for someexamples.@item --trace=@var{macro}[:@var{format}]@itemx -t @var{macro}[:@var{format}]Do not create the @command{configure} script, but list the calls to@var{macro} according to the @var{format}.  Multiple @option{--trace}arguments can be used to list several macros.  Multiple @option{--trace}arguments for a single macro are not cumulative; instead, you shouldjust make @var{format} as long as needed.The @var{format} is a regular string, with newlines if desired, andseveral special escape codes.  It defaults to @samp{$f:$l:$n:$%}; see@ref{autom4te Invocation}, for details on the @var{format}.@item --initialization@itemx -iBy default, @option{--trace} does not trace the initialization of theAutoconf macros (typically the @code{AC_DEFUN} definitions).  Thisresults in a noticeable speedup, but can be disabled by this option.@end tableIt is often necessary to check the content of a @file{configure.ac}file, but parsing it yourself is extremely fragile and error-prone.  Itis suggested that you rely upon @option{--trace} to scan@file{configure.ac}.  For instance, to find the list of variables thatare substituted, use:@example@group$ @kbd{autoconf -t AC_SUBST}configure.ac:2:AC_SUBST:ECHO_Cconfigure.ac:2:AC_SUBST:ECHO_Nconfigure.ac:2:AC_SUBST:ECHO_T@i{More traces deleted}@end group@end example@noindentThe example below highlights the difference between @samp{$@@},

⌨️ 快捷键说明

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