Fixed build with HWASan
[platform/upstream/autogen.git] / doc / invoke-autogen.texi
1 @node autogen Invocation
2 @chapter Invoking autogen
3 @pindex autogen
4 @cindex The Automated Program Generator
5 @ignore
6 #  -*- buffer-read-only: t -*- vi: set ro:
7 #
8 # DO NOT EDIT THIS FILE   (invoke-autogen.texi)
9 #
10 # It has been AutoGen-ed
11 # From the definitions    /u/bkorb/tools/ag/autogen-bld/agen5/opts.def
12 # and the template file   agtexi-cmd.tpl
13 @end ignore
14
15 AutoGen creates text files from templates using external definitions.
16
17 @code{AutoGen} is designed for generating program files that contain
18 repetitive text with varied substitutions.  The goal is to simplify the
19 maintenance of programs that contain large amounts of repetitious text.
20 This is especially valuable if there are several blocks of such text
21 that must be kept synchronized.
22
23 One common example is the problem of maintaining the code required for
24 processing program options.  Processing options requires a minimum of
25 four different constructs be kept in proper order in different places
26 in your program.  You need at least: The flag character in the flag
27 string, code to process the flag when it is encountered, a global
28 state variable or two, and a line in the usage text.
29 You will need more things besides this if you choose to implement
30 long option names, configuration file processing, environment variables
31 and so on.
32
33 All of this can be done mechanically; with the proper templates
34 and this program.
35
36
37 This chapter was generated by @strong{AutoGen},
38 using the @code{agtexi-cmd} template and the option descriptions for the @code{autogen} program.
39 This software is released under the GNU General Public License, version 3 or later.
40
41 @menu
42 * autogen usage::                  autogen help/usage (@option{--help})
43 * autogen input-select::           input-select options
44 * autogen out-handling::           out-handling options
45 * autogen debug-tpl::              debug-tpl options
46 * autogen processing::             processing options
47 * autogen dep-track::              dep-track options
48 * autogen autoopts-opts::          autoopts-opts options
49 * autogen config::                 presetting/configuring autogen
50 * autogen exit status::            exit status
51 * autogen Examples::               Examples
52 @end menu
53
54 @node autogen usage
55 @section autogen help/usage (@option{--help})
56 @cindex autogen help
57
58 This is the automatically generated usage text for autogen.
59
60 The text printed is the same whether selected with the @code{help} option
61 (@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
62 the usage text by passing it through a pager program.
63 @code{more-help} is disabled on platforms without a working
64 @code{fork(2)} function.  The @code{PAGER} environment variable is
65 used to select the program, defaulting to @file{more}.  Both will exit
66 with a status code of 0.
67
68 @exampleindent 0
69 @example
70 autogen (GNU AutoGen) - The Automated Program Generator - Ver. 5.18.15.001
71 Usage:  autogen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ <def-file> ]
72
73 The following options select definitions, templates and scheme functions
74 to use:
75
76   Flg Arg Option-Name    Description
77    -L Str templ-dirs     Search for templates in DIR
78                                 - may appear multiple times
79    -T Str override-tpl   Use TPL-FILE for the template
80                                 - may not be preset
81       Str definitions    Read definitions from FILE
82                                 - disabled as '--no-definitions'
83                                 - enabled by default
84                                 - may not be preset
85       Str shell          name or path name of shell to use
86    -m no  no-fmemopen    Do not use in-mem streams
87       Str equate         characters considered equivalent
88
89 The following options modify how output is handled:
90
91   Flg Arg Option-Name    Description
92    -b Str base-name      Specify NAME as the base name for output
93                                 - may not be preset
94       no  source-time    set mod times to latest source
95                                 - disabled as '--no-source-time'
96       no  writable       Allow output files to be writable
97                                 - disabled as '--not-writable'
98
99 The following options are often useful while debugging new templates:
100
101   Flg Arg Option-Name    Description
102       Num loop-limit     Limit on increment loops
103                                 - is scalable with a suffix: k/K/m/M/g/G/t/T
104                                 - it must lie in one of the ranges:
105                                   -1 exactly, or
106                                   1 to 16777216
107    -t Num timeout        Limit server shell operations to SECONDS
108                                 - it must be in the range:
109                                   0 to 3600
110       KWd trace          tracing level of detail
111       Str trace-out      tracing output file or filter
112       --- show-defs      This option has been disabled
113       no  used-defines   Show the definitions used
114                                 - may not be preset
115    -C no  core           Leave a core dump on a failure exit
116
117 These options can be used to control what gets processed in the
118 definitions files and template files:
119
120   Flg Arg Option-Name    Description
121    -s Str skip-suffix    Skip the file with this SUFFIX
122                                 - prohibits the option 'select-suffix'
123                                 - may not be preset
124                                 - may appear multiple times
125    -o Str select-suffix  specify this output suffix
126                                 - may not be preset
127                                 - may appear multiple times
128    -D Str define         name to add to definition list
129                                 - may appear multiple times
130    -U Str undefine       definition list removal pattern
131                                 - an alternate for 'define'
132
133 This option is used to automate dependency tracking:
134
135   Flg Arg Option-Name    Description
136    -M opt make-dep       emit make dependency file
137                                 - may not be preset
138                                 - may appear multiple times
139
140 help, version, option and error handling:
141
142   Flg Arg Option-Name    Description
143       no  no-abort       Do not abort on errors
144
145 Version, usage and configuration options:
146
147   Flg Arg Option-Name    Description
148    -R Str reset-option   reset an option's state
149    -v opt version        output version information and exit
150    -? no  help           display extended usage information and exit
151    -! no  more-help      extended usage information passed thru pager
152    -u no  usage          abbreviated usage to stdout
153    -> opt save-opts      save the option state to a config file
154    -< Str load-opts      load options from a config file
155                                 - disabled as '--no-load-opts'
156                                 - may appear multiple times
157
158 Options are specified by doubled hyphens and their name or by a single
159 hyphen and the flag character.
160 AutoGen creates text files from templates using external definitions.
161
162 The following option preset mechanisms are supported:
163  - reading file $HOME
164  - reading file ./.autogenrc
165  - examining environment variables named AUTOGEN_*
166
167 The valid "trace" option keywords are:
168   nothing       debug-message server-shell  templates     block-macros
169   expressions   everything
170   or an integer from 0 through 6
171 AutoGen is a tool designed for generating program files that contain
172 repetitive text with varied substitutions.
173
174 Please send bug reports to:  <autogen-users@@lists.sourceforge.net>
175 @end example
176 @exampleindent 4
177
178 @node autogen input-select
179 @section input-select options
180 The following options select definitions, templates and scheme functions to use.
181 @subheading templ-dirs option (-L).
182 @anchor{autogen templ-dirs}
183 @cindex autogen-templ-dirs
184
185 This is the ``search for templates in @file{dir}'' option.
186 This option takes a string argument @file{DIR}.
187
188 @noindent
189 This option has some usage constraints.  It:
190 @itemize @bullet
191 @item
192 may appear an unlimited number of times.
193 @end itemize
194
195 Add a directory to the list of directories @command{autogen} searches when
196 opening a template, either as the primary template or an included one.
197 The last entry has the highest priority in the search list.  That is
198 to say, they are searched in reverse order.
199 @subheading override-tpl option (-T).
200 @anchor{autogen override-tpl}
201 @cindex autogen-override-tpl
202
203 This is the ``use @file{tpl-file} for the template'' option.
204 This option takes a string argument @file{TPL-FILE}.
205
206 @noindent
207 This option has some usage constraints.  It:
208 @itemize @bullet
209 @item
210 may not be preset with environment variables or configuration (rc/ini) files.
211 @end itemize
212
213 Definition files specify the standard template that is to be expanded.
214 This option will override that name and expand a different template.
215 @subheading definitions option.
216 @anchor{autogen definitions}
217 @cindex autogen-definitions
218
219 This is the ``read definitions from @file{file}'' option.
220 This option takes a string argument @file{FILE}.
221
222 @noindent
223 This option has some usage constraints.  It:
224 @itemize @bullet
225 @item
226 can be disabled with --no-definitions.
227 @item
228 It is enabled by default.
229 @item
230 may not be preset with environment variables or configuration (rc/ini) files.
231 @end itemize
232
233 Use this argument to specify the input definitions file with a
234 command line option.  If you do not specify this option, then
235 there must be a command line argument that specifies the file,
236 even if only to specify stdin with a hyphen (@code{-}).
237 Specify, @code{--no-definitions} when you wish to process
238 a template without any active AutoGen definitions.
239 @subheading shell option.
240 @anchor{autogen shell}
241 @cindex autogen-shell
242
243 This is the ``name or path name of shell to use'' option.
244 This option takes a string argument @file{shell}.
245
246 @noindent
247 This option has some usage constraints.  It:
248 @itemize @bullet
249 @item
250 must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
251 @end itemize
252
253 By default, when AutoGen is built, the configuration is probed for a
254 reasonable Bourne-like shell to use for shell script processing.  If
255 a particular template needs an alternate shell, it must be specified
256 with this option on the command line, with an environment variable
257 (@code{SHELL}) or in the configuration/initialization file.
258 @subheading no-fmemopen option (-m).
259 @anchor{autogen no-fmemopen}
260 @cindex autogen-no-fmemopen
261
262 This is the ``do not use in-mem streams'' option.
263 If the local C library supports "@code{fopencookie(3GNU)}", or
264 "@code{funopen(3BSD)}" then AutoGen prefers to use in-memory stream
265 buffer opens instead of anonymous files.  This may lead to problems
266 if there is a shortage of virtual memory.  If, for a particular
267 application, you run out of memory, then specify this option.
268 This is unlikely in a modern 64-bit virtual memory environment.
269
270 On platforms without these functions, the option is accepted
271 but ignored.  @code{fmemopen(POSIX)} is not adequate because
272 its string buffer is not reallocatable.  @code{open_memstream(POSIX)}
273 is @i{also} not adequate because the stream is only opened for
274 output.  AutoGen needs a reallocatable buffer available for both
275 reading and writing.
276 @subheading equate option.
277 @anchor{autogen equate}
278 @cindex autogen-equate
279
280 This is the ``characters considered equivalent'' option.
281 This option takes a string argument @file{char-list}.
282 This option will alter the list of characters considered equivalent.
283 The default are the three characters, "_-^".  (The last is conventional
284 on a Tandem/HP-NonStop, and I used to do a lot of work on Tandems.)
285 @node autogen out-handling
286 @section out-handling options
287 The following options modify how output is handled.
288 @subheading base-name option (-b).
289 @anchor{autogen base-name}
290 @cindex autogen-base-name
291
292 This is the ``specify @code{name} as the base name for output'' option.
293 This option takes a string argument @file{NAME}.
294
295 @noindent
296 This option has some usage constraints.  It:
297 @itemize @bullet
298 @item
299 may not be preset with environment variables or configuration (rc/ini) files.
300 @end itemize
301
302 A template may specify the exact name of the output file.  Normally,
303 it does not.  Instead, the name is composed of the base name of the
304 definitions file with suffixes appended.  This option will override the
305 base name derived from the definitions file name.  This is required if
306 there is no definitions file and advisable if definitions are being
307 read from stdin.  If the definitions are being read from standard in,
308 the base name defaults to @file{stdin}.  Any leading directory components
309 in the name will be silently removed.  If you wish the output file to
310 appear in a particular directory, it is recommended that you "cd" into
311 that directory first, or use directory names in the format specification
312 for the output suffix lists, @xref{pseudo macro}.
313 @subheading source-time option.
314 @anchor{autogen source-time}
315 @cindex autogen-source-time
316
317 This is the ``set mod times to latest source'' option.
318
319 @noindent
320 This option has some usage constraints.  It:
321 @itemize @bullet
322 @item
323 can be disabled with --no-source-time.
324 @end itemize
325
326 If you stamp your output files with the @code{DNE} macro output, then
327 your output files will always be different, even if the content has
328 not really changed.  If you use this option, then the modification
329 time of the output files will change only if the input files change.
330 This will help reduce unneeded builds.
331 @subheading writable option.
332 @anchor{autogen writable}
333 @cindex autogen-writable
334
335 This is the ``allow output files to be writable'' option.
336
337 @noindent
338 This option has some usage constraints.  It:
339 @itemize @bullet
340 @item
341 can be disabled with --not-writable.
342 @end itemize
343
344 This option will leave output files writable.
345 Normally, output files are read-only.
346 @node autogen debug-tpl
347 @section debug-tpl options
348 The following options are often useful while debugging new templates.
349 They specify limits that prevent the template from taking overly long
350 or producing more output than expected.
351 @subheading loop-limit option.
352 @anchor{autogen loop-limit}
353 @cindex autogen-loop-limit
354
355 This is the ``limit on increment loops'' option.
356 This option takes a number argument @file{lim}.
357 This option prevents runaway loops.  For example, if you accidentally
358 specify, "FOR x (for-from 1) (for-to -1) (for-by 1)", it will take a
359 long time to finish.  If you do have more than 256 entries in tables,
360 you will need to specify a new limit with this option.
361 @subheading timeout option (-t).
362 @anchor{autogen timeout}
363 @cindex autogen-timeout
364
365 This is the ``limit server shell operations to @code{seconds}'' option.
366 This option takes a number argument @file{SECONDS}.
367
368 @noindent
369 This option has some usage constraints.  It:
370 @itemize @bullet
371 @item
372 must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
373 @end itemize
374
375 AutoGen works with a shell server process.  Most normal commands will
376 complete in less than 10 seconds.  If, however, your commands need more
377 time than this, use this option.
378
379 The valid range is 0 to 3600 seconds (1 hour).
380 Zero will disable the server time limit.
381 @subheading trace option.
382 @anchor{autogen trace}
383 @cindex autogen-trace
384
385 This is the ``tracing level of detail'' option.
386 This option takes a keyword argument @file{level}.
387
388 @noindent
389 This option has some usage constraints.  It:
390 @itemize @bullet
391 @item
392 This option takes a keyword as its argument.
393 The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_TRACE).
394 The available keywords are:
395 @example
396     nothing       debug-message server-shell
397     templates     block-macros  expressions
398     everything
399 @end example
400
401 or their numeric equivalent.
402 @end itemize
403
404 This option will cause AutoGen to display a trace of its template
405 processing.  There are six levels, each level including messages from
406 the previous levels:
407
408 @table @samp
409 @item nothing
410 Does no tracing at all (default)
411
412 @item debug-message
413 Print messages from the "DEBUG" AutoGen macro (@pxref{DEBUG}).
414
415 @item server-shell
416 Traces all input and output to the server shell.  This includes a shell
417 "independent" initialization script about 30 lines long.  Its output is
418 discarded and not inserted into any template.
419
420 @item templates
421 Traces the invocation of @code{DEFINE}d macros and @code{INCLUDE}s
422
423 @item block-macros
424 Traces all block macros.  The above, plus @code{IF}, @code{FOR},
425 @code{CASE} and @code{WHILE}.
426
427 @item expressions
428 Displays the results of expression evaluations.
429
430 @item everything
431 Displays the invocation of every AutoGen macro, even @code{TEXT} macros
432 (i.e. the text outside of macro quotes).  Additionally, if you rebuild
433 the ``expr.ini'' file with debugging enabled, then all calls to
434 AutoGen defined scheme functions will also get logged:
435 @*
436 @example
437 cd $@{top_builddir@}/agen5
438 DEBUG_ENABLED=true bash bootstrap.dir expr.ini
439 make CFLAGS='-g -DDEBUG_ENABLED=1'
440 @end example
441
442 Be aware that you cannot rebuild this source in this way without first
443 having installed the @code{autogen} executable in your search path.
444 Because of this, "expr.ini" is in the distributed source list, and
445 not in the dependencies.
446 @end table
447 @subheading trace-out option.
448 @anchor{autogen trace-out}
449 @cindex autogen-trace-out
450
451 This is the ``tracing output file or filter'' option.
452 This option takes a string argument @file{file}.
453 The output specified may be a file name, a file that is appended to,
454 or, if the option argument begins with the @code{pipe} operator
455 (@code{|}), a command that will receive the tracing output as standard
456 in.  For example, @code{--traceout='| less'} will run the trace output
457 through the @code{less} program.  Appending to a file is specified by
458 preceding the file name with two greater-than characters (@code{>>}).
459 @subheading show-defs option.
460 @anchor{autogen show-defs}
461 @cindex autogen-show-defs
462
463 This is the ``show the definition tree'' option.
464
465 @noindent
466 This option has some usage constraints.  It:
467 @itemize @bullet
468 @item
469 must be compiled in by defining @code{DEBUG_ENABLED} during the compilation.
470 @item
471 may not be preset with environment variables or configuration (rc/ini) files.
472 @end itemize
473
474 This will print out the complete definition tree before processing
475 the template.
476 @subheading used-defines option.
477 @anchor{autogen used-defines}
478 @cindex autogen-used-defines
479
480 This is the ``show the definitions used'' option.
481
482 @noindent
483 This option has some usage constraints.  It:
484 @itemize @bullet
485 @item
486 may not be preset with environment variables or configuration (rc/ini) files.
487 @end itemize
488
489 This will print out the names of definition values searched for
490 during the processing of the template, whether actually found or
491 not.  There may be other referenced definitions in a template in
492 portions of the template not evaluated.  Some of the names listed
493 may be computed names and others AutoGen macro arguments.  This is
494 not a means for producing a definitive, all-encompassing list of all
495 and only the values used from a definition file.  This is intended
496 as an aid to template documentation only.
497 @subheading core option (-C).
498 @anchor{autogen core}
499 @cindex autogen-core
500
501 This is the ``leave a core dump on a failure exit'' option.
502
503 @noindent
504 This option has some usage constraints.  It:
505 @itemize @bullet
506 @item
507 must be compiled in by defining @code{HAVE_SYS_RESOURCE_H} during the compilation.
508 @end itemize
509
510 Many systems default to a zero sized core limit.  If the system
511 has the sys/resource.h header and if this option is supplied,
512 then in the failure exit path, autogen will attempt to set the
513 soft core limit to whatever the hard core limit is.  If that
514 does not work, then an administrator must raise the hard core
515 size limit.
516 @node autogen processing
517 @section processing options
518 These options can be used to control what gets processed
519 in the definitions files and template files.
520 They specify which outputs and parts of outputs to produce.
521 @subheading skip-suffix option (-s).
522 @anchor{autogen skip-suffix}
523 @cindex autogen-skip-suffix
524
525 This is the ``skip the file with this @file{suffix}'' option.
526 This option takes a string argument @file{SUFFIX}.
527
528 @noindent
529 This option has some usage constraints.  It:
530 @itemize @bullet
531 @item
532 may appear an unlimited number of times.
533 @item
534 may not be preset with environment variables or configuration (rc/ini) files.
535 @item
536 must not appear in combination with any of the following options:
537 select-suffix.
538 @end itemize
539
540 Occasionally, it may not be desirable to produce all of the output
541 files specified in the template.  (For example, only the @file{.h}
542 header file, but not the @file{.c} program text.)  To do this
543 specify @code{--skip-suffix=c} on the command line.
544 @subheading select-suffix option (-o).
545 @anchor{autogen select-suffix}
546 @cindex autogen-select-suffix
547
548 This is the ``specify this output suffix'' option.
549 This option takes a string argument @file{SUFFIX}.
550
551 @noindent
552 This option has some usage constraints.  It:
553 @itemize @bullet
554 @item
555 may appear an unlimited number of times.
556 @item
557 may not be preset with environment variables or configuration (rc/ini) files.
558 @end itemize
559
560 If you wish to override the suffix specifications in the template,
561 you can use one or more copies of this option.  See the suffix
562 specification in the @ref{pseudo macro} section of the info doc.
563 @subheading define option (-D).
564 @anchor{autogen define}
565 @cindex autogen-define
566
567 This is the ``name to add to definition list'' option.
568 This option takes a string argument @file{value}.
569
570 @noindent
571 This option has some usage constraints.  It:
572 @itemize @bullet
573 @item
574 may appear an unlimited number of times.
575 @end itemize
576
577 The AutoGen define names are used for the following purposes:
578
579 @enumerate
580 @item
581 Sections of the AutoGen definitions may be enabled or disabled
582 by using C-style #ifdef and #ifndef directives.
583 @item
584 When defining a value for a name, you may specify the index
585 for a particular value.  That index may be a literal value,
586 a define option or a value #define-d in the definitions themselves.
587 @item
588 The name of a file may be prefixed with @code{$NAME/}.
589 The @code{$NAME} part of the name string will be replaced with
590 the define-d value for @code{NAME}.
591 @item
592 When AutoGen is finished loading the definitions, the defined values
593 are exported to the environment with, @code{putenv(3)}.
594 These values can then be used in shell scripts with @code{$@{NAME@}}
595 references and in templates with @code{(getenv "NAME")}.
596 @item
597 While processing a template, you may specify an index to retrieve
598 a specific value.  That index may also be a define-d value.
599 @end enumerate
600
601 It is entirely equivalent to place this name in the exported environment.
602 Internally, that is what AutoGen actually does with this option.
603 @subheading undefine option (-U).
604 @anchor{autogen undefine}
605 @cindex autogen-undefine
606
607 This is the ``definition list removal pattern'' option.
608 This option takes a string argument @file{name-pat}.
609
610 @noindent
611 This option has some usage constraints.  It:
612 @itemize @bullet
613 @item
614 may appear an unlimited number of times.
615 @item
616 may not be preset with environment variables or configuration (rc/ini) files.
617 @end itemize
618
619 Similar to 'C', AutoGen uses @code{#ifdef/#ifndef} preprocessing
620 directives.  This option will cause the matching names to be
621 removed from the list of defined values.
622 @node autogen dep-track
623 @section dep-track options
624 This option is used to automate dependency tracking.
625 @subheading make-dep option (-M).
626 @anchor{autogen make-dep}
627 @cindex autogen-make-dep
628
629 This is the ``emit make dependency file'' option.
630 This option takes an optional string argument @file{type}.
631
632 @noindent
633 This option has some usage constraints.  It:
634 @itemize @bullet
635 @item
636 may appear an unlimited number of times.
637 @item
638 may not be preset with environment variables or configuration (rc/ini) files.
639 @end itemize
640
641
642 This option behaves fairly closely to the way the @code{-M} series of
643 options work with the gcc compiler, except that instead of just
644 emitting the predecessor dependencies, this also emits the successor
645 dependencies (output target files).  By default, the output dependency
646 information will be placed in @code{<base-name>.d}, but may also be
647 specified with @code{-MF<file>}.  The time stamp on this file will be
648 manipulated so that it will be one second older than the oldest
649 primary output file.
650
651 The target in this dependency file will normally be the dependency
652 file name, but may also be overridden with @code{-MT<targ-name>}.
653 AutoGen will not alter the contents of that file, but it may create
654 it and it will adjust the modification time to match the start time.
655
656 @strong{NB:} these second letters are part of the option argument, so
657 @code{-MF <file>} must have the space character quoted or omitted, and
658 @code{-M "F <file>"} is acceptable because the @code{F} is part of the
659 option argument.
660
661 @code{-M} may be followed by any of the letters M, F, P, T, Q, D, or G.
662 However, only F, Q, T and P are meaningful.  All but F have somewhat
663 different meanings.  @code{-MT<name>} is interpreted as meaning
664 @code{<name>} is a sentinel file that will depend on all inputs
665 (templates and definition files) and all the output files will depend
666 on this sentinel file.  It is suitable for use as a real make target.
667 Q is treated identically to T, except dollar characters ('$') are
668 doubled.  P causes a special clean (clobber) phoney rule to be inserted
669 into the make file fragment.  An empty rule is always created for
670 building the list of targets.
671
672 This is the recommended usage:
673 @example
674   -MFwhatever-you-like.dep -MTyour-sentinel-file -MP
675 @end example
676 and then in your @code{Makefile}, make the @file{autogen} rule:
677 @example
678   -include whatever-you-like.dep
679   clean_targets += clean-your-sentinel-file
680
681   your-sentinel-file:
682       autogen -MT$@@ -MF$*.d .....
683
684   local-clean :
685       rm -f $(clean_targets)
686 @end example
687
688 The modification time on the dependency file is adjusted to be one
689 second before the earliest time stamp of any other output file.
690 Consequently, it is suitable for use as the sentinel file testifying
691 to the fact the program was successfully run.  (@code{-include} is
692 the GNU make way of specifying "include it if it exists".  Your make
693 must support that feature or your bootstrap process must create the
694 file.)
695
696 All of this may also be specified using the @code{DEPENDENCIES_OUTPUT}
697 or @code{AUTOGEN_MAKE_DEP} environment variables.  If defined,
698 dependency information will be output.  If defined with white space
699 free text that is something other than @code{true}, @code{false},
700 @code{yes}, @code{no}, @code{0} or @code{1}, then the string is taken
701 to be an output file name.  If it contains a string of white space
702 characters, the first token is as above and the second token is taken
703 to be the target (sentinel) file as @code{-MT} in the paragraphs
704 above.  @code{DEPENDENCIES_OUTPUT} will be ignored if there are
705 multiple sequences of white space characters or if its contents are,
706 specifically, @code{false}, @code{no} or @code{0}.
707 @node autogen autoopts-opts
708 @section autoopts-opts options
709 help, version, option and error handling.
710 @subheading no-abort option.
711 @anchor{autogen no-abort}
712 @cindex autogen-no-abort
713
714 This is the ``do not abort on errors'' option.
715 By default, @code{AutoGen} will abort on an error leaving behind a core image.
716 That is sometimes inconvenient. If present on the command line or in
717 the environment, AutoGen will call @code{exit(1)} instead of @code{abort()}.
718
719
720 @node autogen config
721 @section presetting/configuring autogen
722
723 Any option that is not marked as @i{not presettable} may be preset by
724 loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{AUTOGEN} and @code{AUTOGEN_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
725 the options listed above in upper case and segmented with underscores.
726 The @code{AUTOGEN} variable will be tokenized and parsed like
727 the command line.  The remaining variables are tested for existence and their
728 values are treated like option arguments.
729
730
731 @noindent
732 @code{libopts} will search in 2 places for configuration files:
733 @itemize @bullet
734 @item
735 $HOME
736 @item
737 $PWD
738 @end itemize
739 The environment variables @code{HOME}, and @code{PWD}
740 are expanded and replaced when @file{autogen} runs.
741 For any of these that are plain files, they are simply processed.
742 For any that are directories, then a file named @file{.autogenrc} is searched for
743 within that directory and processed.
744
745 Configuration files may be in a wide variety of formats.
746 The basic format is an option name followed by a value (argument) on the
747 same line.  Values may be separated from the option name with a colon,
748 equal sign or simply white space.  Values may be continued across multiple
749 lines by escaping the newline with a backslash.
750
751 Multiple programs may also share the same initialization file.
752 Common options are collected at the top, followed by program specific
753 segments.  The segments are separated by lines like:
754 @example
755 [AUTOGEN]
756 @end example
757 @noindent
758 or by
759 @example
760 <?program autogen>
761 @end example
762 @noindent
763 Do not mix these styles within one configuration file.
764
765 Compound values and carefully constructed string values may also be
766 specified using XML syntax:
767 @example
768 <option-name>
769    <sub-opt>...&lt;...&gt;...</sub-opt>
770 </option-name>
771 @end example
772 @noindent
773 yielding an @code{option-name.sub-opt} string value of
774 @example
775 "...<...>..."
776 @end example
777 @code{AutoOpts} does not track suboptions.  You simply note that it is a
778 hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
779 the associated name/value pair list (see: optionFindValue).
780
781 The command line options relating to configuration and/or usage help are:
782
783 @subheading version (-v)
784
785 Print the program version to standard out, optionally with licensing
786 information, then exit 0.  The optional argument specifies how much licensing
787 detail to provide.  The default is to print just the version.  The licensing information may be selected with an option argument.
788 Only the first letter of the argument is examined:
789
790 @table @samp
791 @item version
792 Only print the version.  This is the default.
793 @item copyright
794 Name the copyright usage licensing terms.
795 @item verbose
796 Print the full copyright usage licensing terms.
797 @end table
798
799 @subheading usage (-u)
800
801 Print abbreviated usage to standard out, then exit 0.
802
803 @subheading reset-option (-R)
804
805 Resets the specified option to the compiled-in initial state.
806 This will undo anything that may have been set by configuration files.
807 The option argument may be either the option flag character or its long name.
808
809 @node autogen exit status
810 @section autogen exit status
811
812 One of the following exit values will be returned:
813 @table @samp
814 @item 0 (EXIT_SUCCESS)
815 Successful program execution.
816 @item 1 (EXIT_OPTION_ERROR)
817 The command options were misconfigured.
818 @item 2 (EXIT_BAD_TEMPLATE)
819 An error was encountered processing the template.
820 @item 3 (EXIT_BAD_DEFINITIONS)
821 The definitions could not be deciphered.
822 @item 4 (EXIT_LOAD_ERROR)
823 An error was encountered during the load phase.
824 @item 5 (EXIT_FS_ERROR)
825 a file system error stopped the program.
826 @item 6 (EXIT_NO_MEM)
827 Insufficient memory to operate.
828 @item 128 (EXIT_SIGNAL)
829 @command{autogen} exited due to catching a signal.  If your template includes
830 string formatting, a number argument to a "%s" formatting element will
831 trigger a segmentation fault.  Autogen will catch the seg fault signal
832 and exit with @code{AUTOGEN_EXIT_SIGNAL(5)}.  Alternatively, AutoGen
833 may have been interrupted with a @code{kill(2)} signal.
834
835 Subtract 128 from the actual exit code to detect the signal number.
836 @item 66 (EX_NOINPUT)
837 A specified configuration file could not be loaded.
838 @item 70 (EX_SOFTWARE)
839 libopts had an internal operational error.  Please report
840 it to autogen-users@@lists.sourceforge.net.  Thank you.
841 @end table
842 @node autogen Examples
843 @section autogen Examples
844 Here is how the man page is produced:
845 @example
846 autogen -Tagman-cmd.tpl -MFman-dep -MTstamp-man opts.def
847 @end example
848
849 This command produced this man page from the AutoGen option definition
850 file.  It overrides the template specified in @file{opts.def} (normally
851 @file{options.tpl}) and uses @file{agman-cmd.tpl}.  It also sets the
852 make file dependency output to @file{man-dep} and the sentinel file
853 (time stamp file) to @file{man-stamp}.  The base of the file name is
854 derived from the defined @code{prog-name}.
855
856 The texi invocation document is produced via:
857 @example
858 autogen -Tagtexi-cmd.tpl -MFtexi-dep -MTtexi-stamp opts.def
859 @end example